SchemeList, Edit, Create, delete
This commit is contained in:
@@ -15,7 +15,7 @@ public interface IClassificationSchemeRepository : IRepository<long, Classificat
|
||||
/// </summary>
|
||||
/// <param name="worskhopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<ClassificationSchemePartialModel> ClassificationSchemePartialModel(long workshopId);
|
||||
Task<ClassificationSchemeListDto> GetClassificationSchemeList(long workshopId);
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -23,9 +23,16 @@ public interface IClassificationSchemeRepository : IRepository<long, Classificat
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<EditClassificationScheme> GetClassificationScheme(long id);
|
||||
Task<EditClassificationSchemeDto> GetClassificationScheme(long id);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات طر برای محاسبات
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<EditClassificationScheme> GetClassificationSchemeToCompute(long id);
|
||||
|
||||
/// <summary>
|
||||
/// متد محاسبه پایه سنوات برا افراد تک گروه
|
||||
/// </summary>
|
||||
@@ -39,4 +46,11 @@ public interface IClassificationSchemeRepository : IRepository<long, Classificat
|
||||
/// <returns></returns>
|
||||
Task<BaseYearDataViewModel> BaseYearComputeOneGroup(DateTime schemeStart, DateTime? schemeEnd,
|
||||
DateTime contractStart, DateTime contractEnd, string groupNo, long employeeId, long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// حذف طرح
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteClassificationScheme(long id);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace CompanyManagment.App.Contracts.ClassificationScheme;
|
||||
|
||||
public class CheckStatusToDeleteScheme
|
||||
{
|
||||
/// <summary>
|
||||
/// وضعیت طرح برای حذف
|
||||
/// </summary>
|
||||
public DeleteSchemeStatus DeleteSchemeStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// پیام سیستم
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
||||
public enum DeleteSchemeStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// مجاز
|
||||
/// </summary>
|
||||
Valid,
|
||||
/// <summary>
|
||||
/// مجاز باشرط تایید
|
||||
/// </summary>
|
||||
ConfirmationNeeded,
|
||||
|
||||
/// <summary>
|
||||
/// غیر مجاز
|
||||
/// </summary>
|
||||
NotValid,
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace CompanyManagment.App.Contracts.ClassificationScheme;
|
||||
/// <summary>
|
||||
/// پارشیال صفحه ایجاد طرح
|
||||
/// </summary>
|
||||
public class ClassificationSchemePartialModel
|
||||
public class ClassificationSchemeListDto
|
||||
{
|
||||
/// <summary>
|
||||
/// آیا طرح دارد
|
||||
@@ -20,5 +20,5 @@ public class ClassificationSchemePartialModel
|
||||
/// <summary>
|
||||
/// لیست طرح
|
||||
/// </summary>
|
||||
public List<EditClassificationScheme> ClassificationSchemesList { get; set; }
|
||||
public List<SchemeListDto> ClassificationSchemesList { get; set; }
|
||||
}
|
||||
@@ -9,11 +9,7 @@ namespace CompanyManagment.App.Contracts.ClassificationScheme;
|
||||
/// </summary>
|
||||
public class CreateClassificationScheme
|
||||
{
|
||||
/// <summary>
|
||||
/// تاریخ شمول طرح
|
||||
/// میلادی
|
||||
/// </summary>
|
||||
public DateTime IncludingDateGr { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ شمول طرح
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.ClassificationScheme;
|
||||
|
||||
public class CreateClassificationSchemeDto
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ شمول طرح
|
||||
/// شمسی
|
||||
/// </summary>
|
||||
public string IncludingDateFa { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ اجرای طرح
|
||||
/// شمسی
|
||||
/// </summary>
|
||||
public string ExecutionDateFa { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// نام کامل طراح
|
||||
/// </summary>
|
||||
public string DesignerFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره همراه طراح
|
||||
/// </summary>
|
||||
[RegularExpression("^[0-9]*$", ErrorMessage = "لطفا فقط عدد وارد کنید")]
|
||||
public string DesignerPhone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی کارگاه
|
||||
/// </summary>
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// نوع ضریب
|
||||
/// </summary>
|
||||
public TypeOfCoefficient TypeOfCoefficient { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.ClassificationScheme;
|
||||
|
||||
public class EditClassificationSchemeDto
|
||||
{
|
||||
/// <summary>
|
||||
/// آی دی طرح
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ شمول طرح
|
||||
/// شمسی
|
||||
/// </summary>
|
||||
public string IncludingDateFa { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ اجرای طرح
|
||||
/// شمسی
|
||||
/// </summary>
|
||||
public string ExecutionDateFa { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// نام کامل طراح
|
||||
/// </summary>
|
||||
public string DesignerFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره همراه طراح
|
||||
/// </summary>
|
||||
[RegularExpression("^[0-9]*$", ErrorMessage = "لطفا فقط عدد وارد کنید")]
|
||||
public string DesignerPhone { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// نوع ضریب
|
||||
/// </summary>
|
||||
public TypeOfCoefficient TypeOfCoefficient { get; set; }
|
||||
}
|
||||
@@ -17,28 +17,35 @@ public interface IClassificationSchemeApplication
|
||||
/// </summary>
|
||||
/// <param name="worskhopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<ClassificationSchemePartialModel> ClassificationSchemePartialModel(long workshopId);
|
||||
Task<ClassificationSchemeListDto> GetClassificationSchemeList(long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد طرح
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> CreateClassificationScheme(CreateClassificationScheme command);
|
||||
Task<OperationResult> CreateClassificationScheme(CreateClassificationSchemeDto command);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات طرح برای مودال ویرایش
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<EditClassificationScheme> GetClassificationScheme(long id);
|
||||
Task<EditClassificationSchemeDto> GetClassificationScheme(long id);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات طر برای محاسبات
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<EditClassificationScheme> GetClassificationSchemeToCompute(long id);
|
||||
|
||||
/// <summary>
|
||||
/// ویرایش طرح
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> EditClassificationScheme(EditClassificationScheme command);
|
||||
Task<OperationResult> EditClassificationScheme(EditClassificationSchemeDto command);
|
||||
|
||||
|
||||
|
||||
@@ -178,4 +185,18 @@ public interface IClassificationSchemeApplication
|
||||
Task<BaseYearDataViewModel> BaseYearComputeOneGroup(DateTime schemeStart, DateTime? schemeEnd,
|
||||
DateTime contractStart, DateTime contractEnd, string groupNo, long employeeId, long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// چک کردن امکان حذف طرح
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<CheckStatusToDeleteScheme> CheckToDeleteScheme(long id);
|
||||
|
||||
/// <summary>
|
||||
/// حذف طرح
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> DeleteScheme(long id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.ClassificationScheme;
|
||||
|
||||
public class SchemeListDto
|
||||
{
|
||||
/// <summary>
|
||||
/// آی دی طرح
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ شمول طرح
|
||||
/// شمسی
|
||||
/// </summary>
|
||||
public string IncludingDateFa { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ اجرای طرح
|
||||
/// شمسی
|
||||
/// </summary>
|
||||
public string ExecutionDateFa { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// نام کامل طراح
|
||||
/// </summary>
|
||||
public string DesignerFullName { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -29,12 +29,12 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
|
||||
_classificationEmployeeRepository = classificationEmployeeRepository;
|
||||
}
|
||||
|
||||
public Task<ClassificationSchemePartialModel> ClassificationSchemePartialModel(long workshopId)
|
||||
public Task<ClassificationSchemeListDto> GetClassificationSchemeList(long workshopId)
|
||||
{
|
||||
return _classificationSchemeRepository.ClassificationSchemePartialModel(workshopId);
|
||||
return _classificationSchemeRepository.GetClassificationSchemeList(workshopId);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> CreateClassificationScheme(CreateClassificationScheme command)
|
||||
public async Task<OperationResult> CreateClassificationScheme(CreateClassificationSchemeDto command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
|
||||
|
||||
#endregion
|
||||
//ایجاد طرح
|
||||
var create = new ClassificationScheme(includingDateGr, executionDateGr,
|
||||
var create = new Company.Domain.ClassificationSchemeAgg.ClassificationScheme(includingDateGr, executionDateGr,
|
||||
command.DesignerFullName, command.DesignerPhone, command.WorkshopId, command.TypeOfCoefficient);
|
||||
_classificationSchemeRepository.Create(create);
|
||||
await _classificationSchemeRepository.SaveChangesAsync();
|
||||
@@ -90,12 +90,18 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public Task<EditClassificationScheme> GetClassificationScheme(long id)
|
||||
public async Task<EditClassificationSchemeDto> GetClassificationScheme(long id)
|
||||
{
|
||||
return _classificationSchemeRepository.GetClassificationScheme(id);
|
||||
return await _classificationSchemeRepository.GetClassificationScheme(id);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> EditClassificationScheme(EditClassificationScheme command)
|
||||
|
||||
public Task<EditClassificationScheme> GetClassificationSchemeToCompute(long id)
|
||||
{
|
||||
return _classificationSchemeRepository.GetClassificationSchemeToCompute(id);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> EditClassificationScheme(EditClassificationSchemeDto command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
@@ -349,7 +355,7 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
|
||||
#endregion
|
||||
|
||||
|
||||
var scheme = _classificationSchemeRepository.GetClassificationScheme(command.SchemeId).GetAwaiter().GetResult();
|
||||
var scheme = _classificationSchemeRepository.GetClassificationSchemeToCompute(command.SchemeId).GetAwaiter().GetResult();
|
||||
|
||||
|
||||
var create = new ClassificationEmployee(scheme.WorkshopId, command.EmployeeId, command.SchemeId,
|
||||
@@ -388,7 +394,7 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
|
||||
if (command.Count < 1)
|
||||
return op.Failed("هیچ انتقالی ایجاد نشده است");
|
||||
var oldGroupsMemberize = await _classificationEmployeeRepository.GetEmployeeMemberizeData(command[0].EmployeeId);
|
||||
var scheme = await _classificationSchemeRepository.GetClassificationScheme(oldGroupsMemberize[0].SchemeId);
|
||||
var scheme = await _classificationSchemeRepository.GetClassificationSchemeToCompute(oldGroupsMemberize[0].SchemeId);
|
||||
var newStartDateList = new List<DateTime>();
|
||||
foreach (var item in command)
|
||||
{
|
||||
@@ -473,7 +479,7 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
|
||||
var op = new OperationResult();
|
||||
var zeroItem = command.First(x => x.Id == 0);
|
||||
var oldGroupsMemberize = await _classificationEmployeeRepository.GetEmployeeMemberizeData(zeroItem.EmployeeId);
|
||||
var scheme = await _classificationSchemeRepository.GetClassificationScheme(zeroItem.SchemeId);
|
||||
var scheme = await _classificationSchemeRepository.GetClassificationSchemeToCompute(zeroItem.SchemeId);
|
||||
command = command.Where(x=>x.Id != 0).ToList();
|
||||
var newStartDateList = new List<DateTime>();
|
||||
foreach (var item in command)
|
||||
@@ -556,4 +562,49 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
|
||||
return await _classificationSchemeRepository.BaseYearComputeOneGroup(schemeStart, schemeEnd, contractStart,
|
||||
contractEnd, groupNo, employeeId, workshopId);
|
||||
}
|
||||
|
||||
public async Task<CheckStatusToDeleteScheme> CheckToDeleteScheme(long id)
|
||||
{
|
||||
var op = new CheckStatusToDeleteScheme();
|
||||
var scheme = _classificationSchemeRepository.Get(id);
|
||||
if (scheme != null)
|
||||
{
|
||||
var employeeInfoList =await _classificationEmployeeRepository.GetEmployeeListData(id);
|
||||
var anyHasGroup = employeeInfoList.Any(x => x.HasGroup);
|
||||
if (employeeInfoList.Any() && anyHasGroup)
|
||||
{
|
||||
|
||||
op.DeleteSchemeStatus = DeleteSchemeStatus.ConfirmationNeeded;
|
||||
op.Message = "برای این طرح پرسنل افزوده شده است، آیا از حذف طرح اطمینان دارید";
|
||||
return op;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
op.DeleteSchemeStatus = DeleteSchemeStatus.Valid;
|
||||
op.Message = "مجاز برای حذف";
|
||||
return op;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
op.DeleteSchemeStatus = DeleteSchemeStatus.NotValid;
|
||||
op.Message = "یافت نشد";
|
||||
return op;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> DeleteScheme(long id)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var scheme = _classificationSchemeRepository.Get(id);
|
||||
|
||||
if (scheme != null)
|
||||
{
|
||||
await _classificationSchemeRepository.DeleteClassificationScheme(id);
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
return op.Failed("یافت نشد");
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ using PersianTools.Core;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class ClassificationSchemeRepository :RepositoryBase<long, ClassificationScheme>, IClassificationSchemeRepository
|
||||
public class ClassificationSchemeRepository :RepositoryBase<long, Company.Domain.ClassificationSchemeAgg.ClassificationScheme>, IClassificationSchemeRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
public ClassificationSchemeRepository(CompanyContext context) : base(context)
|
||||
@@ -21,37 +21,30 @@ public class ClassificationSchemeRepository :RepositoryBase<long, Classification
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<ClassificationSchemePartialModel> ClassificationSchemePartialModel(long workshopId)
|
||||
public async Task<ClassificationSchemeListDto> GetClassificationSchemeList(long workshopId)
|
||||
{
|
||||
var hasScheme =await _context.ClassificationSchemes.AnyAsync(x => x.WorkshopId == workshopId);
|
||||
if (!hasScheme)
|
||||
return new ClassificationSchemePartialModel()
|
||||
return new ClassificationSchemeListDto()
|
||||
{
|
||||
HasScheme = false,
|
||||
|
||||
};
|
||||
|
||||
var schemeList = _context.ClassificationSchemes.Where(x => x.WorkshopId == workshopId).Select(x =>
|
||||
new EditClassificationScheme()
|
||||
var schemeList =await _context.ClassificationSchemes.Where(x => x.WorkshopId == workshopId).Select(x =>
|
||||
new SchemeListDto()
|
||||
{
|
||||
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
IncludingDateGr = x.IncludingDateGr,
|
||||
ExecutionDateGr = x.ExecutionDateGr,
|
||||
EndSchemeDateGr = x.EndSchemeDateGr,
|
||||
IncludingDateFa = x.IncludingDateGr.ToFarsi(),
|
||||
ExecutionDateFa = x.ExecutionDateGr.ToFarsi(),
|
||||
DesignerFullName = x.DesignerFullName,
|
||||
DesignerPhone = x.DesignerPhone,
|
||||
TypeOfCoefficient = x.TypeOfCoefficient
|
||||
|
||||
}).ToListAsync();
|
||||
return new ClassificationSchemePartialModel()
|
||||
return new ClassificationSchemeListDto()
|
||||
{
|
||||
HasScheme = true,
|
||||
WorkshopId = workshopId,
|
||||
ClassificationSchemesList = schemeList.GetAwaiter().GetResult()
|
||||
ClassificationSchemesList = schemeList
|
||||
};
|
||||
|
||||
}
|
||||
@@ -61,15 +54,37 @@ public class ClassificationSchemeRepository :RepositoryBase<long, Classification
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Task<EditClassificationScheme> GetClassificationScheme(long id)
|
||||
public Task<EditClassificationSchemeDto> GetClassificationScheme(long id)
|
||||
{
|
||||
return _context.ClassificationSchemes.Select(x =>
|
||||
new EditClassificationSchemeDto()
|
||||
{
|
||||
|
||||
Id = x.id,
|
||||
IncludingDateFa = x.IncludingDateGr.ToFarsi(),
|
||||
ExecutionDateFa = x.ExecutionDateGr.ToFarsi(),
|
||||
DesignerFullName = x.DesignerFullName,
|
||||
DesignerPhone = x.DesignerPhone,
|
||||
TypeOfCoefficient = x.TypeOfCoefficient
|
||||
|
||||
}).FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات طر برای محاسبات
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Task<EditClassificationScheme> GetClassificationSchemeToCompute(long id)
|
||||
{
|
||||
return _context.ClassificationSchemes.Select(x =>
|
||||
new EditClassificationScheme()
|
||||
{
|
||||
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
IncludingDateGr = x.IncludingDateGr,
|
||||
ExecutionDateGr = x.ExecutionDateGr,
|
||||
EndSchemeDateGr = x.EndSchemeDateGr,
|
||||
IncludingDateFa = x.IncludingDateGr.ToFarsi(),
|
||||
@@ -527,6 +542,16 @@ public class ClassificationSchemeRepository :RepositoryBase<long, Classification
|
||||
return baseYearResult;
|
||||
}
|
||||
|
||||
public async Task DeleteClassificationScheme(long id)
|
||||
{
|
||||
var scheme = Get(id);
|
||||
if (scheme != null)
|
||||
{
|
||||
_context.Remove(scheme);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// متد کمکی پایه سنوات
|
||||
|
||||
@@ -14,17 +14,24 @@ public class ClassificationSchemeController : AdminBaseController
|
||||
private readonly IClassificationSchemeApplication _classificationSchemeApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
|
||||
|
||||
public ClassificationSchemeController(IClassificationSchemeApplication classificationSchemeApplication, IAuthHelper authHelper)
|
||||
{
|
||||
_classificationSchemeApplication = classificationSchemeApplication;
|
||||
_authHelper = authHelper;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// لیست طرح
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<List<GetEmployeeListViewModel>>> GetList()
|
||||
public async Task<ActionResult<ClassificationSchemeListDto>> GetList(long workshopId)
|
||||
{
|
||||
var scheme = _classificationSchemeApplication.ClassificationSchemePartialModel(workshopId).GetAwaiter().GetResult();
|
||||
scheme.WorkshopId = workshopId;
|
||||
var result =await _classificationSchemeApplication.GetClassificationSchemeList(workshopId);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -33,21 +40,57 @@ public class ClassificationSchemeController : AdminBaseController
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("Scheme")]
|
||||
public async Task<ActionResult<OperationResult>> CreateScheme([FromBody] CreateClassificationScheme command)
|
||||
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] EditClassificationScheme command)
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class ClassificationSchemeModel : PageModel
|
||||
{
|
||||
WorkshopId = workshopId;
|
||||
WorkshopName = workshopName;
|
||||
var scheme = _classificationSchemeApplication.ClassificationSchemePartialModel(workshopId).GetAwaiter().GetResult();
|
||||
var scheme = _classificationSchemeApplication.GetClassificationSchemeList(workshopId).GetAwaiter().GetResult();
|
||||
HasScheme = scheme.HasScheme;
|
||||
SchemeId = scheme.HasScheme ? scheme.ClassificationSchemesList.FirstOrDefault()!.Id : 0;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class ClassificationSchemeModel : PageModel
|
||||
public IActionResult OnGetSchemeTab(long workshopId)
|
||||
{
|
||||
//دریافت طرح
|
||||
var scheme = _classificationSchemeApplication.ClassificationSchemePartialModel(workshopId).GetAwaiter().GetResult();
|
||||
var scheme = _classificationSchemeApplication.GetClassificationSchemeList(workshopId).GetAwaiter().GetResult();
|
||||
scheme.WorkshopId = workshopId;
|
||||
|
||||
return Partial("_ClassificationPartials/ClassificationSchemeTab", scheme);
|
||||
@@ -85,11 +85,11 @@ public class ClassificationSchemeModel : PageModel
|
||||
/// ایجاد طرح
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<JsonResult> OnPostCreateScheme(CreateClassificationScheme command)
|
||||
{
|
||||
var result = await _classificationSchemeApplication.CreateClassificationScheme(command);
|
||||
return new JsonResult(result);
|
||||
}
|
||||
//public async Task<JsonResult> OnPostCreateScheme(CreateClassificationScheme command)
|
||||
//{
|
||||
// var result = await _classificationSchemeApplication.CreateClassificationScheme(command);
|
||||
// return new JsonResult(result);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// لود مودال ویرایش طرح
|
||||
@@ -107,11 +107,11 @@ public class ClassificationSchemeModel : PageModel
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<JsonResult> OnPostEditScheme(EditClassificationScheme command)
|
||||
{
|
||||
var result = _classificationSchemeApplication.EditClassificationScheme(command).GetAwaiter().GetResult();
|
||||
return new JsonResult(result);
|
||||
}
|
||||
//public async Task<JsonResult> OnPostEditScheme(EditClassificationScheme command)
|
||||
//{
|
||||
// var result = _classificationSchemeApplication.EditClassificationScheme(command).GetAwaiter().GetResult();
|
||||
// return new JsonResult(result);
|
||||
//}
|
||||
#endregion
|
||||
|
||||
//تب تعیین مشاغل
|
||||
@@ -592,7 +592,7 @@ public class ClassificationSchemeModel : PageModel
|
||||
/// <returns></returns>
|
||||
public IActionResult OnGetComputeTest(long schemeId, long employeeId, string year, string month)
|
||||
{
|
||||
var scheme = _classificationSchemeApplication.GetClassificationScheme(schemeId).GetAwaiter().GetResult();
|
||||
var scheme = _classificationSchemeApplication.GetClassificationSchemeToCompute(schemeId).GetAwaiter().GetResult();
|
||||
var typeOfCoefficient = scheme.TypeOfCoefficient;
|
||||
|
||||
var startDate = $"{year}/{month}/01";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@model CompanyManagment.App.Contracts.ClassificationScheme.ClassificationSchemePartialModel
|
||||
@model CompanyManagment.App.Contracts.ClassificationScheme.ClassificationSchemeListDto
|
||||
|
||||
@{
|
||||
int index = 1;
|
||||
|
||||
Reference in New Issue
Block a user