diff --git a/server/AyaNova/Controllers/ContractController.cs b/server/AyaNova/Controllers/ContractController.cs index 5b203200..f2611df0 100644 --- a/server/AyaNova/Controllers/ContractController.cs +++ b/server/AyaNova/Controllers/ContractController.cs @@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(ContractController.GetContract), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate Contract - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// Contract - [HttpPost("duplicate/{id}")] - public async Task DuplicateContract([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - ContractBiz biz = ContractBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - Contract o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(ContractController.GetContract), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate Contract + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// Contract + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateContract([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // ContractBiz biz = ContractBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // Contract o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(ContractController.GetContract), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get Contract diff --git a/server/AyaNova/Controllers/CustomerController.cs b/server/AyaNova/Controllers/CustomerController.cs index c3097be5..5b7a0b55 100644 --- a/server/AyaNova/Controllers/CustomerController.cs +++ b/server/AyaNova/Controllers/CustomerController.cs @@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(CustomerController.GetCustomer), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate Customer - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// Customer - [HttpPost("duplicate/{id}")] - public async Task DuplicateCustomer([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - CustomerBiz biz = CustomerBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - Customer o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(CustomerController.GetCustomer), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate Customer + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// Customer + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateCustomer([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // CustomerBiz biz = CustomerBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // Customer o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(CustomerController.GetCustomer), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get Customer diff --git a/server/AyaNova/Controllers/CustomerServiceRequestController.cs b/server/AyaNova/Controllers/CustomerServiceRequestController.cs index d1f5636e..405841bb 100644 --- a/server/AyaNova/Controllers/CustomerServiceRequestController.cs +++ b/server/AyaNova/Controllers/CustomerServiceRequestController.cs @@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate CustomerServiceRequest - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// CustomerServiceRequest - [HttpPost("duplicate/{id}")] - public async Task DuplicateCustomerServiceRequest([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - CustomerServiceRequestBiz biz = CustomerServiceRequestBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - CustomerServiceRequest o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate CustomerServiceRequest + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// CustomerServiceRequest + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateCustomerServiceRequest([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // CustomerServiceRequestBiz biz = CustomerServiceRequestBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // CustomerServiceRequest o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(CustomerServiceRequestController.GetCustomerServiceRequest), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get CustomerServiceRequest diff --git a/server/AyaNova/Controllers/HeadOfficeController.cs b/server/AyaNova/Controllers/HeadOfficeController.cs index b2874291..0ff7d015 100644 --- a/server/AyaNova/Controllers/HeadOfficeController.cs +++ b/server/AyaNova/Controllers/HeadOfficeController.cs @@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(HeadOfficeController.GetHeadOffice), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate HeadOffice - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// HeadOffice - [HttpPost("duplicate/{id}")] - public async Task DuplicateHeadOffice([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - HeadOfficeBiz biz = HeadOfficeBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - HeadOffice o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(HeadOfficeController.GetHeadOffice), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate HeadOffice + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// HeadOffice + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateHeadOffice([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // HeadOfficeBiz biz = HeadOfficeBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // HeadOffice o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(HeadOfficeController.GetHeadOffice), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get HeadOffice diff --git a/server/AyaNova/Controllers/LoanUnitController.cs b/server/AyaNova/Controllers/LoanUnitController.cs index 1d3a22c9..faf3f36a 100644 --- a/server/AyaNova/Controllers/LoanUnitController.cs +++ b/server/AyaNova/Controllers/LoanUnitController.cs @@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(LoanUnitController.GetLoanUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate LoanUnit - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// LoanUnit - [HttpPost("duplicate/{id}")] - public async Task DuplicateLoanUnit([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - LoanUnitBiz biz = LoanUnitBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - LoanUnit o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(LoanUnitController.GetLoanUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate LoanUnit + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// LoanUnit + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateLoanUnit([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // LoanUnitBiz biz = LoanUnitBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // LoanUnit o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(LoanUnitController.GetLoanUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get LoanUnit diff --git a/server/AyaNova/Controllers/NotifySubscriptionController.cs b/server/AyaNova/Controllers/NotifySubscriptionController.cs index d33650e2..bdf048b8 100644 --- a/server/AyaNova/Controllers/NotifySubscriptionController.cs +++ b/server/AyaNova/Controllers/NotifySubscriptionController.cs @@ -60,28 +60,28 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(NotifySubscriptionController.GetNotifySubscription), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate NotifySubscription - /// - /// Source object id - /// From route path - /// NotifySubscription - [HttpPost("duplicate/{id}")] - public async Task DuplicateNotifySubscription([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - NotifySubscriptionBiz biz = NotifySubscriptionBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - NotifySubscription o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(NotifySubscriptionController.GetNotifySubscription), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate NotifySubscription + // /// + // /// Source object id + // /// From route path + // /// NotifySubscription + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateNotifySubscription([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // NotifySubscriptionBiz biz = NotifySubscriptionBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // NotifySubscription o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(NotifySubscriptionController.GetNotifySubscription), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get NotifySubscription diff --git a/server/AyaNova/Controllers/PMController.cs b/server/AyaNova/Controllers/PMController.cs index d3f51a30..8ffd8cc0 100644 --- a/server/AyaNova/Controllers/PMController.cs +++ b/server/AyaNova/Controllers/PMController.cs @@ -151,40 +151,40 @@ namespace AyaNova.Api.Controllers } - /// - /// Duplicate PM - /// - /// Create a duplicate of this items id - /// From route path - /// - [HttpPost("duplicate/{id}")] - public async Task DuplicatePM([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // /// + // /// Duplicate PM + // /// + // /// Create a duplicate of this items id + // /// From route path + // /// + // [HttpPost("duplicate/{id}")] + // public async Task DuplicatePM([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - //Instantiate the business object handler - PMBiz biz = PMBiz.GetBiz(ct, HttpContext); + // //Instantiate the business object handler + // PMBiz biz = PMBiz.GetBiz(ct, HttpContext); - //If a user has change roles - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); + // //If a user has change roles + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); - var oSrc = await biz.GetAsync(id, false); - if (oSrc == null) - return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); + // var oSrc = await biz.GetAsync(id, false); + // if (oSrc == null) + // return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); - //Create and validate - PM o = await biz.DuplicateAsync(oSrc); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(PMController.GetPM), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // //Create and validate + // PM o = await biz.DuplicateAsync(oSrc); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(PMController.GetPM), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // } diff --git a/server/AyaNova/Controllers/PMTemplateController.cs b/server/AyaNova/Controllers/PMTemplateController.cs index b367f168..6732ebc7 100644 --- a/server/AyaNova/Controllers/PMTemplateController.cs +++ b/server/AyaNova/Controllers/PMTemplateController.cs @@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(PMTemplateController.GetPMTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate PMTemplate - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// PMTemplate - [HttpPost("duplicate/{id}")] - public async Task DuplicatePMTemplate([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - PMTemplateBiz biz = PMTemplateBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - PMTemplate o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(PMTemplateController.GetPMTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate PMTemplate + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// PMTemplate + // [HttpPost("duplicate/{id}")] + // public async Task DuplicatePMTemplate([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // PMTemplateBiz biz = PMTemplateBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // PMTemplate o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(PMTemplateController.GetPMTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get PMTemplate diff --git a/server/AyaNova/Controllers/PartAssemblyController.cs b/server/AyaNova/Controllers/PartAssemblyController.cs index cda7c821..ba3ca857 100644 --- a/server/AyaNova/Controllers/PartAssemblyController.cs +++ b/server/AyaNova/Controllers/PartAssemblyController.cs @@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(PartAssemblyController.GetPartAssembly), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate PartAssembly - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// PartAssembly - [HttpPost("duplicate/{id}")] - public async Task DuplicatePartAssembly([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - PartAssemblyBiz biz = PartAssemblyBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - PartAssembly o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(PartAssemblyController.GetPartAssembly), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate PartAssembly + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// PartAssembly + // [HttpPost("duplicate/{id}")] + // public async Task DuplicatePartAssembly([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // PartAssemblyBiz biz = PartAssemblyBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // PartAssembly o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(PartAssemblyController.GetPartAssembly), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get PartAssembly diff --git a/server/AyaNova/Controllers/PartController.cs b/server/AyaNova/Controllers/PartController.cs index 0ed1459e..d2dfe5fc 100644 --- a/server/AyaNova/Controllers/PartController.cs +++ b/server/AyaNova/Controllers/PartController.cs @@ -62,29 +62,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(PartController.GetPart), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate Part - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// Part - [HttpPost("duplicate/{id}")] - public async Task DuplicatePart([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - PartBiz biz = PartBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - Part o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(PartController.GetPart), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate Part + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// Part + // [HttpPost("duplicate/{id}")] + // public async Task DuplicatePart([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // PartBiz biz = PartBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // Part o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(PartController.GetPart), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get Part diff --git a/server/AyaNova/Controllers/PartWarehouseController.cs b/server/AyaNova/Controllers/PartWarehouseController.cs index cba6ed2e..f1d6efba 100644 --- a/server/AyaNova/Controllers/PartWarehouseController.cs +++ b/server/AyaNova/Controllers/PartWarehouseController.cs @@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(PartWarehouseController.GetPartWarehouse), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate PartWarehouse - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// PartWarehouse - [HttpPost("duplicate/{id}")] - public async Task DuplicatePartWarehouse([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - PartWarehouseBiz biz = PartWarehouseBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - PartWarehouse o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(PartWarehouseController.GetPartWarehouse), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate PartWarehouse + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// PartWarehouse + // [HttpPost("duplicate/{id}")] + // public async Task DuplicatePartWarehouse([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // PartWarehouseBiz biz = PartWarehouseBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // PartWarehouse o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(PartWarehouseController.GetPartWarehouse), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get PartWarehouse diff --git a/server/AyaNova/Controllers/ProjectController.cs b/server/AyaNova/Controllers/ProjectController.cs index 0868b05d..199f7fd7 100644 --- a/server/AyaNova/Controllers/ProjectController.cs +++ b/server/AyaNova/Controllers/ProjectController.cs @@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(ProjectController.GetProject), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate Project - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// Project - [HttpPost("duplicate/{id}")] - public async Task DuplicateProject([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - ProjectBiz biz = ProjectBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - Project o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(ProjectController.GetProject), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate Project + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// Project + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateProject([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // ProjectBiz biz = ProjectBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // Project o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(ProjectController.GetProject), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get Project diff --git a/server/AyaNova/biz/ContractBiz.cs b/server/AyaNova/biz/ContractBiz.cs index e9d06eb6..acf25710 100644 --- a/server/AyaNova/biz/ContractBiz.cs +++ b/server/AyaNova/biz/ContractBiz.cs @@ -118,39 +118,39 @@ MULTIPLE discount / markup ITEMS } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { - Contract dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - Contract newObject = new Contract(); - 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.Contract.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.Contract.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); - await PopulateVizFields(newObject); - return newObject; - } + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { + // Contract dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // Contract newObject = new Contract(); + // 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.Contract.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.Contract.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); + // await PopulateVizFields(newObject); + // return newObject; + // } //////////////////////////////////////////////////////////////////////////////////////////////// //GET diff --git a/server/AyaNova/biz/CustomerBiz.cs b/server/AyaNova/biz/CustomerBiz.cs index 7579c35e..bdac5a35 100644 --- a/server/AyaNova/biz/CustomerBiz.cs +++ b/server/AyaNova/biz/CustomerBiz.cs @@ -60,38 +60,38 @@ namespace AyaNova.Biz } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { - Customer dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - Customer newObject = new Customer(); - 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.Customer.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.Customer.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; - } + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { + // Customer dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // Customer newObject = new Customer(); + // 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.Customer.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.Customer.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 diff --git a/server/AyaNova/biz/CustomerServiceRequestBiz.cs b/server/AyaNova/biz/CustomerServiceRequestBiz.cs index 340af3d7..13d0eeba 100644 --- a/server/AyaNova/biz/CustomerServiceRequestBiz.cs +++ b/server/AyaNova/biz/CustomerServiceRequestBiz.cs @@ -60,38 +60,38 @@ namespace AyaNova.Biz } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { - CustomerServiceRequest dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - CustomerServiceRequest newObject = new CustomerServiceRequest(); - 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.CustomerServiceRequest.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.CustomerServiceRequest.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; - } + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { + // CustomerServiceRequest dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // CustomerServiceRequest newObject = new CustomerServiceRequest(); + // 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.CustomerServiceRequest.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.CustomerServiceRequest.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 diff --git a/server/AyaNova/biz/HeadOfficeBiz.cs b/server/AyaNova/biz/HeadOfficeBiz.cs index 4ee5b256..18c164aa 100644 --- a/server/AyaNova/biz/HeadOfficeBiz.cs +++ b/server/AyaNova/biz/HeadOfficeBiz.cs @@ -60,38 +60,38 @@ namespace AyaNova.Biz } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { - var dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - var newObject = new HeadOffice(); - 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.HeadOffice.AnyAsync(z => z.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.HeadOffice.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; - } + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { + // var dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // var newObject = new HeadOffice(); + // 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.HeadOffice.AnyAsync(z => z.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.HeadOffice.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 diff --git a/server/AyaNova/biz/LoanUnitBiz.cs b/server/AyaNova/biz/LoanUnitBiz.cs index 414ce1f3..6bd0247f 100644 --- a/server/AyaNova/biz/LoanUnitBiz.cs +++ b/server/AyaNova/biz/LoanUnitBiz.cs @@ -60,38 +60,38 @@ namespace AyaNova.Biz } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { - var dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - var newObject = new LoanUnit(); - 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.LoanUnit.AnyAsync(z => z.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.LoanUnit.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; - } + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { + // var dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // var newObject = new LoanUnit(); + // 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.LoanUnit.AnyAsync(z => z.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.LoanUnit.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 diff --git a/server/AyaNova/biz/NotifySubscriptionBiz.cs b/server/AyaNova/biz/NotifySubscriptionBiz.cs index fbf4845b..0cc9caa5 100644 --- a/server/AyaNova/biz/NotifySubscriptionBiz.cs +++ b/server/AyaNova/biz/NotifySubscriptionBiz.cs @@ -52,30 +52,30 @@ namespace AyaNova.Biz } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { - var dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - NotifySubscription newObject = new NotifySubscription(); - CopyObject.Copy(dbObject, newObject); + // var dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // NotifySubscription newObject = new NotifySubscription(); + // CopyObject.Copy(dbObject, newObject); - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.NotifySubscription.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); - return newObject; - } + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.NotifySubscription.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); + // return newObject; + // } //////////////////////////////////////////////////////////////////////////////////////////////// // GET diff --git a/server/AyaNova/biz/PMBiz.cs b/server/AyaNova/biz/PMBiz.cs index 8921254a..fdfcb210 100644 --- a/server/AyaNova/biz/PMBiz.cs +++ b/server/AyaNova/biz/PMBiz.cs @@ -110,43 +110,43 @@ namespace AyaNova.Biz - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // - internal async Task DuplicateAsync(PM dbObject) - { - await Task.CompletedTask; - throw new System.NotImplementedException("STUB: WORKORDER DUPLICATE"); - // PM outObj = new PM(); - // CopyObject.Copy(dbObject, outObj, "Wiki"); - // // outObj.Name = Util.StringUtil.NameUniquify(outObj.Name, 255); - // //generate unique name - // string newUniqueName = string.Empty; - // bool NotUnique = true; - // long l = 1; - // do - // { - // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); - // NotUnique = await ct.PM.AnyAsync(z => z.Name == newUniqueName); - // } while (NotUnique); + // internal async Task DuplicateAsync(PM dbObject) + // { + // await Task.CompletedTask; + // throw new System.NotImplementedException("STUB: WORKORDER DUPLICATE"); + // // PM outObj = new PM(); + // // CopyObject.Copy(dbObject, outObj, "Wiki"); + // // // outObj.Name = Util.StringUtil.NameUniquify(outObj.Name, 255); + // // //generate unique name + // // string newUniqueName = string.Empty; + // // bool NotUnique = true; + // // long l = 1; + // // do + // // { + // // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); + // // NotUnique = await ct.PM.AnyAsync(z => z.Name == newUniqueName); + // // } while (NotUnique); - // outObj.Name = newUniqueName; + // // outObj.Name = newUniqueName; - // outObj.Id = 0; - // outObj.Concurrency = 0; + // // outObj.Id = 0; + // // outObj.Concurrency = 0; - // await ct.PM.AddAsync(outObj); - // await ct.SaveChangesAsync(); + // // await ct.PM.AddAsync(outObj); + // // await ct.SaveChangesAsync(); - // //Handle child and associated items: - // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct); - // await SearchIndexAsync(outObj, true); - // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null); - // return outObj; + // // //Handle child and associated items: + // // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct); + // // await SearchIndexAsync(outObj, true); + // // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null); + // // return outObj; - } + // } //################################################################################################################################################### //################################################################################################################################################### diff --git a/server/AyaNova/biz/PMTemplateBiz.cs b/server/AyaNova/biz/PMTemplateBiz.cs index 786a5eba..51529393 100644 --- a/server/AyaNova/biz/PMTemplateBiz.cs +++ b/server/AyaNova/biz/PMTemplateBiz.cs @@ -63,38 +63,38 @@ namespace AyaNova.Biz } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { - PMTemplate dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - PMTemplate newObject = new PMTemplate(); - 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.PMTemplate.AnyAsync(z => z.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.PMTemplate.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; - } + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { + // PMTemplate dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // PMTemplate newObject = new PMTemplate(); + // 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.PMTemplate.AnyAsync(z => z.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.PMTemplate.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 diff --git a/server/AyaNova/biz/PartAssemblyBiz.cs b/server/AyaNova/biz/PartAssemblyBiz.cs index 1664c1dd..3d62f00f 100644 --- a/server/AyaNova/biz/PartAssemblyBiz.cs +++ b/server/AyaNova/biz/PartAssemblyBiz.cs @@ -62,43 +62,43 @@ namespace AyaNova.Biz } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { - PartAssembly dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - PartAssembly newObject = new PartAssembly(); - CopyObject.Copy(dbObject, newObject, "Wiki,Id"); - string newUniqueName = string.Empty; - bool NotUnique = true; - long l = 1; - do - { - newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); - NotUnique = await ct.PartAssembly.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - foreach (PartAssemblyItem pai in newObject.Items) - { - pai.Id = 0; - pai.Concurrency = 0; - } - await ct.PartAssembly.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; - } + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { + // PartAssembly dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // PartAssembly newObject = new PartAssembly(); + // CopyObject.Copy(dbObject, newObject, "Wiki,Id"); + // string newUniqueName = string.Empty; + // bool NotUnique = true; + // long l = 1; + // do + // { + // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); + // NotUnique = await ct.PartAssembly.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // foreach (PartAssemblyItem pai in newObject.Items) + // { + // pai.Id = 0; + // pai.Concurrency = 0; + // } + // await ct.PartAssembly.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 diff --git a/server/AyaNova/biz/PartBiz.cs b/server/AyaNova/biz/PartBiz.cs index 2cb6a2d5..2acef4e3 100644 --- a/server/AyaNova/biz/PartBiz.cs +++ b/server/AyaNova/biz/PartBiz.cs @@ -60,38 +60,38 @@ namespace AyaNova.Biz } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task 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; - } + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task 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 diff --git a/server/AyaNova/biz/PartWarehouseBiz.cs b/server/AyaNova/biz/PartWarehouseBiz.cs index ecb0fee5..e198c699 100644 --- a/server/AyaNova/biz/PartWarehouseBiz.cs +++ b/server/AyaNova/biz/PartWarehouseBiz.cs @@ -60,38 +60,38 @@ namespace AyaNova.Biz } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { - var dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - PartWarehouse newObject = new PartWarehouse(); - 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.PartWarehouse.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.PartWarehouse.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; - } + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { + // var dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // PartWarehouse newObject = new PartWarehouse(); + // 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.PartWarehouse.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.PartWarehouse.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 diff --git a/server/AyaNova/biz/ProjectBiz.cs b/server/AyaNova/biz/ProjectBiz.cs index 78ce5d19..00dec913 100644 --- a/server/AyaNova/biz/ProjectBiz.cs +++ b/server/AyaNova/biz/ProjectBiz.cs @@ -60,38 +60,38 @@ namespace AyaNova.Biz } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { - var dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - Project newObject = new Project(); - 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.Project.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.Project.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; - } + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { + // var dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // Project newObject = new Project(); + // 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.Project.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.Project.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