This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
|||||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
"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_SEEDLEVEL": "small",
|
||||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||||
|
|||||||
@@ -151,40 +151,40 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate Quote
|
// /// Duplicate Quote
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Create a duplicate of this items id</param>
|
// /// <param name="id">Create a duplicate of this items id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateQuote([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateQuote([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
|
||||||
//Instantiate the business object handler
|
// //Instantiate the business object handler
|
||||||
QuoteBiz biz = QuoteBiz.GetBiz(ct, HttpContext);
|
// QuoteBiz biz = QuoteBiz.GetBiz(ct, HttpContext);
|
||||||
|
|
||||||
//If a user has change roles
|
// //If a user has change roles
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
|
|
||||||
var oSrc = await biz.GetAsync(id, false);
|
// var oSrc = await biz.GetAsync(id, false);
|
||||||
if (oSrc == null)
|
// if (oSrc == null)
|
||||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
// return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||||
|
|
||||||
//Create and validate
|
// //Create and validate
|
||||||
Quote o = await biz.DuplicateAsync(oSrc);
|
// Quote o = await biz.DuplicateAsync(oSrc);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(QuoteController.GetQuote), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(QuoteController.GetQuote), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -146,40 +146,40 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate QuoteTemplate
|
// /// Duplicate QuoteTemplate
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Create a duplicate of this items id</param>
|
// /// <param name="id">Create a duplicate of this items id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateQuoteTemplate([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateQuoteTemplate([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
|
||||||
//Instantiate the business object handler
|
// //Instantiate the business object handler
|
||||||
QuoteTemplateBiz biz = QuoteTemplateBiz.GetBiz(ct, HttpContext);
|
// QuoteTemplateBiz biz = QuoteTemplateBiz.GetBiz(ct, HttpContext);
|
||||||
|
|
||||||
//If a user has change roles
|
// //If a user has change roles
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
|
|
||||||
var oSrc = await biz.GetAsync(id, false);
|
// var oSrc = await biz.GetAsync(id, false);
|
||||||
if (oSrc == null)
|
// if (oSrc == null)
|
||||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
// return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||||
|
|
||||||
//Create and validate
|
// //Create and validate
|
||||||
QuoteTemplate o = await biz.DuplicateAsync(oSrc);
|
// QuoteTemplate o = await biz.DuplicateAsync(oSrc);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(QuoteTemplateController.GetQuoteTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(QuoteTemplateController.GetQuoteTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(ReminderController.GetReminder), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(ReminderController.GetReminder), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate Reminder
|
// /// Duplicate Reminder
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>Reminder</returns>
|
// /// <returns>Reminder</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateReminder([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateReminder([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
ReminderBiz biz = ReminderBiz.GetBiz(ct, HttpContext);
|
// ReminderBiz biz = ReminderBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
Reminder o = await biz.DuplicateAsync(id);
|
// Reminder o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(ReminderController.GetReminder), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(ReminderController.GetReminder), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Reminder
|
/// Get Reminder
|
||||||
|
|||||||
@@ -65,29 +65,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(ReportController.GetReport), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(ReportController.GetReport), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate Report
|
// /// Duplicate Report
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>Report</returns>
|
// /// <returns>Report</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateReport([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateReport([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
ReportBiz biz = ReportBiz.GetBiz(ct, HttpContext);
|
// ReportBiz biz = ReportBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
Report o = await biz.DuplicateAsync(id);
|
// Report o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(ReportController.GetReport), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(ReportController.GetReport), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Report
|
/// Get Report
|
||||||
|
|||||||
@@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(ReviewController.GetReview), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(ReviewController.GetReview), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate Review
|
// /// Duplicate Review
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>Review</returns>
|
// /// <returns>Review</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateReview([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateReview([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
ReviewBiz biz = ReviewBiz.GetBiz(ct, HttpContext);
|
// ReviewBiz biz = ReviewBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
Review o = await biz.DuplicateAsync(id);
|
// Review o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(ReviewController.GetReview), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(ReviewController.GetReview), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Review
|
/// Get Review
|
||||||
|
|||||||
@@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(ServiceRateController.GetServiceRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(ServiceRateController.GetServiceRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate ServiceRate
|
// /// Duplicate ServiceRate
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>ServiceRate</returns>
|
// /// <returns>ServiceRate</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateServiceRate([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateServiceRate([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
ServiceRateBiz biz = ServiceRateBiz.GetBiz(ct, HttpContext);
|
// ServiceRateBiz biz = ServiceRateBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
ServiceRate o = await biz.DuplicateAsync(id);
|
// ServiceRate o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(ServiceRateController.GetServiceRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(ServiceRateController.GetServiceRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get ServiceRate
|
/// Get ServiceRate
|
||||||
|
|||||||
@@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(TaskGroupController.GetTaskGroup), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(TaskGroupController.GetTaskGroup), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate TaskGroup
|
// /// Duplicate TaskGroup
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>TaskGroup</returns>
|
// /// <returns>TaskGroup</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateTaskGroup([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateTaskGroup([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
TaskGroupBiz biz = TaskGroupBiz.GetBiz(ct, HttpContext);
|
// TaskGroupBiz biz = TaskGroupBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
TaskGroup o = await biz.DuplicateAsync(id);
|
// TaskGroup o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(TaskGroupController.GetTaskGroup), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(TaskGroupController.GetTaskGroup), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get TaskGroup
|
/// Get TaskGroup
|
||||||
|
|||||||
@@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(TaxCodeController.GetTaxCode), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(TaxCodeController.GetTaxCode), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate TaxCode
|
// /// Duplicate TaxCode
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>TaxCode</returns>
|
// /// <returns>TaxCode</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateTaxCode([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateTaxCode([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
TaxCodeBiz biz = TaxCodeBiz.GetBiz(ct, HttpContext);
|
// TaxCodeBiz biz = TaxCodeBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
TaxCode o = await biz.DuplicateAsync(id);
|
// TaxCode o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(TaxCodeController.GetTaxCode), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(TaxCodeController.GetTaxCode), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get TaxCode
|
/// Get TaxCode
|
||||||
|
|||||||
@@ -59,29 +59,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(TravelRateController.GetTravelRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(TravelRateController.GetTravelRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate TravelRate
|
// /// Duplicate TravelRate
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>TravelRate</returns>
|
// /// <returns>TravelRate</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateTravelRate([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateTravelRate([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
TravelRateBiz biz = TravelRateBiz.GetBiz(ct, HttpContext);
|
// TravelRateBiz biz = TravelRateBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
TravelRate o = await biz.DuplicateAsync(id);
|
// TravelRate o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(TravelRateController.GetTravelRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(TravelRateController.GetTravelRate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get TravelRate
|
/// Get TravelRate
|
||||||
|
|||||||
@@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(UnitController.GetUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(UnitController.GetUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate Unit
|
// /// Duplicate Unit
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>Unit</returns>
|
// /// <returns>Unit</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateUnit([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateUnit([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
UnitBiz biz = UnitBiz.GetBiz(ct, HttpContext);
|
// UnitBiz biz = UnitBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
Unit o = await biz.DuplicateAsync(id);
|
// Unit o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(UnitController.GetUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(UnitController.GetUnit), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Unit
|
/// Get Unit
|
||||||
|
|||||||
@@ -58,29 +58,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(UnitModelController.GetUnitModel), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(UnitModelController.GetUnitModel), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate UnitModel
|
// /// Duplicate UnitModel
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>UnitModel</returns>
|
// /// <returns>UnitModel</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateUnitModel([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateUnitModel([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
UnitModelBiz biz = UnitModelBiz.GetBiz(ct, HttpContext);
|
// UnitModelBiz biz = UnitModelBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
UnitModel o = await biz.DuplicateAsync(id);
|
// UnitModel o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(UnitModelController.GetUnitModel), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(UnitModelController.GetUnitModel), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get UnitModel
|
/// Get UnitModel
|
||||||
|
|||||||
@@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(VendorController.GetVendor), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(VendorController.GetVendor), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate Vendor
|
// /// Duplicate Vendor
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>Vendor</returns>
|
// /// <returns>Vendor</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateVendor([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateVendor([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
VendorBiz biz = VendorBiz.GetBiz(ct, HttpContext);
|
// VendorBiz biz = VendorBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
Vendor o = await biz.DuplicateAsync(id);
|
// Vendor o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(VendorController.GetVendor), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(VendorController.GetVendor), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Vendor
|
/// Get Vendor
|
||||||
|
|||||||
@@ -66,29 +66,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(WidgetController.GetWidget), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(WidgetController.GetWidget), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate Widget
|
// /// Duplicate Widget
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>Widget</returns>
|
// /// <returns>Widget</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateWidget([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateWidget([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
|
// WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
Widget o = await biz.DuplicateAsync(id);
|
// Widget o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(WidgetController.GetWidget), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(WidgetController.GetWidget), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Widget
|
/// Get Widget
|
||||||
|
|||||||
@@ -81,29 +81,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate WorkOrder
|
// /// Duplicate WorkOrder
|
||||||
/// (Wiki and Attachments are not duplicated)
|
// /// (Wiki and Attachments are not duplicated)
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>WorkOrder</returns>
|
// /// <returns>WorkOrder</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateWorkOrder([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateWorkOrder([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
|
// WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
WorkOrder o = await biz.WorkOrderDuplicateAsync(id);
|
// WorkOrder o = await biz.WorkOrderDuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(WorkOrderController.GetWorkOrder), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(WorkOrderController.GetWorkOrder), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(WorkOrderItemPriorityController.GetWorkOrderItemPriority), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(WorkOrderItemPriorityController.GetWorkOrderItemPriority), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate WorkOrderItemPriority
|
// /// Duplicate WorkOrderItemPriority
|
||||||
///
|
// ///
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>WorkOrderItemPriority</returns>
|
// /// <returns>WorkOrderItemPriority</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateWorkOrderItemPriority([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateWorkOrderItemPriority([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
WorkOrderItemPriorityBiz biz = WorkOrderItemPriorityBiz.GetBiz(ct, HttpContext);
|
// WorkOrderItemPriorityBiz biz = WorkOrderItemPriorityBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
WorkOrderItemPriority o = await biz.DuplicateAsync(id);
|
// WorkOrderItemPriority o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(WorkOrderItemPriorityController.GetWorkOrderItemPriority), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(WorkOrderItemPriorityController.GetWorkOrderItemPriority), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get WorkOrderItemPriority
|
/// Get WorkOrderItemPriority
|
||||||
|
|||||||
@@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(WorkOrderItemStatusController.GetWorkOrderItemStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(WorkOrderItemStatusController.GetWorkOrderItemStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate WorkOrderItemStatus
|
// /// Duplicate WorkOrderItemStatus
|
||||||
///
|
// ///
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>WorkOrderItemStatus</returns>
|
// /// <returns>WorkOrderItemStatus</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateWorkOrderItemStatus([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateWorkOrderItemStatus([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
WorkOrderItemStatusBiz biz = WorkOrderItemStatusBiz.GetBiz(ct, HttpContext);
|
// WorkOrderItemStatusBiz biz = WorkOrderItemStatusBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
WorkOrderItemStatus o = await biz.DuplicateAsync(id);
|
// WorkOrderItemStatus o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(WorkOrderItemStatusController.GetWorkOrderItemStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(WorkOrderItemStatusController.GetWorkOrderItemStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get WorkOrderItemStatus
|
/// Get WorkOrderItemStatus
|
||||||
|
|||||||
@@ -60,29 +60,29 @@ namespace AyaNova.Api.Controllers
|
|||||||
return CreatedAtAction(nameof(WorkOrderStatusController.GetWorkOrderStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(WorkOrderStatusController.GetWorkOrderStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate WorkOrderStatus
|
// /// Duplicate WorkOrderStatus
|
||||||
///
|
// ///
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Source object id</param>
|
// /// <param name="id">Source object id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns>WorkOrderStatus</returns>
|
// /// <returns>WorkOrderStatus</returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateWorkOrderStatus([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateWorkOrderStatus([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
WorkOrderStatusBiz biz = WorkOrderStatusBiz.GetBiz(ct, HttpContext);
|
// WorkOrderStatusBiz biz = WorkOrderStatusBiz.GetBiz(ct, HttpContext);
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
WorkOrderStatus o = await biz.DuplicateAsync(id);
|
// WorkOrderStatus o = await biz.DuplicateAsync(id);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(WorkOrderStatusController.GetWorkOrderStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(WorkOrderStatusController.GetWorkOrderStatus), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get WorkOrderStatus
|
/// Get WorkOrderStatus
|
||||||
|
|||||||
@@ -146,40 +146,40 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Duplicate WorkOrderTemplate
|
// /// Duplicate WorkOrderTemplate
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Create a duplicate of this items id</param>
|
// /// <param name="id">Create a duplicate of this items id</param>
|
||||||
/// <param name="apiVersion">From route path</param>
|
// /// <param name="apiVersion">From route path</param>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
[HttpPost("duplicate/{id}")]
|
// [HttpPost("duplicate/{id}")]
|
||||||
public async Task<IActionResult> DuplicateWorkOrderTemplate([FromRoute] long id, ApiVersion apiVersion)
|
// public async Task<IActionResult> DuplicateWorkOrderTemplate([FromRoute] long id, ApiVersion apiVersion)
|
||||||
{
|
// {
|
||||||
if (!serverState.IsOpen)
|
// if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
|
||||||
//Instantiate the business object handler
|
// //Instantiate the business object handler
|
||||||
WorkOrderTemplateBiz biz = WorkOrderTemplateBiz.GetBiz(ct, HttpContext);
|
// WorkOrderTemplateBiz biz = WorkOrderTemplateBiz.GetBiz(ct, HttpContext);
|
||||||
|
|
||||||
//If a user has change roles
|
// //If a user has change roles
|
||||||
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
// if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
|
|
||||||
var oSrc = await biz.GetAsync(id, false);
|
// var oSrc = await biz.GetAsync(id, false);
|
||||||
if (oSrc == null)
|
// if (oSrc == null)
|
||||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
// return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||||
|
|
||||||
//Create and validate
|
// //Create and validate
|
||||||
WorkOrderTemplate o = await biz.DuplicateAsync(oSrc);
|
// WorkOrderTemplate o = await biz.DuplicateAsync(oSrc);
|
||||||
if (o == null)
|
// if (o == null)
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
else
|
// else
|
||||||
return CreatedAtAction(nameof(WorkOrderTemplateController.GetWorkOrderTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
// return CreatedAtAction(nameof(WorkOrderTemplateController.GetWorkOrderTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -115,43 +115,43 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
|
|
||||||
internal async Task<Quote> DuplicateAsync(Quote dbObject)
|
// internal async Task<Quote> 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);
|
// await Task.CompletedTask;
|
||||||
// NotUnique = await ct.Quote.AnyAsync(z => z.Name == newUniqueName);
|
// throw new System.NotImplementedException("STUB: WORKORDER DUPLICATE");
|
||||||
// } while (NotUnique);
|
// // 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.Id = 0;
|
||||||
// outObj.Concurrency = 0;
|
// // outObj.Concurrency = 0;
|
||||||
|
|
||||||
// await ct.Quote.AddAsync(outObj);
|
// // await ct.Quote.AddAsync(outObj);
|
||||||
// await ct.SaveChangesAsync();
|
// // await ct.SaveChangesAsync();
|
||||||
|
|
||||||
// //Handle child and associated items:
|
// // //Handle child and associated items:
|
||||||
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
// // await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
||||||
// await SearchIndexAsync(outObj, true);
|
// // await SearchIndexAsync(outObj, true);
|
||||||
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null);
|
// // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null);
|
||||||
// return outObj;
|
// // return outObj;
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
//###################################################################################################################################################
|
//###################################################################################################################################################
|
||||||
|
|||||||
@@ -94,42 +94,42 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
|
|
||||||
internal async Task<QuoteTemplate> DuplicateAsync(QuoteTemplate dbObject)
|
// internal async Task<QuoteTemplate> DuplicateAsync(QuoteTemplate dbObject)
|
||||||
{
|
// {
|
||||||
|
|
||||||
QuoteTemplate outObj = new QuoteTemplate();
|
// QuoteTemplate outObj = new QuoteTemplate();
|
||||||
CopyObject.Copy(dbObject, outObj, "Wiki");
|
// CopyObject.Copy(dbObject, outObj, "Wiki");
|
||||||
// outObj.Name = Util.StringUtil.NameUniquify(outObj.Name, 255);
|
// // outObj.Name = Util.StringUtil.NameUniquify(outObj.Name, 255);
|
||||||
//generate unique name
|
// //generate unique name
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.QuoteTemplate.AnyAsync(z => z.Name == newUniqueName);
|
// NotUnique = await ct.QuoteTemplate.AnyAsync(z => z.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
|
|
||||||
outObj.Name = newUniqueName;
|
// outObj.Name = newUniqueName;
|
||||||
|
|
||||||
|
|
||||||
outObj.Id = 0;
|
// outObj.Id = 0;
|
||||||
outObj.Concurrency = 0;
|
// outObj.Concurrency = 0;
|
||||||
|
|
||||||
await ct.QuoteTemplate.AddAsync(outObj);
|
// await ct.QuoteTemplate.AddAsync(outObj);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
|
|
||||||
//Handle child and associated items:
|
// //Handle child and associated items:
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(outObj, true);
|
// await SearchIndexAsync(outObj, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null);
|
||||||
return outObj;
|
// return outObj;
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
//###################################################################################################################################################
|
//###################################################################################################################################################
|
||||||
|
|||||||
@@ -60,38 +60,38 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<Reminder> DuplicateAsync(long id)
|
// internal async Task<Reminder> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
var newObject = new Reminder();
|
// var newObject = new Reminder();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
// CopyObject.Copy(dbObject, newObject, "Wiki");
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.Reminder.AnyAsync(m => m.Name == newUniqueName);
|
// NotUnique = await ct.Reminder.AnyAsync(m => m.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.Reminder.AddAsync(newObject);
|
// await ct.Reminder.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -58,37 +58,37 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<Report> DuplicateAsync(long id)
|
// internal async Task<Report> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
Report dbObject = await GetAsync(id, false);
|
// Report dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
Report newObject = new Report();
|
// Report newObject = new Report();
|
||||||
|
|
||||||
CopyObject.Copy(dbObject, newObject);
|
// CopyObject.Copy(dbObject, newObject);
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.Report.AnyAsync(z => z.Name == newUniqueName);
|
// NotUnique = await ct.Report.AnyAsync(z => z.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.Report.AddAsync(newObject);
|
// await ct.Report.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -60,38 +60,38 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<Review> DuplicateAsync(long id)
|
// internal async Task<Review> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
var newObject = new Review();
|
// var newObject = new Review();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
// CopyObject.Copy(dbObject, newObject, "Wiki");
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.Review.AnyAsync(m => m.Name == newUniqueName);
|
// NotUnique = await ct.Review.AnyAsync(m => m.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.Review.AddAsync(newObject);
|
// await ct.Review.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -60,38 +60,38 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<ServiceRate> DuplicateAsync(long id)
|
// internal async Task<ServiceRate> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
var newObject = new ServiceRate();
|
// var newObject = new ServiceRate();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
// CopyObject.Copy(dbObject, newObject, "Wiki");
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.ServiceRate.AnyAsync(m => m.Name == newUniqueName);
|
// NotUnique = await ct.ServiceRate.AnyAsync(m => m.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.ServiceRate.AddAsync(newObject);
|
// await ct.ServiceRate.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -62,42 +62,42 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<TaskGroup> DuplicateAsync(long id)
|
// internal async Task<TaskGroup> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
TaskGroup dbObject = await GetAsync(id, false);
|
// TaskGroup dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
TaskGroup newObject = new TaskGroup();
|
// TaskGroup newObject = new TaskGroup();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki,Id");
|
// CopyObject.Copy(dbObject, newObject, "Wiki,Id");
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.TaskGroup.AnyAsync(m => m.Name == newUniqueName);
|
// NotUnique = await ct.TaskGroup.AnyAsync(m => m.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
foreach (TaskGroupItem pai in newObject.Items)
|
// foreach (TaskGroupItem pai in newObject.Items)
|
||||||
{
|
// {
|
||||||
pai.Id = 0;
|
// pai.Id = 0;
|
||||||
pai.Concurrency = 0;
|
// pai.Concurrency = 0;
|
||||||
}
|
// }
|
||||||
await ct.TaskGroup.AddAsync(newObject);
|
// await ct.TaskGroup.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
|
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -60,38 +60,38 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<TaxCode> DuplicateAsync(long id)
|
// internal async Task<TaxCode> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
var newObject = new TaxCode();
|
// var newObject = new TaxCode();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
// CopyObject.Copy(dbObject, newObject, "Wiki");
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.TaxCode.AnyAsync(m => m.Name == newUniqueName);
|
// NotUnique = await ct.TaxCode.AnyAsync(m => m.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.TaxCode.AddAsync(newObject);
|
// await ct.TaxCode.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -60,38 +60,38 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<TravelRate> DuplicateAsync(long id)
|
// internal async Task<TravelRate> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
var newObject = new TravelRate();
|
// var newObject = new TravelRate();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
// CopyObject.Copy(dbObject, newObject, "Wiki");
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.TravelRate.AnyAsync(m => m.Name == newUniqueName);
|
// NotUnique = await ct.TravelRate.AnyAsync(m => m.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.TravelRate.AddAsync(newObject);
|
// await ct.TravelRate.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -60,38 +60,38 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<Unit> DuplicateAsync(long id)
|
// internal async Task<Unit> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
var newObject = new Unit();
|
// var newObject = new Unit();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
// CopyObject.Copy(dbObject, newObject, "Wiki");
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Serial, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Serial, l++, 255);
|
||||||
NotUnique = await ct.Unit.AnyAsync(z => z.Serial == newUniqueName);
|
// NotUnique = await ct.Unit.AnyAsync(z => z.Serial == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Serial = newUniqueName;
|
// newObject.Serial = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.Unit.AddAsync(newObject);
|
// await ct.Unit.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -60,38 +60,38 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<UnitModel> DuplicateAsync(long id)
|
// internal async Task<UnitModel> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
var newObject = new UnitModel();
|
// var newObject = new UnitModel();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
// CopyObject.Copy(dbObject, newObject, "Wiki");
|
||||||
string newUniqueModelNumber = string.Empty;
|
// string newUniqueModelNumber = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueModelNumber = Util.StringUtil.UniqueNameBuilder(dbObject.Number, l++, 255);
|
// newUniqueModelNumber = Util.StringUtil.UniqueNameBuilder(dbObject.Number, l++, 255);
|
||||||
NotUnique = await ct.UnitModel.AnyAsync(z => z.Number == newUniqueModelNumber);
|
// NotUnique = await ct.UnitModel.AnyAsync(z => z.Number == newUniqueModelNumber);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Number = newUniqueModelNumber;
|
// newObject.Number = newUniqueModelNumber;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.UnitModel.AddAsync(newObject);
|
// await ct.UnitModel.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -60,38 +60,38 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<Vendor> DuplicateAsync(long id)
|
// internal async Task<Vendor> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
var newObject = new Vendor();
|
// var newObject = new Vendor();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
// CopyObject.Copy(dbObject, newObject, "Wiki");
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.Vendor.AnyAsync(z => z.Name == newUniqueName);
|
// NotUnique = await ct.Vendor.AnyAsync(z => z.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.Vendor.AddAsync(newObject);
|
// await ct.Vendor.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -63,38 +63,38 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<Widget> DuplicateAsync(long id)
|
// internal async Task<Widget> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
var newObject = new Widget();
|
// var newObject = new Widget();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki,Serial");
|
// CopyObject.Copy(dbObject, newObject, "Wiki,Serial");
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.Widget.AnyAsync(z => z.Name == newUniqueName);
|
// NotUnique = await ct.Widget.AnyAsync(z => z.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.Widget.AddAsync(newObject);
|
// await ct.Widget.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// GET
|
// GET
|
||||||
|
|||||||
@@ -124,61 +124,61 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<WorkOrder> WorkOrderDuplicateAsync(long id)
|
// internal async Task<WorkOrder> WorkOrderDuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
WorkOrder dbObject = await WorkOrderGetAsync(id, false);
|
// WorkOrder dbObject = await WorkOrderGetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
WorkOrder newObject = new WorkOrder();
|
// WorkOrder newObject = new WorkOrder();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki, Serial, States");
|
// CopyObject.Copy(dbObject, newObject, "Wiki, Serial, States");
|
||||||
|
|
||||||
//walk the tree and reset all id's and concurrencies
|
// //walk the tree and reset all id's and concurrencies
|
||||||
//TOP
|
// //TOP
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
foreach (var o in newObject.Items)
|
// foreach (var o in newObject.Items)
|
||||||
{
|
// {
|
||||||
o.Id = 0;
|
// o.Id = 0;
|
||||||
o.Concurrency = 0;
|
// o.Concurrency = 0;
|
||||||
foreach (var v in o.Expenses)
|
// foreach (var v in o.Expenses)
|
||||||
{ v.Id = 0; v.Concurrency = 0; }
|
// { v.Id = 0; v.Concurrency = 0; }
|
||||||
foreach (var v in o.Labors)
|
// foreach (var v in o.Labors)
|
||||||
{ v.Id = 0; v.Concurrency = 0; }
|
// { v.Id = 0; v.Concurrency = 0; }
|
||||||
foreach (var v in o.Loans)
|
// foreach (var v in o.Loans)
|
||||||
{ v.Id = 0; v.Concurrency = 0; }
|
// { v.Id = 0; v.Concurrency = 0; }
|
||||||
foreach (var v in o.OutsideServices)
|
// foreach (var v in o.OutsideServices)
|
||||||
{ v.Id = 0; v.Concurrency = 0; }
|
// { v.Id = 0; v.Concurrency = 0; }
|
||||||
foreach (var v in o.PartRequests)
|
// foreach (var v in o.PartRequests)
|
||||||
{ v.Id = 0; v.Concurrency = 0; }
|
// { v.Id = 0; v.Concurrency = 0; }
|
||||||
foreach (var v in o.Parts)
|
// foreach (var v in o.Parts)
|
||||||
{ v.Id = 0; v.Concurrency = 0; }
|
// { v.Id = 0; v.Concurrency = 0; }
|
||||||
foreach (var v in o.ScheduledUsers)
|
// foreach (var v in o.ScheduledUsers)
|
||||||
{ v.Id = 0; v.Concurrency = 0; }
|
// { v.Id = 0; v.Concurrency = 0; }
|
||||||
foreach (var v in o.Tasks)
|
// foreach (var v in o.Tasks)
|
||||||
{ v.Id = 0; v.Concurrency = 0; }
|
// { v.Id = 0; v.Concurrency = 0; }
|
||||||
foreach (var v in o.Travels)
|
// foreach (var v in o.Travels)
|
||||||
{ v.Id = 0; v.Concurrency = 0; }
|
// { v.Id = 0; v.Concurrency = 0; }
|
||||||
foreach (var v in o.Units)
|
// foreach (var v in o.Units)
|
||||||
{ v.Id = 0; v.Concurrency = 0; }
|
// { v.Id = 0; v.Concurrency = 0; }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await ct.WorkOrder.AddAsync(newObject);
|
// await ct.WorkOrder.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await WorkOrderSearchIndexAsync(newObject, true);
|
// await WorkOrderSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// 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 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);
|
// await WorkOrderHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// GET
|
// GET
|
||||||
|
|||||||
@@ -50,36 +50,36 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<WorkOrderItemPriority> DuplicateAsync(long id)
|
// internal async Task<WorkOrderItemPriority> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
WorkOrderItemPriority newObject = new WorkOrderItemPriority();
|
// WorkOrderItemPriority newObject = new WorkOrderItemPriority();
|
||||||
CopyObject.Copy(dbObject, newObject);
|
// CopyObject.Copy(dbObject, newObject);
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.WorkOrderItemPriority.AnyAsync(m => m.Name == newUniqueName);
|
// NotUnique = await ct.WorkOrderItemPriority.AnyAsync(m => m.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.WorkOrderItemPriority.AddAsync(newObject);
|
// await ct.WorkOrderItemPriority.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -50,36 +50,36 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<WorkOrderItemStatus> DuplicateAsync(long id)
|
// internal async Task<WorkOrderItemStatus> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
WorkOrderItemStatus newObject = new WorkOrderItemStatus();
|
// WorkOrderItemStatus newObject = new WorkOrderItemStatus();
|
||||||
CopyObject.Copy(dbObject, newObject);
|
// CopyObject.Copy(dbObject, newObject);
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.WorkOrderItemStatus.AnyAsync(m => m.Name == newUniqueName);
|
// NotUnique = await ct.WorkOrderItemStatus.AnyAsync(m => m.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.WorkOrderItemStatus.AddAsync(newObject);
|
// await ct.WorkOrderItemStatus.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -50,36 +50,36 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
internal async Task<WorkOrderStatus> DuplicateAsync(long id)
|
// internal async Task<WorkOrderStatus> DuplicateAsync(long id)
|
||||||
{
|
// {
|
||||||
var dbObject = await GetAsync(id, false);
|
// var dbObject = await GetAsync(id, false);
|
||||||
if (dbObject == null)
|
// if (dbObject == null)
|
||||||
{
|
// {
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
WorkOrderStatus newObject = new WorkOrderStatus();
|
// WorkOrderStatus newObject = new WorkOrderStatus();
|
||||||
CopyObject.Copy(dbObject, newObject);
|
// CopyObject.Copy(dbObject, newObject);
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.WorkOrderStatus.AnyAsync(m => m.Name == newUniqueName);
|
// NotUnique = await ct.WorkOrderStatus.AnyAsync(m => m.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
await ct.WorkOrderStatus.AddAsync(newObject);
|
// await ct.WorkOrderStatus.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
return newObject;
|
// return newObject;
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
|
|||||||
@@ -96,43 +96,43 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//DUPLICATE
|
// //DUPLICATE
|
||||||
//
|
// //
|
||||||
|
|
||||||
internal async Task<WorkOrderTemplate> DuplicateAsync(WorkOrderTemplate dbObject)
|
// internal async Task<WorkOrderTemplate> DuplicateAsync(WorkOrderTemplate dbObject)
|
||||||
{
|
// {
|
||||||
|
|
||||||
WorkOrderTemplate newObject = new WorkOrderTemplate();
|
// WorkOrderTemplate newObject = new WorkOrderTemplate();
|
||||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
// CopyObject.Copy(dbObject, newObject, "Wiki");
|
||||||
// outObj.Name = Util.StringUtil.NameUniquify(outObj.Name, 255);
|
// // outObj.Name = Util.StringUtil.NameUniquify(outObj.Name, 255);
|
||||||
//generate unique name
|
// //generate unique name
|
||||||
string newUniqueName = string.Empty;
|
// string newUniqueName = string.Empty;
|
||||||
bool NotUnique = true;
|
// bool NotUnique = true;
|
||||||
long l = 1;
|
// long l = 1;
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||||
NotUnique = await ct.WorkOrderTemplate.AnyAsync(z => z.Name == newUniqueName);
|
// NotUnique = await ct.WorkOrderTemplate.AnyAsync(z => z.Name == newUniqueName);
|
||||||
} while (NotUnique);
|
// } while (NotUnique);
|
||||||
|
|
||||||
newObject.Name = newUniqueName;
|
// newObject.Name = newUniqueName;
|
||||||
|
|
||||||
|
|
||||||
newObject.Id = 0;
|
// newObject.Id = 0;
|
||||||
newObject.Concurrency = 0;
|
// newObject.Concurrency = 0;
|
||||||
|
|
||||||
await ct.WorkOrderTemplate.AddAsync(newObject);
|
// await ct.WorkOrderTemplate.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
// await ct.SaveChangesAsync();
|
||||||
|
|
||||||
//Handle child and associated items:
|
// //Handle child and associated items:
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndexAsync(newObject, true);
|
// await SearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
return newObject;
|
// return newObject;
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
//###################################################################################################################################################
|
//###################################################################################################################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user