141 lines
4.4 KiB
C#
141 lines
4.4 KiB
C#
using _0_Framework.Application;
|
||
using CompanyManagment.App.Contracts.ClassificationScheme;
|
||
using CompanyManagment.App.Contracts.Employee;
|
||
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||
using CompanyManagment.Application;
|
||
using Microsoft.AspNetCore.Http;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using ServiceHost.BaseControllers;
|
||
|
||
namespace ServiceHost.Areas.Admin.Controllers;
|
||
|
||
public class ClassificationSchemeController : AdminBaseController
|
||
{
|
||
private readonly IClassificationSchemeApplication _classificationSchemeApplication;
|
||
private readonly IAuthHelper _authHelper;
|
||
|
||
|
||
public ClassificationSchemeController(IClassificationSchemeApplication classificationSchemeApplication, IAuthHelper authHelper)
|
||
{
|
||
_classificationSchemeApplication = classificationSchemeApplication;
|
||
_authHelper = authHelper;
|
||
}
|
||
|
||
#region SchemeTab
|
||
|
||
/// <summary>
|
||
/// لیست طرح
|
||
/// </summary>
|
||
/// <param name="workshopId"></param>
|
||
/// <returns></returns>
|
||
[HttpGet]
|
||
public async Task<ActionResult<ClassificationSchemeListDto>> GetList(long workshopId)
|
||
{
|
||
var result = await _classificationSchemeApplication.GetClassificationSchemeList(workshopId);
|
||
return result;
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// ایجاد طرح
|
||
/// </summary>
|
||
/// <param name="command"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("Scheme")]
|
||
public async Task<ActionResult<OperationResult>> CreateScheme([FromBody] CreateClassificationSchemeDto command)
|
||
{
|
||
var result = await _classificationSchemeApplication.CreateClassificationScheme(command);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// دریافت اطلاعات طرح برای ویرایش
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("GetSchemeToEdit")]
|
||
public async Task<EditClassificationSchemeDto> GetSchemeToEdit(long id)
|
||
{
|
||
var result = await _classificationSchemeApplication.GetClassificationScheme(id);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// ویرایش طرح
|
||
/// </summary>
|
||
/// <param name="command"></param>
|
||
/// <returns></returns>
|
||
[HttpPut("Scheme")]
|
||
public async Task<ActionResult<OperationResult>> EditScheme([FromBody] EditClassificationSchemeDto command)
|
||
{
|
||
var result = await _classificationSchemeApplication.EditClassificationScheme(command);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// چگ کردن شرایط حذف طرح
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("CheckToDeleteScheme")]
|
||
public async Task<CheckStatusToDeleteScheme> CheckToDeleteScheme(long id)
|
||
{
|
||
var result = await _classificationSchemeApplication.CheckToDeleteScheme(id);
|
||
return result;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// حذف طرح
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete]
|
||
public async Task<ActionResult<OperationResult>> DeleteScheme(long id)
|
||
{
|
||
var result = await _classificationSchemeApplication.DeleteScheme(id);
|
||
return result;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region GroupsTab
|
||
/// <summary>
|
||
/// دریافت لیست گروه ها
|
||
/// </summary>
|
||
/// <param name="schemeId"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("GetGroupList")]
|
||
public async Task<List<GetGroupAndJobSchemeListDto>> GetGroupList(long schemeId)
|
||
{
|
||
var result = await _classificationSchemeApplication.GetGroupList(schemeId);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// دریافت لیست مشاغل گروه برای مودال افزودن و ویرایش
|
||
/// </summary>
|
||
/// <param name="groupId"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("GetCreateOrEditJobsData")]
|
||
public async Task<AddOrEditJobInGroupDto> GetCreateOrEditJobsData(long groupId)
|
||
{
|
||
var result = await _classificationSchemeApplication.GetCreateOrEditJobsData(groupId);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// چک میکند که آیا امکان حذف شغل از گروه وجود دارد
|
||
/// </summary>
|
||
/// <param name="jobId"></param>
|
||
/// <param name="groupId"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("CheckDeleteJobFromGroup")]
|
||
public async Task<ActionResult<OperationResult>> CheckDeleteJobFromGroup(long jobId, long groupId)
|
||
{
|
||
var result = await _classificationSchemeApplication.CheckIfEmployeeHasThisJob(jobId, groupId);
|
||
return result;
|
||
}
|
||
|
||
|
||
#endregion
|
||
} |