add Workshop settings and children
This commit is contained in:
@@ -4,5 +4,4 @@ public enum IsActive
|
||||
{
|
||||
True,
|
||||
False,
|
||||
|
||||
}
|
||||
@@ -11,7 +11,6 @@ public class CustomizeWorkshopSettings : EntityBase
|
||||
{
|
||||
private CustomizeWorkshopSettings()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public CustomizeWorkshopSettings(long workshopId,
|
||||
@@ -33,6 +32,7 @@ public class CustomizeWorkshopSettings : EntityBase
|
||||
WorkshopId = workshopId;
|
||||
CustomizeWorkshopSettingsShifts = customizeWorkshopSettingsShifts;
|
||||
LeavePermittedDays = leavePermittedDays;
|
||||
OverTimeThresholdMinute = 0;
|
||||
Currency = Currency.Rial;
|
||||
MaxMonthDays = MaxMonthDays.Default;
|
||||
FridayWork = FridayWork.Default;
|
||||
@@ -141,18 +141,21 @@ public class CustomizeWorkshopSettings : EntityBase
|
||||
|
||||
public long WorkshopId { get; private set; }
|
||||
public Workshop Workshop { get; set; }
|
||||
public ICollection<CustomizeWorkshopSettingsShift> CustomizeWorkshopSettingsShifts { get; set; }
|
||||
public TimeOnly EndTimeOffSet { get; private set; }
|
||||
public ICollection<CustomizeWorkshopGroupSettings> CustomizeWorkshopGroupSettingsCollection { get; set; }
|
||||
|
||||
public Currency Currency { get; set; }
|
||||
public int OverTimeThresholdMinute { get; set; }
|
||||
|
||||
|
||||
public void Edit(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay,
|
||||
public ICollection<CustomizeWorkshopGroupSettings> CustomizeWorkshopGroupSettingsCollection { get; set; }
|
||||
public ICollection<CustomizeWorkshopSettingsShift> CustomizeWorkshopSettingsShifts { get; set; }
|
||||
|
||||
public void Edit(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay,
|
||||
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
|
||||
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
|
||||
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
|
||||
ICollection<CustomizeWorkshopSettingsShift> customizeWorkshopSettingsShifts, FridayWork fridayWork, HolidayWork holidayWork,BonusesPaysInEndOfYear bonusesPaysInEndOfYear, int leavePermittedDays, BaseYearsPayInEndOfYear baseYearsPayInEndOfYear)
|
||||
ICollection<CustomizeWorkshopSettingsShift> customizeWorkshopSettingsShifts,
|
||||
FridayWork fridayWork, HolidayWork holidayWork,BonusesPaysInEndOfYear bonusesPaysInEndOfYear,
|
||||
int leavePermittedDays, BaseYearsPayInEndOfYear baseYearsPayInEndOfYear,int overTimeThresholdMinute)
|
||||
{
|
||||
FridayPay = fridayPay;
|
||||
OverTimePay = overTimePay;
|
||||
@@ -173,8 +176,7 @@ public class CustomizeWorkshopSettings : EntityBase
|
||||
BonusesPaysInEndOfMonth = bonusesPaysInEndOfYear;
|
||||
LeavePermittedDays = leavePermittedDays;
|
||||
BaseYearsPayInEndOfYear= baseYearsPayInEndOfYear;
|
||||
|
||||
|
||||
OverTimeThresholdMinute = overTimeThresholdMinute;
|
||||
}
|
||||
|
||||
//edits the shifts of workshop
|
||||
|
||||
47
Company.Domain/FineAgg/Fine.cs
Normal file
47
Company.Domain/FineAgg/Fine.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.FineAgg;
|
||||
|
||||
public class Fine:EntityBase
|
||||
{
|
||||
public Fine(long employeeId, long workshopId, string title, double amount,DateTime fineDate)
|
||||
{
|
||||
EmployeeId = employeeId;
|
||||
WorkshopId = workshopId;
|
||||
Title = title;
|
||||
Amount = amount;
|
||||
IsActive = IsActive.True;
|
||||
FineDate = fineDate;
|
||||
|
||||
}
|
||||
|
||||
public long EmployeeId { get; private set; }
|
||||
public long WorkshopId { get; private set; }
|
||||
public string Title { get; private set; }
|
||||
public double Amount { get; private set; }
|
||||
public IsActive IsActive { get; private set; }
|
||||
public DateTime FineDate { get; private set; }
|
||||
|
||||
public void DeActive()
|
||||
{
|
||||
IsActive = IsActive.False;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
IsActive = IsActive.True;
|
||||
}
|
||||
|
||||
public void Edit(long employeeId, long workshopId, string title, double amount,DateTime fineDate)
|
||||
{
|
||||
EmployeeId = employeeId;
|
||||
WorkshopId = workshopId;
|
||||
Title = title;
|
||||
Amount = amount;
|
||||
FineDate = fineDate;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
11
Company.Domain/FineAgg/IFineRepository.cs
Normal file
11
Company.Domain/FineAgg/IFineRepository.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.Fine;
|
||||
|
||||
namespace Company.Domain.FineAgg;
|
||||
|
||||
public interface IFineRepository : IRepository<long, Fine>
|
||||
{
|
||||
List<FineSearchViewModel> GetSearchList(FineSearchViewModel searchModel);
|
||||
EditFineViewModel GetDetails(long id);
|
||||
}
|
||||
@@ -42,7 +42,8 @@ public class LeftWork : EntityBase
|
||||
public string ComputeOptions { get; private set; }
|
||||
//نحوه محاسبه عیدی
|
||||
public string BonusesOptions { get; private set; }
|
||||
public Employee Employee { get; set; }
|
||||
public bool HasLeft => LeftWorkDate != new DateTime(2121, 3, 21);
|
||||
public Employee Employee { get; set; }
|
||||
public Workshop Workshop { get; set; }
|
||||
public void Edit(DateTime leftWorkDate, DateTime startWorkDate, long workshopId, long employeeId ,long jobId, bool includeStatus, bool addBonusesPay, bool addYearsPay, bool addLeavePay)
|
||||
{
|
||||
|
||||
119
Company.Domain/LoanAgg/Entities/Loan.cs
Normal file
119
Company.Domain/LoanAgg/Entities/Loan.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.LoanAgg.Entities;
|
||||
|
||||
public class Loan : EntityBase
|
||||
{
|
||||
private Loan(){}
|
||||
|
||||
public Loan(long employeeId, long workshopId, DateTime startDateTime,
|
||||
string count, double amount, double amountPerMonth,ICollection<LoanInstallment> loanInstallments, bool getRounded)
|
||||
{
|
||||
EmployeeId = employeeId;
|
||||
WorkshopId = workshopId;
|
||||
StartDateTime = startDateTime;
|
||||
Count = count;
|
||||
Amount = amount;
|
||||
AmountPerMonth = amountPerMonth;
|
||||
LoanInstallments = loanInstallments;
|
||||
GetRounded = getRounded;
|
||||
//for (int i = 0; i < Convert.ToInt32(count); i++)
|
||||
//{
|
||||
// LoanInstallment newInstallment = new(amountPerMonth, month.ToString("00"), year.ToString("0000"));
|
||||
// installment.Add(newInstallment);
|
||||
// if (month == 12)
|
||||
// {
|
||||
// year++;
|
||||
// month = 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// month++;
|
||||
// }
|
||||
|
||||
// LoanInstallments = installment;
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
public long EmployeeId { get; private set; }
|
||||
public long WorkshopId { get; private set; }
|
||||
public DateTime StartDateTime { get; private set; }
|
||||
public string StartDateMonth => StartDateTime.ToFarsiMonth();
|
||||
public string StartDateYear => StartDateTime.ToFarsiYear();
|
||||
public string Count { get; private set; }
|
||||
public double Amount { get; private set; }
|
||||
public double AmountPerMonth { get; private set; }
|
||||
public bool GetRounded { get; private set; }
|
||||
public ICollection<LoanInstallment> LoanInstallments { get; private set; }
|
||||
|
||||
public void DeActiveInstallment(string year, string month)
|
||||
{
|
||||
var installment = LoanInstallments.FirstOrDefault(x => x.Month == month && x.Year == year);
|
||||
|
||||
if (installment == null)
|
||||
return;
|
||||
|
||||
installment.DeActive();
|
||||
|
||||
var lastInstallment = LoanInstallments.OrderByDescending(x => Convert.ToInt32(x.Month)).ThenByDescending(x => Convert.ToInt32(x.Year)).FirstOrDefault();
|
||||
|
||||
if (lastInstallment == null)
|
||||
throw new InvalidDataException();
|
||||
|
||||
string newMonth;
|
||||
string newYear;
|
||||
|
||||
int lastMonth = Convert.ToInt32(lastInstallment.Month);
|
||||
int lastYear = Convert.ToInt32(lastInstallment.Year);
|
||||
|
||||
if (lastMonth == 12)
|
||||
{
|
||||
newYear = (lastYear + 1).ToString("0000");
|
||||
newMonth = (01).ToString("00");
|
||||
}
|
||||
else
|
||||
{
|
||||
newYear = lastYear.ToString("0000");
|
||||
newMonth = (lastMonth + 1).ToString("00");
|
||||
}
|
||||
|
||||
|
||||
LoanInstallment newInstallment = new LoanInstallment(installment.AmountForMonth, newMonth, newYear);
|
||||
LoanInstallments.Add(newInstallment);
|
||||
|
||||
}
|
||||
|
||||
public void Edit()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class LoanInstallment
|
||||
{
|
||||
public LoanInstallment(double amountForMonth, string month, string year)
|
||||
{
|
||||
AmountForMonth = amountForMonth;
|
||||
Month = month;
|
||||
Year = year;
|
||||
IsActive = IsActive.True;
|
||||
|
||||
}
|
||||
|
||||
public double AmountForMonth { get; private set; }
|
||||
public string Month { get; private set; }
|
||||
public string Year { get; private set; }
|
||||
public IsActive IsActive { get; private set; }
|
||||
|
||||
internal void DeActive()
|
||||
{
|
||||
IsActive = IsActive.False;
|
||||
}
|
||||
|
||||
}
|
||||
12
Company.Domain/LoanAgg/ILoanRepository.cs
Normal file
12
Company.Domain/LoanAgg/ILoanRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.LoanAgg.Entities;
|
||||
using CompanyManagment.App.Contracts.Loan;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Company.Domain.LoanAgg;
|
||||
|
||||
public interface ILoanRepository:IRepository<long,Loan>
|
||||
{
|
||||
List<LoanSearchViewModel> GetSearchList(LoanSearchViewModel searchViewModel);
|
||||
LoanViewModel GetDetails(long id);
|
||||
}
|
||||
11
Company.Domain/RewardAgg/IRewardRepository.cs
Normal file
11
Company.Domain/RewardAgg/IRewardRepository.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using _0_Framework_b.Domain;
|
||||
using CompanyManagment.App.Contracts.Reward;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Company.Domain.RewardAgg;
|
||||
|
||||
public interface IRewardRepository : IRepository<long, Reward>
|
||||
{
|
||||
List<RewardSearchViewModel> GetSearchList(RewardSearchViewModel searchViewModel);
|
||||
EditRewardViewModel GetDetails(long id);
|
||||
}
|
||||
60
Company.Domain/RewardAgg/Reward.cs
Normal file
60
Company.Domain/RewardAgg/Reward.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.RewardAgg;
|
||||
|
||||
public class Reward:EntityBase
|
||||
{
|
||||
private Reward(){}
|
||||
|
||||
public Reward(long employeeId, long workshopId, double amount, string description, long rewardedByAccountId)
|
||||
{
|
||||
EmployeeId = employeeId;
|
||||
WorkshopId = workshopId;
|
||||
Amount = amount;
|
||||
Description = description;
|
||||
RewardedByAccountId = rewardedByAccountId;
|
||||
IsActive = IsActive.True;
|
||||
}
|
||||
|
||||
public long EmployeeId { get; private set; }
|
||||
public long WorkshopId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ پاداش
|
||||
/// </summary>
|
||||
public double Amount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// توضیحات
|
||||
/// </summary>
|
||||
public string Description { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// شخصی که پاداش را داده است
|
||||
/// </summary>
|
||||
public long RewardedByAccountId { get; private set; }
|
||||
|
||||
|
||||
public IsActive IsActive { get; private set; }
|
||||
|
||||
public void Edit(double amount, string description, long rewardedByAccountId)
|
||||
{
|
||||
Amount = amount;
|
||||
Description = description;
|
||||
RewardedByAccountId = rewardedByAccountId;
|
||||
}
|
||||
|
||||
public void Active()
|
||||
{
|
||||
IsActive = IsActive.True;
|
||||
}
|
||||
|
||||
public void DeActive()
|
||||
{
|
||||
IsActive = IsActive.False;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
11
Company.Domain/SalaryAidAgg/ISalaryAidRepository.cs
Normal file
11
Company.Domain/SalaryAidAgg/ISalaryAidRepository.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.SalaryAid;
|
||||
|
||||
namespace Company.Domain.SalaryAidAgg;
|
||||
|
||||
public interface ISalaryAidRepository:IRepository<long,SalaryAid>
|
||||
{
|
||||
List<SalaryAidSearchViewModel> GetSearchList(SalaryAidSearchViewModel searchViewModel);
|
||||
EditSalaryAidViewModel GetDetails(long id);
|
||||
}
|
||||
29
Company.Domain/SalaryAidAgg/SalaryAid.cs
Normal file
29
Company.Domain/SalaryAidAgg/SalaryAid.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using _0_Framework.Domain;
|
||||
using Hangfire.Annotations;
|
||||
|
||||
namespace Company.Domain.SalaryAidAgg;
|
||||
|
||||
public class SalaryAid:EntityBase
|
||||
{
|
||||
private SalaryAid(){}
|
||||
|
||||
|
||||
public SalaryAid(long employeeId, long workshopId, double amount, DateTime salaryAidDateTime)
|
||||
{
|
||||
EmployeeId = employeeId;
|
||||
WorkshopId = workshopId;
|
||||
Amount = amount;
|
||||
SalaryAidDateTime = salaryAidDateTime;
|
||||
}
|
||||
|
||||
public long EmployeeId { get; private set; }
|
||||
public long WorkshopId { get; private set; }
|
||||
public double Amount { get; private set; }
|
||||
public DateTime SalaryAidDateTime { get; private set; }
|
||||
|
||||
public void Edit(double amount)
|
||||
{
|
||||
Amount = amount;
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,7 @@ public class EditCustomizeWorkshopSettings:CreateCustomizeWorkshopSettings
|
||||
#region Safa
|
||||
|
||||
public EditCameraAccount EditCameraAccount { get; set; }
|
||||
public int OverTimeThresholdMinute { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
14
CompanyManagment.App.Contracts/Fine/CreateFineViewModel.cs
Normal file
14
CompanyManagment.App.Contracts/Fine/CreateFineViewModel.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Fine;
|
||||
|
||||
public class CreateFineViewModel
|
||||
{
|
||||
public List<long> EmployeeIds { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public IsActive IsActive { get; set; }
|
||||
public string FineDate { get; set; }
|
||||
}
|
||||
7
CompanyManagment.App.Contracts/Fine/EditFineViewModel.cs
Normal file
7
CompanyManagment.App.Contracts/Fine/EditFineViewModel.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace CompanyManagment.App.Contracts.Fine;
|
||||
|
||||
public class EditFineViewModel:CreateFineViewModel
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
public long Id { get; set; }
|
||||
}
|
||||
22
CompanyManagment.App.Contracts/Fine/FineSearchViewModel.cs
Normal file
22
CompanyManagment.App.Contracts/Fine/FineSearchViewModel.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using _0_Framework.Application;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Fine;
|
||||
public class FineSearchViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string EmployeeFullName { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string PersonnelCode { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public IsActive IsActive { get; set; }
|
||||
public string FineDate { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
public int PageIndex { get; set; }
|
||||
}
|
||||
12
CompanyManagment.App.Contracts/Fine/IFineApplication.cs
Normal file
12
CompanyManagment.App.Contracts/Fine/IFineApplication.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Fine;
|
||||
|
||||
public interface IFineApplication
|
||||
{
|
||||
OperationResult Create(CreateFineViewModel command);
|
||||
OperationResult Edit (EditFineViewModel command);
|
||||
List<FineSearchViewModel> GetSearchList(FineSearchViewModel searchModel);
|
||||
EditFineViewModel GetDetails(long id);
|
||||
}
|
||||
13
CompanyManagment.App.Contracts/Loan/CreateLoanViewModel.cs
Normal file
13
CompanyManagment.App.Contracts/Loan/CreateLoanViewModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Loan;
|
||||
|
||||
public class CreateLoanViewModel
|
||||
{
|
||||
public List<long> EmployeeIds { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string StartDateTime { get; set; }
|
||||
public int Count { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public bool GetRounded { get; set; }
|
||||
}
|
||||
8
CompanyManagment.App.Contracts/Loan/EditLoanViewModel.cs
Normal file
8
CompanyManagment.App.Contracts/Loan/EditLoanViewModel.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Loan;
|
||||
|
||||
public class EditLoanViewModel:CreateLoanViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
}
|
||||
14
CompanyManagment.App.Contracts/Loan/ILoanApplication.cs
Normal file
14
CompanyManagment.App.Contracts/Loan/ILoanApplication.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using _0_Framework_b.Application;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Loan;
|
||||
|
||||
public interface ILoanApplication
|
||||
{
|
||||
List<LoanSearchViewModel> GetSearchList(LoanSearchViewModel searchViewModel);
|
||||
LoanViewModel GetDetails(long id);
|
||||
OperationResult Create(CreateLoanViewModel command);
|
||||
OperationResult Edit(EditLoanViewModel command);
|
||||
List<LoanInstallmentViewModel> CalculateLoanInstallment(string amount , int installmentCount,string loanStartDate,bool getRounded);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace CompanyManagment.App.Contracts.Loan;
|
||||
|
||||
public class LoanInstallmentViewModel
|
||||
{
|
||||
public string Year { get; set; }
|
||||
public string Month { get; set; }
|
||||
public string Amount { get; set; }
|
||||
}
|
||||
23
CompanyManagment.App.Contracts/Loan/LoanSearchViewModel.cs
Normal file
23
CompanyManagment.App.Contracts/Loan/LoanSearchViewModel.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Loan;
|
||||
|
||||
public class LoanSearchViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string EmployeeFullName { get; set; }
|
||||
public string PersonnelCode { get; set; }
|
||||
public string StartDateTime { get; set; }
|
||||
public string Count { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public string AmountPerMonth { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
public int PageIndex { get; set; }
|
||||
}
|
||||
18
CompanyManagment.App.Contracts/Loan/LoanViewModel.cs
Normal file
18
CompanyManagment.App.Contracts/Loan/LoanViewModel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Loan;
|
||||
public class LoanViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string StartDateTime { get; set; }
|
||||
public string Count { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public string AmountPerMonth { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Reward;
|
||||
|
||||
public class CreateRewardViewModel
|
||||
{
|
||||
public List<long> EmployeeIds { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ پاداش
|
||||
/// </summary>
|
||||
public double Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// توضیحات
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// شخصی که پاداش را داده است
|
||||
/// </summary>
|
||||
public long RewardedByAccountId { get; set; }
|
||||
|
||||
}
|
||||
11
CompanyManagment.App.Contracts/Reward/EditRewardViewModel.cs
Normal file
11
CompanyManagment.App.Contracts/Reward/EditRewardViewModel.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Reward;
|
||||
|
||||
public class EditRewardViewModel:CreateRewardViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public IsActive IsActive { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
}
|
||||
12
CompanyManagment.App.Contracts/Reward/IRewardApplication.cs
Normal file
12
CompanyManagment.App.Contracts/Reward/IRewardApplication.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Reward;
|
||||
|
||||
public interface IRewardApplication
|
||||
{
|
||||
OperationResult Create(CreateRewardViewModel command);
|
||||
OperationResult Edit(EditRewardViewModel command);
|
||||
List<RewardSearchViewModel> GetSearchList(RewardSearchViewModel searchViewModel);
|
||||
EditRewardViewModel GetDetails(long id);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Reward;
|
||||
public class RewardSearchViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string EmployeeFullName { get; set; }
|
||||
public string PersonnelCode { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public string Description { get; set; }
|
||||
public long RewardedByAccountId { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
public int PageIndex { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.SalaryAid;
|
||||
|
||||
public class CreateSalaryAidViewModel
|
||||
{
|
||||
public List<long> EmployeeIds { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public string SalaryDateTime { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace CompanyManagment.App.Contracts.SalaryAid;
|
||||
|
||||
public class EditSalaryAidViewModel:CreateSalaryAidViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using _0_Framework_b.Application;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.SalaryAid;
|
||||
|
||||
public interface ISalaryAidApplication
|
||||
{
|
||||
List<SalaryAidSearchViewModel> GetSearchList(SalaryAidSearchViewModel searchViewModel);
|
||||
EditSalaryAidViewModel GetDetails(long id);
|
||||
OperationResult Create(CreateSalaryAidViewModel command);
|
||||
OperationResult Edit(EditSalaryAidViewModel command);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.SalaryAid;
|
||||
public class SalaryAidSearchViewModel
|
||||
{
|
||||
public long Id;
|
||||
public long EmployeeId { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string EmployeeFullName { get; set; }
|
||||
public string PersonnelCode { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public string SalaryDateTime { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
public int PageIndex { get; set; }
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
}).ToList();
|
||||
|
||||
entity.Edit(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction,
|
||||
fineAbsenceDeduction, lateToWork, earlyExit, shifts, command.FridayWork, command.HolidayWork, command.BonusesPaysInEndOfMonth, command.LeavePermittedDays, command.BaseYearsPayInEndOfYear);
|
||||
fineAbsenceDeduction, lateToWork, earlyExit, shifts, command.FridayWork, command.HolidayWork, command.BonusesPaysInEndOfMonth, command.LeavePermittedDays, command.BaseYearsPayInEndOfYear,command.OverTimeThresholdMinute);
|
||||
|
||||
_customizeWorkshopSettingsRepository.SaveChanges();
|
||||
|
||||
|
||||
76
CompanyManagment.Application/FineApplication.cs
Normal file
76
CompanyManagment.Application/FineApplication.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.File1;
|
||||
using Company.Domain.FineAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Fine;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class FineApplication : IFineApplication
|
||||
{
|
||||
private readonly IFineRepository _fineRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
|
||||
public FineApplication(IFineRepository fineRepository, IEmployeeRepository employeeRepository, IWorkshopRepository workshopRepository)
|
||||
{
|
||||
_fineRepository = fineRepository;
|
||||
_employeeRepository = employeeRepository;
|
||||
_workshopRepository = workshopRepository;
|
||||
}
|
||||
|
||||
public List<FineSearchViewModel> GetSearchList(FineSearchViewModel searchModel)
|
||||
{
|
||||
return _fineRepository.GetSearchList(searchModel);
|
||||
}
|
||||
|
||||
public EditFineViewModel GetDetails(long id)
|
||||
{
|
||||
return _fineRepository.GetDetails(id);
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateFineViewModel command)
|
||||
{
|
||||
OperationResult op = new();
|
||||
|
||||
#region Validation
|
||||
|
||||
if (!_workshopRepository.Exists(x => x.id == command.WorkshopId))
|
||||
return op.Failed("خطای سیستمی");
|
||||
if (!_employeeRepository.Exists(x => command.EmployeeIds.Any(a=>a==x.id)))
|
||||
return op.Failed("خطای سیستمی");
|
||||
|
||||
#endregion
|
||||
DateTime date = command.FineDate.ToGeorgianDateTime();
|
||||
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
{
|
||||
Fine entity = new Fine(employeeId, command.WorkshopId, command.Title, command.Amount.MoneyToDouble(), date);
|
||||
_fineRepository.Create(entity);
|
||||
|
||||
}
|
||||
|
||||
_fineRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult Edit(EditFineViewModel command)
|
||||
{
|
||||
OperationResult op = new();
|
||||
var entity = _fineRepository.Get(command.Id);
|
||||
if (entity == null)
|
||||
return op.Failed("چنین جریمه ای یافت نشد");
|
||||
DateTime date = command.FineDate.ToGeorgianDateTime();
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
{
|
||||
entity.Edit(employeeId, command.WorkshopId, command.Title, command.Amount.MoneyToDouble(), date);
|
||||
}
|
||||
_fineRepository.SaveChanges();
|
||||
return op.Succcedded(entity.id);
|
||||
|
||||
}
|
||||
}
|
||||
124
CompanyManagment.Application/LoanApplication.cs
Normal file
124
CompanyManagment.Application/LoanApplication.cs
Normal file
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using _0_Framework_b.Application;
|
||||
using Company.Domain.LoanAgg;
|
||||
using Company.Domain.LoanAgg.Entities;
|
||||
using CompanyManagment.App.Contracts.Loan;
|
||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||
using Tools = _0_Framework.Application.Tools;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class LoanApplication : ILoanApplication
|
||||
{
|
||||
private readonly ILoanRepository _loanRepository;
|
||||
|
||||
public LoanApplication(ILoanRepository loanRepository)
|
||||
{
|
||||
_loanRepository = loanRepository;
|
||||
}
|
||||
|
||||
public List<LoanSearchViewModel> GetSearchList(LoanSearchViewModel searchModel)
|
||||
{
|
||||
return _loanRepository.GetSearchList(searchModel);
|
||||
}
|
||||
|
||||
public LoanViewModel GetDetails(long id)
|
||||
{
|
||||
return _loanRepository.GetDetails(id);
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateLoanViewModel command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var startDate = command.StartDateTime.ToGeorgianDateTime();
|
||||
var now = DateTime.Now;
|
||||
var amountD = Tools.MoneyToDouble(command.Amount);
|
||||
var installment =
|
||||
CalculateLoanInstallment(command.Amount, command.Count, command.StartDateTime, command.GetRounded);
|
||||
#region Validation
|
||||
|
||||
if (startDate.Date < now.Date)
|
||||
{
|
||||
return op.Failed("تاریخ شروع وام نمیتواند در گذشته باشد");
|
||||
}
|
||||
|
||||
if (amountD < 1000000)
|
||||
return op.Failed("حداقل مبلغ وام 1.000.000 ریال میباشد");
|
||||
#endregion
|
||||
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
{
|
||||
var entity = new Loan(employeeId, command.WorkshopId, startDate, command.Count.ToString(),
|
||||
Tools.MoneyToDouble(command.Amount),
|
||||
Tools.MoneyToDouble(installment.First().Amount),
|
||||
installment.Select(x =>
|
||||
new LoanInstallment(Tools.MoneyToDouble(x.Amount), x.Month, x.Year)).ToList()
|
||||
, command.GetRounded);
|
||||
_loanRepository.Create(entity);
|
||||
|
||||
}
|
||||
|
||||
_loanRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult Edit(EditLoanViewModel command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var entity = _loanRepository.Get(command.Id);
|
||||
entity.Edit();
|
||||
_loanRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public List<LoanInstallmentViewModel> CalculateLoanInstallment(string amount, int installmentCount, string loanStartDate,bool getRounded)
|
||||
{
|
||||
PersianCalendar pc = new PersianCalendar();
|
||||
double amountD = Tools.MoneyToDouble(amount);
|
||||
DateTime loanStartDateGe = loanStartDate.ToGeorgianDateTime();
|
||||
var dividedAmount = amountD / installmentCount;
|
||||
double moneyPerMonth = 0;
|
||||
|
||||
if (getRounded)
|
||||
moneyPerMonth = Math.Floor(dividedAmount / 1000) * 1000;
|
||||
else
|
||||
moneyPerMonth = Math.Floor(dividedAmount);
|
||||
|
||||
double lastLoan = amountD - (moneyPerMonth * (installmentCount - 1));
|
||||
|
||||
var installments = new List<LoanInstallmentViewModel>();
|
||||
int month = pc.GetMonth(loanStartDateGe) ;
|
||||
int year = pc.GetYear(loanStartDateGe);
|
||||
for (int i = 1; i < installmentCount; i++)
|
||||
{
|
||||
var installment = new LoanInstallmentViewModel()
|
||||
{
|
||||
Month = month.ToString("00"),
|
||||
Amount = moneyPerMonth.ToMoney(),
|
||||
Year = year.ToString("00")
|
||||
|
||||
};
|
||||
installments.Add(installment);
|
||||
loanStartDateGe = loanStartDateGe.AddMonths(1);
|
||||
month = pc.GetMonth(loanStartDateGe);
|
||||
year = pc.GetYear(loanStartDateGe);
|
||||
}
|
||||
loanStartDateGe = loanStartDateGe.AddMonths(1);
|
||||
month = pc.GetMonth(loanStartDateGe);
|
||||
year = pc.GetYear(loanStartDateGe);
|
||||
var lastInstallment = new LoanInstallmentViewModel()
|
||||
{
|
||||
Month = month.ToString("00"),
|
||||
Amount = moneyPerMonth.ToMoney(),
|
||||
Year = year.ToString("00")
|
||||
|
||||
};
|
||||
installments.Add(lastInstallment);
|
||||
return installments;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
53
CompanyManagment.Application/RewardApplication.cs
Normal file
53
CompanyManagment.Application/RewardApplication.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.RewardAgg;
|
||||
using CompanyManagment.App.Contracts.Reward;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class RewardApplication : IRewardApplication
|
||||
{
|
||||
private readonly IRewardRepository _rewardRepository;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
|
||||
public RewardApplication(IRewardRepository rewardRepository, IAuthHelper authHelper)
|
||||
{
|
||||
_rewardRepository = rewardRepository;
|
||||
_authHelper = authHelper;
|
||||
}
|
||||
|
||||
public List<RewardSearchViewModel> GetSearchList(RewardSearchViewModel searchModel)
|
||||
{
|
||||
return _rewardRepository.GetSearchList(searchModel);
|
||||
}
|
||||
|
||||
public EditRewardViewModel GetDetails(long id)
|
||||
{
|
||||
return _rewardRepository.GetDetails(id);
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateRewardViewModel command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
{
|
||||
var entity = new Reward(employeeId, command.WorkshopId, command.Amount, command.Description, command.RewardedByAccountId);
|
||||
_rewardRepository.Create(entity);
|
||||
}
|
||||
|
||||
_rewardRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult Edit(EditRewardViewModel command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var entity = _rewardRepository.Get(command.Id);
|
||||
if (entity == null)
|
||||
return op.Failed("چنین آیتمی وجود ندارد");
|
||||
entity.Edit(command.Amount,command.Description,command.RewardedByAccountId);
|
||||
_rewardRepository.SaveChanges();
|
||||
return op.Succcedded(entity.id);
|
||||
}
|
||||
}
|
||||
53
CompanyManagment.Application/SalaryAidApplication.cs
Normal file
53
CompanyManagment.Application/SalaryAidApplication.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Application;
|
||||
using Company.Domain.SalaryAidAgg;
|
||||
using CompanyManagment.App.Contracts.SalaryAid;
|
||||
using Tools = _0_Framework.Application.Tools;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class SalaryAidApplication:ISalaryAidApplication
|
||||
{
|
||||
private readonly ISalaryAidRepository _salaryAidRepository;
|
||||
|
||||
public SalaryAidApplication(ISalaryAidRepository salaryAidRepository)
|
||||
{
|
||||
_salaryAidRepository = salaryAidRepository;
|
||||
}
|
||||
|
||||
public List<SalaryAidSearchViewModel> GetSearchList(SalaryAidSearchViewModel searchViewModel)
|
||||
{
|
||||
return _salaryAidRepository.GetSearchList(searchViewModel);
|
||||
}
|
||||
|
||||
public EditSalaryAidViewModel GetDetails(long id)
|
||||
{
|
||||
return _salaryAidRepository.GetDetails(id);
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateSalaryAidViewModel command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var dateTime = command.SalaryDateTime.ToGeorgianDateTime();
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
{
|
||||
|
||||
var entity = new SalaryAid(employeeId, command.WorkshopId, Tools.MoneyToDouble(command.Amount), dateTime);
|
||||
_salaryAidRepository.Create(entity);
|
||||
|
||||
}
|
||||
_salaryAidRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult Edit(EditSalaryAidViewModel command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var entity = _salaryAidRepository.Get(command.Id);
|
||||
if (entity == null)
|
||||
return op.Failed("چنین مساعده ای وجود ندارد");
|
||||
entity.Edit(Tools.MoneyToDouble(command.Amount));
|
||||
_salaryAidRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ using Company.Domain.FileTiming;
|
||||
using Company.Domain.FileTitle;
|
||||
using Company.Domain.FinancialStatmentAgg;
|
||||
using Company.Domain.FinancialTransactionAgg;
|
||||
using Company.Domain.FineAgg;
|
||||
using Company.Domain.GroupPlanAgg;
|
||||
using Company.Domain.GroupPlanJobItemAgg;
|
||||
using Company.Domain.HolidayAgg;
|
||||
@@ -55,6 +56,7 @@ using Company.Domain.JobAgg;
|
||||
using Company.Domain.LeaveAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using Company.Domain.LeftWorkInsuranceAgg;
|
||||
using Company.Domain.LoanAgg.Entities;
|
||||
using Company.Domain.MandatoryHoursAgg;
|
||||
using Company.Domain.MasterPenaltyTitle;
|
||||
using Company.Domain.MasterPetition;
|
||||
@@ -70,11 +72,13 @@ using Company.Domain.PersonnelCodeAgg;
|
||||
using Company.Domain.Petition;
|
||||
using Company.Domain.ProceedingSession;
|
||||
using Company.Domain.RepresentativeAgg;
|
||||
using Company.Domain.RewardAgg;
|
||||
using Company.Domain.RollCallAgg;
|
||||
using Company.Domain.RollCallEmployeeAgg;
|
||||
using Company.Domain.RollCallEmployeeStatusAgg;
|
||||
using Company.Domain.RollCallPlanAgg;
|
||||
using Company.Domain.RollCallServiceAgg;
|
||||
using Company.Domain.SalaryAidAgg;
|
||||
using Company.Domain.SmsResultAgg;
|
||||
using Company.Domain.SubtitleAgg;
|
||||
using Company.Domain.TaxJobCategoryAgg;
|
||||
@@ -139,14 +143,20 @@ public class CompanyContext : DbContext
|
||||
|
||||
#region Mahan
|
||||
|
||||
|
||||
//-----------------------------RollCallWorkshopSettings-----------------------------
|
||||
public DbSet<CustomizeWorkshopSettings> CustomizeWorkshopSettings { get; set; }
|
||||
public DbSet<CustomizeWorkshopGroupSettings> CustomizeWorkshopGroupSettings { get; set; }
|
||||
public DbSet<CustomizeWorkshopEmployeeSettings> CustomizeWorkshopEmployeeSettings { get; set; }
|
||||
|
||||
#endregion
|
||||
public DbSet<CustomizeCheckout> CustomizeCheckouts { get; set; }
|
||||
public DbSet<Fine> Fines { get; set; }
|
||||
|
||||
public DbSet<Loan> Loans { get; set; }
|
||||
|
||||
public DbSet<SalaryAid> SalaryAids { get; set; }
|
||||
|
||||
public DbSet<Reward> Rewards { get; set; }
|
||||
#endregion
|
||||
public DbSet<CustomizeCheckout> CustomizeCheckouts { get; set; }
|
||||
public DbSet<TaxLeftWorkItem> TaxLeftWorkItems { get; set; }
|
||||
public DbSet<TaxLeftWorkCategory> TaxLeftWorkCategories { get; set; }
|
||||
public DbSet<TaxJobCategory> TaxJobCategories { get; set; }
|
||||
|
||||
22
CompanyManagment.EFCore/Mapping/FineMapping.cs
Normal file
22
CompanyManagment.EFCore/Mapping/FineMapping.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
||||
using Company.Domain.FineAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class FineMapping:IEntityTypeConfiguration<Fine>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Fine> builder)
|
||||
{
|
||||
builder.ToTable("Fines");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.IsActive).HasConversion(
|
||||
v => v.ToString("d"),
|
||||
v => (IsActive)Enum.Parse(typeof(IsActive), v)).HasMaxLength(1);
|
||||
builder.Property(x => x.Title).HasMaxLength(255);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,9 @@ public class LeftWorkMapping : IEntityTypeConfiguration<LeftWork>
|
||||
builder.Property(x => x.ComputeOptions).HasMaxLength(50);
|
||||
builder.Property(x => x.BonusesOptions).HasMaxLength(50);
|
||||
|
||||
builder.HasOne(x => x.Employee)
|
||||
builder.Ignore(x => x.HasLeft);
|
||||
|
||||
builder.HasOne(x => x.Employee)
|
||||
.WithMany(x => x.LeftWorks)
|
||||
.HasForeignKey(x => x.EmployeeId);
|
||||
builder.HasOne(x => x.Workshop)
|
||||
|
||||
35
CompanyManagment.EFCore/Mapping/LoanMapping.cs
Normal file
35
CompanyManagment.EFCore/Mapping/LoanMapping.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
||||
using Company.Domain.LoanAgg.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class LoanMapping : IEntityTypeConfiguration<Loan>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Loan> builder)
|
||||
{
|
||||
builder.ToTable("Loan");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.Count).HasMaxLength(3);
|
||||
|
||||
builder.OwnsMany(x => x.LoanInstallments, installment =>
|
||||
{
|
||||
installment.Property(x => x.Month).HasMaxLength(2);
|
||||
|
||||
installment.Property(x => x.Year).HasMaxLength(4);
|
||||
|
||||
installment.Property(x => x.IsActive).HasConversion(
|
||||
v => v.ToString("d"),
|
||||
v => (IsActive)Enum.Parse(typeof(IsActive), v)).HasMaxLength(1);
|
||||
|
||||
installment.WithOwner().HasForeignKey("LoanId");
|
||||
});
|
||||
|
||||
builder.Ignore(x => x.StartDateYear);
|
||||
builder.Ignore(x => x.StartDateMonth);
|
||||
}
|
||||
}
|
||||
23
CompanyManagment.EFCore/Mapping/RewardMapping.cs
Normal file
23
CompanyManagment.EFCore/Mapping/RewardMapping.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
||||
using Company.Domain.RewardAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class RewardMapping:IEntityTypeConfiguration<Reward>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Reward> builder)
|
||||
{
|
||||
builder.ToTable("Rewards");
|
||||
builder.HasKey(x => x.id);
|
||||
builder.Property(x=>x.IsActive).HasConversion(
|
||||
v => v.ToString("d"),
|
||||
v => (IsActive)Enum.Parse(typeof(IsActive), v)).HasMaxLength(1);
|
||||
builder.Property(x => x.Description).HasColumnType("ntext");
|
||||
|
||||
}
|
||||
}
|
||||
15
CompanyManagment.EFCore/Mapping/SalaryAidMapping.cs
Normal file
15
CompanyManagment.EFCore/Mapping/SalaryAidMapping.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Company.Domain.SalaryAidAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class SalaryAidMapping:IEntityTypeConfiguration<SalaryAid>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SalaryAid> builder)
|
||||
{
|
||||
builder.ToTable("SalaryAids");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addOverTimeThresholdToCustomizeWorkshopSettings : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "OverTimeThresholdMinute",
|
||||
table: "CustomizeWorkshopSettings",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OverTimeThresholdMinute",
|
||||
table: "CustomizeWorkshopSettings");
|
||||
}
|
||||
}
|
||||
}
|
||||
7406
CompanyManagment.EFCore/Migrations/20241023163014_RewardsTable.Designer.cs
generated
Normal file
7406
CompanyManagment.EFCore/Migrations/20241023163014_RewardsTable.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RewardsTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Rewards",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeId = table.Column<long>(type: "bigint", nullable: false),
|
||||
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Amount = table.Column<double>(type: "float", nullable: false),
|
||||
Description = table.Column<string>(type: "ntext", nullable: true),
|
||||
RewardedByAccountId = table.Column<long>(type: "bigint", nullable: false),
|
||||
IsActive = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Rewards", x => x.id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Rewards");
|
||||
}
|
||||
}
|
||||
}
|
||||
7434
CompanyManagment.EFCore/Migrations/20241023164629_SalaryAidTable.Designer.cs
generated
Normal file
7434
CompanyManagment.EFCore/Migrations/20241023164629_SalaryAidTable.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SalaryAidTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SalaryAids",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeId = table.Column<long>(type: "bigint", nullable: false),
|
||||
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Amount = table.Column<double>(type: "float", nullable: false),
|
||||
SalaryAidDateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SalaryAids", x => x.id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "SalaryAids");
|
||||
}
|
||||
}
|
||||
}
|
||||
7549
CompanyManagment.EFCore/Migrations/20241023170707_Loan And Fine Table.Designer.cs
generated
Normal file
7549
CompanyManagment.EFCore/Migrations/20241023170707_Loan And Fine Table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class LoanAndFineTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Fines",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeId = table.Column<long>(type: "bigint", nullable: false),
|
||||
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Title = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
||||
Amount = table.Column<double>(type: "float", nullable: false),
|
||||
IsActive = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false),
|
||||
FineDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Fines", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Loan",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeId = table.Column<long>(type: "bigint", nullable: false),
|
||||
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
|
||||
StartDateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
Count = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: true),
|
||||
Amount = table.Column<double>(type: "float", nullable: false),
|
||||
AmountPerMonth = table.Column<double>(type: "float", nullable: false),
|
||||
GetRounded = table.Column<bool>(type: "bit", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Loan", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LoanInstallment",
|
||||
columns: table => new
|
||||
{
|
||||
LoanId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
AmountForMonth = table.Column<double>(type: "float", nullable: false),
|
||||
Month = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true),
|
||||
Year = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: true),
|
||||
IsActive = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LoanInstallment", x => new { x.LoanId, x.Id });
|
||||
table.ForeignKey(
|
||||
name: "FK_LoanInstallment_Loan_LoanId",
|
||||
column: x => x.LoanId,
|
||||
principalTable: "Loan",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Fines");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LoanInstallment");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Loan");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1019,6 +1019,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<int>("MaxMonthDays")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OverTimeThresholdMinute")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("WorkshopId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
@@ -1985,6 +1988,43 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("FinancialTransactions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.FineAgg.Fine", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long>("EmployeeId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime>("FineDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("IsActive")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1)
|
||||
.HasColumnType("nvarchar(1)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("nvarchar(255)");
|
||||
|
||||
b.Property<long>("WorkshopId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("Fines", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.GroupPlanAgg.GroupPlan", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -2909,6 +2949,44 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("LeftWorkInsurances", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.LoanAgg.Entities.Loan", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<double>("AmountPerMonth")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("Count")
|
||||
.HasMaxLength(3)
|
||||
.HasColumnType("nvarchar(3)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long>("EmployeeId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("GetRounded")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("StartDateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long>("WorkshopId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("Loan", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.MandatoryHoursAgg.MandatoryHours", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -3580,6 +3658,42 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("Representative", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.RewardAgg.Reward", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("ntext");
|
||||
|
||||
b.Property<long>("EmployeeId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("IsActive")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1)
|
||||
.HasColumnType("nvarchar(1)");
|
||||
|
||||
b.Property<long>("RewardedByAccountId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("WorkshopId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("Rewards", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.RollCallAgg.RollCall", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -3746,6 +3860,34 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("RollCallServices", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.SalaryAidAgg.SalaryAid", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long>("EmployeeId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime>("SalaryAidDateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long>("WorkshopId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("SalaryAids", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.SmsResultAgg.SmsResult", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -6762,6 +6904,46 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("Workshop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.LoanAgg.Entities.Loan", b =>
|
||||
{
|
||||
b.OwnsMany("Company.Domain.LoanAgg.Entities.LoanInstallment", "LoanInstallments", b1 =>
|
||||
{
|
||||
b1.Property<long>("LoanId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<double>("AmountForMonth")
|
||||
.HasColumnType("float");
|
||||
|
||||
b1.Property<string>("IsActive")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1)
|
||||
.HasColumnType("nvarchar(1)");
|
||||
|
||||
b1.Property<string>("Month")
|
||||
.HasMaxLength(2)
|
||||
.HasColumnType("nvarchar(2)");
|
||||
|
||||
b1.Property<string>("Year")
|
||||
.HasMaxLength(4)
|
||||
.HasColumnType("nvarchar(4)");
|
||||
|
||||
b1.HasKey("LoanId", "Id");
|
||||
|
||||
b1.ToTable("LoanInstallment");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("LoanId");
|
||||
});
|
||||
|
||||
b.Navigation("LoanInstallments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.MasterPenaltyTitle.MasterPenaltyTitle", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.MasterPetition.MasterPetition", "MasterPetition")
|
||||
|
||||
54
CompanyManagment.EFCore/Repository/FineRepository.cs
Normal file
54
CompanyManagment.EFCore/Repository/FineRepository.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.FineAgg;
|
||||
using CompanyManagment.App.Contracts.Fine;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class FineRepository:RepositoryBase<long,Fine>, IFineRepository
|
||||
{
|
||||
private readonly CompanyContext _companyContext;
|
||||
|
||||
public FineRepository(CompanyContext companyContext):base(companyContext)
|
||||
{
|
||||
_companyContext = companyContext;
|
||||
}
|
||||
|
||||
public List<FineSearchViewModel> GetSearchList(FineSearchViewModel searchModel)
|
||||
{
|
||||
var query = _companyContext.Fines.Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
|
||||
if (searchModel.EmployeeId != 0)
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
|
||||
return query.Select(x => new FineSearchViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = _companyContext.Employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
|
||||
PersonnelCode = _companyContext.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(),
|
||||
Title = x.Title,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
FineDate = x.FineDate.ToFarsi(),
|
||||
IsActive = x.IsActive,
|
||||
CreationDate = x.CreationDate
|
||||
}).OrderByDescending(x => x.CreationDate).Skip(searchModel.PageIndex).Take(30).ToList();
|
||||
}
|
||||
|
||||
public EditFineViewModel GetDetails(long id)
|
||||
{
|
||||
return _companyContext.Fines.Select(x => new EditFineViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
Title = x.Title,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
IsActive = x.IsActive,
|
||||
FineDate = x.FineDate.ToFarsi(),
|
||||
}).FirstOrDefault(x => x.Id == id);
|
||||
}
|
||||
}
|
||||
54
CompanyManagment.EFCore/Repository/LoanRepository.cs
Normal file
54
CompanyManagment.EFCore/Repository/LoanRepository.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.LoanAgg;
|
||||
using Company.Domain.LoanAgg.Entities;
|
||||
using CompanyManagment.App.Contracts.Loan;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class LoanRepository:RepositoryBase<long,Loan>,ILoanRepository
|
||||
{
|
||||
private readonly CompanyContext _companyContext;
|
||||
|
||||
public LoanRepository(CompanyContext companyContext):base(companyContext)
|
||||
{
|
||||
_companyContext = companyContext;
|
||||
}
|
||||
|
||||
public LoanViewModel GetDetails(long id)
|
||||
{
|
||||
return _companyContext.Loans.Select(x => new LoanViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
StartDateTime = x.StartDateMonth,
|
||||
Count = x.Count,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
}).FirstOrDefault(x => x.Id == id);
|
||||
}
|
||||
|
||||
public List<LoanSearchViewModel> GetSearchList(LoanSearchViewModel searchViewModel)
|
||||
{
|
||||
var query = _companyContext.Loans.Where(x=> x.WorkshopId == searchViewModel.WorkshopId);
|
||||
|
||||
if (searchViewModel.EmployeeId != 0)
|
||||
query = query.Where(x => x.EmployeeId == searchViewModel.EmployeeId);
|
||||
|
||||
return query.Select(x => new LoanSearchViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = _companyContext.Employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
|
||||
PersonnelCode = _companyContext.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(),
|
||||
StartDateTime = x.StartDateMonth,
|
||||
Count = x.Count,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountPerMonth = x.AmountPerMonth.ToMoney(),
|
||||
CreationDate = x.CreationDate
|
||||
}).OrderByDescending(x => x.CreationDate).Skip(searchViewModel.PageIndex).Take(30).ToList();
|
||||
}
|
||||
}
|
||||
52
CompanyManagment.EFCore/Repository/RewardRepository.cs
Normal file
52
CompanyManagment.EFCore/Repository/RewardRepository.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.RewardAgg;
|
||||
using CompanyManagment.App.Contracts.Reward;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class RewardRepository:RepositoryBase<long,Reward>, IRewardRepository
|
||||
{
|
||||
private readonly CompanyContext _companyContext;
|
||||
public RewardRepository( CompanyContext companyContext) : base(companyContext)
|
||||
{
|
||||
_companyContext = companyContext;
|
||||
}
|
||||
|
||||
public List<RewardSearchViewModel> GetSearchList(RewardSearchViewModel searchViewModel)
|
||||
{
|
||||
var query = _companyContext.Rewards.Where(x => x.WorkshopId == searchViewModel.WorkshopId);
|
||||
|
||||
if (searchViewModel.EmployeeId != 0)
|
||||
query = query.Where(x => x.EmployeeId == searchViewModel.EmployeeId);
|
||||
|
||||
return query.Select(x => new RewardSearchViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = _companyContext.Employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
|
||||
PersonnelCode = _companyContext.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(),
|
||||
Description = x.Description,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
RewardedByAccountId = x.RewardedByAccountId,
|
||||
CreationDate = x.CreationDate
|
||||
}).OrderByDescending(x => x.CreationDate).Skip(searchViewModel.PageIndex).Take(30).ToList();
|
||||
}
|
||||
|
||||
public EditRewardViewModel GetDetails(long id)
|
||||
{
|
||||
return _companyContext.Rewards.Select(x => new EditRewardViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
Amount = x.Amount,
|
||||
Description = x.Description,
|
||||
IsActive = x.IsActive,
|
||||
RewardedByAccountId = x.RewardedByAccountId
|
||||
}).FirstOrDefault(x => x.Id == id);
|
||||
}
|
||||
}
|
||||
50
CompanyManagment.EFCore/Repository/SalaryAidRepository.cs
Normal file
50
CompanyManagment.EFCore/Repository/SalaryAidRepository.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.SalaryAidAgg;
|
||||
using CompanyManagment.App.Contracts.SalaryAid;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class SalaryAidRepository:RepositoryBase<long,SalaryAid>,ISalaryAidRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
|
||||
public SalaryAidRepository(CompanyContext context):base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public List<SalaryAidSearchViewModel> GetSearchList(SalaryAidSearchViewModel searchViewModel)
|
||||
{
|
||||
var query = _context.SalaryAids.Where(x => x.WorkshopId == searchViewModel.WorkshopId);
|
||||
|
||||
if (searchViewModel.EmployeeId != 0)
|
||||
query = query.Where(x => x.EmployeeId == searchViewModel.EmployeeId);
|
||||
|
||||
return query.Select(x => new SalaryAidSearchViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = _context.Employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
|
||||
PersonnelCode = _context.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(),
|
||||
Amount = x.Amount.ToMoney(),
|
||||
SalaryDateTime = x.SalaryAidDateTime.ToFarsi(),
|
||||
CreationDate = x.CreationDate
|
||||
}).OrderByDescending(x => x.CreationDate).Skip(searchViewModel.PageIndex).Take(30).ToList();
|
||||
}
|
||||
|
||||
public EditSalaryAidViewModel GetDetails(long id)
|
||||
{
|
||||
return _context.SalaryAids.Select(x => new EditSalaryAidViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
SalaryDateTime = x.SalaryAidDateTime.ToFarsi()
|
||||
}).FirstOrDefault(x => x.Id == id);
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,15 @@ using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
|
||||
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
|
||||
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
|
||||
using Company.Domain.CustomizeWorkshopSettingsAgg;
|
||||
using Company.Domain.FineAgg;
|
||||
using Company.Domain.LoanAgg;
|
||||
using Company.Domain.RewardAgg;
|
||||
using Company.Domain.SalaryAidAgg;
|
||||
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
|
||||
using CompanyManagment.App.Contracts.Fine;
|
||||
using CompanyManagment.App.Contracts.Loan;
|
||||
using CompanyManagment.App.Contracts.Reward;
|
||||
using CompanyManagment.App.Contracts.SalaryAid;
|
||||
|
||||
namespace PersonalContractingParty.Config;
|
||||
|
||||
@@ -362,12 +370,24 @@ public class PersonalBootstrapper
|
||||
services.AddTransient<ICustomizeWorkshopEmployeeSettingsRepository, CustomizeWorkshopEmployeeSettingsRepository>();
|
||||
services.AddTransient<ICustomizeWorkshopGroupSettingsRepository, CustomizeWorkshopGroupSettingsRepository>();
|
||||
|
||||
#endregion
|
||||
//=========End Of Main====================================
|
||||
|
||||
//---File Project------------------------------------
|
||||
services.AddTransient<IFineRepository, FineRepository>();
|
||||
services.AddTransient<IFineApplication, FineApplication>();
|
||||
|
||||
services.AddTransient<IBoardApplication, BoardApplication>();
|
||||
services.AddTransient<ILoanRepository, LoanRepository>();
|
||||
services.AddTransient<ILoanApplication, LoanApplication>();
|
||||
|
||||
services.AddTransient<ISalaryAidApplication, SalaryAidApplication>();
|
||||
services.AddTransient<ISalaryAidRepository, SalaryAidRepository>();
|
||||
|
||||
services.AddTransient<IRewardApplication, RewardApplication>();
|
||||
services.AddTransient<IRewardRepository, RewardRepository>();
|
||||
#endregion
|
||||
//=========End Of Main====================================
|
||||
|
||||
//---File Project------------------------------------
|
||||
|
||||
services.AddTransient<IBoardApplication, BoardApplication>();
|
||||
services.AddTransient<IBoardRepository, BoardRepository>();
|
||||
|
||||
services.AddTransient<IFileApplication, FileApplication>();
|
||||
|
||||
Reference in New Issue
Block a user