diff --git a/.vscode/launch.json b/.vscode/launch.json index fcc80a75..b77f3b95 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -53,7 +53,7 @@ "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", - "AYANOVA_SERVER_TEST_MODE": "true", + "AYANOVA_SERVER_TEST_MODE": "false", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\" diff --git a/server/AyaNova/Controllers/QuoteController.cs b/server/AyaNova/Controllers/QuoteController.cs index 2bc2c4a8..273c1b5d 100644 --- a/server/AyaNova/Controllers/QuoteController.cs +++ b/server/AyaNova/Controllers/QuoteController.cs @@ -151,40 +151,40 @@ namespace AyaNova.Api.Controllers } - /// - /// Duplicate Quote - /// - /// Create a duplicate of this items id - /// From route path - /// - [HttpPost("duplicate/{id}")] - public async Task DuplicateQuote([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // /// + // /// Duplicate Quote + // /// + // /// Create a duplicate of this items id + // /// From route path + // /// + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateQuote([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - //Instantiate the business object handler - QuoteBiz biz = QuoteBiz.GetBiz(ct, HttpContext); + // //Instantiate the business object handler + // QuoteBiz biz = QuoteBiz.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 - Quote o = await biz.DuplicateAsync(oSrc); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(QuoteController.GetQuote), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // //Create and validate + // Quote o = await biz.DuplicateAsync(oSrc); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(QuoteController.GetQuote), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // } diff --git a/server/AyaNova/Controllers/QuoteTemplateController.cs b/server/AyaNova/Controllers/QuoteTemplateController.cs index 455becd4..47d33b04 100644 --- a/server/AyaNova/Controllers/QuoteTemplateController.cs +++ b/server/AyaNova/Controllers/QuoteTemplateController.cs @@ -146,40 +146,40 @@ namespace AyaNova.Api.Controllers } - /// - /// Duplicate QuoteTemplate - /// - /// Create a duplicate of this items id - /// From route path - /// - [HttpPost("duplicate/{id}")] - public async Task DuplicateQuoteTemplate([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // /// + // /// Duplicate QuoteTemplate + // /// + // /// Create a duplicate of this items id + // /// From route path + // /// + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateQuoteTemplate([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - //Instantiate the business object handler - QuoteTemplateBiz biz = QuoteTemplateBiz.GetBiz(ct, HttpContext); + // //Instantiate the business object handler + // QuoteTemplateBiz biz = QuoteTemplateBiz.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 - QuoteTemplate o = await biz.DuplicateAsync(oSrc); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(QuoteTemplateController.GetQuoteTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // //Create and validate + // QuoteTemplate o = await biz.DuplicateAsync(oSrc); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(QuoteTemplateController.GetQuoteTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // } diff --git a/server/AyaNova/Controllers/ReminderController.cs b/server/AyaNova/Controllers/ReminderController.cs index 58c5174c..6e01602a 100644 --- a/server/AyaNova/Controllers/ReminderController.cs +++ b/server/AyaNova/Controllers/ReminderController.cs @@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(ReminderController.GetReminder), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate Reminder - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// Reminder - [HttpPost("duplicate/{id}")] - public async Task DuplicateReminder([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - ReminderBiz biz = ReminderBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - Reminder o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(ReminderController.GetReminder), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate Reminder + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// Reminder + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateReminder([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // ReminderBiz biz = ReminderBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // Reminder o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(ReminderController.GetReminder), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get Reminder diff --git a/server/AyaNova/Controllers/ReportController.cs b/server/AyaNova/Controllers/ReportController.cs index 89671315..718ac967 100644 --- a/server/AyaNova/Controllers/ReportController.cs +++ b/server/AyaNova/Controllers/ReportController.cs @@ -65,29 +65,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(ReportController.GetReport), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate Report - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// Report - [HttpPost("duplicate/{id}")] - public async Task DuplicateReport([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - ReportBiz biz = ReportBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - Report o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(ReportController.GetReport), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate Report + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// Report + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateReport([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // ReportBiz biz = ReportBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // Report o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(ReportController.GetReport), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get Report diff --git a/server/AyaNova/Controllers/ReviewController.cs b/server/AyaNova/Controllers/ReviewController.cs index 5ecee9cc..33753eed 100644 --- a/server/AyaNova/Controllers/ReviewController.cs +++ b/server/AyaNova/Controllers/ReviewController.cs @@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(ReviewController.GetReview), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate Review - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// Review - [HttpPost("duplicate/{id}")] - public async Task DuplicateReview([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - ReviewBiz biz = ReviewBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - Review o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(ReviewController.GetReview), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate Review + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// Review + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateReview([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // ReviewBiz biz = ReviewBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // Review o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(ReviewController.GetReview), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get Review diff --git a/server/AyaNova/Controllers/ServiceRateController.cs b/server/AyaNova/Controllers/ServiceRateController.cs index 6efdc594..2c8be775 100644 --- a/server/AyaNova/Controllers/ServiceRateController.cs +++ b/server/AyaNova/Controllers/ServiceRateController.cs @@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(ServiceRateController.GetServiceRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate ServiceRate - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// ServiceRate - [HttpPost("duplicate/{id}")] - public async Task DuplicateServiceRate([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - ServiceRateBiz biz = ServiceRateBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - ServiceRate o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(ServiceRateController.GetServiceRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate ServiceRate + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// ServiceRate + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateServiceRate([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // ServiceRateBiz biz = ServiceRateBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // ServiceRate o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(ServiceRateController.GetServiceRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get ServiceRate diff --git a/server/AyaNova/Controllers/TaskGroupController.cs b/server/AyaNova/Controllers/TaskGroupController.cs index ae3bda95..fead7235 100644 --- a/server/AyaNova/Controllers/TaskGroupController.cs +++ b/server/AyaNova/Controllers/TaskGroupController.cs @@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(TaskGroupController.GetTaskGroup), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate TaskGroup - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// TaskGroup - [HttpPost("duplicate/{id}")] - public async Task DuplicateTaskGroup([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - TaskGroupBiz biz = TaskGroupBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - TaskGroup o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(TaskGroupController.GetTaskGroup), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate TaskGroup + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// TaskGroup + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateTaskGroup([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // TaskGroupBiz biz = TaskGroupBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // TaskGroup o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(TaskGroupController.GetTaskGroup), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get TaskGroup diff --git a/server/AyaNova/Controllers/TaxCodeController.cs b/server/AyaNova/Controllers/TaxCodeController.cs index acf18800..3a1ae3d8 100644 --- a/server/AyaNova/Controllers/TaxCodeController.cs +++ b/server/AyaNova/Controllers/TaxCodeController.cs @@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(TaxCodeController.GetTaxCode), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate TaxCode - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// TaxCode - [HttpPost("duplicate/{id}")] - public async Task DuplicateTaxCode([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - TaxCodeBiz biz = TaxCodeBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - TaxCode o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(TaxCodeController.GetTaxCode), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate TaxCode + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// TaxCode + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateTaxCode([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // TaxCodeBiz biz = TaxCodeBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // TaxCode o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(TaxCodeController.GetTaxCode), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get TaxCode diff --git a/server/AyaNova/Controllers/TravelRateController.cs b/server/AyaNova/Controllers/TravelRateController.cs index a9a2c0d3..9d770ac8 100644 --- a/server/AyaNova/Controllers/TravelRateController.cs +++ b/server/AyaNova/Controllers/TravelRateController.cs @@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(TravelRateController.GetTravelRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate TravelRate - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// TravelRate - [HttpPost("duplicate/{id}")] - public async Task DuplicateTravelRate([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - TravelRateBiz biz = TravelRateBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - TravelRate o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(TravelRateController.GetTravelRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate TravelRate + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// TravelRate + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateTravelRate([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // TravelRateBiz biz = TravelRateBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // TravelRate o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(TravelRateController.GetTravelRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get TravelRate diff --git a/server/AyaNova/Controllers/UnitController.cs b/server/AyaNova/Controllers/UnitController.cs index a849f612..f118ba53 100644 --- a/server/AyaNova/Controllers/UnitController.cs +++ b/server/AyaNova/Controllers/UnitController.cs @@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(UnitController.GetUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate Unit - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// Unit - [HttpPost("duplicate/{id}")] - public async Task DuplicateUnit([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - UnitBiz biz = UnitBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - Unit o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(UnitController.GetUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate Unit + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// Unit + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateUnit([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // UnitBiz biz = UnitBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // Unit o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(UnitController.GetUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get Unit diff --git a/server/AyaNova/Controllers/UnitModelController.cs b/server/AyaNova/Controllers/UnitModelController.cs index b2fdbc22..52b73e56 100644 --- a/server/AyaNova/Controllers/UnitModelController.cs +++ b/server/AyaNova/Controllers/UnitModelController.cs @@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(UnitModelController.GetUnitModel), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate UnitModel - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// UnitModel - [HttpPost("duplicate/{id}")] - public async Task DuplicateUnitModel([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - UnitModelBiz biz = UnitModelBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - UnitModel o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(UnitModelController.GetUnitModel), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate UnitModel + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// UnitModel + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateUnitModel([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // UnitModelBiz biz = UnitModelBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // UnitModel o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(UnitModelController.GetUnitModel), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get UnitModel diff --git a/server/AyaNova/Controllers/VendorController.cs b/server/AyaNova/Controllers/VendorController.cs index c7cfcfe6..630fbd34 100644 --- a/server/AyaNova/Controllers/VendorController.cs +++ b/server/AyaNova/Controllers/VendorController.cs @@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(VendorController.GetVendor), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate Vendor - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// Vendor - [HttpPost("duplicate/{id}")] - public async Task DuplicateVendor([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - VendorBiz biz = VendorBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - Vendor o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(VendorController.GetVendor), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate Vendor + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// Vendor + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateVendor([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // VendorBiz biz = VendorBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // Vendor o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(VendorController.GetVendor), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get Vendor diff --git a/server/AyaNova/Controllers/WidgetController.cs b/server/AyaNova/Controllers/WidgetController.cs index 40a95170..1a9d4d97 100644 --- a/server/AyaNova/Controllers/WidgetController.cs +++ b/server/AyaNova/Controllers/WidgetController.cs @@ -66,29 +66,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(WidgetController.GetWidget), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate Widget - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// Widget - [HttpPost("duplicate/{id}")] - public async Task DuplicateWidget([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - Widget o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(WidgetController.GetWidget), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate Widget + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// Widget + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateWidget([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // Widget o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(WidgetController.GetWidget), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get Widget diff --git a/server/AyaNova/Controllers/WorkOrderController.cs b/server/AyaNova/Controllers/WorkOrderController.cs index 2421d605..a4a7798a 100644 --- a/server/AyaNova/Controllers/WorkOrderController.cs +++ b/server/AyaNova/Controllers/WorkOrderController.cs @@ -81,29 +81,29 @@ namespace AyaNova.Api.Controllers } - /// - /// Duplicate WorkOrder - /// (Wiki and Attachments are not duplicated) - /// - /// Source object id - /// From route path - /// WorkOrder - [HttpPost("duplicate/{id}")] - public async Task DuplicateWorkOrder([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - WorkOrder o = await biz.WorkOrderDuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(WorkOrderController.GetWorkOrder), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate WorkOrder + // /// (Wiki and Attachments are not duplicated) + // /// + // /// Source object id + // /// From route path + // /// WorkOrder + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateWorkOrder([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // WorkOrder o = await biz.WorkOrderDuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(WorkOrderController.GetWorkOrder), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// diff --git a/server/AyaNova/Controllers/WorkOrderItemPriorityController.cs b/server/AyaNova/Controllers/WorkOrderItemPriorityController.cs index be5de3d2..b1106279 100644 --- a/server/AyaNova/Controllers/WorkOrderItemPriorityController.cs +++ b/server/AyaNova/Controllers/WorkOrderItemPriorityController.cs @@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(WorkOrderItemPriorityController.GetWorkOrderItemPriority), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate WorkOrderItemPriority - /// - /// - /// Source object id - /// From route path - /// WorkOrderItemPriority - [HttpPost("duplicate/{id}")] - public async Task DuplicateWorkOrderItemPriority([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - WorkOrderItemPriorityBiz biz = WorkOrderItemPriorityBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - WorkOrderItemPriority o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(WorkOrderItemPriorityController.GetWorkOrderItemPriority), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate WorkOrderItemPriority + // /// + // /// + // /// Source object id + // /// From route path + // /// WorkOrderItemPriority + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateWorkOrderItemPriority([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // WorkOrderItemPriorityBiz biz = WorkOrderItemPriorityBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // WorkOrderItemPriority o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(WorkOrderItemPriorityController.GetWorkOrderItemPriority), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get WorkOrderItemPriority diff --git a/server/AyaNova/Controllers/WorkOrderItemStatusController.cs b/server/AyaNova/Controllers/WorkOrderItemStatusController.cs index 7ddc406a..136049b8 100644 --- a/server/AyaNova/Controllers/WorkOrderItemStatusController.cs +++ b/server/AyaNova/Controllers/WorkOrderItemStatusController.cs @@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(WorkOrderItemStatusController.GetWorkOrderItemStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate WorkOrderItemStatus - /// - /// - /// Source object id - /// From route path - /// WorkOrderItemStatus - [HttpPost("duplicate/{id}")] - public async Task DuplicateWorkOrderItemStatus([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - WorkOrderItemStatusBiz biz = WorkOrderItemStatusBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - WorkOrderItemStatus o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(WorkOrderItemStatusController.GetWorkOrderItemStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate WorkOrderItemStatus + // /// + // /// + // /// Source object id + // /// From route path + // /// WorkOrderItemStatus + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateWorkOrderItemStatus([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // WorkOrderItemStatusBiz biz = WorkOrderItemStatusBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // WorkOrderItemStatus o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(WorkOrderItemStatusController.GetWorkOrderItemStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get WorkOrderItemStatus diff --git a/server/AyaNova/Controllers/WorkOrderStatusController.cs b/server/AyaNova/Controllers/WorkOrderStatusController.cs index 93751968..76207074 100644 --- a/server/AyaNova/Controllers/WorkOrderStatusController.cs +++ b/server/AyaNova/Controllers/WorkOrderStatusController.cs @@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers return CreatedAtAction(nameof(WorkOrderStatusController.GetWorkOrderStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } - /// - /// Duplicate WorkOrderStatus - /// - /// - /// Source object id - /// From route path - /// WorkOrderStatus - [HttpPost("duplicate/{id}")] - public async Task DuplicateWorkOrderStatus([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - WorkOrderStatusBiz biz = WorkOrderStatusBiz.GetBiz(ct, HttpContext); - if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - return StatusCode(403, new ApiNotAuthorizedResponse()); - if (!ModelState.IsValid) - return BadRequest(new ApiErrorResponse(ModelState)); - WorkOrderStatus o = await biz.DuplicateAsync(id); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(WorkOrderStatusController.GetWorkOrderStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // /// + // /// Duplicate WorkOrderStatus + // /// + // /// + // /// Source object id + // /// From route path + // /// WorkOrderStatus + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateWorkOrderStatus([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // WorkOrderStatusBiz biz = WorkOrderStatusBiz.GetBiz(ct, HttpContext); + // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) + // return StatusCode(403, new ApiNotAuthorizedResponse()); + // if (!ModelState.IsValid) + // return BadRequest(new ApiErrorResponse(ModelState)); + // WorkOrderStatus o = await biz.DuplicateAsync(id); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(WorkOrderStatusController.GetWorkOrderStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // } /// /// Get WorkOrderStatus diff --git a/server/AyaNova/Controllers/WorkOrderTemplateController.cs b/server/AyaNova/Controllers/WorkOrderTemplateController.cs index b2d3139b..daef62b2 100644 --- a/server/AyaNova/Controllers/WorkOrderTemplateController.cs +++ b/server/AyaNova/Controllers/WorkOrderTemplateController.cs @@ -146,40 +146,40 @@ namespace AyaNova.Api.Controllers } - /// - /// Duplicate WorkOrderTemplate - /// - /// Create a duplicate of this items id - /// From route path - /// - [HttpPost("duplicate/{id}")] - public async Task DuplicateWorkOrderTemplate([FromRoute] long id, ApiVersion apiVersion) - { - if (!serverState.IsOpen) - return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + // /// + // /// Duplicate WorkOrderTemplate + // /// + // /// Create a duplicate of this items id + // /// From route path + // /// + // [HttpPost("duplicate/{id}")] + // public async Task DuplicateWorkOrderTemplate([FromRoute] long id, ApiVersion apiVersion) + // { + // if (!serverState.IsOpen) + // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); - //Instantiate the business object handler - WorkOrderTemplateBiz biz = WorkOrderTemplateBiz.GetBiz(ct, HttpContext); + // //Instantiate the business object handler + // WorkOrderTemplateBiz biz = WorkOrderTemplateBiz.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 - WorkOrderTemplate o = await biz.DuplicateAsync(oSrc); - if (o == null) - return BadRequest(new ApiErrorResponse(biz.Errors)); - else - return CreatedAtAction(nameof(WorkOrderTemplateController.GetWorkOrderTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + // //Create and validate + // WorkOrderTemplate o = await biz.DuplicateAsync(oSrc); + // if (o == null) + // return BadRequest(new ApiErrorResponse(biz.Errors)); + // else + // return CreatedAtAction(nameof(WorkOrderTemplateController.GetWorkOrderTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - } + // } diff --git a/server/AyaNova/biz/QuoteBiz.cs b/server/AyaNova/biz/QuoteBiz.cs index 4294d46d..cfd92b29 100644 --- a/server/AyaNova/biz/QuoteBiz.cs +++ b/server/AyaNova/biz/QuoteBiz.cs @@ -115,43 +115,43 @@ namespace AyaNova.Biz - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // - internal async Task DuplicateAsync(Quote dbObject) - { - await Task.CompletedTask; - throw new System.NotImplementedException("STUB: WORKORDER DUPLICATE"); - // Quote outObj = new Quote(); - // 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.Quote.AnyAsync(z => z.Name == newUniqueName); - // } while (NotUnique); + // internal async Task DuplicateAsync(Quote dbObject) + // { + // await Task.CompletedTask; + // throw new System.NotImplementedException("STUB: WORKORDER DUPLICATE"); + // // Quote outObj = new Quote(); + // // 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.Quote.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.Quote.AddAsync(outObj); - // await ct.SaveChangesAsync(); + // // await ct.Quote.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/QuoteTemplateBiz.cs b/server/AyaNova/biz/QuoteTemplateBiz.cs index 94c5425b..b3a6b9ca 100644 --- a/server/AyaNova/biz/QuoteTemplateBiz.cs +++ b/server/AyaNova/biz/QuoteTemplateBiz.cs @@ -94,42 +94,42 @@ namespace AyaNova.Biz - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // - internal async Task DuplicateAsync(QuoteTemplate dbObject) - { + // internal async Task DuplicateAsync(QuoteTemplate dbObject) + // { - QuoteTemplate outObj = new QuoteTemplate(); - 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.QuoteTemplate.AnyAsync(z => z.Name == newUniqueName); - } while (NotUnique); + // QuoteTemplate outObj = new QuoteTemplate(); + // 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.QuoteTemplate.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.QuoteTemplate.AddAsync(outObj); - await ct.SaveChangesAsync(); + // await ct.QuoteTemplate.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/ReminderBiz.cs b/server/AyaNova/biz/ReminderBiz.cs index 0cc8d514..bd944a5c 100644 --- a/server/AyaNova/biz/ReminderBiz.cs +++ b/server/AyaNova/biz/ReminderBiz.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 Reminder(); - 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.Reminder.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.Reminder.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 Reminder(); + // 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.Reminder.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.Reminder.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/ReportBiz.cs b/server/AyaNova/biz/ReportBiz.cs index bf6ea44d..c633816a 100644 --- a/server/AyaNova/biz/ReportBiz.cs +++ b/server/AyaNova/biz/ReportBiz.cs @@ -58,37 +58,37 @@ namespace AyaNova.Biz } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { - Report dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - Report newObject = new Report(); + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { + // Report dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // Report newObject = new Report(); - CopyObject.Copy(dbObject, newObject); - string newUniqueName = string.Empty; - bool NotUnique = true; - long l = 1; - do - { - newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); - NotUnique = await ct.Report.AnyAsync(z => z.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.Report.AddAsync(newObject); - await ct.SaveChangesAsync(); - await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); - await SearchIndexAsync(newObject, true); - return newObject; - } + // CopyObject.Copy(dbObject, newObject); + // string newUniqueName = string.Empty; + // bool NotUnique = true; + // long l = 1; + // do + // { + // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); + // NotUnique = await ct.Report.AnyAsync(z => z.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.Report.AddAsync(newObject); + // await ct.SaveChangesAsync(); + // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); + // await SearchIndexAsync(newObject, true); + // return newObject; + // } //////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/server/AyaNova/biz/ReviewBiz.cs b/server/AyaNova/biz/ReviewBiz.cs index edd5c501..e2fbe711 100644 --- a/server/AyaNova/biz/ReviewBiz.cs +++ b/server/AyaNova/biz/ReviewBiz.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 Review(); - 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.Review.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.Review.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 Review(); + // 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.Review.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.Review.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/ServiceRateBiz.cs b/server/AyaNova/biz/ServiceRateBiz.cs index 03a53f47..f0220121 100644 --- a/server/AyaNova/biz/ServiceRateBiz.cs +++ b/server/AyaNova/biz/ServiceRateBiz.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 ServiceRate(); - 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.ServiceRate.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.ServiceRate.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 ServiceRate(); + // 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.ServiceRate.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.ServiceRate.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/TaskGroupBiz.cs b/server/AyaNova/biz/TaskGroupBiz.cs index ec495359..10512d58 100644 --- a/server/AyaNova/biz/TaskGroupBiz.cs +++ b/server/AyaNova/biz/TaskGroupBiz.cs @@ -62,42 +62,42 @@ namespace AyaNova.Biz } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task DuplicateAsync(long id) - { - TaskGroup dbObject = await GetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - TaskGroup newObject = new TaskGroup(); - 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.TaskGroup.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - foreach (TaskGroupItem pai in newObject.Items) - { - pai.Id = 0; - pai.Concurrency = 0; - } - await ct.TaskGroup.AddAsync(newObject); - await ct.SaveChangesAsync(); - await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); - await SearchIndexAsync(newObject, true); + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task DuplicateAsync(long id) + // { + // TaskGroup dbObject = await GetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // TaskGroup newObject = new TaskGroup(); + // 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.TaskGroup.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // foreach (TaskGroupItem pai in newObject.Items) + // { + // pai.Id = 0; + // pai.Concurrency = 0; + // } + // await ct.TaskGroup.AddAsync(newObject); + // await ct.SaveChangesAsync(); + // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); + // await SearchIndexAsync(newObject, true); - return newObject; - } + // return newObject; + // } //////////////////////////////////////////////////////////////////////////////////////////////// //GET diff --git a/server/AyaNova/biz/TaxCodeBiz.cs b/server/AyaNova/biz/TaxCodeBiz.cs index a52f0b8f..eedeb6a0 100644 --- a/server/AyaNova/biz/TaxCodeBiz.cs +++ b/server/AyaNova/biz/TaxCodeBiz.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 TaxCode(); - 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.TaxCode.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.TaxCode.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 TaxCode(); + // 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.TaxCode.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.TaxCode.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/TravelRateBiz.cs b/server/AyaNova/biz/TravelRateBiz.cs index dabe9af1..60715993 100644 --- a/server/AyaNova/biz/TravelRateBiz.cs +++ b/server/AyaNova/biz/TravelRateBiz.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 TravelRate(); - 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.TravelRate.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.TravelRate.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 TravelRate(); + // 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.TravelRate.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.TravelRate.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/UnitBiz.cs b/server/AyaNova/biz/UnitBiz.cs index a946c91e..492ac6a7 100644 --- a/server/AyaNova/biz/UnitBiz.cs +++ b/server/AyaNova/biz/UnitBiz.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 Unit(); - CopyObject.Copy(dbObject, newObject, "Wiki"); - string newUniqueName = string.Empty; - bool NotUnique = true; - long l = 1; - do - { - newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Serial, l++, 255); - NotUnique = await ct.Unit.AnyAsync(z => z.Serial == newUniqueName); - } while (NotUnique); - newObject.Serial = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.Unit.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 Unit(); + // CopyObject.Copy(dbObject, newObject, "Wiki"); + // string newUniqueName = string.Empty; + // bool NotUnique = true; + // long l = 1; + // do + // { + // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Serial, l++, 255); + // NotUnique = await ct.Unit.AnyAsync(z => z.Serial == newUniqueName); + // } while (NotUnique); + // newObject.Serial = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.Unit.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/UnitModelBiz.cs b/server/AyaNova/biz/UnitModelBiz.cs index 36a6f66f..5295ad10 100644 --- a/server/AyaNova/biz/UnitModelBiz.cs +++ b/server/AyaNova/biz/UnitModelBiz.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 UnitModel(); - CopyObject.Copy(dbObject, newObject, "Wiki"); - string newUniqueModelNumber = string.Empty; - bool NotUnique = true; - long l = 1; - do - { - newUniqueModelNumber = Util.StringUtil.UniqueNameBuilder(dbObject.Number, l++, 255); - NotUnique = await ct.UnitModel.AnyAsync(z => z.Number == newUniqueModelNumber); - } while (NotUnique); - newObject.Number = newUniqueModelNumber; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.UnitModel.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 UnitModel(); + // CopyObject.Copy(dbObject, newObject, "Wiki"); + // string newUniqueModelNumber = string.Empty; + // bool NotUnique = true; + // long l = 1; + // do + // { + // newUniqueModelNumber = Util.StringUtil.UniqueNameBuilder(dbObject.Number, l++, 255); + // NotUnique = await ct.UnitModel.AnyAsync(z => z.Number == newUniqueModelNumber); + // } while (NotUnique); + // newObject.Number = newUniqueModelNumber; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.UnitModel.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/VendorBiz.cs b/server/AyaNova/biz/VendorBiz.cs index e29be245..4f32fb81 100644 --- a/server/AyaNova/biz/VendorBiz.cs +++ b/server/AyaNova/biz/VendorBiz.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 Vendor(); - 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.Vendor.AnyAsync(z => z.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.Vendor.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 Vendor(); + // 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.Vendor.AnyAsync(z => z.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.Vendor.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/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs index 1518d9b5..c8875c5c 100644 --- a/server/AyaNova/biz/WidgetBiz.cs +++ b/server/AyaNova/biz/WidgetBiz.cs @@ -63,38 +63,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 Widget(); - CopyObject.Copy(dbObject, newObject, "Wiki,Serial"); - string newUniqueName = string.Empty; - bool NotUnique = true; - long l = 1; - do - { - newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); - NotUnique = await ct.Widget.AnyAsync(z => z.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.Widget.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 Widget(); + // CopyObject.Copy(dbObject, newObject, "Wiki,Serial"); + // string newUniqueName = string.Empty; + // bool NotUnique = true; + // long l = 1; + // do + // { + // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); + // NotUnique = await ct.Widget.AnyAsync(z => z.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.Widget.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/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index 1c522cff..84fed279 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -124,61 +124,61 @@ namespace AyaNova.Biz } } - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // - internal async Task WorkOrderDuplicateAsync(long id) - { - WorkOrder dbObject = await WorkOrderGetAsync(id, false); - if (dbObject == null) - { - AddError(ApiErrorCode.NOT_FOUND, "id"); - return null; - } - WorkOrder newObject = new WorkOrder(); - CopyObject.Copy(dbObject, newObject, "Wiki, Serial, States"); + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // + // internal async Task WorkOrderDuplicateAsync(long id) + // { + // WorkOrder dbObject = await WorkOrderGetAsync(id, false); + // if (dbObject == null) + // { + // AddError(ApiErrorCode.NOT_FOUND, "id"); + // return null; + // } + // WorkOrder newObject = new WorkOrder(); + // CopyObject.Copy(dbObject, newObject, "Wiki, Serial, States"); - //walk the tree and reset all id's and concurrencies - //TOP - newObject.Id = 0; - newObject.Concurrency = 0; - foreach (var o in newObject.Items) - { - o.Id = 0; - o.Concurrency = 0; - foreach (var v in o.Expenses) - { v.Id = 0; v.Concurrency = 0; } - foreach (var v in o.Labors) - { v.Id = 0; v.Concurrency = 0; } - foreach (var v in o.Loans) - { v.Id = 0; v.Concurrency = 0; } - foreach (var v in o.OutsideServices) - { v.Id = 0; v.Concurrency = 0; } - foreach (var v in o.PartRequests) - { v.Id = 0; v.Concurrency = 0; } - foreach (var v in o.Parts) - { v.Id = 0; v.Concurrency = 0; } - foreach (var v in o.ScheduledUsers) - { v.Id = 0; v.Concurrency = 0; } - foreach (var v in o.Tasks) - { v.Id = 0; v.Concurrency = 0; } - foreach (var v in o.Travels) - { v.Id = 0; v.Concurrency = 0; } - foreach (var v in o.Units) - { v.Id = 0; v.Concurrency = 0; } - } + // //walk the tree and reset all id's and concurrencies + // //TOP + // newObject.Id = 0; + // newObject.Concurrency = 0; + // foreach (var o in newObject.Items) + // { + // o.Id = 0; + // o.Concurrency = 0; + // foreach (var v in o.Expenses) + // { v.Id = 0; v.Concurrency = 0; } + // foreach (var v in o.Labors) + // { v.Id = 0; v.Concurrency = 0; } + // foreach (var v in o.Loans) + // { v.Id = 0; v.Concurrency = 0; } + // foreach (var v in o.OutsideServices) + // { v.Id = 0; v.Concurrency = 0; } + // foreach (var v in o.PartRequests) + // { v.Id = 0; v.Concurrency = 0; } + // foreach (var v in o.Parts) + // { v.Id = 0; v.Concurrency = 0; } + // foreach (var v in o.ScheduledUsers) + // { v.Id = 0; v.Concurrency = 0; } + // foreach (var v in o.Tasks) + // { v.Id = 0; v.Concurrency = 0; } + // foreach (var v in o.Travels) + // { v.Id = 0; v.Concurrency = 0; } + // foreach (var v in o.Units) + // { v.Id = 0; v.Concurrency = 0; } + // } - await ct.WorkOrder.AddAsync(newObject); - await ct.SaveChangesAsync(); - await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); - await WorkOrderSearchIndexAsync(newObject, true); - await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); - await WorkOrderPopulateVizFields(newObject, false);//doing this here ahead of notification because notification may require the viz field lookup anyway and afaict no harm in it - await WorkOrderHandlePotentialNotificationEvent(AyaEvent.Created, newObject); - return newObject; - } + // await ct.WorkOrder.AddAsync(newObject); + // await ct.SaveChangesAsync(); + // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); + // await WorkOrderSearchIndexAsync(newObject, true); + // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + // await WorkOrderPopulateVizFields(newObject, false);//doing this here ahead of notification because notification may require the viz field lookup anyway and afaict no harm in it + // await WorkOrderHandlePotentialNotificationEvent(AyaEvent.Created, newObject); + // return newObject; + // } //////////////////////////////////////////////////////////////////////////////////////////////// // GET diff --git a/server/AyaNova/biz/WorkOrderItemPriorityBiz.cs b/server/AyaNova/biz/WorkOrderItemPriorityBiz.cs index 23033103..4730017f 100644 --- a/server/AyaNova/biz/WorkOrderItemPriorityBiz.cs +++ b/server/AyaNova/biz/WorkOrderItemPriorityBiz.cs @@ -50,36 +50,36 @@ 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; - } - WorkOrderItemPriority newObject = new WorkOrderItemPriority(); - CopyObject.Copy(dbObject, newObject); - string newUniqueName = string.Empty; - bool NotUnique = true; - long l = 1; - do - { - newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); - NotUnique = await ct.WorkOrderItemPriority.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.WorkOrderItemPriority.AddAsync(newObject); - await ct.SaveChangesAsync(); - await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); - await SearchIndexAsync(newObject, true); - 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; + // } + // WorkOrderItemPriority newObject = new WorkOrderItemPriority(); + // CopyObject.Copy(dbObject, newObject); + // string newUniqueName = string.Empty; + // bool NotUnique = true; + // long l = 1; + // do + // { + // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); + // NotUnique = await ct.WorkOrderItemPriority.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.WorkOrderItemPriority.AddAsync(newObject); + // await ct.SaveChangesAsync(); + // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); + // await SearchIndexAsync(newObject, true); + // return newObject; + // } //////////////////////////////////////////////////////////////////////////////////////////////// //GET diff --git a/server/AyaNova/biz/WorkOrderItemStatusBiz.cs b/server/AyaNova/biz/WorkOrderItemStatusBiz.cs index 84531c0f..d76510e8 100644 --- a/server/AyaNova/biz/WorkOrderItemStatusBiz.cs +++ b/server/AyaNova/biz/WorkOrderItemStatusBiz.cs @@ -50,36 +50,36 @@ 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; - } - WorkOrderItemStatus newObject = new WorkOrderItemStatus(); - CopyObject.Copy(dbObject, newObject); - string newUniqueName = string.Empty; - bool NotUnique = true; - long l = 1; - do - { - newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); - NotUnique = await ct.WorkOrderItemStatus.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.WorkOrderItemStatus.AddAsync(newObject); - await ct.SaveChangesAsync(); - await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); - await SearchIndexAsync(newObject, true); - 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; + // } + // WorkOrderItemStatus newObject = new WorkOrderItemStatus(); + // CopyObject.Copy(dbObject, newObject); + // string newUniqueName = string.Empty; + // bool NotUnique = true; + // long l = 1; + // do + // { + // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); + // NotUnique = await ct.WorkOrderItemStatus.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.WorkOrderItemStatus.AddAsync(newObject); + // await ct.SaveChangesAsync(); + // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); + // await SearchIndexAsync(newObject, true); + // return newObject; + // } //////////////////////////////////////////////////////////////////////////////////////////////// //GET diff --git a/server/AyaNova/biz/WorkOrderStatusBiz.cs b/server/AyaNova/biz/WorkOrderStatusBiz.cs index 7de7cd62..12aa1b58 100644 --- a/server/AyaNova/biz/WorkOrderStatusBiz.cs +++ b/server/AyaNova/biz/WorkOrderStatusBiz.cs @@ -50,36 +50,36 @@ 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; - } - WorkOrderStatus newObject = new WorkOrderStatus(); - CopyObject.Copy(dbObject, newObject); - string newUniqueName = string.Empty; - bool NotUnique = true; - long l = 1; - do - { - newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); - NotUnique = await ct.WorkOrderStatus.AnyAsync(m => m.Name == newUniqueName); - } while (NotUnique); - newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; - await ct.WorkOrderStatus.AddAsync(newObject); - await ct.SaveChangesAsync(); - await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); - await SearchIndexAsync(newObject, true); - 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; + // } + // WorkOrderStatus newObject = new WorkOrderStatus(); + // CopyObject.Copy(dbObject, newObject); + // string newUniqueName = string.Empty; + // bool NotUnique = true; + // long l = 1; + // do + // { + // newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255); + // NotUnique = await ct.WorkOrderStatus.AnyAsync(m => m.Name == newUniqueName); + // } while (NotUnique); + // newObject.Name = newUniqueName; + // newObject.Id = 0; + // newObject.Concurrency = 0; + // await ct.WorkOrderStatus.AddAsync(newObject); + // await ct.SaveChangesAsync(); + // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); + // await SearchIndexAsync(newObject, true); + // return newObject; + // } //////////////////////////////////////////////////////////////////////////////////////////////// //GET diff --git a/server/AyaNova/biz/WorkorderTemplateBiz.cs b/server/AyaNova/biz/WorkorderTemplateBiz.cs index 4881fd71..fa5685b9 100644 --- a/server/AyaNova/biz/WorkorderTemplateBiz.cs +++ b/server/AyaNova/biz/WorkorderTemplateBiz.cs @@ -96,43 +96,43 @@ namespace AyaNova.Biz - //////////////////////////////////////////////////////////////////////////////////////////////// - //DUPLICATE - // + // //////////////////////////////////////////////////////////////////////////////////////////////// + // //DUPLICATE + // // - internal async Task DuplicateAsync(WorkOrderTemplate dbObject) - { + // internal async Task DuplicateAsync(WorkOrderTemplate dbObject) + // { - WorkOrderTemplate newObject = new WorkOrderTemplate(); - CopyObject.Copy(dbObject, newObject, "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.WorkOrderTemplate.AnyAsync(z => z.Name == newUniqueName); - } while (NotUnique); + // WorkOrderTemplate newObject = new WorkOrderTemplate(); + // CopyObject.Copy(dbObject, newObject, "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.WorkOrderTemplate.AnyAsync(z => z.Name == newUniqueName); + // } while (NotUnique); - newObject.Name = newUniqueName; + // newObject.Name = newUniqueName; - newObject.Id = 0; - newObject.Concurrency = 0; + // newObject.Id = 0; + // newObject.Concurrency = 0; - await ct.WorkOrderTemplate.AddAsync(newObject); - await ct.SaveChangesAsync(); + // await ct.WorkOrderTemplate.AddAsync(newObject); + // await ct.SaveChangesAsync(); - //Handle child and associated items: - 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; + // //Handle child and associated items: + // 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; - } + // } //###################################################################################################################################################