This commit is contained in:
2021-06-29 18:02:12 +00:00
parent 0ee5f7c598
commit fe541dcacd
24 changed files with 658 additions and 658 deletions

View File

@@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers
return CreatedAtAction(nameof(ContractController.GetContract), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(ContractController.GetContract), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> // /// <summary>
/// Duplicate Contract // /// Duplicate Contract
/// (Wiki and Attachments are not duplicated) // /// (Wiki and Attachments are not duplicated)
/// </summary> // /// </summary>
/// <param name="id">Source object id</param> // /// <param name="id">Source object id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns>Contract</returns> // /// <returns>Contract</returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicateContract([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicateContract([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
ContractBiz biz = ContractBiz.GetBiz(ct, HttpContext); // ContractBiz biz = ContractBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
Contract o = await biz.DuplicateAsync(id); // Contract o = await biz.DuplicateAsync(id);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(ContractController.GetContract), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(ContractController.GetContract), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }
/// <summary> /// <summary>
/// Get Contract /// Get Contract

View File

@@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers
return CreatedAtAction(nameof(CustomerController.GetCustomer), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(CustomerController.GetCustomer), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> // /// <summary>
/// Duplicate Customer // /// Duplicate Customer
/// (Wiki and Attachments are not duplicated) // /// (Wiki and Attachments are not duplicated)
/// </summary> // /// </summary>
/// <param name="id">Source object id</param> // /// <param name="id">Source object id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns>Customer</returns> // /// <returns>Customer</returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicateCustomer([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicateCustomer([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
CustomerBiz biz = CustomerBiz.GetBiz(ct, HttpContext); // CustomerBiz biz = CustomerBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
Customer o = await biz.DuplicateAsync(id); // Customer o = await biz.DuplicateAsync(id);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(CustomerController.GetCustomer), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(CustomerController.GetCustomer), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }
/// <summary> /// <summary>
/// Get Customer /// Get Customer

View File

@@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers
return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> // /// <summary>
/// Duplicate CustomerServiceRequest // /// Duplicate CustomerServiceRequest
/// (Wiki and Attachments are not duplicated) // /// (Wiki and Attachments are not duplicated)
/// </summary> // /// </summary>
/// <param name="id">Source object id</param> // /// <param name="id">Source object id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns>CustomerServiceRequest</returns> // /// <returns>CustomerServiceRequest</returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicateCustomerServiceRequest([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicateCustomerServiceRequest([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
CustomerServiceRequestBiz biz = CustomerServiceRequestBiz.GetBiz(ct, HttpContext); // CustomerServiceRequestBiz biz = CustomerServiceRequestBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
CustomerServiceRequest o = await biz.DuplicateAsync(id); // CustomerServiceRequest o = await biz.DuplicateAsync(id);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }
/// <summary> /// <summary>
/// Get CustomerServiceRequest /// Get CustomerServiceRequest

View File

@@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers
return CreatedAtAction(nameof(HeadOfficeController.GetHeadOffice), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(HeadOfficeController.GetHeadOffice), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> // /// <summary>
/// Duplicate HeadOffice // /// Duplicate HeadOffice
/// (Wiki and Attachments are not duplicated) // /// (Wiki and Attachments are not duplicated)
/// </summary> // /// </summary>
/// <param name="id">Source object id</param> // /// <param name="id">Source object id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns>HeadOffice</returns> // /// <returns>HeadOffice</returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicateHeadOffice([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicateHeadOffice([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
HeadOfficeBiz biz = HeadOfficeBiz.GetBiz(ct, HttpContext); // HeadOfficeBiz biz = HeadOfficeBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
HeadOffice o = await biz.DuplicateAsync(id); // HeadOffice o = await biz.DuplicateAsync(id);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(HeadOfficeController.GetHeadOffice), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(HeadOfficeController.GetHeadOffice), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }
/// <summary> /// <summary>
/// Get HeadOffice /// Get HeadOffice

View File

@@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers
return CreatedAtAction(nameof(LoanUnitController.GetLoanUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(LoanUnitController.GetLoanUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> // /// <summary>
/// Duplicate LoanUnit // /// Duplicate LoanUnit
/// (Wiki and Attachments are not duplicated) // /// (Wiki and Attachments are not duplicated)
/// </summary> // /// </summary>
/// <param name="id">Source object id</param> // /// <param name="id">Source object id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns>LoanUnit</returns> // /// <returns>LoanUnit</returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicateLoanUnit([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicateLoanUnit([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
LoanUnitBiz biz = LoanUnitBiz.GetBiz(ct, HttpContext); // LoanUnitBiz biz = LoanUnitBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
LoanUnit o = await biz.DuplicateAsync(id); // LoanUnit o = await biz.DuplicateAsync(id);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(LoanUnitController.GetLoanUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(LoanUnitController.GetLoanUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }
/// <summary> /// <summary>
/// Get LoanUnit /// Get LoanUnit

View File

@@ -60,28 +60,28 @@ namespace AyaNova.Api.Controllers
return CreatedAtAction(nameof(NotifySubscriptionController.GetNotifySubscription), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(NotifySubscriptionController.GetNotifySubscription), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> // /// <summary>
/// Duplicate NotifySubscription // /// Duplicate NotifySubscription
/// </summary> // /// </summary>
/// <param name="id">Source object id</param> // /// <param name="id">Source object id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns>NotifySubscription</returns> // /// <returns>NotifySubscription</returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicateNotifySubscription([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicateNotifySubscription([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
NotifySubscriptionBiz biz = NotifySubscriptionBiz.GetBiz(ct, HttpContext); // NotifySubscriptionBiz biz = NotifySubscriptionBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
NotifySubscription o = await biz.DuplicateAsync(id); // NotifySubscription o = await biz.DuplicateAsync(id);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(NotifySubscriptionController.GetNotifySubscription), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(NotifySubscriptionController.GetNotifySubscription), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }
/// <summary> /// <summary>
/// Get NotifySubscription /// Get NotifySubscription

View File

@@ -151,40 +151,40 @@ namespace AyaNova.Api.Controllers
} }
/// <summary> // /// <summary>
/// Duplicate PM // /// Duplicate PM
/// </summary> // /// </summary>
/// <param name="id">Create a duplicate of this items id</param> // /// <param name="id">Create a duplicate of this items id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns></returns> // /// <returns></returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicatePM([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicatePM([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
//Instantiate the business object handler // //Instantiate the business object handler
PMBiz biz = PMBiz.GetBiz(ct, HttpContext); // PMBiz biz = PMBiz.GetBiz(ct, HttpContext);
//If a user has change roles // //If a user has change roles
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
var oSrc = await biz.GetAsync(id, false); // var oSrc = await biz.GetAsync(id, false);
if (oSrc == null) // if (oSrc == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); // return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
//Create and validate // //Create and validate
PM o = await biz.DuplicateAsync(oSrc); // PM o = await biz.DuplicateAsync(oSrc);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(PMController.GetPM), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(PMController.GetPM), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }

View File

@@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers
return CreatedAtAction(nameof(PMTemplateController.GetPMTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(PMTemplateController.GetPMTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> // /// <summary>
/// Duplicate PMTemplate // /// Duplicate PMTemplate
/// (Wiki and Attachments are not duplicated) // /// (Wiki and Attachments are not duplicated)
/// </summary> // /// </summary>
/// <param name="id">Source object id</param> // /// <param name="id">Source object id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns>PMTemplate</returns> // /// <returns>PMTemplate</returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicatePMTemplate([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicatePMTemplate([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
PMTemplateBiz biz = PMTemplateBiz.GetBiz(ct, HttpContext); // PMTemplateBiz biz = PMTemplateBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
PMTemplate o = await biz.DuplicateAsync(id); // PMTemplate o = await biz.DuplicateAsync(id);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(PMTemplateController.GetPMTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(PMTemplateController.GetPMTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }
/// <summary> /// <summary>
/// Get PMTemplate /// Get PMTemplate

View File

@@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers
return CreatedAtAction(nameof(PartAssemblyController.GetPartAssembly), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(PartAssemblyController.GetPartAssembly), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> // /// <summary>
/// Duplicate PartAssembly // /// Duplicate PartAssembly
/// (Wiki and Attachments are not duplicated) // /// (Wiki and Attachments are not duplicated)
/// </summary> // /// </summary>
/// <param name="id">Source object id</param> // /// <param name="id">Source object id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns>PartAssembly</returns> // /// <returns>PartAssembly</returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicatePartAssembly([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicatePartAssembly([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
PartAssemblyBiz biz = PartAssemblyBiz.GetBiz(ct, HttpContext); // PartAssemblyBiz biz = PartAssemblyBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
PartAssembly o = await biz.DuplicateAsync(id); // PartAssembly o = await biz.DuplicateAsync(id);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(PartAssemblyController.GetPartAssembly), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(PartAssemblyController.GetPartAssembly), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }
/// <summary> /// <summary>
/// Get PartAssembly /// Get PartAssembly

View File

@@ -62,29 +62,29 @@ namespace AyaNova.Api.Controllers
return CreatedAtAction(nameof(PartController.GetPart), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(PartController.GetPart), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> // /// <summary>
/// Duplicate Part // /// Duplicate Part
/// (Wiki and Attachments are not duplicated) // /// (Wiki and Attachments are not duplicated)
/// </summary> // /// </summary>
/// <param name="id">Source object id</param> // /// <param name="id">Source object id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns>Part</returns> // /// <returns>Part</returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicatePart([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicatePart([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
PartBiz biz = PartBiz.GetBiz(ct, HttpContext); // PartBiz biz = PartBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
Part o = await biz.DuplicateAsync(id); // Part o = await biz.DuplicateAsync(id);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(PartController.GetPart), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(PartController.GetPart), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }
/// <summary> /// <summary>
/// Get Part /// Get Part

View File

@@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers
return CreatedAtAction(nameof(PartWarehouseController.GetPartWarehouse), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(PartWarehouseController.GetPartWarehouse), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> // /// <summary>
/// Duplicate PartWarehouse // /// Duplicate PartWarehouse
/// (Wiki and Attachments are not duplicated) // /// (Wiki and Attachments are not duplicated)
/// </summary> // /// </summary>
/// <param name="id">Source object id</param> // /// <param name="id">Source object id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns>PartWarehouse</returns> // /// <returns>PartWarehouse</returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicatePartWarehouse([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicatePartWarehouse([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
PartWarehouseBiz biz = PartWarehouseBiz.GetBiz(ct, HttpContext); // PartWarehouseBiz biz = PartWarehouseBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
PartWarehouse o = await biz.DuplicateAsync(id); // PartWarehouse o = await biz.DuplicateAsync(id);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(PartWarehouseController.GetPartWarehouse), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(PartWarehouseController.GetPartWarehouse), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }
/// <summary> /// <summary>
/// Get PartWarehouse /// Get PartWarehouse

View File

@@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers
return CreatedAtAction(nameof(ProjectController.GetProject), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(ProjectController.GetProject), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> // /// <summary>
/// Duplicate Project // /// Duplicate Project
/// (Wiki and Attachments are not duplicated) // /// (Wiki and Attachments are not duplicated)
/// </summary> // /// </summary>
/// <param name="id">Source object id</param> // /// <param name="id">Source object id</param>
/// <param name="apiVersion">From route path</param> // /// <param name="apiVersion">From route path</param>
/// <returns>Project</returns> // /// <returns>Project</returns>
[HttpPost("duplicate/{id}")] // [HttpPost("duplicate/{id}")]
public async Task<IActionResult> DuplicateProject([FromRoute] long id, ApiVersion apiVersion) // public async Task<IActionResult> DuplicateProject([FromRoute] long id, ApiVersion apiVersion)
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
ProjectBiz biz = ProjectBiz.GetBiz(ct, HttpContext); // ProjectBiz biz = ProjectBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); // return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid) // if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); // return BadRequest(new ApiErrorResponse(ModelState));
Project o = await biz.DuplicateAsync(id); // Project o = await biz.DuplicateAsync(id);
if (o == null) // if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); // return BadRequest(new ApiErrorResponse(biz.Errors));
else // else
return CreatedAtAction(nameof(ProjectController.GetProject), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); // return CreatedAtAction(nameof(ProjectController.GetProject), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} // }
/// <summary> /// <summary>
/// Get Project /// Get Project

View File

@@ -118,39 +118,39 @@ MULTIPLE discount / markup ITEMS
} }
} }
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<Contract> DuplicateAsync(long id) // internal async Task<Contract> DuplicateAsync(long id)
{ // {
Contract dbObject = await GetAsync(id, false); // Contract dbObject = await GetAsync(id, false);
if (dbObject == null) // if (dbObject == null)
{ // {
AddError(ApiErrorCode.NOT_FOUND, "id"); // AddError(ApiErrorCode.NOT_FOUND, "id");
return null; // return null;
} // }
Contract newObject = new Contract(); // Contract newObject = new Contract();
CopyObject.Copy(dbObject, newObject, "Wiki"); // CopyObject.Copy(dbObject, newObject, "Wiki");
string newUniqueName = string.Empty; // string newUniqueName = string.Empty;
bool NotUnique = true; // bool NotUnique = true;
long l = 1; // long l = 1;
do // do
{ // {
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
NotUnique = await ct.Contract.AnyAsync(m => m.Name == newUniqueName); // NotUnique = await ct.Contract.AnyAsync(m => m.Name == newUniqueName);
} while (NotUnique); // } while (NotUnique);
newObject.Name = newUniqueName; // newObject.Name = newUniqueName;
newObject.Id = 0; // newObject.Id = 0;
newObject.Concurrency = 0; // newObject.Concurrency = 0;
await ct.Contract.AddAsync(newObject); // await ct.Contract.AddAsync(newObject);
await ct.SaveChangesAsync(); // await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); // await SearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject); // await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
await PopulateVizFields(newObject); // await PopulateVizFields(newObject);
return newObject; // return newObject;
} // }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//GET //GET

View File

@@ -60,38 +60,38 @@ namespace AyaNova.Biz
} }
} }
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<Customer> DuplicateAsync(long id) // internal async Task<Customer> DuplicateAsync(long id)
{ // {
Customer dbObject = await GetAsync(id, false); // Customer dbObject = await GetAsync(id, false);
if (dbObject == null) // if (dbObject == null)
{ // {
AddError(ApiErrorCode.NOT_FOUND, "id"); // AddError(ApiErrorCode.NOT_FOUND, "id");
return null; // return null;
} // }
Customer newObject = new Customer(); // Customer newObject = new Customer();
CopyObject.Copy(dbObject, newObject, "Wiki"); // CopyObject.Copy(dbObject, newObject, "Wiki");
string newUniqueName = string.Empty; // string newUniqueName = string.Empty;
bool NotUnique = true; // bool NotUnique = true;
long l = 1; // long l = 1;
do // do
{ // {
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
NotUnique = await ct.Customer.AnyAsync(m => m.Name == newUniqueName); // NotUnique = await ct.Customer.AnyAsync(m => m.Name == newUniqueName);
} while (NotUnique); // } while (NotUnique);
newObject.Name = newUniqueName; // newObject.Name = newUniqueName;
newObject.Id = 0; // newObject.Id = 0;
newObject.Concurrency = 0; // newObject.Concurrency = 0;
await ct.Customer.AddAsync(newObject); // await ct.Customer.AddAsync(newObject);
await ct.SaveChangesAsync(); // await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); // await SearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject); // await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
return newObject; // return newObject;
} // }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//GET //GET

View File

@@ -60,38 +60,38 @@ namespace AyaNova.Biz
} }
} }
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<CustomerServiceRequest> DuplicateAsync(long id) // internal async Task<CustomerServiceRequest> DuplicateAsync(long id)
{ // {
CustomerServiceRequest dbObject = await GetAsync(id, false); // CustomerServiceRequest dbObject = await GetAsync(id, false);
if (dbObject == null) // if (dbObject == null)
{ // {
AddError(ApiErrorCode.NOT_FOUND, "id"); // AddError(ApiErrorCode.NOT_FOUND, "id");
return null; // return null;
} // }
CustomerServiceRequest newObject = new CustomerServiceRequest(); // CustomerServiceRequest newObject = new CustomerServiceRequest();
CopyObject.Copy(dbObject, newObject, "Wiki"); // CopyObject.Copy(dbObject, newObject, "Wiki");
string newUniqueName = string.Empty; // string newUniqueName = string.Empty;
bool NotUnique = true; // bool NotUnique = true;
long l = 1; // long l = 1;
do // do
{ // {
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
NotUnique = await ct.CustomerServiceRequest.AnyAsync(m => m.Name == newUniqueName); // NotUnique = await ct.CustomerServiceRequest.AnyAsync(m => m.Name == newUniqueName);
} while (NotUnique); // } while (NotUnique);
newObject.Name = newUniqueName; // newObject.Name = newUniqueName;
newObject.Id = 0; // newObject.Id = 0;
newObject.Concurrency = 0; // newObject.Concurrency = 0;
await ct.CustomerServiceRequest.AddAsync(newObject); // await ct.CustomerServiceRequest.AddAsync(newObject);
await ct.SaveChangesAsync(); // await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); // await SearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject); // await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
return newObject; // return newObject;
} // }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//GET //GET

View File

@@ -60,38 +60,38 @@ namespace AyaNova.Biz
} }
} }
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<HeadOffice> DuplicateAsync(long id) // internal async Task<HeadOffice> DuplicateAsync(long id)
{ // {
var dbObject = await GetAsync(id, false); // var dbObject = await GetAsync(id, false);
if (dbObject == null) // if (dbObject == null)
{ // {
AddError(ApiErrorCode.NOT_FOUND, "id"); // AddError(ApiErrorCode.NOT_FOUND, "id");
return null; // return null;
} // }
var newObject = new HeadOffice(); // var newObject = new HeadOffice();
CopyObject.Copy(dbObject, newObject, "Wiki"); // CopyObject.Copy(dbObject, newObject, "Wiki");
string newUniqueName = string.Empty; // string newUniqueName = string.Empty;
bool NotUnique = true; // bool NotUnique = true;
long l = 1; // long l = 1;
do // do
{ // {
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
NotUnique = await ct.HeadOffice.AnyAsync(z => z.Name == newUniqueName); // NotUnique = await ct.HeadOffice.AnyAsync(z => z.Name == newUniqueName);
} while (NotUnique); // } while (NotUnique);
newObject.Name = newUniqueName; // newObject.Name = newUniqueName;
newObject.Id = 0; // newObject.Id = 0;
newObject.Concurrency = 0; // newObject.Concurrency = 0;
await ct.HeadOffice.AddAsync(newObject); // await ct.HeadOffice.AddAsync(newObject);
await ct.SaveChangesAsync(); // await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); // await SearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject); // await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
return newObject; // return newObject;
} // }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//GET //GET

View File

@@ -60,38 +60,38 @@ namespace AyaNova.Biz
} }
} }
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<LoanUnit> DuplicateAsync(long id) // internal async Task<LoanUnit> DuplicateAsync(long id)
{ // {
var dbObject = await GetAsync(id, false); // var dbObject = await GetAsync(id, false);
if (dbObject == null) // if (dbObject == null)
{ // {
AddError(ApiErrorCode.NOT_FOUND, "id"); // AddError(ApiErrorCode.NOT_FOUND, "id");
return null; // return null;
} // }
var newObject = new LoanUnit(); // var newObject = new LoanUnit();
CopyObject.Copy(dbObject, newObject, "Wiki"); // CopyObject.Copy(dbObject, newObject, "Wiki");
string newUniqueName = string.Empty; // string newUniqueName = string.Empty;
bool NotUnique = true; // bool NotUnique = true;
long l = 1; // long l = 1;
do // do
{ // {
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
NotUnique = await ct.LoanUnit.AnyAsync(z => z.Name == newUniqueName); // NotUnique = await ct.LoanUnit.AnyAsync(z => z.Name == newUniqueName);
} while (NotUnique); // } while (NotUnique);
newObject.Name = newUniqueName; // newObject.Name = newUniqueName;
newObject.Id = 0; // newObject.Id = 0;
newObject.Concurrency = 0; // newObject.Concurrency = 0;
await ct.LoanUnit.AddAsync(newObject); // await ct.LoanUnit.AddAsync(newObject);
await ct.SaveChangesAsync(); // await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); // await SearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject); // await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
return newObject; // return newObject;
} // }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//GET //GET

View File

@@ -52,30 +52,30 @@ namespace AyaNova.Biz
} }
} }
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<NotifySubscription> DuplicateAsync(long id) // internal async Task<NotifySubscription> DuplicateAsync(long id)
{ // {
var dbObject = await GetAsync(id, false); // var dbObject = await GetAsync(id, false);
if (dbObject == null) // if (dbObject == null)
{ // {
AddError(ApiErrorCode.NOT_FOUND, "id"); // AddError(ApiErrorCode.NOT_FOUND, "id");
return null; // return null;
} // }
NotifySubscription newObject = new NotifySubscription(); // NotifySubscription newObject = new NotifySubscription();
CopyObject.Copy(dbObject, newObject); // CopyObject.Copy(dbObject, newObject);
newObject.Id = 0; // newObject.Id = 0;
newObject.Concurrency = 0; // newObject.Concurrency = 0;
await ct.NotifySubscription.AddAsync(newObject); // await ct.NotifySubscription.AddAsync(newObject);
await ct.SaveChangesAsync(); // await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
//await SearchIndexAsync(newObject, true); // //await SearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
return newObject; // return newObject;
} // }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
// GET // GET

View File

@@ -110,43 +110,43 @@ namespace AyaNova.Biz
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<PM> DuplicateAsync(PM dbObject) // internal async Task<PM> DuplicateAsync(PM dbObject)
{ // {
await Task.CompletedTask; // await Task.CompletedTask;
throw new System.NotImplementedException("STUB: WORKORDER DUPLICATE"); // throw new System.NotImplementedException("STUB: WORKORDER DUPLICATE");
// PM outObj = new PM(); // // PM outObj = new PM();
// CopyObject.Copy(dbObject, outObj, "Wiki"); // // CopyObject.Copy(dbObject, outObj, "Wiki");
// // outObj.Name = Util.StringUtil.NameUniquify(outObj.Name, 255); // // // outObj.Name = Util.StringUtil.NameUniquify(outObj.Name, 255);
// //generate unique name // // //generate unique name
// string newUniqueName = string.Empty; // // string newUniqueName = string.Empty;
// bool NotUnique = true; // // bool NotUnique = true;
// long l = 1; // // long l = 1;
// do // // do
// { // // {
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); // // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
// NotUnique = await ct.PM.AnyAsync(z => z.Name == newUniqueName); // // NotUnique = await ct.PM.AnyAsync(z => z.Name == newUniqueName);
// } while (NotUnique); // // } while (NotUnique);
// outObj.Name = newUniqueName; // // outObj.Name = newUniqueName;
// outObj.Id = 0; // // outObj.Id = 0;
// outObj.Concurrency = 0; // // outObj.Concurrency = 0;
// await ct.PM.AddAsync(outObj); // // await ct.PM.AddAsync(outObj);
// await ct.SaveChangesAsync(); // // await ct.SaveChangesAsync();
// //Handle child and associated items: // // //Handle child and associated items:
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct); // // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
// await SearchIndexAsync(outObj, true); // // await SearchIndexAsync(outObj, true);
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null); // // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null);
// return outObj; // // return outObj;
} // }
//################################################################################################################################################### //###################################################################################################################################################
//################################################################################################################################################### //###################################################################################################################################################

View File

@@ -63,38 +63,38 @@ namespace AyaNova.Biz
} }
} }
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<PMTemplate> DuplicateAsync(long id) // internal async Task<PMTemplate> DuplicateAsync(long id)
{ // {
PMTemplate dbObject = await GetAsync(id, false); // PMTemplate dbObject = await GetAsync(id, false);
if (dbObject == null) // if (dbObject == null)
{ // {
AddError(ApiErrorCode.NOT_FOUND, "id"); // AddError(ApiErrorCode.NOT_FOUND, "id");
return null; // return null;
} // }
PMTemplate newObject = new PMTemplate(); // PMTemplate newObject = new PMTemplate();
CopyObject.Copy(dbObject, newObject, "Wiki"); // CopyObject.Copy(dbObject, newObject, "Wiki");
string newUniqueName = string.Empty; // string newUniqueName = string.Empty;
bool NotUnique = true; // bool NotUnique = true;
long l = 1; // long l = 1;
do // do
{ // {
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
NotUnique = await ct.PMTemplate.AnyAsync(z => z.Name == newUniqueName); // NotUnique = await ct.PMTemplate.AnyAsync(z => z.Name == newUniqueName);
} while (NotUnique); // } while (NotUnique);
newObject.Name = newUniqueName; // newObject.Name = newUniqueName;
newObject.Id = 0; // newObject.Id = 0;
newObject.Concurrency = 0; // newObject.Concurrency = 0;
await ct.PMTemplate.AddAsync(newObject); // await ct.PMTemplate.AddAsync(newObject);
await ct.SaveChangesAsync(); // await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); // await SearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject); // await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
return newObject; // return newObject;
} // }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//GET //GET

View File

@@ -62,43 +62,43 @@ namespace AyaNova.Biz
} }
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<PartAssembly> DuplicateAsync(long id) // internal async Task<PartAssembly> DuplicateAsync(long id)
{ // {
PartAssembly dbObject = await GetAsync(id, false); // PartAssembly dbObject = await GetAsync(id, false);
if (dbObject == null) // if (dbObject == null)
{ // {
AddError(ApiErrorCode.NOT_FOUND, "id"); // AddError(ApiErrorCode.NOT_FOUND, "id");
return null; // return null;
} // }
PartAssembly newObject = new PartAssembly(); // PartAssembly newObject = new PartAssembly();
CopyObject.Copy(dbObject, newObject, "Wiki,Id"); // CopyObject.Copy(dbObject, newObject, "Wiki,Id");
string newUniqueName = string.Empty; // string newUniqueName = string.Empty;
bool NotUnique = true; // bool NotUnique = true;
long l = 1; // long l = 1;
do // do
{ // {
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
NotUnique = await ct.PartAssembly.AnyAsync(m => m.Name == newUniqueName); // NotUnique = await ct.PartAssembly.AnyAsync(m => m.Name == newUniqueName);
} while (NotUnique); // } while (NotUnique);
newObject.Name = newUniqueName; // newObject.Name = newUniqueName;
newObject.Id = 0; // newObject.Id = 0;
newObject.Concurrency = 0; // newObject.Concurrency = 0;
foreach (PartAssemblyItem pai in newObject.Items) // foreach (PartAssemblyItem pai in newObject.Items)
{ // {
pai.Id = 0; // pai.Id = 0;
pai.Concurrency = 0; // pai.Concurrency = 0;
} // }
await ct.PartAssembly.AddAsync(newObject); // await ct.PartAssembly.AddAsync(newObject);
await ct.SaveChangesAsync(); // await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); // await SearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject); // await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
return newObject; // return newObject;
} // }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//GET //GET

View File

@@ -60,38 +60,38 @@ namespace AyaNova.Biz
} }
} }
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<Part> DuplicateAsync(long id) // internal async Task<Part> DuplicateAsync(long id)
{ // {
Part dbObject = await GetAsync(id, false); // Part dbObject = await GetAsync(id, false);
if (dbObject == null) // if (dbObject == null)
{ // {
AddError(ApiErrorCode.NOT_FOUND, "id"); // AddError(ApiErrorCode.NOT_FOUND, "id");
return null; // return null;
} // }
Part newObject = new Part(); // Part newObject = new Part();
CopyObject.Copy(dbObject, newObject, "Wiki"); // CopyObject.Copy(dbObject, newObject, "Wiki");
string newUniqueName = string.Empty; // string newUniqueName = string.Empty;
bool NotUnique = true; // bool NotUnique = true;
long l = 1; // long l = 1;
do // do
{ // {
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
NotUnique = await ct.Part.AnyAsync(m => m.Name == newUniqueName); // NotUnique = await ct.Part.AnyAsync(m => m.Name == newUniqueName);
} while (NotUnique); // } while (NotUnique);
newObject.Name = newUniqueName; // newObject.Name = newUniqueName;
newObject.Id = 0; // newObject.Id = 0;
newObject.Concurrency = 0; // newObject.Concurrency = 0;
await ct.Part.AddAsync(newObject); // await ct.Part.AddAsync(newObject);
await ct.SaveChangesAsync(); // await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); // await SearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject); // await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
return newObject; // return newObject;
} // }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//GET //GET

View File

@@ -60,38 +60,38 @@ namespace AyaNova.Biz
} }
} }
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<PartWarehouse> DuplicateAsync(long id) // internal async Task<PartWarehouse> DuplicateAsync(long id)
{ // {
var dbObject = await GetAsync(id, false); // var dbObject = await GetAsync(id, false);
if (dbObject == null) // if (dbObject == null)
{ // {
AddError(ApiErrorCode.NOT_FOUND, "id"); // AddError(ApiErrorCode.NOT_FOUND, "id");
return null; // return null;
} // }
PartWarehouse newObject = new PartWarehouse(); // PartWarehouse newObject = new PartWarehouse();
CopyObject.Copy(dbObject, newObject, "Wiki"); // CopyObject.Copy(dbObject, newObject, "Wiki");
string newUniqueName = string.Empty; // string newUniqueName = string.Empty;
bool NotUnique = true; // bool NotUnique = true;
long l = 1; // long l = 1;
do // do
{ // {
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
NotUnique = await ct.PartWarehouse.AnyAsync(m => m.Name == newUniqueName); // NotUnique = await ct.PartWarehouse.AnyAsync(m => m.Name == newUniqueName);
} while (NotUnique); // } while (NotUnique);
newObject.Name = newUniqueName; // newObject.Name = newUniqueName;
newObject.Id = 0; // newObject.Id = 0;
newObject.Concurrency = 0; // newObject.Concurrency = 0;
await ct.PartWarehouse.AddAsync(newObject); // await ct.PartWarehouse.AddAsync(newObject);
await ct.SaveChangesAsync(); // await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); // await SearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject); // await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
return newObject; // return newObject;
} // }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//GET //GET

View File

@@ -60,38 +60,38 @@ namespace AyaNova.Biz
} }
} }
//////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE // //DUPLICATE
// // //
internal async Task<Project> DuplicateAsync(long id) // internal async Task<Project> DuplicateAsync(long id)
{ // {
var dbObject = await GetAsync(id, false); // var dbObject = await GetAsync(id, false);
if (dbObject == null) // if (dbObject == null)
{ // {
AddError(ApiErrorCode.NOT_FOUND, "id"); // AddError(ApiErrorCode.NOT_FOUND, "id");
return null; // return null;
} // }
Project newObject = new Project(); // Project newObject = new Project();
CopyObject.Copy(dbObject, newObject, "Wiki"); // CopyObject.Copy(dbObject, newObject, "Wiki");
string newUniqueName = string.Empty; // string newUniqueName = string.Empty;
bool NotUnique = true; // bool NotUnique = true;
long l = 1; // long l = 1;
do // do
{ // {
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
NotUnique = await ct.Project.AnyAsync(m => m.Name == newUniqueName); // NotUnique = await ct.Project.AnyAsync(m => m.Name == newUniqueName);
} while (NotUnique); // } while (NotUnique);
newObject.Name = newUniqueName; // newObject.Name = newUniqueName;
newObject.Id = 0; // newObject.Id = 0;
newObject.Concurrency = 0; // newObject.Concurrency = 0;
await ct.Project.AddAsync(newObject); // await ct.Project.AddAsync(newObject);
await ct.SaveChangesAsync(); // await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); // await SearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject); // await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
return newObject; // return newObject;
} // }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//GET //GET