This commit is contained in:
@@ -317,6 +317,25 @@ namespace AyaNova.Api.Controllers
|
||||
if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
return Ok(ApiOkResponse.Response(o));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get list for accounting integrations
|
||||
/// </summary>
|
||||
/// <returns>NameIdActiveChargeCost list</returns>
|
||||
[HttpGet("accounting-list")]
|
||||
public async Task<IActionResult> GetAccountingList()
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
PartBiz biz = PartBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
var o = await biz.GetNameIdActiveChargeCostItemsAsync();
|
||||
if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
return Ok(ApiOkResponse.Response(o));
|
||||
}
|
||||
//------------
|
||||
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace AyaNova.Api.Controllers
|
||||
ServiceRateBiz biz = ServiceRateBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
var o = await biz.PutAsync(updatedObject);
|
||||
var o = await biz.PutAsync(updatedObject);
|
||||
if (o == null)
|
||||
{
|
||||
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
|
||||
@@ -169,6 +169,24 @@ namespace AyaNova.Api.Controllers
|
||||
return Ok(ApiOkResponse.Response(o));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get list for accounting integrations
|
||||
/// </summary>
|
||||
/// <returns>NameIdActiveChargeCost list</returns>
|
||||
[HttpGet("accounting-list")]
|
||||
public async Task<IActionResult> GetAccountingList()
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
ServiceRateBiz biz = ServiceRateBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
var o = await biz.GetNameIdActiveChargeCostItemsAsync();
|
||||
if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
return Ok(ApiOkResponse.Response(o));
|
||||
}
|
||||
|
||||
//------------
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace AyaNova.Api.Controllers
|
||||
TravelRateBiz biz = TravelRateBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
var o = await biz.PutAsync(updatedObject);
|
||||
var o = await biz.PutAsync(updatedObject);
|
||||
if (o == null)
|
||||
{
|
||||
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
|
||||
@@ -150,7 +150,7 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Get prior rate Units entered
|
||||
/// </summary>
|
||||
/// <returns>list of Units</returns>
|
||||
@@ -169,6 +169,24 @@ namespace AyaNova.Api.Controllers
|
||||
return Ok(ApiOkResponse.Response(o));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get list for accounting integrations
|
||||
/// </summary>
|
||||
/// <returns>NameIdActiveChargeCost list</returns>
|
||||
[HttpGet("accounting-list")]
|
||||
public async Task<IActionResult> GetAccountingList()
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
TravelRateBiz biz = TravelRateBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
var o = await biz.GetNameIdActiveChargeCostItemsAsync();
|
||||
if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
return Ok(ApiOkResponse.Response(o));
|
||||
}
|
||||
|
||||
//------------
|
||||
|
||||
|
||||
@@ -60,38 +60,6 @@ namespace AyaNova.Biz
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //DUPLICATE
|
||||
// //
|
||||
// internal async Task<Part> DuplicateAsync(long id)
|
||||
// {
|
||||
// Part dbObject = await GetAsync(id, false);
|
||||
// if (dbObject == null)
|
||||
// {
|
||||
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||
// return null;
|
||||
// }
|
||||
// Part newObject = new Part();
|
||||
// CopyObject.Copy(dbObject, newObject, "Wiki");
|
||||
// string newUniqueName = string.Empty;
|
||||
// bool NotUnique = true;
|
||||
// long l = 1;
|
||||
// do
|
||||
// {
|
||||
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||
// NotUnique = await ct.Part.AnyAsync(m => m.Name == newUniqueName);
|
||||
// } while (NotUnique);
|
||||
// newObject.Name = newUniqueName;
|
||||
// newObject.Id = 0;
|
||||
// newObject.Concurrency = 0;
|
||||
// await ct.Part.AddAsync(newObject);
|
||||
// await ct.SaveChangesAsync();
|
||||
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||
// await SearchIndexAsync(newObject, true);
|
||||
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
// return newObject;
|
||||
// }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//GET
|
||||
@@ -104,6 +72,14 @@ namespace AyaNova.Biz
|
||||
return ret;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//GET LIST FOR QBI MAPPING
|
||||
//
|
||||
internal async Task<List<NameIdActiveChargeCostItem>> GetNameIdActiveChargeCostItemsAsync()
|
||||
{
|
||||
return await ct.Part.AsNoTracking().Select(x => new NameIdActiveChargeCostItem { Name = x.Name, Id = x.Id, Active = x.Active, Cost = x.Cost, Charge = x.Retail }).OrderBy(x => x.Name).ToListAsync();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//UPDATE
|
||||
//
|
||||
@@ -694,7 +670,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -196,6 +196,14 @@ namespace AyaNova.Biz
|
||||
return await ct.ServiceRate.AsNoTracking().Select(x => x.Unit).Where(x => x != null).Distinct().OrderBy(x => x).ToListAsync();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//GET LIST FOR QBI MAPPING
|
||||
//
|
||||
internal async Task<List<NameIdActiveChargeCostItem>> GetNameIdActiveChargeCostItemsAsync()
|
||||
{
|
||||
return await ct.ServiceRate.AsNoTracking().Select(x => new NameIdActiveChargeCostItem { Name = x.Name, Id = x.Id, Active = x.Active, Cost = x.Cost, Charge = x.Charge }).OrderBy(x => x.Name).ToListAsync();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//SEARCH
|
||||
//
|
||||
|
||||
@@ -196,6 +196,14 @@ namespace AyaNova.Biz
|
||||
return await ct.TravelRate.AsNoTracking().Select(x => x.Unit).Where(x => x != null).Distinct().OrderBy(x => x).ToListAsync();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//GET LIST FOR QBI MAPPING
|
||||
//
|
||||
internal async Task<List<NameIdActiveChargeCostItem>> GetNameIdActiveChargeCostItemsAsync()
|
||||
{
|
||||
return await ct.TravelRate.AsNoTracking().Select(x => new NameIdActiveChargeCostItem { Name = x.Name, Id = x.Id, Active = x.Active, Cost = x.Cost, Charge = x.Charge }).OrderBy(x => x.Name).ToListAsync();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//SEARCH
|
||||
//
|
||||
|
||||
13
server/AyaNova/models/dto/NameIdActiveChargeCostItem.cs
Normal file
13
server/AyaNova/models/dto/NameIdActiveChargeCostItem.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace AyaNova.Models
|
||||
{
|
||||
//Used by QBI for part and service /travel rate lists for caching and mapping
|
||||
public class NameIdActiveChargeCostItem
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool Active { get; set; }
|
||||
public decimal Cost { get; set; }
|
||||
public decimal Charge { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user