Compare commits

..

41 Commits

Author SHA1 Message Date
9095ed28e1 fix invalid bug 2025-10-07 17:20:48 +03:30
7b3d1f527c feat: integrate "IsInvalid" filter and dropdown functionality in leave management 2025-10-07 12:51:18 +03:30
dbbee73e2a add is invalid to list - NOT FINISHED 2025-10-06 20:07:32 +03:30
21df40af3b add isInvalid to leave entity - set query filter for it 2025-10-06 19:50:42 +03:30
SamSys
f50fdd7f91 createLive bug fixed 2025-10-06 14:45:54 +03:30
SamSys
87cde91ad0 Extecpt Condition EmployeeId = 45104, workshopId = 315 2025-10-02 16:11:38 +03:30
SamSys
55f62da928 monthlyWage bug fixed 2025-10-02 15:39:01 +03:30
SamSys
5a7f233568 checkout dailyWage bug fixed 2025-10-02 14:22:48 +03:30
SamSys
9d83de947f Merge branch 'master' of https://github.com/samsyntax24/OriginalGozareshgir 2025-10-02 13:03:47 +03:30
SamSys
f4c3aa1889 Except Personnel checkoutChange 2025-10-02 13:03:29 +03:30
8fb10ba5b0 add validation for leave 2025-10-01 16:32:58 +03:30
SamSys
d0928804ee new permission to DailyWageReport btn on Contract list 2025-09-30 22:05:12 +03:30
SamSys
67f199e86f merge from master 2025-09-30 21:37:19 +03:30
SamSys
85936cad63 gozareshgir address and phone changed 2025-09-29 05:11:05 +03:30
SamSys
6f805d9abe add enamd logo 2025-09-28 18:33:09 +03:30
914a7def53 feat: add condition for left personnel for laon installment 2025-09-28 14:47:33 +03:30
7777ad52de create workshop permission 2025-09-25 13:06:39 +03:30
b8b8d9c3c4 set account permission in EditWorkshop 2025-09-25 12:47:04 +03:30
SamSys
04710e321a Merge branch 'master' of https://git.dadmehrg.ir/gozareshgir/OriginalGozareshgir 2025-09-25 12:26:46 +03:30
SamSys
b9ff14757b new tab permission code 2025-09-25 12:26:38 +03:30
f387d0c535 fix create pay bug 2025-09-24 15:38:47 +03:30
ffc6969ee7 feat: change the create customize checkout 2025-09-24 13:47:55 +03:30
c3bbd9af98 feat: change the loan is paid by checkout 2025-09-23 17:55:03 +03:30
72435f2d47 fix: InsuranceList edit on get bug 2025-09-22 11:07:37 +03:30
SamSys
b3cf56eb1c conflict Fixed 2025-09-16 03:01:41 +03:30
SamSys
20dbd0121f Merge From Master 2025-09-16 03:01:02 +03:30
SamSys
7d3a1dad71 test mirror2 2025-09-08 00:53:59 +03:30
SamSys
b5fc98a47b test mirror 2025-09-08 00:50:28 +03:30
SamSys
29fed23805 Checkout NEW Compute DailyWage Completed 2025-09-02 04:33:30 +03:30
SamSys
a26f079969 merge from master to manualDailyWage 2025-08-31 17:20:27 +03:30
SamSys
77458978b5 checkout change 2025-08-31 05:28:59 +03:30
SamSys
7e3f7d1dcf Completed DailYWage and BaseYear report For Contract 2025-08-28 06:09:02 +03:30
SamSys
c40b457d1f Merge branch 'master' into ManualDailyWageContractSide 2025-08-26 01:49:05 +03:30
SamSys
a344c3f3a6 Merge branch 'master' into ManualDailyWageContractSide 2025-08-24 03:45:58 +03:30
SamSys
8f76b8c082 Upgraded daillyWage Completed 2025-08-24 03:37:54 +03:30
SamSys
584425b3af and new metod to upgrade dailyWage 2025-08-23 07:09:56 +03:30
SamSys
2f60883ea2 add new prop to contractTable - compute dailyWage 2025-08-23 04:27:04 +03:30
SamSys
df1e6f62b8 new manualdailywage metod to create contract 2025-08-21 15:55:53 +03:30
SamSys
856ed38f08 Merge branch 'master' into ManualDailyWageContractSide 2025-08-21 01:49:27 +03:30
SamSys
4a3515ad65 manualDailyWage frontEnd Completed 2025-08-20 02:52:06 +03:30
SamSys
49b84b50a5 add dailywage select on create contract front 2025-08-18 05:33:31 +03:30
178 changed files with 9009 additions and 107305 deletions

View File

@@ -37,7 +37,7 @@ jobs:
& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
-verb:sync `
-source:contentPath="$publishFolder" `
-dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName="Administrator",password="R2rNpdnetP3j>q5b18",authType="Basic" `
-dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName=".\deployuser",password="R2rNpdnetP3j>q5b18",authType="Basic" `
-allowUntrusted `
-enableRule:AppOffline

View File

@@ -21,19 +21,4 @@
</ItemGroup>
<ItemGroup>
<Compile Remove="Application\UID\UidService.cs" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Application\AuthorizedPerson\AuthorizedPersonApplication.cs" />
<Compile Remove="Application\AuthorizedPerson\IAuthorizedPersonApplication.cs" />
<Compile Remove="Domain\AuthorizedPersonAgg\IAuthorizedPersonRepository.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Domain\AuthorizedPersonAgg\" />
<Folder Include="InfraStructure\AuthorizedPerson\" />
</ItemGroup>
</Project>

View File

@@ -477,26 +477,42 @@ public static class Tools
string bb = string.Empty;
bool isNegative = false;
for (int x = 0; x < myMoney.Length; x++)
try
{
if (char.IsDigit(myMoney[x]))
if (!string.IsNullOrWhiteSpace(myMoney))
{
bb += myMoney[x];
}
else if (myMoney[x] == '-' && bb.Length == 0)
{
// اگر علامت منفی قبل از اولین عدد آمد، در نظر بگیر
isNegative = true;
}
}
for (int x = 0; x < myMoney.Length; x++)
{
if (char.IsDigit(myMoney[x]))
{
bb += myMoney[x];
}
else if (myMoney[x] == '-' && bb.Length == 0)
{
// اگر علامت منفی قبل از اولین عدد آمد، در نظر بگیر
isNegative = true;
}
}
if (bb.Length > 0)
{
double res = double.Parse(bb);
return isNegative ? -res : res;
if (bb.Length > 0)
{
double res = double.Parse(bb);
return isNegative ? -res : res;
}
else
{
return 0;
}
}
else
{
return 0;
}
}
else
catch (Exception)
{
return 0;
}
}

View File

@@ -0,0 +1,79 @@
using System;
using System.Net.Http;
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace _0_Framework.Application.UID;
public class UidService : IUidService
{
private readonly HttpClient _httpClient;
private const string BaseUrl = "https://json-api.uid.ir/api/inquiry/";
public UidService()
{
_httpClient = new HttpClient()
{
BaseAddress = new Uri(BaseUrl)
};
}
public async Task<PersonalInfoResponse> GetPersonalInfo(string nationalCode, string birthDate)
{
var request = new PersonalInfoRequest
{
BirthDate = birthDate,
NationalId = nationalCode,
RequestContext = new UidRequestContext()
};
var json = JsonConvert.SerializeObject(request);
var contentType = new StringContent(json, Encoding.UTF8, "application/json");
try
{
var requestResult = await _httpClient.PostAsync("person/v2", contentType);
if (!requestResult.IsSuccessStatusCode)
return null;
var responseResult = await requestResult.Content.ReadFromJsonAsync<PersonalInfoResponse>();
if (responseResult.BasicInformation != null)
{
responseResult.BasicInformation.FirstName = responseResult.BasicInformation.FirstName?.ToPersian();
responseResult.BasicInformation.LastName = responseResult.BasicInformation.LastName?.ToPersian();
responseResult.BasicInformation.FatherName = responseResult.BasicInformation.FatherName?.ToPersian();
}
return responseResult;
}
catch
{
return new PersonalInfoResponse(new UidBasicInformation(),
new IdentificationInformation(default, default, default, default, default), new RegistrationStatus(),
new ResponseContext(new UidStatus(14, "")));
}
}
public async Task<MatchMobileWithNationalCodeResponse> IsMachPhoneWithNationalCode(string nationalCode, string phoneNumber)
{
var request = new PersonalInfoRequest
{
MobileNumber = phoneNumber,
NationalId = nationalCode,
RequestContext = new UidRequestContext()
};
var json = JsonConvert.SerializeObject(request);
var contentType = new StringContent(json, Encoding.UTF8, "application/json");
var requestResult = await _httpClient.PostAsync("mobile/owner/v2", contentType);
if (!requestResult.IsSuccessStatusCode)
return null;
var responseResult = await requestResult.Content.ReadFromJsonAsync<MatchMobileWithNationalCodeResponse>();
return responseResult;
}
}

View File

@@ -64,6 +64,4 @@ public interface IAccountApplication
/// <param name="userName"></param>
/// <returns></returns>
public bool CheckExistClientAccount(string userName);
List<AccountViewModel> GetAdminAccountsNew();
}

View File

@@ -799,8 +799,4 @@ public class AccountApplication : IAccountApplication
return _accountRepository.CheckExistClientAccount(userName);
}
public List<AccountViewModel> GetAdminAccountsNew()
{
return _accountRepository.GetAdminAccountsNew();
}
}

View File

@@ -1,51 +0,0 @@
using System;
using _0_Framework.Domain;
namespace Company.Domain.AuthorizedPersonAgg;
public class AuthorizedPerson : EntityBase
{
public string NationalCode { get; private set; }
public string FirstName { get; private set; }
public string LastName { get; private set; }
public string FatherName { get; private set; }
public string BirthDate { get; private set; }
public string Gender { get; private set; }
public string DeathStatus { get; private set; }
public string ShenasnameSeri { get; private set; }
public string ShenasnameSerial { get; private set; }
public string ShenasnamehNumber { get; private set; }
public bool IsVerified { get; private set; }
public DateTime? VerificationDate { get; private set; }
public AuthorizedPerson(string nationalCode, string firstName, string lastName, string fatherName,
string birthDate, string gender, string deathStatus, string shenasnameSeri,
string shenasnameSerial, string shenasnamehNumber)
{
NationalCode = nationalCode;
FirstName = firstName;
LastName = lastName;
FatherName = fatherName;
BirthDate = birthDate;
Gender = gender;
DeathStatus = deathStatus;
ShenasnameSeri = shenasnameSeri;
ShenasnameSerial = shenasnameSerial;
ShenasnamehNumber = shenasnamehNumber;
IsVerified = true;
VerificationDate = DateTime.Now;
}
public void UpdatePersonalInfo(string firstName, string lastName, string fatherName,
string gender, string deathStatus)
{
FirstName = firstName;
LastName = lastName;
FatherName = fatherName;
Gender = gender;
DeathStatus = deathStatus;
VerificationDate = DateTime.Now;
}
protected AuthorizedPerson() { }
}

View File

@@ -1,9 +0,0 @@
using _0_Framework.Domain;
namespace Company.Domain.AuthorizedPersonAgg;
public interface IAuthorizedPersonRepository : IRepository<long, AuthorizedPerson>
{
AuthorizedPerson GetByNationalCode(string nationalCode);
bool ExistsByNationalCode(string nationalCode);
}

View File

@@ -10,7 +10,7 @@ namespace Company.Domain.ClassifiedSalaryAgg
{
public class ClassifiedSalary : EntityBase
{
//test
//test//test
public ClassifiedSalary(double group1, double group2, double group3, double group4, double group5, double group6, double group7, double group8, double group9, double group10, double group11, double group12, double group13, double group14, double group15, double group16, double group17, double group18, double group19, double group20, DateTime startDate, DateTime endDate, int year)
{
Group1 = group1;

View File

@@ -15,7 +15,7 @@ public interface IPersonalContractingPartyRepository :IRepository<long, Personal
EditPersonalContractingParty GetDetailsToEdit(long id);
string GetFullName(long id);
List<PersonalContractingPartyViewModel> Search(PersonalContractingPartySearchModel searchModel2);
int GetLastNewArchiveCode();
int GetLastArchiveCode();
#region Mahan
List<string> SearchByName(string name);

View File

@@ -73,16 +73,12 @@ public class PersonalContractingParty : EntityBase
/// آیا از طریق ای پی ای احراز هویت شده است
/// </summary>
public bool IsAuthenticated { get; private set; }
/// <summary>
/// جنسیت
/// </summary>
public Gender Gender { get; private set; }
/// <summary>
/// سمت و صاحب امضاء اوراق (فقط برای طرف حقوقی)
/// </summary>
public string LegalPosition { get; private set; }
#endregion
@@ -98,7 +94,7 @@ public class PersonalContractingParty : EntityBase
public PersonalContractingParty(string fName, string lName, string nationalcode, string idNumber,
/*string legalName,*/ string registerId, string nationalId, string isLegal,
string phone, string agentPhone, string address,long representativeId,
string representativeFullName, int archiveCode, string state,string city, string zone, string sureName,string legalPosition=null)
string representativeFullName, int archiveCode, string state,string city, string zone, string sureName)
{
FName = fName;
@@ -124,7 +120,8 @@ public class PersonalContractingParty : EntityBase
IsActiveString = "true";
IsBlock = "false";
BlockTimes = 0;
LegalPosition = legalPosition;
}
@@ -154,7 +151,7 @@ public class PersonalContractingParty : EntityBase
}
public void EditLegal(string lName, string registerId, string nationalId, string phone, string agentPhone, string address, long representativeId, string representativeFullName, int archiveCode,
string state, string city, string zone, string sureName,string legalPosition = null)
string state, string city, string zone, string sureName)
{
LName = lName;
@@ -171,8 +168,6 @@ public class PersonalContractingParty : EntityBase
State = state;
City = city;
Zone = zone;
if (legalPosition != null)
LegalPosition = legalPosition;
}

View File

@@ -17,7 +17,7 @@ public class Contract : EntityBase
public Contract(long personnelCode, long employeeId, long employerId,
long workshopIds, long yearlySalaryId, DateTime contarctStart, DateTime contractEnd, string dayliWage,
string archiveCode, DateTime getWorkDate, DateTime setContractDate, string jobType,
string contractType, string workshopAddress1, string workshopAddress2, string consumableItems, long jobTypeId, string housingAllowance, string agreementSalary, string workingHoursWeekly, string familyAllowance, string contractPeriod)
string contractType, string workshopAddress1, string workshopAddress2, string consumableItems, long jobTypeId, string housingAllowance, string agreementSalary, string workingHoursWeekly, string familyAllowance, string contractPeriod, double dailySalaryAffected, double baseYearAffected, double dailySalaryUnAffected, double baseYearUnAffected, bool hasManualDailyWage, string dailyWageType)
{
PersonnelCode = personnelCode;
EmployeeId = employeeId;
@@ -45,6 +45,19 @@ public class Contract : EntityBase
WorkingHoursWeekly = workingHoursWeekly;
FamilyAllowance = familyAllowance;
ContractPeriod = contractPeriod;
//پراپرتی های جدید برای دستمزد دلخواه
#region NewManualDailyWage
DailySalaryAffected = dailySalaryAffected;
BaseYearAffected = baseYearAffected;
DailySalaryUnAffected = dailySalaryUnAffected;
BaseYearUnAffected = baseYearUnAffected;
HasManualDailyWage = hasManualDailyWage;
DailyWageType = dailyWageType;
#endregion
Signature = "0";
@@ -65,7 +78,42 @@ public class Contract : EntityBase
public DateTime SetContractDate { get; private set; }
public string JobType { get; private set; }
public string ContractType { get; private set; }
/// <summary>
/// مزد تجمیعی یعد از تاثیر ساعت کار
/// </summary>
public string DayliWage { get; private set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
/// <summary>
/// آیا دستمزد روزانه دستی وارد شده است؟
/// </summary>
public bool HasManualDailyWage { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
public string IsActiveString { get; private set; }
public string ArchiveCode { get; private set; }
public string WorkshopAddress1 { get; private set; }
@@ -89,6 +137,7 @@ public class Contract : EntityBase
public Contract()
{
WorkingHoursList = new List<WorkingHours>();
}
public void Edit(long pesrsonnelCode, long employeeId, long employerId, long workshopId, long yearlySalaryId,

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.Contract;
@@ -9,6 +10,24 @@ namespace Company.Domain.ContractAgg;
public interface IContractRepository : IRepository<long, Contract>
{
/// <summary>
/// دریافت مزد ارتقاء یافته
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="yearlySalaryId"></param>
/// <returns></returns>
Task<double> GetManualDailWage(long workshopId, long employeeId, long yearlySalaryId, DateTime contractStart);
/// <summary>
/// دریافت لیست مزد ارتقاء یافته
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="contractStart"></param>
/// <returns></returns>
Task<UpgradeManualDailyWageModel> GetManualDailWageList(long workshopId, long employeeId,
DateTime contractStart);
EditContract GetDetails(long id);
EditContract GetContractByStartEnd(DateTime start, DateTime end, long workshopId, long employeeId);

View File

@@ -17,7 +17,6 @@ public class FinancialStatment : EntityBase
ContractingPartyId = contractingPartyId;
ContractingPartyName = contractingPartyName;
PublicId = Guid.NewGuid();
FinancialTransactionList = [];
}
public FinancialStatment()
@@ -38,12 +37,4 @@ public class FinancialStatment : EntityBase
{
PublicId = Guid.NewGuid();
}
public void AddFinancialTransaction(FinancialTransaction financialTransaction)
{
if (financialTransaction == null)
throw new ArgumentNullException(nameof(financialTransaction));
FinancialTransactionList.Add(financialTransaction);
}
}

View File

@@ -47,9 +47,4 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
Task<PagedResult<GetInstitutionContractListItemsViewModel>> GetList(InstitutionContractListSearchModel searchModel);
Task<GetInstitutionContractListStatsViewModel> GetListStats(InstitutionContractListSearchModel searchModel);
Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList();
Task<List<RegistrationWorkflowItemsViewModel>> RegistrationWorkflowItems(long institutionContractId);
Task<InstitutionContractWorkshopDetail> GetInstitutionWorkshopDetails(long institutionWorkshopDetailsId);
Task<InstitutionContract> GetIncludeWorkshopDetailsAsync(long institutionContractId);
void UpdateStatusIfNeeded(long institutionContractId);
}

View File

@@ -1,22 +1,17 @@
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using _0_Framework.Application;
using _0_Framework.Domain;
using Company.Domain.InstitutionContractContactInfoAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
namespace Company.Domain.InstitutionContractAgg;
public class InstitutionContract : EntityBase
{
public InstitutionContract(string contractNo, long representativeId, string representativeName,
long contractingPartyId,
public InstitutionContract(string contractNo, long representativeId, string representativeName, long contractingPartyId,
string contractingPartyName, DateTime contractDateGr, string contractDateFa, string state, string city,
string address, DateTime contractStartGr, string contractStartFa, DateTime contractEndGr,
string contractEndFa, double contractAmount, double dailyCompenseation, double obligation,
double totalAmount, int extensionNo, string workshopManualCount, string employeeManualCount, string description,
string officialCompany, string typeOfcontract, string hasValueAddedTax, double valueAddedTax)
double totalAmount, int extensionNo, string workshopManualCount, string employeeManualCount, string description, string officialCompany,string typeOfcontract, string hasValueAddedTax, double valueAddedTax)
{
ContractNo = contractNo;
RepresentativeId = representativeId;
@@ -48,10 +43,6 @@ public class InstitutionContract : EntityBase
TypeOfContract = typeOfcontract;
HasValueAddedTax = hasValueAddedTax;
ValueAddedTax = valueAddedTax;
Status = InstitutionContractStatus.Incomplete;
ContactInfoList = [];
WorkshopDetails = [];
Installments = [];
}
public string ContractNo { get; private set; }
@@ -64,24 +55,21 @@ public class InstitutionContract : EntityBase
public string ContractDateFa { get; private set; }
public string State { get; private set; }
public string City { get; private set; }
public string Address { get; private set; }
//public long ContactInfoId { get; private set; }
public DateTime ContractStartGr { get; private set; }
public string ContractStartFa { get; private set; }
public DateTime ContractEndGr { get; private set; }
public string ContractEndFa { get; private set; }
// مبلغ قرارداد
public double ContractAmount { get; private set; }
//خسارت روزانه
public double DailyCompenseation { get; private set; }
//وجه التزام
public double Obligation { get; private set; }
// مبلغ کل قرارداد
public double TotalAmount { get; private set; }
public string WorkshopManualCount { get; private set; }
@@ -94,33 +82,28 @@ public class InstitutionContract : EntityBase
public string TypeOfContract { get; private set; }
public string HasValueAddedTax { get; set; }
public double ValueAddedTax { get; set; }
public InstitutionContractStatus Status { get; private set; }
public List<InstitutionContractWorkshopDetail> WorkshopDetails { get; set; }
public List<InstitutionContractContactInfo> ContactInfoList { get; set; }
public List<InstitutionContractInstallment> Installments { get; set; }
public InstitutionContract()
{
ContactInfoList = [];
WorkshopDetails = [];
Installments = [];
ContactInfoList = new List<InstitutionContractContactInfo>();
}
public void Edit(DateTime contractDateGr, string contractDateFa, string state, string city, string address,
DateTime contractStartGr, string contractStartFa, DateTime contractEndGr, string contractEndFa,
double contractAmount, double dailyCompenseation, double obligation, double totalAmount,
string workshopManualCount, string employeeManualCount, string description, string officialCompany,
string workshopManualCount, string employeeManualCount, string description, string officialCompany,
string typeOfcontract, double valueAddedTax, string hasValueAddedTax)
{
ContractDateGr = contractDateGr;
ContractDateFa = contractDateFa;
State = state;
City = city;
Address = address;
ContractStartGr = contractStartGr;
ContractStartFa = contractStartFa;
ContractEndGr = contractEndGr;
@@ -141,11 +124,13 @@ public class InstitutionContract : EntityBase
public void Active()
{
this.IsActiveString = "true";
}
public void DeActive()
{
this.IsActiveString = "false";
}
@@ -163,177 +148,4 @@ public class InstitutionContract : EntityBase
{
this.Signature = "0";
}
public void Complete()
{
Status = InstitutionContractStatus.Completed;
}
public void SetWorkshopDetails(List<InstitutionContractWorkshopDetail> commandWorkshops)
{
WorkshopDetails = commandWorkshops;
}
public void SetInstallments(List<InstitutionContractInstallment> installments)
{
Installments = installments;
}
}
public class InstitutionContractWorkshopDetail:EntityBase
{
public InstitutionContractWorkshopDetail(string workshopName, bool hasRollCallPlan,
bool hasCustomizeCheckoutPlan, bool hasContractPlan,bool hasContractPlanInPerson,bool hasInsurancePlan,bool hasInsurancePlanInPerson,
int personnelCount, double price)
{
WorkshopName = workshopName;
HasRollCallPlan = hasRollCallPlan;
HasCustomizeCheckoutPlan = hasCustomizeCheckoutPlan;
HasContractPlan = hasContractPlan;
HasContractPlanInPerson = hasContractPlanInPerson;
HasInsurancePlan = hasInsurancePlan;
HasInsurancePlanInPerson = hasInsurancePlanInPerson;
PersonnelCount = personnelCount;
WorkshopCreated = false;
Price = price;
Employers = [];
}
/// <summary>
/// شناسه کارگاه
/// </summary>
public long? WorkshopId { get; private set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; private set; }
/// <summary>
/// پلن حضور و غیاب
/// </summary>
public bool HasRollCallPlan { get; private set; }
/// <summary>
/// پلن فیش غیر رسمی
/// </summary>
public bool HasCustomizeCheckoutPlan { get; private set; }
/// <summary>
/// پلن قرارداد و تصفیه
/// </summary>
public bool HasContractPlan { get; private set; }
/// <summary>
/// پلن قرارداد و تصفیه حضوری
/// </summary>
public bool HasContractPlanInPerson { get; private set; }
/// <summary>
/// پلن بیمه
/// </summary>
public bool HasInsurancePlan { get; private set; }
/// <summary>
/// پلن بیمه حضوری
/// </summary>
public bool HasInsurancePlanInPerson { get; private set; }
public int PersonnelCount { get; private set; }
public bool WorkshopCreated { get; private set; }
/// <summary>
/// شناسه قرارداد نهاد مرتبط
/// </summary>
public long InstitutionContractId { get; private set; }
/// <summary>
/// Navigation property to InstitutionContract
/// </summary>
public InstitutionContract InstitutionContract { get; private set; }
public double Price { get; private set; }
private InstitutionContractWorkshopDetail()
{
}
public List<InstitutionContractWorkshopDetailEmployer> Employers { get; private set; } = new();
public void SetEmployers(List<long> employerIds)
{
Employers.Clear();
foreach (var employerId in employerIds)
{
Employers.Add(new InstitutionContractWorkshopDetailEmployer(id, employerId));
}
}
public void AddEmployer(long employerId)
{
if (Employers.Exists(x => x.EmployerId == employerId))
return;
Employers.Add(new InstitutionContractWorkshopDetailEmployer(id, employerId));
}
public void Edit(bool hasAttendancePlan, bool hasUnofficialPayslipPlan, bool hasContractSettlementPlan)
{
HasRollCallPlan = hasAttendancePlan;
HasCustomizeCheckoutPlan = hasUnofficialPayslipPlan;
HasContractPlan = hasContractSettlementPlan;
}
public void SetWorkshopId(long workshopId)
{
WorkshopId = workshopId;
WorkshopCreated = true;
}
}
public enum InstitutionContractStatus
{
/// <summary>
/// ناتمام - قرارداد هنوز تکمیل نشده و نیاز به انجام کارهای بیشتر دارد
/// </summary>
Incomplete = 0,
/// <summary>
/// تکمیل شده - قرارداد به طور کامل انجام شده و نهایی شده است
/// </summary>
Completed = 1
}
public class InstitutionContractInstallment
{
public InstitutionContractInstallment(DateTime installmentDateGr, double amount,
string description)
{
InstallmentDateGr = installmentDateGr;
InstallmentDateFa = installmentDateGr.ToFarsi();
Amount = amount;
Description = description;
}
public long Id { get; private set; }
public DateTime InstallmentDateGr { get; private set; }
public string InstallmentDateFa { get; private set; }
public double Amount { get; private set; }
public string Description { get; private set; }
public long InstitutionContractId { get; private set; }
public InstitutionContract InstitutionContract { get; private set; }
}
public class InstitutionContractWorkshopDetailEmployer : EntityBase
{
public long InstitutionContractWorkshopDetailId { get; private set; }
public long EmployerId { get; private set; }
public InstitutionContractWorkshopDetailEmployer(long institutionContractWorkshopDetailId, long employerId)
{
InstitutionContractWorkshopDetailId = institutionContractWorkshopDetailId;
EmployerId = employerId;
}
private InstitutionContractWorkshopDetailEmployer() { }
}

View File

@@ -1,15 +0,0 @@
using _0_Framework.Domain;
using System.Collections.Generic;
using System.Threading.Tasks;
using CompanyManagment.App.Contracts.Law;
namespace Company.Domain.LawAgg
{
public interface ILawRepository : IRepository<long, Law>
{
Task<Law> GetWithItems(long id);
Task<List<Law>> GetActive();
Task<LawViewModel> GetByType(LawType type);
Task<List<LawViewModel>> GetList(LawSearchModel searchModel);
}
}

View File

@@ -1,89 +0,0 @@
using System;
using System.Collections.Generic;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.Law;
using System.Text.Json;
using System.ComponentModel.DataAnnotations.Schema;
namespace Company.Domain.LawAgg
{
public class Law : EntityBase
{
private Law(){}
public string Title { get; private set; }
public bool IsActive { get; private set; }
public List<LawItem> Items { get; private set; }
public LawType Type { get; private set; }
public string HeadTitle { get; private set; }
public string NotificationsJson { get; private set; }
[NotMapped]
public List<string> Notifications
{
get => string.IsNullOrEmpty(NotificationsJson)
? new List<string>()
: JsonSerializer.Deserialize<List<string>>(NotificationsJson);
set => NotificationsJson = JsonSerializer.Serialize(value);
}
public Law(string title, LawType lawType, List<string> notifications, string headTitle )
{
Title = title;
IsActive = true;
Items = new List<LawItem>();
Type = lawType;
Notifications = notifications ?? new List<string>();
HeadTitle = headTitle;
}
public void Edit(string title)
{
Title = title;
}
public void AddItem(string header, string details, int orderNumber)
{
Items.Add(new LawItem(header, details, orderNumber));
}
public void SetItem(List<LawItem> items)
{
Items = items ?? new List<LawItem>();
}
public void RemoveItem(int orderNumber)
{
var item = Items.Find(x => x.OrderNumber == orderNumber);
if (item != null)
Items.Remove(item);
}
public void Activate()
{
IsActive = true;
}
public void Deactivate()
{
IsActive = false;
}
}
public class LawItem
{
public long Id { get; set; }
public string Header { get; private set; }
public string Details { get; private set; }
public int OrderNumber { get; private set; }
public long LawId { get; set; }
protected LawItem() { }
public LawItem(string header, string details, int orderNumber)
{
Header = header;
Details = details;
OrderNumber = orderNumber;
}
}
}

View File

@@ -22,7 +22,7 @@ public interface ILeaveRepository : IRepository<long, Leave>
bool CheckContractExist(DateTime myDate,long employeeId, long workshopId);
LeavErrorViewModel CheckErrors(DateTime startLeav, DateTime endLeav, long employeeId, long workshopId);
LeavErrorViewModel CheckErrors(DateTime startLeav, DateTime endLeav, long employeeId, long workshopId,bool isInvalid);
LeaveViewModel LeavOnChekout(DateTime starContract, DateTime endContract, long employeeId, long workshopId);
List<LeaveMainViewModel> searchClient(LeaveSearchModel searchModel);
LeavePrintViewModel PrintOne(long id);

View File

@@ -8,7 +8,9 @@ public class Leave: EntityBase
{
public Leave(DateTime startLeave, DateTime endLeave,
string leaveHourses, long workshopId, long employeeId,
string paidLeaveType, string leaveType, string employeeFullName, string workshopName, bool isAccepted, string decription, int year, int month, TimeSpan shiftDuration, bool hasShiftDuration)
string paidLeaveType, string leaveType, string employeeFullName, string workshopName,
bool isAccepted, string decription, int year, int month, TimeSpan shiftDuration,
bool hasShiftDuration,bool isInvalid)
{
StartLeave = startLeave;
EndLeave = endLeave;
@@ -25,6 +27,7 @@ public class Leave: EntityBase
Month = month;
ShiftDuration = shiftDuration;
HasShiftDuration = hasShiftDuration;
IsInvalid = isInvalid;
}
public DateTime StartLeave { get; private set; }
@@ -43,6 +46,10 @@ public class Leave: EntityBase
public TimeSpan ShiftDuration { get; private set; }
public bool HasShiftDuration { get; private set; }
/// <summary>
///آیا فاقد اعتبار است. فاقد اعتبار ها فقط برای فیش های غیررسمی مورد استفاده قرار میگیرند
/// </summary>
public bool IsInvalid { get; private set; }
public void Edit(DateTime startLeave, DateTime endLeave,
string leaveHourses, long workshopId, long employeeId,

View File

@@ -15,7 +15,7 @@ namespace Company.Domain.RollCallAgg;
public interface IRollCallMandatoryRepository : IRepository<long, RollCall>
{
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, double dailyWageUnAffected, bool totalLeaveCompute);
/// <summary>
/// محاسبه ساعات کارکرد پرسنل در صورت داشتن حضور غیاب

View File

@@ -21,8 +21,6 @@ public class ContractingPartyTemp : EntityBase
IdNumberSerial = idNumberSerial;
Gender = gender;
DateOfBirth = dateOfBirth;
PublicId = Guid.NewGuid();
Status = ContractingPartyTempStatus.InComplete;
}
/// <summary>
@@ -93,34 +91,10 @@ public class ContractingPartyTemp : EntityBase
/// </summary>
public string Address { get; private set; }
public ContractingPartyTempStatus Status { get; set; }
public string VerifyCode { get; set; }
public DateTime VerifyCodeSentDateTime { get; set; }
public Guid PublicId { get; set; }
public void UpdateAddress(string state, string city, string address)
{
this.State = state;
this.City = city;
this.Address = address;
}
public void SetCompleted()
{
Status = ContractingPartyTempStatus.Completed;
}
public void SetVerifyCode(string verifyCode)
{
VerifyCode = verifyCode;
VerifyCodeSentDateTime = DateTime.Now;
}
}
public enum ContractingPartyTempStatus
{
InComplete,
Completed
}

View File

@@ -1,7 +0,0 @@
using _0_Framework.Domain;
namespace Company.Domain.TemporaryClientRegistrationAgg;
public interface IInstitutionContractContactInfoTempRepository : IRepository<long, InstitutionContractContactInfoTemp>
{
}

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework_b.Domain;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
namespace Company.Domain.TemporaryClientRegistrationAgg;
@@ -18,5 +17,10 @@ public interface IInstitutionContractTempRepository : IRepository<long, Institut
/// <returns></returns>
Task<InstitutionContractTempViewModel> GetInstitutionContractTemp(long id,long contractingPartyTempId);
/// <summary>
/// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
/// جهت نمایش در کارپوشه
/// </summary>
/// <returns></returns>
Task<List<RegistrationWorkflowMainList>> GetAllCompletedRegistration();
}

View File

@@ -1,25 +0,0 @@
using _0_Framework.Domain;
namespace Company.Domain.TemporaryClientRegistrationAgg;
public class InstitutionContractContactInfoTemp : EntityBase
{
public InstitutionContractContactInfoTemp(string phoneType, string position, string phoneNumber,
string fullName, long institutionContractTempId, bool sendSms)
{
PhoneType = phoneType;
Position = position;
PhoneNumber = phoneNumber;
FullName = fullName;
InstitutionContractTempId = institutionContractTempId;
SendSms = sendSms;
}
public string PhoneType { get; private set; }
public long InstitutionContractTempId { get; private set; }
public string Position { get; private set; }
public string PhoneNumber { get; private set; }
public string FullName { get; private set; }
public bool SendSms { get; private set; }
public InstitutionContractTemp InstitutionContractTemp { get; set; }
}

View File

@@ -1,15 +1,13 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application.UID;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
namespace Company.Domain.TemporaryClientRegistrationAgg;
public class InstitutionContractTemp : EntityBase
{
public InstitutionContractTemp(long contractingPartyTempId, string paymentModel, string periodModel, double totalPayment, DateTime contractStartGr, DateTime contractEndGr, string officialCompany, double valueAddedTax, string verifyCode, InstitutionContractTempStatus registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
public InstitutionContractTemp(long contractingPartyTempId, string paymentModel, string periodModel, double totalPayment, DateTime contractStartGr, DateTime contractEndGr, string officialCompany, double valueAddedTax, string verifyCode, string registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
{
ContractingPartyTempId = contractingPartyTempId;
PaymentModel = paymentModel;
@@ -24,7 +22,6 @@ public class InstitutionContractTemp : EntityBase
MessageId = messageId;
SendVerifyCodeTime = sendVerifyCodeTime;
VerifyCodeEndTime = verifyCodeEndTime;
PublicId = Guid.NewGuid();
}
/// <summary>
@@ -90,7 +87,7 @@ public class InstitutionContractTemp : EntityBase
/// -
/// Completed ثبت نام تکمیل شده
/// </summary>
public InstitutionContractTempStatus RegistrationStatus { get; private set; }
public string RegistrationStatus { get; private set; }
/// <summary>
/// آی دی پیامک ارسال شده
@@ -107,16 +104,8 @@ public class InstitutionContractTemp : EntityBase
/// </summary>
public DateTime? VerifyCodeEndTime{ get; private set; }
/// <summary>
/// آیدی عمومی
/// برای نمایش در آدرس
/// </summary>
public Guid PublicId { get; set; }
public List<InstitutionContractContactInfoTemp> ContactInfoList { get; set; }
public void Edit(long contractingPartyTempId, string paymentModel, string periodModel, double totalPayment, DateTime contractStartGr, DateTime contractEndGr, string officialCompany, double valueAddedTax, string verifyCode, InstitutionContractTempStatus registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
public void Edit(long contractingPartyTempId, string paymentModel, string periodModel, double totalPayment, DateTime contractStartGr, DateTime contractEndGr, string officialCompany, double valueAddedTax, string verifyCode, string registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
{
ContractingPartyTempId = contractingPartyTempId;
PaymentModel = paymentModel;
@@ -133,7 +122,7 @@ public class InstitutionContractTemp : EntityBase
VerifyCodeEndTime = verifyCodeEndTime;
}
public void Update(string verifyCode, InstitutionContractTempStatus registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
public void Update(string verifyCode, string registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
{
VerifyCode = verifyCode;
RegistrationStatus = registrationStatus;
@@ -142,10 +131,9 @@ public class InstitutionContractTemp : EntityBase
VerifyCodeEndTime = verifyCodeEndTime;
}
public void ChangeRegistrationStatus(InstitutionContractTempStatus registrationStatus)
public void ChangeRegistrationStatus(string registrationStatus)
{
RegistrationStatus = registrationStatus;
}
}
}

View File

@@ -76,13 +76,14 @@ public class Workshop : EntityBase
ClientEmployeeWorkshopList = new List<ClientEmployeeWorkshop>();
}
public Workshop(string workshopName,string workshopSureName, string insuranceCode, string typeOfOwnership, string archiveCode, string agentName, string agentPhone,
string state, string city, string address, string typeOfInsuranceSend, string typeOfContract, string contractTerm,
string agreementNumber, bool fixedSalary, string population,long? insuranceJobId, string zoneName, bool addBonusesPay, bool addYearsPay, bool addLeavePay, bool totalPaymentHide,
bool isClassified, string computeOptions, string bonusesOptions, string yearsOptions, string hasRollCallFreeVip, bool workshopHolidayWorking,
bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance, bool createContract, bool signContract, bool createCheckout, bool signCheckout,
IsActive cutContractEndOfYear, bool rotatingShiftCompute, bool isStaticCheckout,long contractingPartyId)
bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance, bool createContract, bool signContract, bool createCheckout, bool signCheckout, IsActive cutContractEndOfYear, bool rotatingShiftCompute, bool isStaticCheckout)
{
WorkshopName = workshopName;
WorkshopSureName = workshopSureName;
@@ -133,7 +134,6 @@ public class Workshop : EntityBase
CutContractEndOfYear = cutContractEndOfYear;
RotatingShiftCompute = rotatingShiftCompute;
IsStaticCheckout = isStaticCheckout;
ContractingPartyId = contractingPartyId;
}
@@ -233,8 +233,6 @@ public class Workshop : EntityBase
/// </summary>
public bool IsStaticCheckout { get; private set; }
public long ContractingPartyId { get; private set; }
public Workshop()
{
RollCallServicesList = new List<RollCallService>();
@@ -346,10 +344,4 @@ public class Workshop : EntityBase
this.IsActiveString = "false";
ArchiveCode = "b-" + archiveCode;
}
}
public enum WorkshopRegistrationStatus
{
NotRegistered = 0,
Registered = 1
}

View File

@@ -6,6 +6,7 @@ using CompanyManagment.App.Contracts.YearlySalary;
using System.Threading.Tasks;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Holiday;
using CompanyManagment.App.Contracts.Contract;
namespace Company.Domain.YearlySalaryAgg;
@@ -17,11 +18,39 @@ public interface IYearlySalaryRepository : IRepository<long, YearlySalary>
void TestDayliFeeCompute();
List<string> GetYears();
List<YearlySalaryViewModel> GetYearlySalary();
/// <summary>
/// دریافت مزد روزانه فیش حقوقی
/// </summary>
/// <param name="contract"></param>
/// <param name="checkoutStart"></param>
/// <param name="checkoutEnd"></param>
/// <returns></returns>
Task<double> GetCheckoutDailyWage(EditContract contract, DateTime checkoutStart, DateTime checkoutEnd);
/// <summary>
/// دریافت مزد روزانه بر اساس تاریخ شروع و پایان
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
Task<(double dailyWage, long yearlySalaryId)> GetDailyWageByStartEnd(DateTime start, DateTime end);
MontlywageBunosYearsViewModel GetMontlyBunosYears(TimeSpan weeklyTime, DateTime contractStart,DateTime contractEnd, double daylyWage, string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete, bool hasRollCall, bool holidaysWorking,string shiftWork);
double GetLeavePay(DateTime contractStart, DateTime contractEnd, double daylyWage, double consumableItem, double housingAllowance, double familyAllowance , string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM);
double GetOverTimeWorking(double dayliWage, string overTimeWorkH, string overTimeWorkM);
double GetOverNightWorking(double dayliWage, string overNightWorkH, string overNightWorkM, string weeklyWorkingTime, int officialholiday, int friday, DateTime contractStart, DateTime contractEnd, string totalHoursH, string totalHorsM);
/// <summary>
/// متد ارتقاء مزد دلخواه
/// </summary>
/// <param name="newContractStart"></param>
/// <param name="lastContractStart"></param>
/// <param name="lastContractManualDailyWage"></param>
/// <returns></returns>
Task<UpgradeManualDailyWageModel> UpgradeManualDailyWage(DateTime newContractStart, DateTime lastContractStart,
double lastContractManualDailyWage);
/// <summary>
/// متد محاسبه پایه سنوات و لیست پایه سنوات های پرسنل
/// </summary>

View File

@@ -1,19 +0,0 @@
namespace CompanyManagment.App.Contracts.AuthorizedPerson;
public class AuthorizedPersonViewModel
{
public long Id { get; set; }
public string NationalCode { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string FatherName { get; set; }
public string BirthDate { get; set; }
public string Gender { get; set; }
public string DeathStatus { get; set; }
public string ShenasnameSeri { get; set; }
public string ShenasnameSerial { get; set; }
public string ShenasnamehNumber { get; set; }
public bool IsVerified { get; set; }
public string VerificationDate { get; set; }
public string CreationDate { get; set; }
}

View File

@@ -1,15 +0,0 @@
namespace CompanyManagment.App.Contracts.AuthorizedPerson;
public class CreateAuthorizedPerson
{
public string NationalCode { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string FatherName { get; set; }
public string BirthDate { get; set; }
public string Gender { get; set; }
public string DeathStatus { get; set; }
public string ShenasnameSeri { get; set; }
public string ShenasnameSerial { get; set; }
public string ShenasnamehNumber { get; set; }
}

View File

@@ -1,13 +0,0 @@
using System.Collections.Generic;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.AuthorizedPerson;
public interface IAuthorizedPersonApplication
{
OperationResult Create(CreateAuthorizedPerson command);
OperationResult CreateFromUidResponse(CreateAuthorizedPerson command);
AuthorizedPersonViewModel GetByNationalCode(string nationalCode);
List<AuthorizedPersonViewModel> Search(string nationalCode = null, string firstName = null, string lastName = null);
bool ExistsByNationalCode(string nationalCode);
}

View File

@@ -160,4 +160,37 @@ public class CreateCheckout
public TimeSpan TotalPaidLeave { get; set; }
public TimeSpan TotalSickLeave { get; set; }
public bool HasLeft { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// دستمزد روزانه دریافت شده از سمت فرانت
/// </summary>
public string DailySalaryUnAffectedStr { get; set; }
/// <summary>
/// مزد سالانه نرمال دریافت از سمت فرانت
/// </summary>
public string NormalDailyWage { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
}

View File

@@ -61,9 +61,23 @@ public class ComputingViewModel
/// </summary>
public TimeSpan EmployeeMandatoryHours { get; set; }
/// <summary>
/// مجموع مرخصی های پرسنل در این فیش حقوقی
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
//public TimeSpan TotalLeaveOnThisCheckout { get; set; }
public double BaseYearUnAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
//public List<string> holidays;
}

View File

@@ -0,0 +1,70 @@
using CompanyManagment.App.Contracts.YearlySalary;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.Contract;
/// <summary>
/// نمایش نحوه محاسبه پایه سنوات و دستمزد روزانه
/// </summary>
public class ContractDailyWageAndBaseYearReport
{
/// <summary>
/// لیست داده های محاسبه پایه سنوات
/// </summary>
public BaseYearDataViewModel BaseYearDataViewModel { get; set; }
/// <summary>
/// پایه سنوات متاثر از ساعت کار
/// </summary>
public string BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه متاثر از ساعت کار
/// </summary>
public string DailySalaryAffected { get; set; }
/// <summary>
/// دستمزد روزانه بدون تاثیر ساعت کار
/// </summary>
public string DailySalaryUnAffected { get; set; }
/// <summary>
/// دستمزد روزانه تجمیعی
/// </summary>
public string DailyWage { get; set; }
/// <summary>
/// تاریخ قراداد
/// </summary>
public string ContractDate { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
/// <summary>
/// لیست ارتقاء
/// </summary>
public List<UpgradeManualDailyWageList> UpgradeManualDailyWageLists { get; set; }
/// <summary>
/// نام پرسنل
/// </summary>
public string EmployeeName { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; set; }
/// <summary>
/// آیا با متد جدید محاسبه شده
/// </summary>
public bool OldComputeMethod { get; set; }
/// <summary>
/// آیا محاسبات با مقادیر ذخیره شده مغایرت دارد
/// </summary>
public bool Contradiction { get; set; }
}

View File

@@ -140,7 +140,36 @@ public class CreateContract
public string ConvertMonth { get; set; }
public string FormStep { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
/// <summary>
/// آیا دستمزد روزانه دستی وارد شده است؟
/// </summary>
public bool HasManualDailyWage { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
public List<ContractViweModel> Contracts { get; set; }
public List<WorkshopViewModel> Workshops { get; set; }
public List<EmployerViewModel> Employers { get; set; }

View File

@@ -7,6 +7,14 @@ namespace CompanyManagment.App.Contracts.Contract;
public interface IContractApplication
{
/// <summary>
/// دریافت مزد ارتقاء یافته
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="yearlySalaryId"></param>
/// <returns></returns>
Task<double> GetManualDailWage(long workshopId, long employeeId, long yearlySalaryId, DateTime contractStart);
OperationResult Create(CreateContract command);
OperationResult CreateNew(createContractModel command);
OperationResult Edit(EditContract command);

View File

@@ -0,0 +1,36 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.Contract;
/// <summary>
/// ویو مدل رتقاء دستمزد روزانه و لیست ارتقاء
/// </summary>
public class UpgradeManualDailyWageModel
{
/// <summary>
/// دستمزد روزانه
/// </summary>
public double DailyWage{ get; set; }
/// <summary>
/// لیست ارتقاء
/// </summary>
public List<UpgradeManualDailyWageList> UpgradeManualDailyWageLists { get; set; }
}
/// <summary>
/// لیست ارتقاء
/// </summary>
public class UpgradeManualDailyWageList
{
/// <summary>
/// تاریخ شروع و پایان بازه ارتقاء
/// </summary>
public string StartEndDate { get; set; }
/// <summary>
/// دستمزد روزانه
/// </summary>
public string DailyWage { get; set; }
}

View File

@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Transactions;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Employee;
@@ -128,282 +125,4 @@ public interface IEmployerApplication
#endregion
Task<OperationResult> CreateWorkflowRegistration(CreateEmployerWorkflowRegistration command);
/// <summary>
/// ویرایش کارفرما در گردش کار ثبت نام
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> EditWorkflowRegistration(EditEmployerWorkflowRegistration command);
/// <summary>
/// حذف کارفرما از گردش کار ثبت نام
/// </summary>
/// <param name="employerId">شناسه کارفرما</param>
/// <param name="institutionWorkshopDetailsId">شناسه جزئیات کارگاه موسسه</param>
/// <returns></returns>
Task<OperationResult> DeleteWorkflowRegistration(long employerId, long institutionWorkshopDetailsId);
Task<OperationResult<AuthenticateUserViewModel>> AuthenticateEmployer(string nationalCode, string dateOfBirth, string mobile);
}
public class AuthenticateUserViewModel
{
/// <summary>
/// نام
/// </summary>
public string FName { get; set; }
/// <summary>
/// نام خانوادگی
/// </summary>
public string LName { get; set; }
/// <summary>
/// نام پدر
/// </summary>
public string FatherName { get; set; }
/// <summary>
/// جنسیت
/// </summary>
public Gender Gender { get; set; }
/// <summary>
/// کد ملی
/// </summary>
public string NationalCode { get; set; }
public string DateOfBirth { get; set; }
/// <summary>
/// سری شناسنامه
/// </summary>
public string IdNumberSeri { get; set; }
/// <summary>
/// سریال شناسنامه
/// </summary>
public string IdNumberSerial { get; set; }
/// <summary>
/// شماره شناسنامه
/// </summary>
public string IdNumber { get; set; }
/// <summary>
/// شماره همراه
/// </summary>
public string Phone { get; set; }
}
/// <summary>
/// کلاس ثبت کارفرما در گردش کار - شامل اطلاعات کارفرمای حقیقی و حقوقی
/// </summary>
public class CreateEmployerWorkflowRegistration
{
/// <summary>
/// اطلاعات کارفرمای حقیقی
/// </summary>
public CreateRealEmployerWorkflowRegistration RealEmployer { get; set; }
/// <summary>
/// اطلاعات کارفرمای حقوقی
/// </summary>
public CreateLegalEmployerWorkflowRegistration LegalEmployer { get; set; }
/// <summary>
/// نوع حقوقی
/// </summary>
public LegalType LegalType { get; set; }
/// <summary>
/// شناسه جزئیات کارگاه موسسه
/// </summary>
public long InstitutionWorkshopDetailsId { get; set; }
/// <summary>
/// شناسه قرارداد موسسه
/// </summary>
public long InstitutionContractId { get; set; }
/// <summary>
/// شناسه طرف قرارداد
/// </summary>
public long ContractingPartyId { get; set; }
}
/// <summary>
/// کلاس ثبت کارفرمای حقوقی در گردش کار - شامل اطلاعات شرکت و مدیرعامل
/// </summary>
public class CreateLegalEmployerWorkflowRegistration
{
/// <summary>
/// نام شرکت
/// </summary>
public string CompanyName { get; set; }
/// <summary>
/// شماره ثبت
/// </summary>
public string RegisterId { get; set; }
/// <summary>
/// شناسه ملی شرکت
/// </summary>
public string NationalId { get; set; }
/// <summary>
/// جنسیت
/// </summary>
public Gender Gender { get; set; }
/// <summary>
/// وضعیت احراز هویت
/// </summary>
public bool IsAuth { get; set; }
/// <summary>
/// کد ملی مدیرعامل
/// </summary>
public string CeoNationalCode { get; set; }
/// <summary>
/// شماره شناسنامه مدیرعامل
/// </summary>
public string CeoIdNumber { get; set; }
/// <summary>
/// نام مدیرعامل
/// </summary>
public string CeoFName { get; set; }
/// <summary>
/// نام خانوادگی مدیرعامل
/// </summary>
public string CeoLName { get; set; }
/// <summary>
/// نام پدر مدیرعامل
/// </summary>
public string CeoFatherName { get; set; }
/// <summary>
/// تاریخ تولد مدیرعامل
/// </summary>
public string CeoDateOfBirth { get; set; }
/// <summary>
/// محل صدور شناسنامه مدیرعامل
/// </summary>
public string CeoPlaceOfIssue { get; set; }
/// <summary>
/// تاریخ صدور شناسنامه مدیرعامل
/// </summary>
public string CeoDateOfIssue { get; set; }
/// <summary>
/// شماره موبایل
/// </summary>
public string PhoneNumber { get; set; }
/// <summary>
/// شماره تلفن ثابت
/// </summary>
public string TelephoneNumber { get; set; }
/// <summary>
/// اطلاعات سیستم دولتی
/// </summary>
public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
}
/// <summary>
/// کلاس ثبت کارفرمای حقیقی در گردش کار - شامل اطلاعات شخصی کارفرما
/// </summary>
public class CreateRealEmployerWorkflowRegistration
{
/// <summary>
/// جنسیت
/// </summary>
public Gender Gender { get; set; }
/// <summary>
/// وضعیت احراز هویت
/// </summary>
public bool IsAuth { get; set; }
/// <summary>
/// کد ملی
/// </summary>
public string NationalCode { get; set; }
/// <summary>
/// شماره شناسنامه
/// </summary>
public string IdNumber { get; set; }
/// <summary>
/// نام
/// </summary>
public string FName { get; set; }
/// <summary>
/// نام خانوادگی
/// </summary>
public string LName { get; set; }
/// <summary>
/// نام پدر
/// </summary>
public string FatherName { get; set; }
/// <summary>
/// تاریخ تولد
/// </summary>
public string DateOfBirth { get; set; }
/// <summary>
/// شماره موبایل
/// </summary>
public string PhoneNumber { get; set; }
/// <summary>
/// محل صدور شناسنامه
/// </summary>
public string PlaceOfIssue { get; set; }
/// <summary>
/// تاریخ صدور شناسنامه
/// </summary>
public string DateOfIssue { get; set; }
/// <summary>
/// اطلاعات سیستم دولتی
/// </summary>
public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
/// <summary>
/// شماره تلفن
/// </summary>
public string Telephone { get; set; }
}
/// <summary>
/// کلاس ویرایش کارفرما در گردش کار - شامل اطلاعات کارفرمای حقیقی و حقوقی
/// </summary>
public class EditEmployerWorkflowRegistration : CreateEmployerWorkflowRegistration
{
/// <summary>
/// شناسه کارفرما
/// </summary>
public long EmployerId { get; set; }
}
}

View File

@@ -1,316 +1,29 @@
using System.Collections.Generic;
using System.Security.AccessControl;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
using CompanyManagment.App.Contracts.Workshop;
namespace CompanyManagment.App.Contracts.InstitutionContract;
/// <summary>
/// درخواست ایجاد قرارداد نهاد
/// </summary>
public class CreateInstitutionContractRequest
{
/// <summary>
/// نوع حقوقی طرف قرارداد (حقیقی یا حقوقی)
/// </summary>
public LegalType ContractingPartyLegalType { get; set; }
/// <summary>
/// اطلاعات شخص حقیقی
/// </summary>
public CreateInstitutionContractRealPartyRequest RealParty { get; set; }
/// <summary>
/// اطلاعات شخص حقوقی
/// </summary>
public CreateInstitutionContractLegalPartyRequest LegalParty { get; set; }
/// <summary>
/// آیدی معرف
/// </summary>
public long RepresentativeId { get; set; }
/// <summary>
/// مدت زمان قرارداد
/// </summary>
public InstitutionContractDuration Duration { get; set; }
/// <summary>
/// استان
/// </summary>
public string Province { get; set; }
/// <summary>
/// شهر
/// </summary>
public string City { get; set; }
/// <summary>
/// آدرس
/// </summary>
public string Address { get; set; }
/// <summary>
/// اطلاعات تماس
/// </summary>
public List<CreateContactInfo> ContactInfos { get; set; }
/// <summary>
/// لیست کارگاه‌های مورد نظر برای قرارداد
/// </summary>
public List<CreateInstitutionContractWorkshopDetail> Workshops { get; set; }
/// <summary>
/// تاریخ شروع قرارداد (فارسی)
/// </summary>
public long ContractingPartyId { get; set; }
public long RepresentativeId { get; set; }
public string TypeOfContract { get; set; }
public string ContractDateFa { get; set; }
public string ContractStartFa { get; set; }
/// <summary>
/// مبلغ خسارت روزانه
/// </summary>
public double DailyCompensation { get; set; }
/// <summary>
/// وجه التزام
/// </summary>
public double Obligation { get; set; }
/// <summary>
/// توضیحات
/// </summary>
public string ContractEndFa { get; set; }
public string Address { get; set; }
public string State { get; set; }
public string City { get; set; }
public string OfficialCompany { get; set; }
public string HasValueAddedTax { get; set; }
public string ContractAmountString { get; set; }
public string DailyCompenseationString { get; set; }
public string ObligationString { get; set; }
public string TotalAmountString { get; set; }
public string ValueAddedTaxStr { get; set; }
public string WorkshopManualCount { get; set; }
public string EmployeeManualCount { get; set; }
public string Description { get; set; }
/// <summary>
/// مبلغ کل قرارداد
/// </summary>
public double TotalAmount { get; set; }
/// <summary>
/// آیا قرارداد اقساطی است؟
/// </summary>
public bool IsInstallment { get; set; }
/// <summary>
/// مالیات ارزش افزوده
/// </summary>
public double TaxAmount { get; set; }
}
/// <summary>
/// مدت زمان قرارداد نهاد
/// </summary>
public enum InstitutionContractDuration
{
/// <summary>
/// یک ماهه
/// </summary>
OneMonth = 1,
/// <summary>
/// سه ماهه
/// </summary>
ThreeMonths = 3,
/// <summary>
/// شش ماهه
/// </summary>
SixMonths = 6,
/// <summary>
/// دوازده ماهه
/// </summary>
TwelveMonths = 12
}
/// <summary>
/// جزئیات کارگاه در درخواست ایجاد قرارداد نهاد
/// </summary>
public class CreateInstitutionContractWorkshopDetail
{
/// <summary>
/// شناسه کارگاه (اختیاری - در صورت وجود کارگاه از قبل)
/// </summary>
public long? WorkshopId { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; set; }
/// <summary>
/// پلن حضور و غیاب
/// </summary>
public bool HasRollCallPlan { get; set; }
/// <summary>
/// پلن فیش غیر رسمی
/// </summary>
public bool HasCustomizeCheckoutPlan { get; set; }
/// <summary>
/// پلن قرارداد و تصفیه
/// </summary>
public bool HasContractPlan { get; set; }
/// <summary>
/// پلن قرارداد و تصفیه حضوری
/// </summary>
public bool HasContractPlanInPerson { get; set; }
/// <summary>
/// پلن بیمه
/// </summary>
public bool HasInsurancePlan { get; set; }
/// <summary>
/// پلن بیمه حضوری
/// </summary>
public bool HasInsurancePlanInPerson { get; set; }
/// <summary>
/// تعداد پرسنل کارگاه
/// </summary>
public int PersonnelCount { get; set; }
/// <summary>
/// مبلغ
/// </summary>
public double Price { get; set; }
}
/// <summary>
/// درخواست ایجاد طرف حقیقی در قرارداد نهاد
/// </summary>
public class CreateInstitutionContractRealPartyRequest
{
/// <summary>
/// کد ملی
/// </summary>
public string NationalCode { get; set; }
/// <summary>
/// تاریخ تولد فارسی
/// </summary>
public string BirthDateFa { get; set; }
/// <summary>
/// شماره تلفن
/// </summary>
public string PhoneNumber { get; set; }
/// <summary>
/// وضعیت احراز هویت
/// </summary>
public bool IsAuth { get; set; }
/// <summary>
/// نام
/// </summary>
public string FName { get; set; }
/// <summary>
/// نام خانوادگی
/// </summary>
public string LName { get; set; }
/// <summary>
/// نام پدر
/// </summary>
public string FatherName { get; set; }
/// <summary>
/// شماره شناسنامه
/// </summary>
public string IdNumber { get; set; }
/// <summary>
/// شناسه موقت طرف قرارداد
/// </summary>
public long ContractingPartyTempId { get; set; }
/// <summary>
/// جنسیت
/// </summary>
public Gender Gender { get; set; }
}
/// <summary>
/// درخواست ایجاد طرف حقوقی در قرارداد نهاد
/// </summary>
public class CreateInstitutionContractLegalPartyRequest
{
/// <summary>
/// نام شرکت
/// </summary>
public string CompanyName { get; set; }
/// <summary>
/// شماره ثبت
/// </summary>
public string RegisterId { get; set; }
/// <summary>
/// شناسه ملی شرکت
/// </summary>
public string NationalId { get; set; }
/// <summary>
/// شماره تلفن شرکت
/// </summary>
public string PhoneNumber { get; set; }
/// <summary>
/// شناسه موقت طرف قرارداد
/// </summary>
public long ContractingPartyTempId { get; set; }
/// <summary>
/// کد ملی نماینده قانونی
/// </summary>
public string NationalCode { get; set; }
/// <summary>
/// تاریخ تولد نماینده قانونی فارسی
/// </summary>
public string BirthDateFa { get; set; }
/// <summary>
/// نام نماینده قانونی
/// </summary>
public string FName { get; set; }
/// <summary>
/// نام خانوادگی نماینده قانونی
/// </summary>
public string LName { get; set; }
/// <summary>
/// نام پدر نماینده قانونی
/// </summary>
public string FatherName { get; set; }
/// <summary>
/// شماره شناسنامه نماینده قانونی
/// </summary>
public string IdNumber { get; set; }
/// <summary>
/// وضعیت احراز هویت نماینده قانونی
/// </summary>
public bool IsAuth { get; set; }
/// <summary>
/// سمت نماینده قانونی در شرکت
/// </summary>
public string Position { get; set; }
/// <summary>
/// جنسیت نماینده قانونی
/// </summary>
public Gender Gender { get; set; }
public int ExtensionNo { get; set; }
}

View File

@@ -3,5 +3,4 @@ namespace CompanyManagment.App.Contracts.InstitutionContract;
public class EditInstitutionContractRequest:CreateInstitutionContractRequest
{
public long Id { get; set; }
public long ContractingPartyId { get; set; }
}

View File

@@ -77,12 +77,10 @@ public class GetInstitutionContractListItemsViewModel
/// <summary>
/// وضعیت قرارداد
/// </summary>
public InstitutionContractListStatus ListStatus { get; set; }
public InstitutionContractStatus Status { get; set; }
/// <summary>
/// آیا منقضی شده است
/// </summary>
public bool IsExpired { get; set; }
public long ContractingPartyId { get; set; }
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
@@ -11,149 +10,53 @@ using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.InstitutionContract;
/// <summary>
/// رابط اپلیکیشن قراردادهای مؤسسه
/// مدیریت عملیات مربوط به قراردادهای مالی مؤسسات
/// </summary>
public interface IInstitutionContractApplication
{
/// <summary>
/// ایجاد قرارداد جدید
/// </summary>
/// <param name="command">اطلاعات قرارداد جدید</param>
/// <returns>نتیجه عملیات</returns>
OperationResult Create(CreateInstitutionContract command);
/// <summary>
/// تمدید قرارداد موجود
/// </summary>
/// <param name="command">اطلاعات قرارداد برای تمدید</param>
/// <returns>نتیجه عملیات</returns>
OperationResult Extension(CreateInstitutionContract command);
/// <summary>
/// ویرایش قرارداد موجود
/// </summary>
/// <param name="command">اطلاعات جدید قرارداد</param>
/// <returns>نتیجه عملیات</returns>
OperationResult Edit(EditInstitutionContract command);
/// <summary>
/// دریافت جزئیات قرارداد برای ویرایش
/// </summary>
/// <param name="id">شناسه قرارداد</param>
/// <returns>اطلاعات قرارداد</returns>
EditInstitutionContract GetDetails(long id);
/// <summary>
/// جستجو در قراردادها
/// </summary>
/// <param name="searchModel">مدل جستجو</param>
/// <returns>لیست قراردادها</returns>
List<InstitutionContractViewModel> Search(InstitutionContractSearchModel searchModel);
/// <summary>
/// جستجوی جدید در قراردادها
/// </summary>
/// <param name="searchModel">مدل جستجو</param>
/// <returns>لیست قراردادها</returns>
List<InstitutionContractViewModel> NewSearch(InstitutionContractSearchModel searchModel);
/// <summary>
/// دریافت اطلاعات قرارداد های مالی فعال
/// دریافت اطلاعات قزداد های مالی فعال
///دارای کارگاه
/// جهت ست کردن سرویس ها از طریق اکسل
/// </summary>
/// <returns></returns>
List<InstitutionContractViewModel> GetInstitutionContractToSetServicesExcelImport();
/// <summary>
/// چاپ مجموعه قراردادها
/// </summary>
/// <param name="id">لیست شناسه قراردادها</param>
/// <returns>لیست قراردادها برای چاپ</returns>
List<InstitutionContractViewModel> PrintAll(List<long> id);
/// <summary>
/// چاپ یک قرارداد
/// </summary>
/// <param name="id">شناسه قرارداد</param>
/// <returns>اطلاعات قرارداد برای چاپ</returns>
InstitutionContractViewModel PrintOne(long id);
/// <summary>
/// فعال کردن قرارداد
/// </summary>
/// <param name="id">شناسه قرارداد</param>
/// <returns>نتیجه عملیات</returns>
OperationResult Active(long id);
/// <summary>
/// غیرفعال کردن قرارداد
/// </summary>
/// <param name="id">شناسه قرارداد</param>
/// <returns>نتیجه عملیات</returns>
OperationResult DeActive(long id);
/// <summary>
/// غیرفعال کردن قرارداد (حالت آبی)
/// </summary>
/// <param name="id">شناسه قرارداد</param>
/// <returns>نتیجه عملیات</returns>
OperationResult DeActiveBlue(long id);
/// <summary>
/// غیرفعال کردن تمام اتصالات قرارداد
/// </summary>
/// <param name="id">شناسه قرارداد</param>
/// <returns>نتیجه عملیات</returns>
OperationResult DeActiveAllConnections(long id);
/// <summary>
/// فعال کردن مجدد تمام اتصالات قرارداد
/// </summary>
/// <param name="id">شناسه قرارداد</param>
/// <returns>نتیجه عملیات</returns>
OperationResult ReActiveAllConnections(long id);
/// <summary>
/// فعال کردن مجدد تمام قراردادها بعد از ایجاد قرارداد جدید
/// </summary>
/// <param name="contractingPartyId">شناسه طرف قرارداد</param>
void ReActiveAllAfterCreateNew(long contractingPartyId);
/// <summary>
/// حذف قرارداد
/// </summary>
/// <param name="id">شناسه قرارداد</param>
void RemoveContract(long id);
/// <summary>
/// امضای قرارداد
/// </summary>
/// <param name="id">شناسه قرارداد</param>
/// <returns>نتیجه عملیات</returns>
OperationResult Sign(long id);
/// <summary>
/// لغو امضای قرارداد
/// </summary>
/// <param name="id">شناسه قرارداد</param>
/// <returns>نتیجه عملیات</returns>
OperationResult UnSign(long id);
/// <summary>
/// ایجاد حساب کاربری برای طرف قرارداد
/// </summary>
/// <param name="contractingPartyid">شناسه طرف قرارداد</param>
/// <param name="accountId">شناسه حساب کاربری</param>
void CreateContractingPartyAccount(long contractingPartyid, long accountId);
/// <summary>
/// محاسبه مبلغ قرارداد بر اساس تعداد افراد
/// </summary>
/// <param name="countPerson">تعداد افراد</param>
/// <returns>مبلغ قرارداد</returns>
double GetcontractAmount(int countPerson);
#region Api
@@ -179,14 +82,12 @@ public interface IInstitutionContractApplication
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> CreateAsync(CreateInstitutionContractRequest command);
/// <summary>
/// ویرایش
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> EditAsync(EditInstitutionContractRequest command);
/// <summary>
/// تمدید قرارداد
/// </summary>
@@ -194,108 +95,39 @@ public interface IInstitutionContractApplication
/// <returns></returns>
Task<OperationResult> ExtensionَAsync(CreateInstitutionContractRequest command);
/// <summary>
/// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
/// جهت نمایش در کارپوشه
/// </summary>
/// <returns></returns>
Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList();
/// <summary>
/// دریافت آیتم های کارپوشه ثبت نام
/// </summary>
/// <param name="institutionContractId"></param>
/// <returns></returns>
Task<List<RegistrationWorkflowItemsViewModel>> RegistrationWorkflowItems(long institutionContractId);
#endregion
}
public class GetInstitutionContractListStatsViewModel
{
/// <summary>
/// مجموع بدهی قراردادهای مؤسسه
/// این ویژگی بدهی‌های قراردادهای مربوطه را تجمیع می‌کند و
/// یک معیار واحد برای اندازه‌گیری تعهدات مالی ارائه می‌دهد
/// Represents the total outstanding debt of institution contracts.
/// This property aggregates the liabilities of the respective contracts and provides
/// a single metric to measure financial obligations.
/// </summary>
public double TotalDebt { get; set; }
/// <summary>
/// مجموع ارزش پولی مرتبط با قراردادهای مؤسسه
/// این ویژگی مبلغ کل قراردادهای مربوطه را برای
/// گزارش‌گیری و تجزیه و تحلیل مالی تجمیع می‌کند
/// Represents the total monetary value associated with institution contracts.
/// This property consolidates the aggregate amount from relevant contracts
/// for financial reporting and analysis.
/// </summary>
public double TotalAmount { get; set; }
/// <summary>
/// مجموعه‌ای از تعداد قراردادهای مؤسسه دسته‌بندی شده بر اساس وضعیت
/// این ویژگی تعداد قراردادها را برای هر وضعیت تعریف شده در
/// شمارش InstitutionContractStatus ارائه می‌دهد که امکان تجزیه و تحلیل و نظارت بر توزیع قراردادها را فراهم می‌کند
/// Represents a collection of counts for institution contracts categorized by their status.
/// This property provides the count of contracts for each status defined in the
/// InstitutionContractStatus enumeration, enabling analysis and monitoring of contract distribution.
/// </summary>
public List<InstitutionContractStatusCount> Counts { get; set; }
public List<InstitutionContractStatusCount> Counts { get; set; }
}
/// <summary>
/// شمارش وضعیت قراردادهای مؤسسه
/// نمایش تعداد قراردادها برای هر وضعیت خاص
/// </summary>
public class InstitutionContractStatusCount
{
/// <summary>
/// وضعیت لیست قرارداد
/// </summary>
public InstitutionContractListStatus ListStatus { get; set; }
/// <summary>
/// تعداد قراردادها در این وضعیت
/// </summary>
public InstitutionContractStatus Status { get; set; }
public int Count { get; set; }
}
/// <summary>
/// درخواست تمدید قرارداد مؤسسه
/// شامل اطلاعات قرارداد قبلی برای فرآیند تمدید
/// </summary>
public class ExtenstionInstitutionContractRequest : EditInstitutionContractRequest
public class ExtenstionInstitutionContractRequest:EditInstitutionContractRequest
{
/// <summary>
/// شناسه قرارداد قبلی که قرار است تمدید شود
/// </summary>
public long PreviousContractId { get; set; }
}
/// <summary>
/// مدل نمایش اقساط قرارداد مؤسسه
/// شامل اطلاعات مربوط به هر قسط از قرارداد
/// </summary>
public class InstitutionContractInstallmentViewModel
{
/// <summary>
/// شناسه یکتای قسط
/// </summary>
public long Id { get; set; }
/// <summary>
/// تاریخ میلادی قسط
/// </summary>
public DateTime InstallmentDateGr { get; set; }
/// <summary>
/// تاریخ فارسی قسط
/// </summary>
public string InstallmentDateFa { get; set; }
/// <summary>
/// مبلغ قسط
/// </summary>
public double Amount { get; set; }
/// <summary>
/// توضیحات قسط
/// </summary>
public string Description { get; set; }
/// <summary>
/// شناسه قرارداد مؤسسه مربوط به این قسط
/// </summary>
public long InstitutionContractId { get; set; }
}
}

View File

@@ -42,7 +42,7 @@ public class InstitutionContractListSearchModel :PaginationRequest
/// <summary>
/// تب
/// </summary>
public InstitutionContractListStatus? Status { get; set; }
public InstitutionContractStatus? Status { get; set; }
/// <summary>
/// فعال / غیرفعال

View File

@@ -1,6 +1,6 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
public enum InstitutionContractListStatus
public enum InstitutionContractStatus
{
Active,
Deactive,
@@ -8,5 +8,5 @@ public enum InstitutionContractListStatus
Block,
Free,
PendingForRenewal,
WithoutWorkshop
WithoutWorkshop,
}

View File

@@ -1,92 +0,0 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class RegistrationWorkflowMainListViewModel
{
/// <summary>
/// شناسه قرارداد موسسه
/// </summary>
public long InstitutionContractId { get; set; }
/// <summary>
/// نام کامل طرف حساب
/// </summary>
public string ContractingPartyFullName { get; set; }
/// <summary>
/// شماره همراه
/// </summary>
public string Phone { get; set; }
/// <summary>
/// تعداد کارگاه‌های انجام شده
/// </summary>
public int DoneWorkshops { get; set; }
/// <summary>
/// تعداد کارگاه‌های انجام نشده
/// </summary>
public int UnDoneWorkshops { get; set; }
/// <summary>
/// تعداد کل کارگاه‌ها
/// </summary>
public int TotalWorkshops { get; set; }
/// <summary>
/// مبلغ
/// </summary>
public double Amount { get; set; }
public long ContractingPartyId { get; set; }
}
/// <summary>
/// مدل نمایش آیتم‌های گردش کار ثبت نام
/// </summary>
public class RegistrationWorkflowItemsViewModel
{
/// <summary>
/// لیست کارفرمایان
/// </summary>
public List<RegistrationWorkflowItemsEmployerViewModel> Employers { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; set; }
/// <summary>
/// تعداد پرسنل
/// </summary>
public int PersonnelCount { get; set; }
/// <summary>
/// قیمت
/// </summary>
public double Price { get; set; }
/// <summary>
/// وضعیت انجام شدن
/// </summary>
public bool IsDone { get; set; }
public long WorkshopDetailsId { get; set; }
}
/// <summary>
/// مدل نمایش کارفرما در آیتم‌های گردش کار ثبت نام
/// </summary>
public class RegistrationWorkflowItemsEmployerViewModel
{
/// <summary>
/// نام و نام خانوادگی
/// </summary>
public string FullName { get; set; }
/// <summary>
/// شناسه
/// </summary>
public long Id { get; set; }
}

View File

@@ -1,37 +0,0 @@
using _0_Framework.Application;
using System.Collections.Generic;
using System.Security.AccessControl;
using System.Threading.Tasks;
using CompanyManagment.App.Contracts.Workshop;
namespace CompanyManagment.App.Contracts.Law
{
public interface ILawApplication
{
OperationResult Create(CreateLaw command);
OperationResult Edit(EditLaw command);
OperationResult Activate(long id);
OperationResult Deactivate(long id);
OperationResult ActivateByType(LawType type);
OperationResult DeactivateByType(LawType type);
EditLaw GetDetails(long id);
Task<List<LawViewModel>> GetList(LawSearchModel searchModel);
Task<LawViewModel> GetLawWithItems(long id);
Task<LawViewModel> GetLawByType(LawType type);
OperationResult UpsertLaw(EditLaw command);
}
public class LawSearchModel
{
public string Title { get; set; }
public string Text { get; set; }
}
public enum LawType
{
/// <summary>
/// ثبت نام
/// </summary>
Register
}
}

View File

@@ -1,47 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace CompanyManagment.App.Contracts.Law
{
public class LawViewModel
{
public long Id { get; set; }
public string Title { get; set; }
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
public List<LawItemViewModel> Items { get; set; }
public LawType Type { get; set; }
public string HeadTitle { get; set; }
public List<string> Notifications { get; set; }
}
public class LawItemViewModel
{
public string Header { get; set; }
public string Details { get; set; }
// public int OrderNumber { get; set; }
}
public class CreateLaw
{
public string Title { get; set; }
public List<LawItemViewModel> Items { get; set; }
public LawType Type { get; set; }
public string HeadTitle { get; set; }
public List<string> Notifications { get; set; }
}
public class EditLaw
{
public long Id { get; set; }
public string Title { get; set; }
public List<LawItemViewModel> Items { get; set; }
public LawType Type { get; set; }
public string HeadTitle { get; set; }
public List<string> Notifications { get; set; }
}
}

View File

@@ -37,4 +37,5 @@ public class CreateLeave
public List<CustomizeRotatingShiftsViewModel> RotatingShifts { get; set; }
public bool HasRollCall { get; set; }
public CustomizeRotatingShiftsViewModel SelectedShift { get; set; }
public bool IsInvallid { get; set; }
}

View File

@@ -14,5 +14,8 @@ namespace CompanyManagment.App.Contracts.Leave
public string LeftWorlErrMessage { get; set; }
public bool HasNotContract { get; set; }
public string ContractErrMessage { get; set; }
public bool HasHolidayError { get; set; }
public string HolidayErrorMessage { get; set; }
}
}

View File

@@ -27,4 +27,5 @@ public class LeavePrintViewModel
public string MonthGr { get; set; }
public int PrintCounter { get; set; }
public List<EmprViewModel> EmployerList { get; set; }
public bool IsInvalid { get; set; }
}

View File

@@ -20,4 +20,5 @@ public class LeaveSearchModel
public int Year { get; set; }
public int Month { get; set; }
public int PageIndex { get; set; }
public bool IsInvalid { get; set; }
}

View File

@@ -27,4 +27,5 @@ public class LeaveViewModel
public TimeSpan ShiftDuration { get; set; }
public bool HasShiftDuration { get; set; }
public bool IsInvalid { get; set; }
}

View File

@@ -8,7 +8,8 @@ namespace CompanyManagment.App.Contracts.RollCall;
public interface IRollCallMandatoryApplication
{
bool HasRollCallRecord(long employeeId, long workshopId, DateTime contractStart);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, double dailyWageUnAffected, bool totalLeaveCompute);
/// <summary>
/// گزارش نوبت کاری حضور غیاب

View File

@@ -67,7 +67,7 @@ public class CreateInstitutionContractTemp
/// -
/// Completed ثبت نام تکمیل شده
/// </summary>
public InstitutionContractTempStatus RegistrationStatus { get; set; }
public string RegistrationStatus { get; set; }
/// <summary>
/// آی دی پیامک ارسال شده

View File

@@ -16,7 +16,20 @@ public class CreateWorkshopTemp
/// ای دی طرف حساب
/// </summary>
public long ContractingPartyTempId { get; set; }
/// <summary>
/// جمع کل مبالغ سرویس ها برای کارگاه
/// Double
/// </summary>
public double WorkshopServicesAmount { get; set; }
/// <summary>
/// جمع کل مبالغ سرویس ها برای کارگاه
/// فارسی
/// </summary>
public string WorkshopServicesAmountStr { get; set; }
#region ServiceSelection
/// <summary>

View File

@@ -2,10 +2,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.InstitutionPlan;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
@@ -19,7 +16,7 @@ public interface ITemporaryClientRegistrationApplication
/// <param name="mobile"></param>
/// <returns></returns>
Task<OperationResult<ContractingPartyTempViewModel>> CreateContractingPartyTemp(string nationalCode, string dateOfBirth, string mobile);
/// <summary>
/// تکمیل اطلاعات
/// </summary>
@@ -55,25 +52,11 @@ public interface ITemporaryClientRegistrationApplication
/// دریافت مبالغ بررسی و پرداخت
/// </summary>
/// <param name="contractingPartyTempId"></param>
/// <param name="duration"></param>
/// <param name="periodModel"></param>
/// <param name="paymentModel"></param>
/// <returns></returns>
Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string paymentModel = "OneTime", string contractStartType = "currentMonth");
/// <summary>
/// دریافت مبالغ بررسی و پرداخت با لیست کارگاه ها
/// این متد برای زمانی است که کارگاه ها در مرحله ثبت نام موقت هستند
/// و هنوز در دیتابیس ثبت نشده اند
/// </summary>
/// <param name="totalPaymentMonth"></param>
/// <param name="duration"></param>
/// <param name="hasInPersonContract"></param>
/// <param name="contractingPartyTempId"></param>
/// <param name="paymentModel"></param>
/// <returns></returns>
Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(double totalPaymentMonth,
InstitutionContractDuration duration , bool hasInPersonContract);
string periodModel = "12", string paymentModel = "OneTime", string contractStartType = "currentMonth");
/// <summary>
/// ایجاد یا ویرایش قرارداد موقت
@@ -111,14 +94,10 @@ public interface ITemporaryClientRegistrationApplication
/// <returns></returns>
Task<OperationResult> PayOffCompleted(long contractingPartyTempId);
/// <summary>
/// ارسال لینک تایید قوانین و مقررات به طرف حساب
/// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
/// جهت نمایش در کارپوشه
/// </summary>
/// <param name="contractingPartyTempId"></param>
/// <returns></returns>
Task<OperationResult> SendAgreementLink(long contractingPartyTempId);
}
Task<List<RegistrationWorkflowMainList>> RegistrationWorkflowMainList();
}

View File

@@ -3,14 +3,4 @@
public class InstitutionContractTempViewModel : CreateInstitutionContractTemp
{
public long Id { get; set; }
}
public enum InstitutionContractTempStatus
{
BeforeSendVerifyCode,
VerifyCodeSent,
PendingToCompletion,
ReceivedCodeFromClient,
Completed
}

View File

@@ -0,0 +1,21 @@
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
public class RegistrationWorkflowMainList
{
/// <summary>
/// آی دی طرف حساب ثبت شده موقت
/// </summary>
public long ContractingPartyTempId { get; set; }
/// <summary>
/// نام کامل طرف حساب
/// </summary>
public string ContractingPartyFullName { get; set; }
/// <summary>
/// شماره همراه
/// </summary>
public string Phone { get; set; }
}

View File

@@ -1,22 +1,30 @@
using System;
using System.Collections.Generic;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.Workshop;
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
public class ReviewAndPaymentViewModel
{
/// <summary>
/// جمع کل
/// double
/// </summary>
public double SumOfWorkshopsPaymentDouble { get; set; }
/// <summary>
/// تخفیف
/// جمع کل
/// string
/// </summary>
public string Discount { get; set; }
public string SumOfWorkshopsPaymentPaymentStr { get; set; }
/// <summary>
/// مقدار جمع مبلغ کارگاه ها
/// مبلغ پرداخت بدون مالیات
/// Double
/// </summary>
public string SumOfWorkshopsPayment { get; set; }
public double OneTimeWithoutTaxPaymentDouble { get; set; }
/// <summary>
/// مبلغ پرداخت بدون مالیات
@@ -24,44 +32,118 @@ public class ReviewAndPaymentViewModel
/// </summary>
public string OneTimeWithoutTaxPaymentStr { get; set; }
/// <summary>
/// مبلغ پرداخت کامل
/// Double
/// </summary>
public double OneTimeTotalPaymentDouble { get; set; }
/// <summary>
/// مبلغ پرداخت کامل
/// string
/// </summary>
public string OneTimeTotalPaymentStr { get; set; }
/// <summary>
/// مبلغ پرداخت بدون مالیات ماهانه
/// مبلغ پرداخت بدون مالیات
/// Double
/// </summary>
public double MonthlyWithoutTaxPaymentDouble { get; set; }
/// <summary>
/// مبلغ پرداخت بدون مالیات
/// string
/// </summary>
public string MonthlyWithoutTaxPaymentStr { get; set; }
/// <summary>
/// مبلغ پرداخت کامل ماهانه
/// string
/// مبلغ پرداخت کامل
/// Double
/// </summary>
public double MonthlyTotalPaymentDouble { get; set; }
/// <summary>
/// مبلغ پرداخت کامل
/// string
/// </summary>
public string MonthlyTotalPaymentStr { get; set; }
/// <summary>
/// مالیات بر ارزش افزوده
/// Double
/// </summary>
public double ValueAddedTaxDouble { get; set; }
/// <summary>
/// مالیات بر ارزش افزوده
/// string
/// </summary>
public string ValueAddedTaxStr { get; set; }
public string ValueAddedTaxSt { get; set; }
/// <summary>
/// بازه قرداد
/// با عدد مشخص میشود
/// مثلا یک ماه عدد 1
/// </summary>
public string PeriodModel { get; set; }
/// <summary>
/// OneTime پرداخت یکجا
/// -
/// Monthly پرداخت ماهانه
/// </summary>
public string PaymentModel { get; set; }
/// <summary>
/// لیست کارگاه های ایجاد شده
/// </summary>
public List<WorkshopTempViewModel> WorkshopTempViewList { get; set; }
/// <summary>
/// آی دی طرف حساب
/// </summary>
public long ContractingPartTempId { get; set; }
/// <summary>
/// لیست اقساط ماهیانه
/// </summary>
public List<MonthlyInstallment> MonthlyInstallments { get; set; }
/// <summary>
/// شروع قرارداد - شمسی
/// </summary>
public string ContractStartFa { get; set; }
/// <summary>
/// شروع قرارداد - میلادی
/// تاریخ شروع قرارداد در اول ماه جاری
/// -
/// شمسی
/// </summary>
public DateTime ContractStartGr { get; set; }
public string ContractStartCurrentMonthFa { get; set; }
/// <summary>
/// تاریخ شروع قرارداد در اول ماه جاری
/// -
/// میلادی
/// </summary>
public DateTime ContractStartCurrentMonthGr { get; set; }
/// <summary>
/// تاریخ شروع قرارداد در اول ماه بعد
/// -
/// شمسی
/// </summary>
public string ContractStartNextMonthFa{ get; set; }
/// <summary>
/// تاریخ شروع قرارداد در اول ماه بعد
/// -
/// میلادی
/// </summary>
public DateTime ContractStartNextMonthGr { get; set; }
/// <summary>
/// تاریخ پایان قرارداد
@@ -76,8 +158,4 @@ public class ReviewAndPaymentViewModel
/// شمسی
/// </summary>
public string ContractEndFa { get; set; }
public string DailyCompensation { get; set; }
public string Obligation { get; set; }
public string DiscountedAmountForOneMonth { get; set; }
}

View File

@@ -3,16 +3,4 @@
public class WorkshopTempViewModel : CreateWorkshopTemp
{
public long Id { get; set; }
/// <summary>
/// جمع کل مبالغ سرویس ها برای کارگاه
/// Double
/// </summary>
public double WorkshopServicesAmount { get; set; }
/// <summary>
/// جمع کل مبالغ سرویس ها برای کارگاه
/// فارسی
/// </summary>
public string WorkshopServicesAmountStr { get; set; }
}

View File

@@ -311,4 +311,9 @@ public class CreateWorkingHoursTemp
public string WeeklyWorkingTime { get; set; }
public long ContractId { get; set; }
public long WorknigHoursId { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
}

View File

@@ -151,6 +151,5 @@ public class CreateWorkshop
/// تصفیه حساب بصورت استاتیک محاصبه شود
/// </summary>
public bool IsStaticCheckout { get; set; }
}

View File

@@ -1,4 +1,6 @@
namespace CompanyManagment.App.Contracts.Workshop.DTOs;
using System.ComponentModel.DataAnnotations.Schema;
namespace CompanyManagment.App.Contracts.Workshop.DTOs;
public class AutoExtensionEmployeeListDto
{
@@ -32,6 +34,17 @@ public class AutoExtensionEmployeeListDto
public bool EmployeeHasCreateContract { get; set; }
/// <summary>
/// دستمزد روزانه دریافت شده از سمت فرانت
/// </summary>
public string DailySalaryUnAffectedStr => "0";
/// <summary>
/// مزد سالانه نرمال دریافت از سمت فرانت
/// </summary>
public string NormalDailyWage => "0";
public string ContarctStart { get; set; }
public string ContractEnd { get; set; }

View File

@@ -4,7 +4,6 @@ using System.Threading.Tasks;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Account;
using CompanyManagment.App.Contracts.Workshop.DTOs;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.Workshop;
@@ -90,167 +89,4 @@ public interface IWorkshopApplication
#endregion
Task<ActionResult<OperationResult>> CreateWorkshopWorkflowRegistration(CreateWorkshopWorkflowRegistration command);
}
public class CreateWorkshopWorkflowRegistration
{
/// <summary>
/// شناس<D8A7><D8B3> جزئیات کارگاه قرارداد مؤسسه
/// </summary>
public long InstitutionContractWorkshopDetailId { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; set; }
/// <summary>
/// نام مستعار
/// </summary>
public string SureName { get; set; }
/// <summary>
/// نوع مالکیت
/// </summary>
public string TypeOfOwnership { get; set; }
/// <summary>
/// کد بایگانی
/// </summary>
public string ArchiveCode { get; set; }
/// <summary>
/// نام نماینده
/// </summary>
public string AgentName { get; set; }
/// <summary>
/// شناسه طرف قرارداد
/// </summary>
public long ContractingPartyId { get; set; }
/// <summary>
/// شهر
/// </summary>
public string City { get; set; }
/// <summary>
/// استان
/// </summary>
public string Province { get; set; }
/// <summary>
/// آدرس
/// </summary>
public string Address { get; set; }
/// <summary>
/// شناسه حساب کارشناس ارشد قرارداد
/// </summary>
public long SeniorContractAccountId { get; set; }
/// <summary>
/// شناسه حساب کارشناس قرارداد
/// </summary>
public long JuniorContractAccountId { get; set; }
/// <summary>
/// شناسه حساب کارشناس ارشد بیمه
/// </summary>
public long SeniorInsuranceAccountId { get; set; }
/// <summary>
/// شناسه حساب کارشناس بیمه
/// </summary>
public long JuniorInsuranceAccountId { get; set; }
/// <summary>
/// باز بودن در تعطیلات
/// </summary>
public bool OpenInHolidays { get; set; }
/// <summary>
/// محاسبه نوبت کاری در فیش حقوقی
/// </summary>
public bool RotatingShiftCompute { get; set; }
/// <summary>
/// ایجاد قرارداد
/// </summary>
public bool CreateContract { get; set; }
/// <summary>
/// امضاء قراداد
/// </summary>
public bool SignContract { get; set; }
/// <summary>
/// ایجات تصف<D8B5><D981>ه حساب
/// </summary>
public bool CreateCheckout { get; set; }
/// <summary>
/// امضاء تصفیه حساب
/// </summary>
public bool SignCheckout { get; set; }
/// <summary>
/// تصفیه حساب بصورت استاتیک محاصبه شود
/// </summary>
public bool IsStaticCheckout { get; set; }
/// <summary>
/// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
/// این آیتم
/// True
/// است
/// </summary>
public IsActive CutContractEndOfYear { get; set; }
/// <summary>
/// سرویس تصفیه حساب سفارشی
/// </summary>
public string HasCustomizeCheckoutService { get; set; }
/// <summary>
/// محاسبه اضافه کار فیش حقوقی در لیست بیمه
/// </summary>
public bool InsuranceCheckoutOvertime { get; set; }
/// <summary>
/// محاسبه حق اولاد در لیست بیمه
/// </summary>
public bool InsuranceCheckoutFamilyAllowance { get; set; }
/// <summary>
/// حضور و غیاب رایگان ویژه
/// </summary>
public string HasRollCallFreeVip { get; set; }
/// <summary>
/// مدت قرارداد
/// </summary>
public string ContractTerm { get; set; }
/// <summary>
/// مخفی کردن کل پرداخت
/// </summary>
public bool TotalPaymentHide { get; set; }
/// <summary>
/// نوع ارسال بیمه
/// </summary>
public string TypeOfInsuranceSend { get; set; }
/// <summary>
/// کد بیمه
/// </summary>
public string InsuranceCode { get; set; }
/// <summary>
/// مشمول دستمزد مقطوع
/// </summary>
public bool FixedSalary { get; set; }
/// <summary>
/// صنف
/// </summary>
public long InsuranceJobId { get; set; }
/// <summary>
/// جمعیت شهر
/// </summary>
public string Population { get; set; }
/// <summary>
/// شماره تماس نماینده کارگاه
/// </summary>
public string AgentPhone { get; set; }
public string TypeOfContract { get; set; }
/// <summary>
/// ردیف پیمان
/// </summary>
public string AgreementNumber { get; set; }
public string ComputeOptions { get; set; }
public bool AddYearsPay { get; set; }
public bool AddLeavePay { get; set; }
public string BonusesOptions { get; set; }
public string YearsOptions { get; set; }
}

View File

@@ -38,6 +38,46 @@ public class createContractModel
public long YearlySalaryId { get; set; }
public long EmployerId { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// دستمزد روزانه دریافت شده از سمت فرانت
/// </summary>
public string DailySalaryUnAffectedStr { get; set; }
/// <summary>
/// مزد سالانه نرمال دریافت از سمت فرانت
/// </summary>
public string NormalDailyWage { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
/// <summary>
/// آیا دستمزد روزانه دستی وارد شده است؟
/// </summary>
public bool HasManualDailyWage { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
}

View File

@@ -24,6 +24,11 @@ public class BaseYearDataViewModel
/// </summary>
public double BaseYearResult { get; set; }
/// <summary>
/// اولین روز شروع بکار
/// </summary>
public string FirstWorkDayInLeftWork { get; set; }
/// <summary>
/// لیست تمام پایه سنوات های محاسبه شده
/// </summary>
@@ -64,4 +69,29 @@ public class BaseYearDataList
/// سالی که در آن پایه سنوات تعلق گرفته
/// </summary>
public string Year { get; set; }
/// <summary>
///روزی که پایه سنوات تعلق گرفته
///یا شروع بکار. ترک کار
/// شمسی
/// </summary>
public string BaseYearPayDay { get; set; }
/// <summary>
/// روزی که پایه سنوات تعلق گرفته
///یا شروع بکار. ترک کار
/// میلادی
/// </summary>
public DateTime BaseYearPayDayGr { get; set; }
/// <summary>
/// آیا تاریخ شروع بکار دارد
/// </summary>
public bool HasStartWork { get; set; }
/// <summary>
/// آیا تاریخ پایان کار دارد
/// </summary>
public bool HasLeftWork { get; set; }
}

View File

@@ -2,7 +2,9 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.Holiday;
using CompanyManagment.App.Contracts.LeftWork;
namespace CompanyManagment.App.Contracts.YearlySalary;
@@ -14,6 +16,35 @@ public interface IYearlySalaryApplication
OperationResult Err();
EditYearlySalary GetDetails(long id);
List<YearlySalaryViewModel> GetYearlySalary();
/// <summary>
/// متد ارتقاء مزد دلخواه
/// </summary>
/// <param name="newContractStart"></param>
/// <param name="lastContractStart"></param>
/// <param name="lastContractManualDailyWage"></param>
/// <returns></returns>
Task<UpgradeManualDailyWageModel> UpgradeManualDailyWage(DateTime newContractStart, DateTime lastContractStart,
double lastContractManualDailyWage);
/// <summary>
/// متد محاسبه پایه سنوات و لیست پایه سنوات های پرسنل
/// </summary>
/// <param name="contractStart"></param>
/// <param name="contractEnd"></param>
/// <param name="employeeId"></param>
/// <param name="workshopId"></param>
/// <param name="leftWorkList"></param>
/// <returns></returns>
Task<BaseYearDataViewModel> BaseYearComputeByContractId(long contractId);
/// <summary>
/// دریافت مزد روزانه بر اساس تاریخ شروع و پایان
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
Task<(double dailyWage, long yearlySalaryId)> GetDailyWageByStartEnd(DateTime start, DateTime end);
List<YearlySalaryViewModel> Search(YearlySalarySearchModel searchModel);
EditYearlySalary GetDetailsBySearchModel(YearlySalarySearchModel searchModel);

View File

@@ -1,119 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using _0_Framework.Application;
using Company.Domain.AuthorizedPersonAgg;
using CompanyManagment.App.Contracts.AuthorizedPerson;
namespace CompanyManagment.Application;
public class AuthorizedPersonApplication : IAuthorizedPersonApplication
{
private readonly IAuthorizedPersonRepository _authorizedPersonRepository;
public AuthorizedPersonApplication(IAuthorizedPersonRepository authorizedPersonRepository)
{
_authorizedPersonRepository = authorizedPersonRepository;
}
public OperationResult Create(CreateAuthorizedPerson command)
{
var operation = new OperationResult();
if (_authorizedPersonRepository.ExistsByNationalCode(command.NationalCode))
return operation.Failed("شخص با این کد ملی قبلاً ثبت شده است");
var authorizedPerson = new AuthorizedPerson(
command.NationalCode, command.FirstName, command.LastName,
command.FatherName, command.BirthDate, command.Gender,
command.DeathStatus, command.ShenasnameSeri,
command.ShenasnameSerial, command.ShenasnamehNumber);
_authorizedPersonRepository.Create(authorizedPerson);
_authorizedPersonRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult CreateFromUidResponse(CreateAuthorizedPerson command)
{
var operation = new OperationResult();
var existingPerson = _authorizedPersonRepository.GetByNationalCode(command.NationalCode);
if (existingPerson != null)
{
existingPerson.UpdatePersonalInfo(command.FirstName, command.LastName,
command.FatherName, command.Gender, command.DeathStatus);
_authorizedPersonRepository.SaveChanges();
return operation.Succcedded();
}
var authorizedPerson = new AuthorizedPerson(
command.NationalCode, command.FirstName, command.LastName,
command.FatherName, command.BirthDate, command.Gender,
command.DeathStatus, command.ShenasnameSeri,
command.ShenasnameSerial, command.ShenasnamehNumber);
_authorizedPersonRepository.Create(authorizedPerson);
_authorizedPersonRepository.SaveChanges();
return operation.Succcedded();
}
public AuthorizedPersonViewModel GetByNationalCode(string nationalCode)
{
var authorizedPerson = _authorizedPersonRepository.GetByNationalCode(nationalCode);
if (authorizedPerson == null) return null;
return new AuthorizedPersonViewModel
{
Id = authorizedPerson.id,
NationalCode = authorizedPerson.NationalCode,
FirstName = authorizedPerson.FirstName,
LastName = authorizedPerson.LastName,
FatherName = authorizedPerson.FatherName,
BirthDate = authorizedPerson.BirthDate,
Gender = authorizedPerson.Gender,
DeathStatus = authorizedPerson.DeathStatus,
ShenasnameSeri = authorizedPerson.ShenasnameSeri,
ShenasnameSerial = authorizedPerson.ShenasnameSerial,
ShenasnamehNumber = authorizedPerson.ShenasnamehNumber,
IsVerified = authorizedPerson.IsVerified,
VerificationDate = authorizedPerson.VerificationDate?.ToString("yyyy/MM/dd HH:mm"),
CreationDate = authorizedPerson.CreationDate.ToString("yyyy/MM/dd HH:mm")
};
}
public List<AuthorizedPersonViewModel> Search(string nationalCode = null, string firstName = null, string lastName = null)
{
var allPersons = _authorizedPersonRepository.Get();
var filteredPersons = allPersons.Where(x =>
(string.IsNullOrEmpty(nationalCode) || x.NationalCode.Contains(nationalCode)) &&
(string.IsNullOrEmpty(firstName) || x.FirstName.Contains(firstName)) &&
(string.IsNullOrEmpty(lastName) || x.LastName.Contains(lastName)))
.Select(x => new AuthorizedPersonViewModel
{
Id = x.id,
NationalCode = x.NationalCode,
FirstName = x.FirstName,
LastName = x.LastName,
FatherName = x.FatherName,
BirthDate = x.BirthDate,
Gender = x.Gender,
DeathStatus = x.DeathStatus,
ShenasnameSeri = x.ShenasnameSeri,
ShenasnameSerial = x.ShenasnameSerial,
ShenasnamehNumber = x.ShenasnamehNumber,
IsVerified = x.IsVerified,
VerificationDate = x.VerificationDate?.ToString("yyyy/MM/dd HH:mm"),
CreationDate = x.CreationDate.ToString("yyyy/MM/dd HH:mm")
}).ToList();
return filteredPersons;
}
public bool ExistsByNationalCode(string nationalCode)
{
return _authorizedPersonRepository.ExistsByNationalCode(nationalCode);
}
}

View File

@@ -152,17 +152,38 @@ public class CheckoutApplication : ICheckoutApplication
var housingAllowance = command.HousingAllowance.MoneyToDouble();
//حق تاهل
var marriedAllowance = command.MarriedAllowance.MoneyToDouble();
var MontlyYearsBunos =
_yearlySalaryRepository.GetMontlyBunosYears(command.WeeklyTime, command.ContractStartGr, command.ContractEndGr, dayliWage, command.WorkingWeeklyTime, command.officialholiday, command.friday, command.TotalHolidaysAndNotH, command.TotalHolidaysAndNotM, command.Basic, command.FridayStarttoEnd, command.DailFeeComplete, command.HasRollCall, command.HolidayWorking, command.ShiftWork);
//دستمزد ماهانه
var monthlyWage = MontlyYearsBunos.MontlyWage;
//سنوات
var years = command.YearsPay;
//var MontlyYearsBunos =
//_yearlySalaryRepository.GetMontlyBunosYears(command.WeeklyTime, command.ContractStartGr, command.ContractEndGr, dayliWage, command.WorkingWeeklyTime, command.officialholiday, command.friday, command.TotalHolidaysAndNotH, command.TotalHolidaysAndNotM, command.Basic, command.FridayStarttoEnd, command.DailFeeComplete, command.HasRollCall, command.HolidayWorking, command.ShiftWork);
//دستمزد ماهانه
#region Salary
var totalDays = (command.ContractEndGr - command.ContractStartGr).TotalDays + 1;
var mandatoryDays = totalDays - command.FridayStarttoEnd - command.officialholiday;
if (!command.HasRollCall && command.ShiftWork != "4")
mandatoryDays = totalDays - command.FridayStarttoEnd;
var monthlyWage = command.DailySalaryAffected * totalDays;
//پایه سنوات
var bacicYears = command.BaseYearAffected * totalDays;
#endregion
//سنوات
var years = command.YearsPay;
//عیدی و پاداش
var bunos = command.BonusesPay;
//پایه سنوات
var bacicYears = MontlyYearsBunos.BasicYears;
var sumOfWorkingDays = MontlyYearsBunos.SumOfWorkingDay;
//فاطمه احمدژاد === موقت عیدی و پاداش و سنوات حساب نشه
if (command.EmployeeId == 45104 && command.WorkshopId == 315)
{
years = 0;
bunos = 0;
}
var sumOfWorkingDays = $"{totalDays}";
if (command.friday > 0)
{
var fridayPercent = dayliWage * 40 / 100;
@@ -200,11 +221,11 @@ public class CheckoutApplication : ICheckoutApplication
.Select(x => new CheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa, x.Id)).ToList();
command.SalaryAidDeduction = salaryAids.Sum(x => x.Amount.MoneyToDouble());
var loanInstallments = _rollCallMandatoryRepository.LoanInstallmentForCheckout(command.EmployeeId,
command.WorkshopId, command.ContractStartGr, command.ContractEndGr)
.Select(x => new CheckoutLoanInstallment(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount, x.Id)).ToList();
command.WorkshopId, command.ContractStartGr, command.HasLeft ? DateTime.MaxValue : command.ContractEndGr)
.Select(x =>
new CheckoutLoanInstallment(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount, x.Id)).ToList();
command.InstallmentDeduction = loanInstallments.Sum(x => x.AmountForMonth.MoneyToDouble());

View File

@@ -78,6 +78,11 @@ public class ContractApplication : IContractApplication
}
public async Task<double> GetManualDailWage(long workshopId, long employeeId, long yearlySalaryId, DateTime contractStart)
{
return await _contractRepository.GetManualDailWage(workshopId, employeeId, yearlySalaryId, contractStart);
}
public OperationResult Create(CreateContract command)
{
var yearlysalaryList = _yearlySalaryRepository.GetYearlySalary();
@@ -142,7 +147,9 @@ public class ContractApplication : IContractApplication
yearlySalarId,
start, end, command.DayliWage, command.ArchiveCode, getWorkdate, setContractDate,
command.JobType, command.ContractType, command.WorkshopAddress1, command.WorkshopAddress2,
command.ConsumableItems, command.JobTypeId, command.HousingAllowance, command.AgreementSalary, command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod);
command.ConsumableItems, command.JobTypeId, command.HousingAllowance, command.AgreementSalary,
command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod,command.DailySalaryAffected,
command.BaseYearAffected, command.DailySalaryUnAffected,command.BaseYearUnAffected, command.HasManualDailyWage, command.DailyWageType);
_contractRepository.Create(makeContract);
_contractRepository.SaveChanges();
@@ -356,7 +363,9 @@ public class ContractApplication : IContractApplication
command.YearlySalaryId,
start, end, command.DayliWage, command.ArchiveCode, getWorkdate, setContractDate,
command.JobName, command.ContractType, command.WorkshopAddress1, command.WorkshopAddress2,
command.ConsumableItems, command.JobId, command.HousingAllowance, "0", command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod);
command.ConsumableItems, command.JobId, command.HousingAllowance, "0", command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod,
command.DailySalaryAffected,
command.BaseYearAffected, command.DailySalaryUnAffected, command.BaseYearUnAffected, command.HasManualDailyWage, command.DailyWageType);
_contractRepository.Create(makeContract);
_contractRepository.SaveChanges();

View File

@@ -319,7 +319,10 @@ namespace CompanyManagment.Application
if (workshopId == 170)
{
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository.GetEmployeeSettingsByGroupSettingsId(117).Select(x => x.EmployeeId).ToList();
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository
.GetEmployeeSettingsByGroupSettingsId(117)
.Select(x => x.EmployeeId)
.Where(x=> workshopLeftWorksInMonth.Select(l=>l.EmployeeId).Contains(x)).ToList();
foreach (var employeesId in exceptionEmployeeIds)
{

View File

@@ -249,7 +249,10 @@ namespace CompanyManagment.Application
if (workshopId == 170)
{
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository.GetEmployeeSettingsByGroupSettingsId(117).Select(x => x.EmployeeId).ToList();
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository
.GetEmployeeSettingsByGroupSettingsId(117)
.Select(x => x.EmployeeId)
.Where(x=> workshopLeftWorksInMonth.Select(l=>l.EmployeeId).Contains(x)).ToList();
foreach (var employeesId in exceptionEmployeeIds)
{

File diff suppressed because it is too large Load Diff

View File

@@ -2,31 +2,21 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Exceptions;
using AccountManagement.Application.Contracts.Account;
using Company.Domain.ContarctingPartyAgg;
using Company.Domain.EmployeeAgg;
using Company.Domain.empolyerAgg;
using Company.Domain.FinancialStatmentAgg;
using Company.Domain.FinancialTransactionAgg;
using Company.Domain.InstitutionContractAgg;
using Company.Domain.LeftWorkAgg;
using Company.Domain.RepresentativeAgg;
using Company.Domain.TemporaryClientRegistrationAgg;
using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.FinancialStatment;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
using CompanyManagment.App.Contracts.PersonalContractingParty;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.EFCore.Migrations;
using PersianTools.Core;
using ConnectedPersonnelViewModel = CompanyManagment.App.Contracts.Workshop.ConnectedPersonnelViewModel;
using FinancialStatment = Company.Domain.FinancialStatmentAgg.FinancialStatment;
namespace CompanyManagment.Application;
@@ -40,20 +30,13 @@ public class InstitutionContractApplication : IInstitutionContractApplication
private readonly IWorkshopRepository _workshopRepository;
private readonly ILeftWorkRepository _leftWorkRepository;
private readonly IWorkshopApplication _workshopApplication;
private readonly IContractingPartyTempRepository _contractingPartyTempRepository;
private readonly IFinancialStatmentRepository _financialStatmentRepository;
private readonly IContactInfoApplication _contactInfoApplication;
private readonly IAccountApplication _accountApplication;
public InstitutionContractApplication(IInstitutionContractRepository institutionContractRepository,
IPersonalContractingPartyRepository contractingPartyRepository,
IRepresentativeRepository representativeRepository, IEmployerRepository employerRepository,
IWorkshopRepository workshopRepository, ILeftWorkRepository leftWorkRepository,
IFinancialStatmentApplication financialStatmentApplication, IWorkshopApplication workshopApplication,
IContractingPartyTempRepository contractingPartyTempRepository,
IFinancialStatmentRepository financialStatmentRepository, IContactInfoApplication contactInfoApplication,
IAccountApplication accountApplication)
IFinancialStatmentApplication financialStatmentApplication, IWorkshopApplication workshopApplication)
{
_institutionContractRepository = institutionContractRepository;
_contractingPartyRepository = contractingPartyRepository;
@@ -63,10 +46,6 @@ public class InstitutionContractApplication : IInstitutionContractApplication
_leftWorkRepository = leftWorkRepository;
_financialStatmentApplication = financialStatmentApplication;
_workshopApplication = workshopApplication;
_contractingPartyTempRepository = contractingPartyTempRepository;
_financialStatmentRepository = financialStatmentRepository;
_contactInfoApplication = contactInfoApplication;
_accountApplication = accountApplication;
}
public OperationResult Create(CreateInstitutionContract command)
@@ -922,349 +901,352 @@ public class InstitutionContractApplication : IInstitutionContractApplication
public async Task<OperationResult> CreateAsync(CreateInstitutionContractRequest command)
{
string contractingPartyName = String.Empty;
bool dateMessages = false;
string dateMaessageResult = String.Empty;
var opration = new OperationResult();
if (_institutionContractRepository.Exists(x =>
x.ContractingPartyId == command.ContractingPartyId && x.RepresentativeId == command.RepresentativeId &&
x.TypeOfContract == command.TypeOfContract))
return opration.Failed(
"برای این معرف و طرف حساب قبلا قرارداد ایجاد شده است، شما میتوانید از تمدید استفاده کنید");
if (string.IsNullOrWhiteSpace(command.ContractDateFa))
{
dateMaessageResult = "تاریخ قراراداد اجباری است. ";
dateMessages = true;
}
if (string.IsNullOrWhiteSpace(command.ContractStartFa))
{
dateMaessageResult += "تاریخ شروع قراراداد اجباری است. ";
dateMessages = true;
}
if (string.IsNullOrWhiteSpace(command.ContractEndFa))
{
dateMaessageResult += "تاریخ پایان قراراداد اجباری است. ";
dateMessages = true;
}
if (dateMessages)
return opration.Failed(dateMaessageResult);
if (command.RepresentativeId < 1 && command.ContractingPartyId > 1)
{
return opration.Failed("معرف را انتخاب کنید");
}
else if (command.ContractingPartyId < 1 && command.RepresentativeId > 1)
{
return opration.Failed("طرف حساب را انتخاب کنید");
}
else if (command.ContractingPartyId < 1 && command.RepresentativeId < 1)
{
return opration.Failed("معرف و طرف حساب را انتخاب کنید");
}
var syear = command.ContractStartFa.Substring(0, 4);
var smonth = command.ContractStartFa.Substring(5, 2);
var sday = command.ContractStartFa.Substring(8, 2);
var transaction = await _contractingPartyRepository.BeginTransactionAsync();
OperationResult<PersonalContractingParty> contractingPartyResult = command.ContractingPartyLegalType switch
{
LegalType.Legal => await CreateLegalContractingPartyEntity(command.LegalParty, command.RepresentativeId),
LegalType.Real => await CreateRealContractingPartyEntity(command.RealParty, command.RepresentativeId),
_ => throw new BadRequestException("نوع طرف قرارداد مشخص نشده است")
};
if (!contractingPartyResult.IsSuccedded)
return opration.Failed(contractingPartyResult.Message);
var contractingParty = contractingPartyResult.Data;
var contractingParty = _contractingPartyRepository.GetDetails(command.ContractingPartyId);
//شماره قرارداد
var contractNo = $"{syear}{smonth}{sday}/{contractingParty.ArchiveCode}/0";
var representative = _representativeRepository.Get(command.RepresentativeId);
if (representative == null)
return opration.Failed("معرف مورد نظر یافت نشد");
///////////////////////
if (command.ContactInfos.Count == 0)
return opration.Failed("ورود شماره تماس برای ارسال پیامک الزامیست");
var accountContact = command.ContactInfos.Where(x =>
x.SendSmsString == "true" && x.Position == "طرف قرارداد" && x.PhoneType == "شماره همراه" &&
!string.IsNullOrWhiteSpace(x.PhoneNumber)).ToList();
if (accountContact.Count == 0)
return opration.Failed("ورود شماره همراه با سمت طرف قرارداد برای ساخت حساب کاربری الزامیست");
var accountContactCount = command.ContactInfos
.Where(x => x.PhoneType == "شماره همراه" && x.Position == "طرف قرارداد").ToList();
if (accountContactCount.Count > 1)
return opration.Failed("فقط یکی از شماره تلفن ها میتواند سمت طرف قرارداد داشته باشد");
if (command.ContractStartFa.TryToGeorgianDateTime(out var contractStartGr) == false)
return opration.Failed("تاریخ شروع قرارداد معتبر نیست");
contractingPartyName = contractingParty.LName;
//نام معرف
var representative = _representativeRepository.GetDetails(command.RepresentativeId).FullName;
if (command.IsInstallment && !command.Workshops.Any(x=>x.HasContractPlanInPerson || x.HasInsurancePlanInPerson))
var contractStartGr = command.ContractStartFa.ToGeorgianDateTime();
var contractEndGr = command.ContractEndFa.ToGeorgianDateTime();
var contractDateGr = command.ContractDateFa.ToGeorgianDateTime();
if (command.Address != null && command.State == null)
{
return opration.Failed("برای قراردادهای اقساطی حداقل یک کارگاه باید دارای طرح حضوری باشد");
}
contractStartGr.AddMonthsFa((int)command.Duration, out var contractEndGr);
contractEndGr = contractEndGr.ToFarsi().FindeEndOfMonth().ToGeorgianDateTime();
var today = DateTime.Today;
var contractDateGr = today;
var contractDateFa = contractDateGr.ToFarsi();
var hasValueAddedTax = command.TaxAmount > 0 ? "true" : "false";
var contractingPartyFullName = contractingParty.FName + " " + contractingParty.LName;
var entity = new InstitutionContract(contractNo, command.RepresentativeId, representative.FullName,
contractingParty.id,
contractingPartyFullName, contractDateGr, contractDateFa, command.Province, command.City, command.Address,
contractStartGr,
contractStartGr.ToFarsi(), contractEndGr, contractEndGr.ToFarsi(), 0, command.DailyCompensation,
command.Obligation, command.TotalAmount, 0,
command.Workshops.Count.ToString(),
command.Workshops.Sum(x => x.PersonnelCount).ToString(), command.Description,
"NotOfficial", "JobRelation", hasValueAddedTax
, command.TaxAmount);
var workshopDetails = command.Workshops.Select(x =>
new InstitutionContractWorkshopDetail(x.WorkshopName, x.HasRollCallPlan, x.HasCustomizeCheckoutPlan,
x.HasContractPlan, x.HasContractPlanInPerson,x.HasInsurancePlan,x.HasInsurancePlanInPerson,x.PersonnelCount, x.Price)).ToList();
var financialStatement = new FinancialStatment(contractingParty.id, contractingPartyFullName);
if (command.IsInstallment)
{
var installments =
CalculateInstallment(command.TotalAmount, (int)command.Duration, command.ContractStartFa, true);
// دریافت مبلغ اولین قسط
//این کار برای این هست که اولین قسط باید با تاریخ امروز باشد و باید به وضعیت مالی بدهی ایجاد شود که یوزر اولین بدهی را وارد کند
var firstInstallmentAmount = installments.First().Amount;
// حذف اولین قسط
installments.RemoveAt(0);
// ایجاد قسط جدید با تاریخ امروز
var todayInstallment = new InstitutionContractInstallment(DateTime.Today, firstInstallmentAmount, "");
var financialTransaction = new FinancialTransaction(0, today, today.ToFarsi(),
"قسط اول سرویس", "debt", "بابت خدمات", firstInstallmentAmount, 0, 0);
financialStatement.AddFinancialTransaction(financialTransaction);
// اضافه کردن قسط جدید به ابتدای لیست
installments.Insert(0, todayInstallment);
entity.SetInstallments(installments);
}
else
{
var financialTransaction = new FinancialTransaction(0, today, today.ToFarsi(),
"پرداخت کل سرویس", "debt", "بابت خدمات", command.TotalAmount, 0, 0);
financialStatement.AddFinancialTransaction(financialTransaction);
return opration.Failed("لطفا استان و شهر را انتخاب کنید");
}
entity.SetWorkshopDetails(workshopDetails);
await _financialStatmentRepository.CreateAsync(financialStatement);
await _institutionContractRepository.CreateAsync(entity);
await _institutionContractRepository.SaveChangesAsync();
var mainContactInfo = new CreateContactInfo
if ((command.Address != null && command.State != null) && command.City == "شهرستان")
{
InstitutionContractId = entity.id,
PhoneType = "شماره همراه",
Position = "طرف قرارداد",
PhoneNumber = contractingParty.Phone,
FnameLname = contractingPartyFullName,
SendSms = true
};
_contactInfoApplication.Create(mainContactInfo);
foreach (var contactInfo in command.ContactInfos)
{
if (contactInfo.PhoneNumber != null)
{
var contactinfo = new CreateContactInfo
{
InstitutionContractId = entity.id,
PhoneType = contactInfo.PhoneType,
Position = contactInfo.Position,
PhoneNumber = contactInfo.PhoneNumber,
FnameLname = contactInfo.FnameLname,
SendSms = contactInfo.SendSmsString == "true" ? true : false
};
_contactInfoApplication.Create(contactinfo);
}
return opration.Failed("لطفا شهر را انتخاب کنید");
}
var userPass = contractingParty.IsLegal == "حقیقی"
? contractingParty.Nationalcode
: contractingParty.NationalId;
var createAcc = new RegisterAccount
if (command.Address == null && command.State != null)
{
Fullname = contractingParty.LName,
Username = userPass,
Password = userPass,
Mobile = contractingParty.Phone,
NationalCode = userPass
};
var res = _accountApplication.RegisterClient(createAcc);
if (res.IsSuccedded)
CreateContractingPartyAccount(contractingParty.id, res.SendId);
return opration.Failed("لطفا آدرس را وارد کنید");
}
if (string.IsNullOrWhiteSpace(command.OfficialCompany))
return opration.Failed("رسمی یا غیر رسمی بودن پرداخت را مشخص کنید");
if (command.OfficialCompany == "Official" && string.IsNullOrWhiteSpace(command.HasValueAddedTax))
return opration.Failed("وضعیت ارزش افزوده را مشخص کنید");
if (string.IsNullOrWhiteSpace(command.TypeOfContract))
return opration.Failed("عنوان قرارداد را انتخاب کنید");
if (string.IsNullOrWhiteSpace(command.ContractAmountString))
command.ContractAmountString = "0";
if (string.IsNullOrWhiteSpace(command.DailyCompenseationString))
command.DailyCompenseationString = "0";
if (string.IsNullOrWhiteSpace(command.ObligationString))
command.ObligationString = "0";
if (string.IsNullOrWhiteSpace(command.TotalAmountString))
command.TotalAmountString = "0";
await _institutionContractRepository.SaveChangesAsync();
await transaction.CommitAsync();
return opration.Succcedded();
var valueAddedTax = string.IsNullOrWhiteSpace(command.ValueAddedTaxStr)
? 0
: command.ValueAddedTaxStr.MoneyToDouble();
var contractAmountStr = command.ContractAmountString.ToDoubleMoney();
var contractAmount = Convert.ToDouble(contractAmountStr);
var DailyCompenseationStr = command.DailyCompenseationString.ToDoubleMoney();
var dailyCompenseation = Convert.ToDouble(DailyCompenseationStr);
var ObligationStr = command.ObligationString.ToDoubleMoney();
var obligation = Convert.ToDouble(ObligationStr);
var TotalAmountStr = command.TotalAmountString.ToDoubleMoney();
var totalAmount = Convert.ToDouble(TotalAmountStr);
//var hasValueAddedTax = "false";
//double valueAddedTax = 0;
//if (command.HasValueAddedTax == "true")
//{
// hasValueAddedTax = "true";
// valueAddedTax = command.ContractAmount * 0.1;
// command.ContractAmount += valueAddedTax;
//}
var createContract = new InstitutionContract(contractNo, command.RepresentativeId, representative,
command.ContractingPartyId,
contractingPartyName, contractDateGr, command.ContractDateFa, command.State, command.City,
command.Address, contractStartGr,
command.ContractStartFa, contractEndGr, command.ContractEndFa, contractAmount,
dailyCompenseation, obligation,
totalAmount, 0, command.WorkshopManualCount, command.EmployeeManualCount, command.Description,
command.OfficialCompany, command.TypeOfContract, command.HasValueAddedTax, valueAddedTax);
_institutionContractRepository.Create(createContract);
_institutionContractRepository.SaveChanges();
return opration.Succcedded(createContract.id);
}
public async Task<OperationResult> EditAsync(EditInstitutionContractRequest command)
{
throw new NotImplementedException();
bool dateMessages = false;
string dateMaessageResult = String.Empty;
var opration = new OperationResult();
var ContractEdit = _institutionContractRepository.Get(command.Id);
if (ContractEdit == null)
opration.Failed("رکورد مورد نظر وجود ندارد");
var contractStartGr = command.ContractStartFa.ToGeorgianDateTime();
var contractEndGr = command.ContractEndFa.ToGeorgianDateTime();
var contractDateGr = command.ContractDateFa.ToGeorgianDateTime();
if (_institutionContractRepository.Exists(x =>
x.ContractingPartyId == ContractEdit.ContractingPartyId &&
((contractStartGr >= x.ContractStartGr && contractStartGr <= x.ContractEndGr) ||
(contractEndGr >= x.ContractStartGr && contractEndGr <= x.ContractEndGr)) && x.id != command.Id &&
x.TypeOfContract == command.TypeOfContract))
return opration.Failed("در بازه تاریخ وارد شده قرارداد دیگری وجود دارد");
//if (_institutionContractRepository.Exists(x =>
// x.ContractingPartyId == ContractEdit.ContractingPartyId && (x.ContractStartGr <= contractDateGr || x.ContractDateGr <= contractDateGr) && x.id != command.Id))
// return opration.Failed("تاریخ عقد قرارداد با قرارداد دیگری تداخل دارد");
if (string.IsNullOrWhiteSpace(command.ContractDateFa))
{
dateMaessageResult = "تاریخ قراراداد اجباری است. ";
dateMessages = true;
}
if (string.IsNullOrWhiteSpace(command.ContractStartFa))
{
dateMaessageResult += "تاریخ شروع قراراداد اجباری است. ";
dateMessages = true;
}
if (string.IsNullOrWhiteSpace(command.ContractEndFa))
{
dateMaessageResult += "تاریخ پایان قراراداد اجباری است. ";
dateMessages = true;
}
if (dateMessages)
return opration.Failed(dateMaessageResult);
if (command.Address != null && command.State == null)
{
return opration.Failed("لطفا استان و شهر را انتخاب کنید");
}
if ((command.Address != null && command.State != null) && command.City == "شهرستان")
{
return opration.Failed("لطفا شهر را انتخاب کنید");
}
if (command.Address == null && command.State != null)
{
return opration.Failed("لطفا آدرس را وارد کنید");
}
if (string.IsNullOrWhiteSpace(command.OfficialCompany))
return opration.Failed("رسمی یا غیر رسمی بودن پرداخت را مشخص کنید");
if (command.OfficialCompany == "Official" && string.IsNullOrWhiteSpace(command.HasValueAddedTax))
return opration.Failed("وضعیت ارزش افزوده را مشخص کنید");
if (string.IsNullOrWhiteSpace(command.TypeOfContract))
return opration.Failed("عنوان قرارداد را انتخاب کنید");
if (string.IsNullOrWhiteSpace(command.ContractAmountString))
command.ContractAmountString = "0";
if (string.IsNullOrWhiteSpace(command.DailyCompenseationString))
command.DailyCompenseationString = "0";
if (string.IsNullOrWhiteSpace(command.ObligationString))
command.ObligationString = "0";
if (string.IsNullOrWhiteSpace(command.TotalAmountString))
command.TotalAmountString = "0";
var valueAddedTax = command.ValueAddedTaxStr.MoneyToDouble();
var contractAmountStr = command.ContractAmountString.ToDoubleMoney();
var contractAmount = Convert.ToDouble(contractAmountStr);
var DailyCompenseationStr = command.DailyCompenseationString.ToDoubleMoney();
var dailyCompenseation = Convert.ToDouble(DailyCompenseationStr);
var ObligationStr = command.ObligationString.ToDoubleMoney();
var obligation = Convert.ToDouble(ObligationStr);
var TotalAmountStr = command.TotalAmountString.ToDoubleMoney();
var totalAmount = Convert.ToDouble(TotalAmountStr);
ContractEdit.Edit(contractDateGr, command.ContractDateFa, command.State, command.City, command.Address,
contractStartGr,
command.ContractStartFa, contractEndGr, command.ContractEndFa, contractAmount,
dailyCompenseation,
obligation, totalAmount, command.WorkshopManualCount, command.EmployeeManualCount,
command.Description, command.OfficialCompany, command.TypeOfContract, valueAddedTax,
command.HasValueAddedTax);
await _institutionContractRepository.SaveChangesAsync();
return opration.Succcedded(command.Id);
}
public async Task<OperationResult> ExtensionَAsync(CreateInstitutionContractRequest command)
{
throw new NotImplementedException();
}
bool dateMessages = false;
string dateMaessageResult = String.Empty;
var opration = new OperationResult();
public Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList()
{
return _institutionContractRepository.RegistrationWorkflowMainList();
}
public Task<List<RegistrationWorkflowItemsViewModel>> RegistrationWorkflowItems(long institutionContractId)
{
return _institutionContractRepository.RegistrationWorkflowItems(institutionContractId);
}
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
CreateInstitutionContractLegalPartyRequest request, long representativeId)
{
var opration = new OperationResult<PersonalContractingParty>();
if (_contractingPartyRepository.Exists(x =>
x.LName == request.CompanyName && x.RegisterId == request.RegisterId))
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
if (representativeId < 1)
return opration.Failed("لطفا معرف را انتخاب کنید");
if (_contractingPartyRepository.Exists(x =>
x.LName == request.CompanyName && x.NationalId == request.NationalId))
return opration.Failed("نام شرکت وارد شده تکراری است");
command.ExtensionNo += 1;
if (_institutionContractRepository.Exists(x =>
x.ExtensionNo == command.ExtensionNo && x.ContractingPartyId == command.ContractingPartyId &&
x.TypeOfContract == command.TypeOfContract))
return opration.Failed("برای این قرارداد قبلا تمدید ایجاد شده است");
if (_contractingPartyRepository.Exists(x =>
x.RegisterId == request.RegisterId && x.LName != request.CompanyName))
return opration.Failed("شماره ثبت وارد شده تکراری است");
if (_contractingPartyRepository.Exists(x =>
x.NationalId == request.NationalId && x.LName != request.CompanyName))
if (string.IsNullOrWhiteSpace(command.ContractDateFa))
{
return opration.Failed("شناسه ملی وارد شده تکراری است");
dateMaessageResult = "تاریخ قراراداد اجباری است. ";
dateMessages = true;
}
var archiveCode = _contractingPartyRepository.GetLastNewArchiveCode();
var representative = _representativeRepository.GetDetails(representativeId);
var legalContractingParty = new PersonalContractingParty("*", request.CompanyName,
"*", "*", request.RegisterId, request.NationalId,
"حقوقی",
request.PhoneNumber, request.PhoneNumber, null, representativeId, representative.FullName,
archiveCode, null, null, null, null, request.Position);
await _contractingPartyRepository.CreateAsync(legalContractingParty);
await _contractingPartyRepository.SaveChangesAsync();
return opration.Succcedded(legalContractingParty);
}
private async Task<OperationResult<PersonalContractingParty>> CreateRealContractingPartyEntity(
CreateInstitutionContractRealPartyRequest request, long representativeId)
{
var operation = new OperationResult<PersonalContractingParty>();
if (_contractingPartyRepository.Exists(x =>
x.LName == request.LName && x.Nationalcode == request.NationalCode))
return operation.Failed("امکان ثبت رکورد تکراری وجود ندارد");
if (representativeId < 1)
return operation.Failed("لطفا معرف را انتخاب کنید");
if (_contractingPartyRepository.Exists(x => x.Nationalcode == request.NationalCode))
if (string.IsNullOrWhiteSpace(command.ContractStartFa))
{
return operation.Failed("کد ملی وارد شده تکراری است");
dateMaessageResult += "تاریخ شروع قراراداد اجباری است. ";
dateMessages = true;
}
var archiveCode = _contractingPartyRepository.GetLastNewArchiveCode();
if (request.NationalCode.NationalCodeValid() != "valid")
if (string.IsNullOrWhiteSpace(command.ContractEndFa))
{
return operation.Failed("کد ملی وارد شده نا معتبر است");
dateMaessageResult += "تاریخ پایان قراراداد اجباری است. ";
dateMessages = true;
}
var representative = _representativeRepository.GetDetails(representativeId);
if (dateMessages)
return opration.Failed(dateMaessageResult);
if (representative == null)
return operation.Failed("معرف مورد نظر یافت نشد");
var firstContract =
_institutionContractRepository.GetFirstContract(command.ContractingPartyId, command.TypeOfContract);
var personalContractingParty = new PersonalContractingParty(request.FName, request.LName,
request.NationalCode, request.IdNumber, "*", "*",
"حقیقی",
request.PhoneNumber, request.PhoneNumber, null, representativeId, representative.FullName, archiveCode,
null, null, null, null);
var syear = firstContract.ContractStartFa.Substring(0, 4);
var smonth = firstContract.ContractStartFa.Substring(5, 2);
var sday = firstContract.ContractStartFa.Substring(8, 2);
var contractingParty = _contractingPartyRepository.GetDetails(command.ContractingPartyId);
//شماره قرارداد
var contractNo = $"{syear}{smonth}{sday}/{contractingParty.ArchiveCode}/{command.ExtensionNo}";
await _contractingPartyRepository.CreateAsync(personalContractingParty);
await _contractingPartyRepository.SaveChangesAsync();
var contractStartGr = command.ContractStartFa.ToGeorgianDateTime();
var contractEndGr = command.ContractEndFa.ToGeorgianDateTime();
return operation.Succcedded(personalContractingParty);
}
private List<InstitutionContractInstallment> CalculateInstallment(double amount, int installmentCount,
string loanStartDate, bool getRounded)
{
int day = Convert.ToInt32(loanStartDate.Substring(8, 2));
int month = Convert.ToInt32(loanStartDate.Substring(5, 2));
int year = Convert.ToInt32(loanStartDate.Substring(0, 4));
var installments = new List<InstitutionContractInstallment>();
bool endOfMonth = day == 31;
var dividedAmount = amount / installmentCount;
double moneyPerMonth = 0;
if (getRounded)
moneyPerMonth = Math.Floor(dividedAmount / 1000) * 1000;
else
moneyPerMonth = Math.Floor(dividedAmount);
double lastLoan = amount - (moneyPerMonth * (installmentCount - 1));
if (endOfMonth)
var contractDateGr = command.ContractDateFa.ToGeorgianDateTime();
if (_institutionContractRepository.Exists(x =>
((contractStartGr >= x.ContractStartGr && contractStartGr <= x.ContractEndGr) ||
(contractEndGr >= x.ContractStartGr && contractEndGr <= x.ContractEndGr)) &&
x.TypeOfContract == command.TypeOfContract && x.ContractingPartyId == command.ContractingPartyId))
return opration.Failed("تاریخ شروع و پایان وارد شده با قرارداد دیگری تداخل دارد");
if (command.Address != null && command.State == null)
{
for (int i = 1; i < installmentCount; i++)
{
var installment =
new InstitutionContractInstallment(loanStartDate.ToGeorgianDateTime(), moneyPerMonth, "");
installments.Add(installment);
if (month == 12)
{
year++;
month = 1;
}
else
{
month++;
}
loanStartDate = $"{year:0000}/{month:00}/01".FindeEndOfMonth();
}
var lastInstallment = new InstitutionContractInstallment(loanStartDate.ToGeorgianDateTime(), lastLoan, "");
installments.Add(lastInstallment);
return installments;
return opration.Failed("لطفا استان و شهر را انتخاب کنید");
}
else
if ((command.Address != null && command.State != null) && command.City == "شهرستان")
{
for (int i = 1; i < installmentCount; i++)
{
var installment =
new InstitutionContractInstallment(loanStartDate.ToGeorgianDateTime(), moneyPerMonth, "");
installments.Add(installment);
var endDay = 0;
if (month == 12)
{
year++;
month = 1;
}
else
{
month++;
}
if (day == 30)
{
if (month == 12)
{
var lastYearDay =
Convert.ToInt32($"{year:0000}/{month:00}/1".FindeEndOfMonth().Substring(8, 2));
endDay = lastYearDay == 30 ? lastYearDay : 29;
}
}
loanStartDate =
endDay == 0 ? $"{year:0000}/{month:00}/{day:00}" : $"{year:0000}/{month:00}/{endDay:00}";
}
var lastInstallment = new InstitutionContractInstallment(loanStartDate.ToGeorgianDateTime(), lastLoan, "");
installments.Add(lastInstallment);
return installments;
return opration.Failed("لطفا شهر را انتخاب کنید");
}
if (command.Address == null && command.State != null)
{
return opration.Failed("لطفا آدرس را وارد کنید");
}
if (string.IsNullOrWhiteSpace(command.OfficialCompany))
return opration.Failed("رسمی یا غیر رسمی بودن پرداخت را مشخص کنید");
if (command.OfficialCompany == "Official" && string.IsNullOrWhiteSpace(command.HasValueAddedTax))
return opration.Failed("وضعیت ارزش افزوده را مشخص کنید");
if (string.IsNullOrWhiteSpace(command.TypeOfContract))
return opration.Failed("عنوان قرارداد را انتخاب کنید");
if (string.IsNullOrWhiteSpace(command.ContractAmountString))
command.ContractAmountString = "0";
if (string.IsNullOrWhiteSpace(command.DailyCompenseationString))
command.DailyCompenseationString = "0";
if (string.IsNullOrWhiteSpace(command.ObligationString))
command.ObligationString = "0";
if (string.IsNullOrWhiteSpace(command.TotalAmountString))
command.TotalAmountString = "0";
var valueAddedTax = string.IsNullOrWhiteSpace(command.ValueAddedTaxStr)
? 0
: command.ValueAddedTaxStr.MoneyToDouble();
var contractAmountStr = command.ContractAmountString.ToDoubleMoney();
var contractAmount = Convert.ToDouble(contractAmountStr);
var DailyCompenseationStr = command.DailyCompenseationString.ToDoubleMoney();
var dailyCompenseation = Convert.ToDouble(DailyCompenseationStr);
var ObligationStr = command.ObligationString.ToDoubleMoney();
var obligation = Convert.ToDouble(ObligationStr);
var TotalAmountStr = command.TotalAmountString.ToDoubleMoney();
var totalAmount = Convert.ToDouble(TotalAmountStr);
var contractingPartyName = contractingParty.LName;
var representative = _representativeRepository.GetDetails(command.RepresentativeId).FullName;
var createContract = new InstitutionContract(contractNo, command.RepresentativeId, representative,
command.ContractingPartyId,
contractingPartyName, contractDateGr, command.ContractDateFa, command.State, command.City,
command.Address, contractStartGr,
command.ContractStartFa, contractEndGr, command.ContractEndFa, contractAmount,
dailyCompenseation, obligation,
totalAmount, command.ExtensionNo, command.WorkshopManualCount, command.EmployeeManualCount,
command.Description, command.OfficialCompany, command.TypeOfContract, command.HasValueAddedTax,
valueAddedTax);
_institutionContractRepository.Create(createContract);
_institutionContractRepository.SaveChanges();
return opration.Succcedded(createContract.id);
}
}

View File

@@ -1,256 +0,0 @@
using _0_Framework.Application;
using Company.Domain.LawAgg;
using CompanyManagment.App.Contracts.Law;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CompanyManagment.Application;
public class LawApplication : ILawApplication
{
private readonly ILawRepository _lawRepository;
public LawApplication(ILawRepository lawRepository)
{
_lawRepository = lawRepository;
}
public OperationResult Create(CreateLaw command)
{
var operation = new OperationResult();
if (_lawRepository.Exists(x => x.Type == command.Type))
{
return operation.Failed("این قانون قبلا ثبت شده است");
}
var law = new Law(command.Title, command.Type, command.Notifications, command.HeadTitle);
if (command.Items == null || command.Items.Count == 0)
{
return operation.Failed("باید حداقل یک بند برای قانون باید ثبت شود");
}
var orderNumber = 1;
foreach (var item in command.Items)
{
law.AddItem(item.Header, item.Details, orderNumber);
orderNumber++;
}
_lawRepository.Create(law);
_lawRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult Edit(EditLaw command)
{
var operation = new OperationResult();
var law = _lawRepository.Get(command.Id);
if (law == null)
return operation.Failed(ApplicationMessages.RecordNotFound);
if (command.Items == null || command.Items.Count == 0)
{
return operation.Failed("باید حداقل یک بند برای قانون باید ثبت شود");
}
var orderNumber = 1;
var lawItems = command.Items.Select(x =>
{
var res = new LawItem(x.Header, x.Details, orderNumber);
orderNumber++;
return res;
}).ToList();
law.Edit(command.Title);
law.SetItem(lawItems);
_lawRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult UpsertLaw(EditLaw command)
{
var operation = new OperationResult();
// Validate items
if (command.Items == null || command.Items.Count == 0)
{
return operation.Failed("باید حداقل یک بند برای قانون باید ثبت شود");
}
// Check if law exists by type
var existingLaw = _lawRepository.Get().FirstOrDefault(x => x.Type == command.Type);
if (existingLaw == null)
{
// If law doesn't exist, create a new one
var law = new Law(command.Title, command.Type,command.Notifications, command.HeadTitle);
var orderNumber = 1;
foreach (var item in command.Items)
{
law.AddItem(item.Header, item.Details, orderNumber);
orderNumber++;
}
_lawRepository.Create(law);
_lawRepository.SaveChanges();
}
else
{
// If law exists, update it
var orderNumber = 1;
var lawItems = command.Items.Select(x =>
{
var res = new LawItem(x.Header, x.Details, orderNumber);
orderNumber++;
return res;
}).ToList();
existingLaw.Edit(command.Title);
existingLaw.SetItem(lawItems);
_lawRepository.SaveChanges();
}
return operation.Succcedded();
}
public OperationResult Activate(long id)
{
var operation = new OperationResult();
var law = _lawRepository.Get(id);
if (law == null)
return operation.Failed(ApplicationMessages.RecordNotFound);
law.Activate();
_lawRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult Deactivate(long id)
{
var operation = new OperationResult();
var law = _lawRepository.Get(id);
if (law == null)
return operation.Failed(ApplicationMessages.RecordNotFound);
law.Deactivate();
_lawRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult ActivateByType(LawType type)
{
var operation = new OperationResult();
var law = _lawRepository.Get().FirstOrDefault(x => x.Type == type);
if (law == null)
{
// If law doesn't exist, create a new active one with default values
var newLaw = new Law(GetDefaultTitleForLawType(type), type, new List<string>(), "");
newLaw.Activate();
_lawRepository.Create(newLaw);
_lawRepository.SaveChanges();
return operation.Succcedded();
}
law.Activate();
_lawRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult DeactivateByType(LawType type)
{
var operation = new OperationResult();
var law = _lawRepository.Get().FirstOrDefault(x => x.Type == type);
if (law == null)
return operation.Failed("قانون مورد نظر یافت نشد");
law.Deactivate();
_lawRepository.SaveChanges();
return operation.Succcedded();
}
public EditLaw GetDetails(long id)
{
var law = _lawRepository.Get(id);
return new EditLaw
{
Id = law.id,
Title = law.Title,
Type = law.Type,
Items = law.Items.OrderBy(x => x.OrderNumber).Select(x => new LawItemViewModel
{
Header = x.Header,
Details = x.Details
}).ToList()
};
}
public async Task<List<LawViewModel>> GetList(LawSearchModel searchModel)
{
// Get filtered laws from database
return await _lawRepository.GetList(searchModel);
}
private string GetDefaultTitleForLawType(LawType lawType)
{
return lawType switch
{
LawType.Register => "قوانین ثبت نام",
_ => $"قوانین {lawType}"
};
}
public async Task<LawViewModel> GetLawWithItems(long id)
{
var law = await _lawRepository.GetWithItems(id);
if (law == null)
return null;
return new LawViewModel
{
Id = law.id,
Title = law.Title,
IsActive = law.IsActive,
CreatedAt = law.CreationDate,
Type = law.Type,
Items = law.Items.OrderBy(x=>x.OrderNumber).Select(x => new LawItemViewModel
{
Header = x.Header,
Details = x.Details,
}).ToList()
};
}
public async Task<LawViewModel> GetLawByType(LawType type)
{
var lawViewModel = await _lawRepository.GetByType(type);
// If no law exists for this type, return a default empty law
if (lawViewModel == null)
{
return new LawViewModel
{
Id = 0,
Title = GetDefaultTitleForLawType(type),
IsActive = false,
CreatedAt = DateTime.Now,
Type = type,
Items = new List<LawItemViewModel>()
};
}
return lawViewModel;
}
}

View File

@@ -84,7 +84,7 @@ public class LeaveApplication : ILeaveApplication
var end = command.PaidLeaveType == "ساعتی" ? start : command.EndLeave.ToGeorgianDateTime();
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId);
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId,command.IsInvallid);
// start = new DateTime(start.Year, start.Month, start.Day, startH.Hours, startH.Minutes, startH.Seconds);
//end = new DateTime(end.Year, end.Month, end.Day, endH.Hours, endH.Minutes, endH.Seconds);
@@ -96,8 +96,10 @@ public class LeaveApplication : ILeaveApplication
return op.Failed(checkErr.ContractErrMessage);
if (checkErr.HasLeftWork)
return op.Failed(checkErr.LeftWorlErrMessage);
//if (checkErr.HasHolidayError)
// return op.Failed(checkErr.HolidayErrorMessage);
if (start > end)
if (start > end)
return op.Failed("تارخ شروع از پایان بزرگتر است");
@@ -180,29 +182,30 @@ public class LeaveApplication : ILeaveApplication
shiftDuration = shiftEndDateTime - shiftStartDateTime;
hasShiftDuration = true;
}
}
else if (employeeSettings is { WorkshopShiftStatus: WorkshopShiftStatus.Irregular })
{
if ((end - start).TotalDays > 1)
else if (employeeSettings is { WorkshopShiftStatus: WorkshopShiftStatus.Irregular })
{
return op.Failed("شما نمیتوانید بیشتر از یک روز مرخصی روزانه ثبت کنید");
}
var isActive = _rollCallEmployeeStatusApplication.IsActiveInPeriod(command.EmployeeId, command.WorkshopId, start, start);
if (isActive)
{
shiftDuration = employeeSettings.IrregularShift.WorkshopIrregularShifts switch
if ((end - start).TotalDays > 1)
{
WorkshopIrregularShifts.TwelveThirtySix => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwelveTwentyFour => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwentyFourFortyEight => TimeSpan.FromHours(24),
WorkshopIrregularShifts.TwentyFourTwentyFour => TimeSpan.FromHours(24),
_ => new TimeSpan()
};
hasShiftDuration = true;
}
return op.Failed("شما نمیتوانید بیشتر از یک روز مرخصی روزانه ثبت کنید");
}
var isActive = _rollCallEmployeeStatusApplication.IsActiveInPeriod(command.EmployeeId, command.WorkshopId, start, start);
if (isActive)
{
shiftDuration = employeeSettings.IrregularShift.WorkshopIrregularShifts switch
{
WorkshopIrregularShifts.TwelveThirtySix => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwelveTwentyFour => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwentyFourFortyEight => TimeSpan.FromHours(24),
WorkshopIrregularShifts.TwentyFourTwentyFour => TimeSpan.FromHours(24),
_ => new TimeSpan()
};
hasShiftDuration = true;
}
}
}
}
@@ -235,7 +238,8 @@ public class LeaveApplication : ILeaveApplication
var employeeFullName = _employeeRepository.GetDetails(command.EmployeeId).EmployeeFullName;
var workshopName = _workshopRepository.GetDetails(command.WorkshopId).WorkshopName;
var leave = new Leave(start, end, totalhourses, command.WorkshopId, command.EmployeeId
, command.PaidLeaveType, command.LeaveType, employeeFullName, workshopName, command.IsAccepted, command.Decription, year, month, shiftDuration, hasShiftDuration);
, command.PaidLeaveType, command.LeaveType, employeeFullName, workshopName, command.IsAccepted, command.Decription,
year, month, shiftDuration, hasShiftDuration,command.IsInvallid);
_leaveRepository.Create(leave);
_leaveRepository.SaveChanges();
@@ -297,13 +301,15 @@ public class LeaveApplication : ILeaveApplication
return op.Failed("لطفا تاریخ پایان را وارد کنید");
var start = command.StartLeave.ToGeorgianDateTime();
var end = command.PaidLeaveType == "ساعتی" ? start : command.EndLeave.ToGeorgianDateTime();
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId);
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId,command.IsInvallid);
if (checkErr.HasChekout)
return op.Failed(checkErr.CheckoutErrMessage);
if (checkErr.HasLeftWork)
return op.Failed(checkErr.LeftWorlErrMessage);
if (checkErr.HasHolidayError)
return op.Failed(checkErr.HolidayErrorMessage);
if (start > end)
return op.Failed("تارخ شروع از پایان بزرگتر است");

View File

@@ -200,8 +200,7 @@ public class LoanApplication : ILoanApplication
DateGr = loanStartDate.ToGeorgianDateTime(),
Month = loanStartDate.Substring(5, 2),
Year = loanStartDate.Substring(0, 4),
Day = loanStartDate.Substring(8, 2),
AmountDouble = moneyPerMonth
Day = loanStartDate.Substring(8, 2)
};
installments.Add(installment);
@@ -226,8 +225,7 @@ public class LoanApplication : ILoanApplication
DateGr = loanStartDate.ToGeorgianDateTime(),
Month = loanStartDate.Substring(5, 2),
Year = loanStartDate.Substring(0, 4),
Day = loanStartDate.Substring(8, 2),
AmountDouble = lastLoan
Day = loanStartDate.Substring(8, 2)
};
installments.Add(lastInstallment);
@@ -245,8 +243,7 @@ public class LoanApplication : ILoanApplication
DateGr = loanStartDate.ToGeorgianDateTime(),
Month = loanStartDate.Substring(5, 2),
Year = loanStartDate.Substring(0, 4),
Day = loanStartDate.Substring(8, 2),
AmountDouble = moneyPerMonth
Day = loanStartDate.Substring(8, 2)
};
installments.Add(installment);
@@ -281,8 +278,7 @@ public class LoanApplication : ILoanApplication
DateGr = loanStartDate.ToGeorgianDateTime(),
Month = loanStartDate.Substring(5, 2),
Year = loanStartDate.Substring(0, 4),
Day = loanStartDate.Substring(8, 2),
AmountDouble = lastLoan
Day = loanStartDate.Substring(8, 2)
};
installments.Add(lastInstallment);

View File

@@ -370,7 +370,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
public int GetLastArchiveCode()
{
return _personalContractingPartyRepository.GetLastNewArchiveCode();
return _personalContractingPartyRepository.GetLastArchiveCode();
}
#region Mahan
public List<string> SearchByName(string name)

View File

@@ -21,9 +21,11 @@ public class RollCallMandatoryApplication : IRollCallMandatoryApplication
return _rollCallMandatoryRepository.Exists(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart.Date);
}
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute,bool totalLeaveCompute)
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, double dailyWageUnAffected, bool totalLeaveCompute)
{
return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout, rotatingShiftCompute, totalLeaveCompute);
return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout, rotatingShiftCompute, dailyWageUnAffected, totalLeaveCompute);
}
public async Task<ComputingViewModel> RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart, DateTime contractEnd,

View File

@@ -1,19 +1,16 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Sms;
using _0_Framework.Application.UID;
using _0_Framework.Exceptions;
using Company.Domain.ContarctingPartyAgg;
using Company.Domain.InstitutionPlanAgg;
using Company.Domain.TemporaryClientRegistrationAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.InstitutionPlan;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using IPE.SmsIrClient.Models.Results;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using PersianTools.Core;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
@@ -31,11 +28,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
private readonly IInstitutionContractTempRepository _institutionContractTempRepository;
private readonly ISmsService _smsService;
public TemporaryClientRegistrationApplication(IContractingPartyTempRepository contractingPartyTempRepository,
IPersonalContractingPartyRepository personalContractingPartyRepository, IUidService uidService,
IWorkshopTempRepository workshopTempRepository, IPlanPercentageRepository planPercentageRepository,
IWorkshopServicesTempRepository workshopServicesTempRepository,
IInstitutionContractTempRepository institutionContractTempRepository, ISmsService smsService)
public TemporaryClientRegistrationApplication(IContractingPartyTempRepository contractingPartyTempRepository, IPersonalContractingPartyRepository personalContractingPartyRepository, IUidService uidService, IWorkshopTempRepository workshopTempRepository, IPlanPercentageRepository planPercentageRepository, IWorkshopServicesTempRepository workshopServicesTempRepository, IInstitutionContractTempRepository institutionContractTempRepository, ISmsService smsService)
{
_contractingPartyTempRepository = contractingPartyTempRepository;
_personalContractingPartyRepository = personalContractingPartyRepository;
@@ -54,8 +47,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
/// <param name="dateOfBirth"></param>
/// <param name="mobile"></param>
/// <returns></returns>
public async Task<OperationResult<ContractingPartyTempViewModel>> CreateContractingPartyTemp(string nationalCode,
string dateOfBirth, string mobile)
public async Task<OperationResult<ContractingPartyTempViewModel>> CreateContractingPartyTemp(string nationalCode, string dateOfBirth, string mobile)
{
var op = new OperationResult<ContractingPartyTempViewModel>();
@@ -75,11 +67,12 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
if (!mobile.IsMobileValid())
return op.Failed("شماره همراه نا معتبر است");
#endregion
var getExistContractingParty =
await _contractingPartyTempRepository.CheckExistOrAuthenticated(nationalCode, dateOfBirth);
var getExistContractingParty = await _contractingPartyTempRepository.CheckExistOrAuthenticated(nationalCode, dateOfBirth);
//اگر طرف حساب قبلا در دیتابیس وجود داشت
if (getExistContractingParty)
@@ -103,7 +96,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
if (institutionContractTemp != null)
{
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
if (institutionContractTemp.RegistrationStatus == "Completed")
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
}
@@ -112,8 +106,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
if (getExistTemp.Phone != mobile)
return op.Failed("شما قبلا با شماره همراه دیگری ثبت نام نموده اید");
return op.Succcedded(getExistTemp);
}
}
//چک کردن مطابقت شماره همراه و کد ملی
var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
if (isMachMobilAndNationalCode == null)
@@ -125,17 +119,13 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var apiRespons = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
if (apiRespons == null)
throw new InternalServerException("خطا در سرویس احراز هویت");
if (apiRespons.ResponseContext.Status.Code ==14)
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
return op.Failed("خطا در سرویس احراز هویت");
if (apiRespons.ResponseContext.Status.Code != 0)
return op.Failed($"{apiRespons.ResponseContext.Status.Message}");
var idNumber = apiRespons.IdentificationInformation.ShenasnamehNumber == "0"
? apiRespons.IdentificationInformation.NationalId
: apiRespons.IdentificationInformation.ShenasnamehNumber;
? apiRespons.IdentificationInformation.NationalId
: apiRespons.IdentificationInformation.ShenasnamehNumber;
//ایجاد طرف حساب موقت
var createTemp = new ContractingPartyTemp(apiRespons.BasicInformation.FirstName,
@@ -158,6 +148,9 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
return op.Succcedded(result);
}
}
/// <summary>
@@ -168,6 +161,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
/// <param name="city"></param>
/// <param name="address"></param>
/// <returns></returns>
public async Task<OperationResult> UpdateAddress(long id, string state, string city, string address)
{
var op = new OperationResult();
@@ -197,8 +191,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
public async Task<OperationResult> CreateOrUpdateWorkshopTemp(List<WorkshopTempViewModel> command,
long contractingPartyTempId)
public async Task<OperationResult> CreateOrUpdateWorkshopTemp(List<WorkshopTempViewModel> command, long contractingPartyTempId)
{
var op = new OperationResult();
var updateWorkshopList = command.Where(x => x.Id > 0).ToList();
@@ -209,7 +202,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var oldWorkshops = await _workshopTempRepository.GetWorkshopTemp(contractingPartyTempId);
#region Update
if (updateWorkshopList.Count > 0)
{
var updateListIds = updateWorkshopList.Select(x => x.Id).ToList();
@@ -221,6 +213,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
foreach (var workshop in updateWorkshopList)
{
if (string.IsNullOrWhiteSpace(workshop.WorkshopName))
return op.Failed("نام مجموعه نمی تواند خالی باشد");
if (workshop.CountPerson == 0)
@@ -242,8 +235,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
if (plan.OnlineAndInPersonSumAmountDouble > 0)
{
//ویرایش مشخصات کارگاه
existWorkshops.Edit(workshop.WorkshopName, workshop.CountPerson,
plan.OnlineAndInPersonSumAmountDouble);
existWorkshops.Edit(workshop.WorkshopName, workshop.CountPerson, plan.OnlineAndInPersonSumAmountDouble);
await _workshopTempRepository.SaveChangesAsync();
//حذف سرویس های قبلی
@@ -256,8 +248,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
//سرویس خدمات حضوری قرارداد
if (workshop.ContractAndCheckoutInPerson)
await _workshopServicesTempRepository.CreateAsync(
new WorkshopServicesTemp("ContractAndCheckoutInPerson", workshop.CountPerson,
workshop.Id));
new WorkshopServicesTemp("ContractAndCheckoutInPerson", workshop.CountPerson, workshop.Id));
//سرویس بیمه
if (workshop.Insurance)
@@ -279,10 +270,12 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
await _workshopServicesTempRepository.SaveChangesAsync();
}
}
}
}
}
}
}
#endregion
#region Create
@@ -291,6 +284,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
{
foreach (var workshop in createNewWorkshopList)
{
if (string.IsNullOrWhiteSpace(workshop.WorkshopName))
return op.Failed("نام مجموعه نمی تواند خالی باشد");
if (workshop.CountPerson == 0)
@@ -308,22 +302,23 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var plan = _planPercentageRepository.GetInstitutionPlanForWorkshop(workshop);
if (plan.OnlineAndInPersonSumAmountDouble > 0)
{
var createNewWorkshopTemp = new WorkshopTemp(workshop.WorkshopName, workshop.CountPerson,
workshop.ContractingPartyTempId, plan.OnlineAndInPersonSumAmountDouble);
await _workshopTempRepository.CreateAsync(createNewWorkshopTemp);
await _workshopTempRepository.SaveChangesAsync();
//سرویس قرداد
if (workshop.ContractAndCheckout)
await _workshopServicesTempRepository.CreateAsync(
new WorkshopServicesTemp("ContractAndCheckout", workshop.CountPerson,
createNewWorkshopTemp.id));
new WorkshopServicesTemp("ContractAndCheckout", workshop.CountPerson, createNewWorkshopTemp.id));
//سرویس خدمات حضوری قرارداد
if (workshop.ContractAndCheckoutInPerson)
await _workshopServicesTempRepository.CreateAsync(
new WorkshopServicesTemp("ContractAndCheckoutInPerson", workshop.CountPerson,
createNewWorkshopTemp.id));
new WorkshopServicesTemp("ContractAndCheckoutInPerson", workshop.CountPerson, createNewWorkshopTemp.id));
//سرویس بیمه
if (workshop.Insurance)
@@ -332,8 +327,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
//سرویس خدمات حضوری بیمه
if (workshop.InsuranceInPerson)
await _workshopServicesTempRepository.CreateAsync(
new WorkshopServicesTemp("InsuranceInPerson", workshop.CountPerson,
createNewWorkshopTemp.id));
new WorkshopServicesTemp("InsuranceInPerson", workshop.CountPerson, createNewWorkshopTemp.id));
//سرویس حضورغیاب
if (workshop.RollCall)
@@ -342,11 +336,11 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
//سرویس فیش غیر رسمی
if (workshop.CustomizeCheckout)
await _workshopServicesTempRepository.CreateAsync(
new WorkshopServicesTemp("CustomizeCheckout", workshop.CountPerson,
createNewWorkshopTemp.id));
new WorkshopServicesTemp("CustomizeCheckout", workshop.CountPerson, createNewWorkshopTemp.id));
await _workshopServicesTempRepository.SaveChangesAsync();
}
}
}
@@ -373,257 +367,125 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
/// </summary>
/// <param name="contractingPartyTempId"></param>
/// <returns></returns>
public async Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths,
string paymentModel = "OneTime", string contractStartType = "currentMonth")
public async Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId, string periodModel = "12", string paymentModel = "OneTime", string contractStartType = "currentMonth")
{
throw new NotImplementedException();
// //دریافت کارگاه ها
// var workshops = await _workshopTempRepository.GetWorkshopTemp(contractingPartyTempId);
//
// double totalPayment1MonthDouble = 0;
//
// //بدست آوردن جمع کل برای یک ماه
// foreach (var workshop in workshops)
// {
// totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
// }
//
// if (totalPayment1MonthDouble == 0)
// return new ReviewAndPaymentViewModel();
//
// var result = new ReviewAndPaymentViewModel();
//
// int months = 0;
// months = (int)duration;
// //رند کردن مبالغ کارگاه ها
// var roundAmount = (((Convert.ToInt64(totalPayment1MonthDouble))) / 1000000) * 1000000;
// double roundAmount2 = roundAmount;
// //بدست آوردن جمع کل مبالغ کارگاه بر اساس مدت قراداد
// result.SumOfWorkshopsPaymentDouble = months * roundAmount2;
// result.SumOfWorkshopsPaymentPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney();
//
//
// result.Duration = duration;
// result.PaymentModel = paymentModel;
//
//
// var tenPercent = result.SumOfWorkshopsPaymentDouble * 10 / 100;
// //مالیات
// result.ValueAddedTaxDouble = tenPercent;
// result.ValueAddedTaxStr = tenPercent.ToMoney();
// //پرداخت یکجا
//
// #region OneTimePaymentResult
//
// double discountOneTimePeyment = result.SumOfWorkshopsPaymentDouble - tenPercent;
//
//
// //مبلغ بدون مالیات و با تخفیف
// result.OneTimeWithoutTaxPaymentDouble = discountOneTimePeyment;
// result.OneTimeWithoutTaxPaymentStr = discountOneTimePeyment.ToMoney();
//
// //مبلغ با مالیات
// result.OneTimeTotalPaymentDouble = discountOneTimePeyment + tenPercent;
// result.OneTimeTotalPaymentStr = result.OneTimeTotalPaymentDouble.ToMoney();
//
// #endregion
//
// //پرداخت ماهیانه
//
// #region MonthlyPaymentResult
//
// //مبلغ بدون مالیات
// result.MonthlyWithoutTaxPaymentDouble = result.SumOfWorkshopsPaymentDouble;
// result.MonthlyWithoutTaxPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney();
//
// // مبلغ با مالیات
// result.MonthlyTotalPaymentDouble = result.SumOfWorkshopsPaymentDouble + tenPercent;
// result.MonthlyTotalPaymentStr = result.MonthlyTotalPaymentDouble.ToMoney();
// var installmentList = new List<MonthlyInstallment>();
//
// var startDate = (DateTime.Now).ToFarsi();
// result.ContractStartCurrentMonthFa = $"{startDate.Substring(0, 8)}01";
// result.ContractStartCurrentMonthGr = result.ContractStartCurrentMonthFa.ToGeorgianDateTime();
// startDate = result.ContractStartCurrentMonthFa;
//
// result.ContractStartNextMonthGr = ((startDate.FindeEndOfMonth()).ToGeorgianDateTime()).AddDays(1);
// result.ContractStartNextMonthFa = result.ContractStartNextMonthGr.ToFarsi();
//
// if (contractStartType == "nextMonth")
// startDate = result.ContractStartNextMonthFa;
//
//
// var findeEnd = Tools.FindEndOfContract(startDate, ((int)duration).ToString());
// var contractEndDate = findeEnd.endDateGr;
// result.ContractEndGr = contractEndDate;
// result.ContractEndFa = contractEndDate.ToFarsi();
//
// if (duration == InstitutionContractDuration.OneMonth)
// {
// installmentList.Add(new MonthlyInstallment()
// {
// InstallmentAmountStr = result.MonthlyTotalPaymentStr,
// InstallmentCounter = "سررسید پرداخت اول",
// InstalmentDate = (DateTime.Now).ToFarsi()
// });
// result.MonthlyInstallments = installmentList;
// }
// else
// {
// int instalmentCount = (int)duration;
// var instalmentAmount = result.MonthlyTotalPaymentDouble / instalmentCount;
// var findEndOfMonth = startDate.FindeEndOfMonth();
// for (int i = 1; i <= instalmentCount; i++)
// {
// if (i == 1)
// {
// startDate = (DateTime.Now).ToFarsi();
// }
// else if (i > 1)
// {
// var currentMonthStart = ((findEndOfMonth.ToGeorgianDateTime()).AddDays(1)).ToFarsi();
// startDate = currentMonthStart.FindeEndOfMonth();
// findEndOfMonth = startDate;
// }
//
// installmentList.Add(new MonthlyInstallment()
// {
// InstallmentAmountStr = instalmentAmount.ToMoney(),
// InstallmentCounter = i switch
// {
// 1 => "سررسید پرداخت اول",
// 2 => "سررسید پرداخت دوم",
// 3 => "سررسید پرداخت سوم",
// 4 => "سررسید پرداخت چهارم",
// 5 => "سررسید پرداخت پنجم",
// 6 => "سررسید پرداخت ششم",
// 7 => "سررسید پرداخت هفتم",
// 8 => "سررسید پرداخت هشتم",
// 9 => "سررسید پرداخت نهم",
// 10 => "سررسید پرداخت دهم",
// 11 => "سررسید پرداخت یازدهم",
// 12 => "سررسید پرداخت دوازدهم",
// _ => "سررسید پرداخت دوازدهم",
// },
// InstalmentDate = startDate
// });
// }
// }
//
// #endregion
//
// result.MonthlyInstallments = installmentList;
// result.ContractingPartTempId = contractingPartyTempId;
//
// return result;
}
public async Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(double totalPaymentMonth,
InstitutionContractDuration duration, bool hasInPersonContract)
{
//دریافت کارگاه ها
var workshops = await _workshopTempRepository.GetWorkshopTemp(contractingPartyTempId);
double totalPayment1MonthDouble = 0;
// //بدست آوردن جمع کل برای یک ماه
// foreach (var workshop in workshops)
// {
// totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
// }
//بدست آوردن جمع کل برای یک ماه
foreach (var workshop in workshops)
{
totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
}
totalPayment1MonthDouble = totalPaymentMonth;
if (totalPayment1MonthDouble == 0)
return new ReviewAndPaymentViewModel();
var result = new ReviewAndPaymentViewModel();
var months = (int)duration;
int months = 0;
months = periodModel switch
{
"1" => 1,
"3" => 3,
"6" => 6,
"12" => 12,
_ => 12,
};
//رند کردن مبالغ کارگاه ها
double roundAmount2 = totalPayment1MonthDouble;
var roundAmount = (((Convert.ToInt64(totalPayment1MonthDouble))) / 1000000) * 1000000;
double roundAmount2 = roundAmount;
//بدست آوردن جمع کل مبالغ کارگاه بر اساس مدت قراداد
var sumOfWorkshopsPaymentDouble = months * roundAmount2;
result.SumOfWorkshopsPayment = roundAmount2.ToMoney();
var installmentstart = (DateTime.Now).ToFarsi();
result.SumOfWorkshopsPaymentDouble = months * roundAmount2;
result.SumOfWorkshopsPaymentPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney();
var originalDay = int.Parse(installmentstart.Substring(8, 2));
result.ContractStartFa = installmentstart;
result.ContractStartGr = result.ContractStartFa.ToGeorgianDateTime();
var findeEnd = Tools.FindEndOfContract(installmentstart, ((int)duration).ToString());
result.PeriodModel = periodModel;
result.PaymentModel = paymentModel;
var tenPercent = result.SumOfWorkshopsPaymentDouble * 10 / 100;
//مالیات
result.ValueAddedTaxDouble = tenPercent;
result.ValueAddedTaxSt = tenPercent.ToMoney();
//پرداخت یکجا
#region OneTimePaymentResult
double discountOneTimePeyment = result.SumOfWorkshopsPaymentDouble - tenPercent;
//مبلغ بدون مالیات و با تخفیف
result.OneTimeWithoutTaxPaymentDouble = discountOneTimePeyment;
result.OneTimeWithoutTaxPaymentStr = discountOneTimePeyment.ToMoney();
//مبلغ با مالیات
result.OneTimeTotalPaymentDouble = discountOneTimePeyment + tenPercent;
result.OneTimeTotalPaymentStr = result.OneTimeTotalPaymentDouble.ToMoney();
#endregion
//پرداخت ماهیانه
#region MonthlyPaymentResult
//مبلغ بدون مالیات
result.MonthlyWithoutTaxPaymentDouble = result.SumOfWorkshopsPaymentDouble;
result.MonthlyWithoutTaxPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney();
// مبلغ با مالیات
result.MonthlyTotalPaymentDouble = result.SumOfWorkshopsPaymentDouble + tenPercent;
result.MonthlyTotalPaymentStr = result.MonthlyTotalPaymentDouble.ToMoney();
var installmentList = new List<MonthlyInstallment>();
var startDate = (DateTime.Now).ToFarsi();
result.ContractStartCurrentMonthFa = $"{startDate.Substring(0, 8)}01";
result.ContractStartCurrentMonthGr = result.ContractStartCurrentMonthFa.ToGeorgianDateTime();
startDate = result.ContractStartCurrentMonthFa;
result.ContractStartNextMonthGr = ((startDate.FindeEndOfMonth()).ToGeorgianDateTime()).AddDays(1);
result.ContractStartNextMonthFa = result.ContractStartNextMonthGr.ToFarsi();
if (contractStartType == "nextMonth")
startDate = result.ContractStartNextMonthFa;
var findeEnd = Tools.FindEndOfContract(startDate, periodModel);
var contractEndDate = findeEnd.endDateGr;
result.ContractEndGr = contractEndDate;
result.ContractEndFa = contractEndDate.ToFarsi();
if (hasInPersonContract)
if (periodModel == "1")
{
var tenPercent = sumOfWorkshopsPaymentDouble * 10 / 100;
//مالیات
result.ValueAddedTaxStr = tenPercent.ToMoney();
//پرداخت یکجا
#region OneTimePaymentResult
installmentList.Add(new MonthlyInstallment()
{
InstallmentAmountStr = result.MonthlyTotalPaymentStr,
InstallmentCounter = "سررسید پرداخت اول",
InstalmentDate = (DateTime.Now).ToFarsi()
double discountOneTimePeyment = sumOfWorkshopsPaymentDouble - tenPercent;
//مبلغ بدون مالیات و با تخفیف
result.OneTimeWithoutTaxPaymentStr = discountOneTimePeyment.ToMoney();
//مبلغ با مالیات
var oneTimePayment = discountOneTimePeyment + tenPercent;
result.OneTimeTotalPaymentStr = oneTimePayment.ToMoney();
result.DiscountedAmountForOneMonth = roundAmount2.ToMoney();
#endregion
//پرداخت ماهیانه
#region MonthlyPaymentResult
//مبلغ بدون مالیات
result.MonthlyWithoutTaxPaymentStr = sumOfWorkshopsPaymentDouble.ToMoney();
// مبلغ با مالیات
var monthlyTotalPaymentDouble = sumOfWorkshopsPaymentDouble + tenPercent;
result.MonthlyTotalPaymentStr = monthlyTotalPaymentDouble.ToMoney();
var installmentList = new List<MonthlyInstallment>();
int instalmentCount = (int)duration;
var instalmentAmount = monthlyTotalPaymentDouble / instalmentCount;
int currentInstallmentStartDay = int.Parse(installmentstart.Substring(8, 2));
bool endOfMonth = currentInstallmentStartDay == 31;
// Loop through each installment period
});
result.MonthlyInstallments = installmentList;
}
else
{
int instalmentCount = Convert.ToInt32(periodModel);
var instalmentAmount = result.MonthlyTotalPaymentDouble / instalmentCount;
var findEndOfMonth = startDate.FindeEndOfMonth();
for (int i = 1; i <= instalmentCount; i++)
{
string installmentDate;
// For first installment, use the initial date
if (i == 1)
{
installmentDate = installmentstart;
startDate = (DateTime.Now).ToFarsi();
}
else
else if (i > 1)
{
var currentDay = int.Parse(installmentstart.Substring(8, 2));
var currentMonth = int.Parse(installmentstart.Substring(5, 2));
var currentYear = int.Parse(installmentstart.Substring(0, 4));
// Get next month's date
var nextMonthFa = installmentstart.ToGeorgianDateTime().AddMonthsFa(1, out var nextMonth);
var maxDayInNextMonth = int.Parse(nextMonthFa.FindeEndOfMonth().Substring(8, 2));
// Use original day if possible, otherwise use last day of month
var dayToUse = Math.Min(originalDay, maxDayInNextMonth);
installmentDate = nextMonthFa.Substring(0, 8) + dayToUse.ToString("D2");
// Update installmentstart for next iteration
installmentstart = installmentDate;
var currentMonthStart = ((findEndOfMonth.ToGeorgianDateTime()).AddDays(1)).ToFarsi();
startDate = currentMonthStart.FindeEndOfMonth();
findEndOfMonth = startDate;
}
installmentList.Add(new MonthlyInstallment()
@@ -631,52 +493,34 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
InstallmentAmountStr = instalmentAmount.ToMoney(),
InstallmentCounter = i switch
{
1 => "اول",
2 => "دوم",
3 => "سوم",
4 => "چهارم",
5 => "پنجم",
6 => "ششم",
7 => "هفتم",
8 => "هشتم",
9 => "نهم",
10 => "دهم",
11 => "یازدهم",
12 => "دوازدهم",
_ => "دوازدهم",
1 => "سررسید پرداخت اول",
2 => "سررسید پرداخت دوم",
3 => ررسید پرداخت سوم",
4 => "سررسید پرداخت چهارم",
5 => "سررسید پرداخت پنجم",
6 => "سررسید پرداخت ششم",
7 => "سررسید پرداخت هفتم",
8 => "سررسید پرداخت هشتم",
9 => "سررسید پرداخت نهم",
10 => "سررسید پرداخت دهم",
11 => "سررسید پرداخت یازدهم",
12 => "سررسید پرداخت دوازدهم",
_ => "سررسید پرداخت دوازدهم",
},
InstalmentDate = installmentDate
InstalmentDate = startDate
});
}
#endregion
result.MonthlyInstallments = installmentList;
}
else
{
var discount = duration switch
{
InstitutionContractDuration.OneMonth => 0,
InstitutionContractDuration.ThreeMonths => 5,
InstitutionContractDuration.SixMonths => 10,
InstitutionContractDuration.TwelveMonths => 15,
_ => throw new ArgumentOutOfRangeException(nameof(duration), duration, null)
};
var oneMonthDiscountAmount = (roundAmount2 * discount) / 100;
var totalDiscount = oneMonthDiscountAmount * months;
var discountedPayment = sumOfWorkshopsPaymentDouble - totalDiscount;
result.Discount = oneMonthDiscountAmount.ToMoney();
result.DiscountedAmountForOneMonth = (roundAmount2 - oneMonthDiscountAmount).ToMoney();
var taxDouble = (discountedPayment * 10)/100;
result.ValueAddedTaxStr =taxDouble.ToMoney();
result.OneTimeWithoutTaxPaymentStr = discountedPayment.ToMoney();
result.OneTimeTotalPaymentStr =( discountedPayment + taxDouble).ToMoney();
}
result.DailyCompensation = ((roundAmount2 * 10) / 100).ToMoney();
result.Obligation = result.OneTimeWithoutTaxPaymentStr;
#endregion
result.MonthlyInstallments = installmentList;
result.ContractingPartTempId = contractingPartyTempId;
return result;
}
/// <summary>
@@ -684,12 +528,13 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
/// </summary>
/// <param name="contractingPartyTempId"></param>
/// <returns></returns>
public async Task<OperationResult> CreateOrUpdateInstitutionContractTemp(long contractingPartyTempId,
string periodModel, string paymentModel, double totalPayment, double valueAddedTax, DateTime contractStart)
public async Task<OperationResult> CreateOrUpdateInstitutionContractTemp(long contractingPartyTempId, string periodModel, string paymentModel, double totalPayment, double valueAddedTax, DateTime contractStart)
{
var op = new OperationResult();
var institutionContractTemp = await
_institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
var contractStartDate = contractStart;
@@ -700,10 +545,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
{
var periodModelInt = Convert.ToInt32(periodModel);
var create = new InstitutionContractTemp(contractingPartyTempId, paymentModel, periodModel, totalPayment,
contractStartDate, contractEndDate, "official", valueAddedTax, "",
InstitutionContractTempStatus.BeforeSendVerifyCode, 0, null,
null);
var create = new InstitutionContractTemp(contractingPartyTempId, paymentModel, periodModel, totalPayment, contractStartDate, contractEndDate, "official", valueAddedTax, "", "BeforeSendVerifyCode", 0, null, null);
_institutionContractTempRepository.Create(create);
_institutionContractTempRepository.SaveChanges();
@@ -718,13 +560,11 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
if (institutionContractTemp.VerifyCodeEndTime != null)
{
var spaning = (DateTime.Now - institutionContractTemp.VerifyCodeEndTime.Value);
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.VerifyCodeSent &&
spaning > new TimeSpan(0, 0, 0) &&
spaning < new TimeSpan(0, 1, 0))
if (institutionContractTemp.RegistrationStatus == "VerifyCodeSent" && spaning > new TimeSpan(0, 0, 0) && spaning < new TimeSpan(0, 1, 0))
return op.Failed("شما به تازگی پیامک دریافت نموده اید دو دقیقه صبر کنید و دوباره تلاش کنید");
}
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
if (institutionContractTemp.RegistrationStatus == "Completed")
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
@@ -732,17 +572,17 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var contractstart = DateTime.Now;
var contractEnd = DateTime.Now.AddMonths(periodModelInt);
var update = _institutionContractTempRepository.Get(institutionContractTemp.Id);
update.Edit(contractingPartyTempId, paymentModel, periodModel, totalPayment, contractStartDate,
contractEndDate, "official", valueAddedTax, "", InstitutionContractTempStatus.BeforeSendVerifyCode, 0,
null, null);
update.Edit(contractingPartyTempId, paymentModel, periodModel, totalPayment, contractStartDate, contractEndDate, "official", valueAddedTax, "", "BeforeSendVerifyCode", 0, null, null);
_institutionContractTempRepository.SaveChanges();
//temporary
var res = await PayOffCompleted(contractingPartyTempId);
if (!res.IsSuccedded)
return op.Failed(res.Message);
return op.Succcedded();
}
}
@@ -754,25 +594,27 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
/// <returns></returns>
public async Task<OperationResult> ReceivedCodeFromServer(long contractingPartyTempId)
{
var op = new OperationResult();
var institutionContractTemp = await
_institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
_institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
if (institutionContractTemp == null)
return op.Failed("خطا");
var update = _institutionContractTempRepository.Get(institutionContractTemp.Id);
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.BeforeSendVerifyCode)
if (institutionContractTemp.RegistrationStatus == "BeforeSendVerifyCode")
{
//ساخت کد شش رقمی
Random generator = new Random();
String code = generator.Next(1, 1000000).ToString("D6");
//ارسال اس ام اس
var getContractingPaty =
_contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
var getContractingPaty = _contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
var sendResult = await _smsService.SendVerifyCodeToClient(getContractingPaty.Phone, code);
if (!sendResult.IsSuccedded)
@@ -784,16 +626,18 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
//تغییر وضعیت به ارسال شده
if (update != null)
{
update.Update(code, InstitutionContractTempStatus.VerifyCodeSent, sendResult.MessageId, DateTime.Now,
DateTime.Now.AddMinutes(2));
update.Update(code, "VerifyCodeSent", sendResult.MessageId, DateTime.Now, DateTime.Now.AddMinutes(2));
_institutionContractTempRepository.SaveChanges();
return op.Succcedded(1, "کد برای شما پیامک شد");
}
}
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.VerifyCodeSent)
if (institutionContractTemp.RegistrationStatus == "VerifyCodeSent")
{
if (DateTime.Now < institutionContractTemp.VerifyCodeEndTime.Value)
return op.Failed("کد دریافت شده را وارد کنید");
var spaning = (DateTime.Now - institutionContractTemp.VerifyCodeEndTime.Value);
@@ -806,14 +650,14 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
Random generator = new Random();
String code = generator.Next(1, 1000000).ToString("D6");
//ارسال اس ام اس
var getContractingPaty =
_contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
var getContractingPaty = _contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
var sendResult = await _smsService.SendVerifyCodeToClient(getContractingPaty.Phone, code);
if (!sendResult.IsSuccedded)
return op.Failed($"{sendResult.Message}");
//ذخیره کد در دیتا بیس
//ذخیره تاریخ ارسال و مهلت پایان
//ذخیره آیدی پیامک
@@ -821,19 +665,21 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
if (update != null)
{
update.Update(code, InstitutionContractTempStatus.VerifyCodeSent, sendResult.MessageId,
DateTime.Now,
DateTime.Now.AddMinutes(2));
update.Update(code, "VerifyCodeSent", sendResult.MessageId, DateTime.Now, DateTime.Now.AddMinutes(2));
_institutionContractTempRepository.SaveChanges();
return op.Succcedded(1, "کد برای شما پیامک شد");
}
}
}
//if (institutionContractTemp.RegistrationStatus == "ReceivedCodeFromClient")
// return op.Succcedded(2, "انتقال به بخش پرداخت");
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
if (institutionContractTemp.RegistrationStatus == "Completed")
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
return op.Failed("خظا");
}
@@ -848,27 +694,32 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
public async Task<OperationResult> CheckVerifyCodeIsTrue(long contractingPartyTempId, string verifyCode)
{
var op = new OperationResult();
var contractingPartyTemp = _contractingPartyTempRepository.Get( contractingPartyTempId);
if (contractingPartyTemp == null)
var institutionContractTemp = await
_institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
if (institutionContractTemp == null)
return op.Failed("خظا");
if (institutionContractTemp.RegistrationStatus != "VerifyCodeSent")
return op.Failed("خطا");
if (contractingPartyTemp.Status != ContractingPartyTempStatus.InComplete)
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
if (contractingPartyTemp.VerifyCodeSentDateTime.AddMinutes(2) < DateTime.Now)
if (institutionContractTemp.VerifyCodeEndTime < DateTime.Now)
return op.Failed("کد شما منقضی شده است");
if (contractingPartyTemp.VerifyCodeSentDateTime < DateTime.Now &&
contractingPartyTemp.VerifyCodeSentDateTime >= DateTime.Now)
if (institutionContractTemp.SendVerifyCodeTime < DateTime.Now && institutionContractTemp.VerifyCodeEndTime >= DateTime.Now)
{
if (contractingPartyTemp.VerifyCode == verifyCode)
if (institutionContractTemp.VerifyCode == verifyCode)
{
contractingPartyTemp.SetCompleted();
await _contractingPartyTempRepository.SaveChangesAsync();
return op.Succcedded();
}
else
{
return op.Failed("کد وارد شده صحیح نیست");
}
}
return op.Failed("کد وارد شده صحیح نیست");
}
@@ -885,10 +736,10 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var temp = _contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
if (_personalContractingPartyRepository.Exists(x =>
x.Nationalcode == temp.NationalCode))
x.Nationalcode == temp.NationalCode))
return op.Failed("امکان ثبت رکورد تکراری وجود ندارد");
var lastArchiveCode = _personalContractingPartyRepository.GetLastNewArchiveCode();
var lastArchiveCode = _personalContractingPartyRepository.GetLastArchiveCode();
var personalContractingParty = new PersonalContractingParty(temp.FName, temp.LName,
temp.NationalCode, temp.IdNumber, "*", "*",
"حقیقی",
@@ -897,13 +748,12 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
_personalContractingPartyRepository.Create(personalContractingParty);
_personalContractingPartyRepository.SaveChanges();
personalContractingParty.RegisterComplete(temp.FatherName, temp.IdNumberSeri, temp.IdNumberSerial,
temp.DateOfBirth, temp.Gender);
personalContractingParty.RegisterComplete(temp.FatherName, temp.IdNumberSeri, temp.IdNumberSerial, temp.DateOfBirth, temp.Gender);
_personalContractingPartyRepository.SaveChanges();
var institutionContractTemp = await
_institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
var update = _institutionContractTempRepository.Get(institutionContractTemp.Id);
update.ChangeRegistrationStatus(InstitutionContractTempStatus.PendingToCompletion);
update.ChangeRegistrationStatus("Completed");
_institutionContractTempRepository.SaveChanges();
@@ -911,24 +761,10 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
}
public async Task<OperationResult> SendAgreementLink(long contractingPartyTempId)
public async Task<List<RegistrationWorkflowMainList>> RegistrationWorkflowMainList()
{
var op = new OperationResult();
var contractingPartyTemp = _contractingPartyTempRepository.Get(contractingPartyTempId);
if (contractingPartyTemp == null)
throw new NotFoundException("طرف حساب یافت نشد");
if (contractingPartyTemp.Status == ContractingPartyTempStatus.Completed)
throw new BadRequestException("شما قبلا ثبت نام خود را تکمیل نموده اید");
Random generator = new Random();
string verifyCode = generator.Next(1, 1000000).ToString("D6");
contractingPartyTemp.SetVerifyCode(verifyCode);
await _contractingPartyTempRepository.SaveChangesAsync();
await _smsService.SendVerifyCodeToClient(contractingPartyTemp.Phone, verifyCode);
return op.Succcedded();
return await _institutionContractTempRepository.GetAllCompletedRegistration();
}
}

View File

@@ -19,7 +19,6 @@ using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.Workshop.DTOs;
using CompanyManagment.App.Contracts.WorkshopPlan;
using CompanyManagment.EFCore.Migrations;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration.UserSecrets;
using Microsoft.Identity.Client;
@@ -40,12 +39,7 @@ public class WorkshopAppliction : IWorkshopApplication
private readonly IRollCallServiceApplication _rollCallServiceApplication;
private readonly IPasswordHasher _passwordHasher;
public WorkshopAppliction(IWorkshopRepository workshopRepository, ILeftWorkRepository leftWorkRepository,
ILeftWorkInsuranceRepository leftWorkInsuranceRepository, IWorkshopPlanApplication workshopPlanApplication,
IEmployeeApplication employeeApplication, IEmployeeChildrenApplication employeeChildrenApplication,
IInstitutionContractRepository institutionContractRepository,
IPersonalContractingPartyRepository personalContractingPartyRepository,
IRollCallServiceApplication rollCallServiceApplication, IPasswordHasher passwordHasher)
public WorkshopAppliction(IWorkshopRepository workshopRepository, ILeftWorkRepository leftWorkRepository, ILeftWorkInsuranceRepository leftWorkInsuranceRepository, IWorkshopPlanApplication workshopPlanApplication, IEmployeeApplication employeeApplication, IEmployeeChildrenApplication employeeChildrenApplication, IInstitutionContractRepository institutionContractRepository, IPersonalContractingPartyRepository personalContractingPartyRepository, IRollCallServiceApplication rollCallServiceApplication, IPasswordHasher passwordHasher)
{
_workshopRepository = workshopRepository;
_leftWorkRepository = leftWorkRepository;
@@ -64,7 +58,7 @@ public class WorkshopAppliction : IWorkshopApplication
bool createPlanValidations = false;
var accountIds = new List<long>();
var operation = new OperationResult();
if (command.EmployerIdList == null)
if (command.EmployerIdList==null)
return operation.Failed("لطفا کارفرما را انتخاب نمایید");
var employer = command.EmployerIdList.ToList();
if (command.AccountIdsList != null)
@@ -72,49 +66,45 @@ public class WorkshopAppliction : IWorkshopApplication
accountIds = command.AccountIdsList.ToList();
}
if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" &&
string.IsNullOrEmpty(command.InsuranceCode))
if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" && string.IsNullOrEmpty(command.InsuranceCode))
return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode))
return operation.Failed("موارد اجباری را پر کنید");
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
// return operation.Failed("نام کارگاه تکراری است");
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
// return operation.Failed("نام کارگاه تکراری است");
if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" &&
(command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" && (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
command.CutContractEndOfYear = IsActive.None;
if (!command.CreateContract)
{
command.SignContract = false;
command.CreateCheckout = false;
command.SignCheckout = false;
}
if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
command.CutContractEndOfYear = IsActive.None;
if (!command.CreateContract)
{
command.SignContract = false;
command.CreateCheckout = false;
command.SignCheckout = false;
}
if (!command.CreateCheckout)
{
command.SignCheckout = false;
}
if (!command.CreateCheckout)
{
command.SignCheckout = false;
}
if (_workshopRepository.Exists(x =>
!string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode))
if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode))
return operation.Failed("کد بیمه کارگاه تکراری است");
if (!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.State))
return operation.Failed("لطفا استان و شهر را انتخاب کنید");
if ((!string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.State)) &&
command.City == "شهرستان")
if ((!string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.State)) && command.City == "شهرستان")
return operation.Failed("لطفا شهر را انتخاب کنید");
if (string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.State))
return operation.Failed("لطفا آدرس را وارد کنید");
if (command.FixedSalary)
{
if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
@@ -125,14 +115,12 @@ public class WorkshopAppliction : IWorkshopApplication
if (command.IsClassified)
{
if (string.IsNullOrWhiteSpace(command.CreatePlan.ExecutionDateFa) ||
command.CreatePlan.ExecutionDateFa.Length < 10)
if (string.IsNullOrWhiteSpace(command.CreatePlan.ExecutionDateFa) || command.CreatePlan.ExecutionDateFa.Length < 10)
return operation.Failed("تاریخ اجرای طرح را بصورت صحیح وارد کنید");
if (string.IsNullOrWhiteSpace(command.CreatePlan.IncludingDateFa) ||
command.CreatePlan.IncludingDateFa.Length < 10)
if(string.IsNullOrWhiteSpace(command.CreatePlan.IncludingDateFa) || command.CreatePlan.IncludingDateFa.Length <10)
return operation.Failed("تاریخ شمول طرح را بصورت صحیح وارد کنید");
var groupCounter = 0;
// var planEmployeeCounter = command.CreatePlan.EditWorkshopPlanEmployeeList == null ? 0 : command.CreatePlan.EditWorkshopPlanEmployeeList.Count;
// var planEmployeeCounter = command.CreatePlan.EditWorkshopPlanEmployeeList == null ? 0 : command.CreatePlan.EditWorkshopPlanEmployeeList.Count;
for (int i = 0; i <= command.CreatePlan.EditGroupPlanlist.Count - 1; i++)
{
if (!string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].AnnualSalaryStr)
@@ -141,12 +129,14 @@ public class WorkshopAppliction : IWorkshopApplication
&& command.CreatePlan.EditGroupPlanlist[i].JobIdList.Count > 0)
{
groupCounter += 1;
}
}
if (groupCounter >= 1)
{
createPlanValidations = true;
}
else
{
@@ -154,37 +144,31 @@ public class WorkshopAppliction : IWorkshopApplication
return operation.Failed("وارد کردن اطلاعات تمامی گروه ها الزامی است");
}
}
//if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend))
// return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
var account = new AccountViewModel();
var institutionContract = new InstitutionContract();
if (command.HasRollCallFreeVip == "true")
{
institutionContract =
_institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
institutionContract = _institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
if (institutionContract == null)
return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract
.ContractingPartyId);
if (account == null || account.ClientAreaPermission != "true")
account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract.ContractingPartyId);
if(account == null || account.ClientAreaPermission != "true")
return operation.Failed("بدلیل نداشتن حساب کاربری کلاینت نمیتوانید سرویس حضور غیاب را فعال کنید");
}
var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode,
var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode,
command.TypeOfOwnership,
command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City,
command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
, command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName, command.AddBonusesPay,
command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide, command.IsClassified,
command.ComputeOptions,
command.BonusesOptions, command.YearsOptions, command.HasRollCallFreeVip, command.WorkshopHolidayWorking,
command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract,
command.SignContract,
command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear, command.RotatingShiftCompute,
command.IsStaticCheckout, institutionContract.ContractingPartyId);
command.TypeOfInsuranceSend, command.TypeOfContract,command.ContractTerm,command.AgreementNumber
,command.FixedSalary, command.Population,command.InsuranceJobId,command.ZoneName,command.AddBonusesPay,
command.AddYearsPay,command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,command.ComputeOptions,
command.BonusesOptions,command.YearsOptions,command.HasRollCallFreeVip,command.WorkshopHolidayWorking,
command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract, command.SignContract,
command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear,command.RotatingShiftCompute, command.IsStaticCheckout);
_workshopRepository.Create(workshop);
_workshopRepository.SaveChanges();
@@ -200,17 +184,20 @@ public class WorkshopAppliction : IWorkshopApplication
MaxPersonValid = 500,
Duration = "12",
HasCustomizeCheckoutService = command.HasCustomizeCheckoutService
};
_rollCallServiceApplication.Create(commandSave);
}
};
_rollCallServiceApplication.Create(commandSave);
}
//مشاغل مقطوع
if (createPlanValidations)
{
command.CreatePlan.WorkshopId = workshop.id;
var creatPlan = _workshopPlanApplication.CreateWorkshopPlan(command.CreatePlan);
}
foreach (var e in employer)
{
@@ -221,7 +208,9 @@ public class WorkshopAppliction : IWorkshopApplication
var op = _workshopRepository.CreateAccountLeftWorkAndWorkshopAccounts(accountIds, workshop.id);
return operation.Succcedded();
}
public OperationResult Edit(EditWorkshop command)
@@ -239,48 +228,44 @@ public class WorkshopAppliction : IWorkshopApplication
{
accountIds = command.AccountIdsList.ToList();
}
if (workshop == null)
operation.Failed("رکورد مورد نظر وجود ندارد");
if (command.EmployerIdList == null)
return operation.Failed("لطفا کارفرما را انتخاب نمایید");
var employer = command.EmployerIdList.ToList();
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
// return operation.Failed(" نام کارگاه تکراری است ");
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
// return operation.Failed(" نام کارگاه تکراری است ");
if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" &&
(command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" && (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
command.CutContractEndOfYear = IsActive.None;
if (!command.CreateContract)
{
command.SignContract = false;
command.CreateCheckout = false;
command.SignCheckout = false;
}
if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
command.CutContractEndOfYear = IsActive.None;
if (!command.CreateContract)
{
command.SignContract = false;
command.CreateCheckout = false;
command.SignCheckout = false;
}
if (!command.CreateCheckout)
{
command.SignCheckout = false;
}
if (!command.CreateCheckout)
{
command.SignCheckout = false;
}
if (command.TypeOfInsuranceSend != null && string.IsNullOrEmpty(command.InsuranceCode))
if (command.TypeOfInsuranceSend != null && string.IsNullOrEmpty(command.InsuranceCode))
return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
if (_workshopRepository.Exists(x =>
!string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode &&
x.id != command.Id))
if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode && x.id != command.Id))
return operation.Failed("کد بیمه کارگاه تکراری است");
if (command.Address != null && command.State == null)
return operation.Failed("لطفا استان و شهر را انتخاب کنید");
if ((command.Address != null && command.State != null) && command.City == "شهرستان")
return operation.Failed("لطفا شهر را انتخاب کنید");
if (command.Address == null && command.State != null)
if (command.Address == null && command.State != null)
return operation.Failed("لطفا آدرس را وارد کنید");
if (command.ComputeOptions == "0")
@@ -295,19 +280,17 @@ public class WorkshopAppliction : IWorkshopApplication
if (string.IsNullOrWhiteSpace(command.Population))
return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
}
var account = new AccountViewModel();
var institutionContract = new InstitutionContract();
if (command.HasRollCallFreeVip == "true")
{
institutionContract =
_institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
institutionContract = _institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
if (institutionContract == null)
return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract
.ContractingPartyId);
account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract.ContractingPartyId);
if ((account == null || account.ClientAreaPermission != "true") && command.Id != 11)
return operation.Failed("بدلیل نداشتن حساب کاربری کلاینت نمیتوانید سرویس حضور غیاب را فعال کنید");
var searchService = _rollCallServiceApplication.GetAllServiceByWorkshopId(command.Id);
@@ -326,7 +309,7 @@ public class WorkshopAppliction : IWorkshopApplication
{
var hasService = searchService.FirstOrDefault(x =>
x.IsActiveString == "true" && x.StartService <= DateTime.Now &&
x.EndService >= DateTime.Now);
x.EndService >= DateTime.Now );
if (hasService == null)
{
_rollCallServiceApplication.Create(commandSave);
@@ -338,18 +321,22 @@ public class WorkshopAppliction : IWorkshopApplication
hasService.HasCustomizeCheckoutService != "true")
{
_rollCallServiceApplication.AddCustomizeCheckoutServiceVip(hasService.Id);
}
else if (command.HasCustomizeCheckoutService == "false" &&
hasService.HasCustomizeCheckoutService == "true")
}else if (command.HasCustomizeCheckoutService == "false" &&
hasService.HasCustomizeCheckoutService == "true")
{
_rollCallServiceApplication.StopVipService(hasService.Id);
}
}
}
else
{
_rollCallServiceApplication.Create(commandSave);
}
}
else
{
@@ -365,18 +352,16 @@ public class WorkshopAppliction : IWorkshopApplication
}
}
}
workshop.Edit(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, command.TypeOfOwnership,
workshop.Edit(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, command.TypeOfOwnership,
command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City,
command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
command.TypeOfInsuranceSend, command.TypeOfContract,command.ContractTerm, command.AgreementNumber
, command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName,
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide,
command.IsClassified,
command.ComputeOptions, command.BonusesOptions, command.YearsOptions, command.HasRollCallFreeVip,
command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance,
command.CreateContract, command.SignContract, command.CreateCheckout, command.SignCheckout,
command.CutContractEndOfYear, command.RotatingShiftCompute, command.IsStaticCheckout);
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide,command.IsClassified,
command.ComputeOptions,command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip,
command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime,command.InsuranceCheckoutFamilyAllowance,
command.CreateContract, command.SignContract, command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear,command.RotatingShiftCompute, command.IsStaticCheckout);
_workshopRepository.SaveChanges();
_workshopRepository.RemoveOldRelation(command.Id);
@@ -384,18 +369,18 @@ public class WorkshopAppliction : IWorkshopApplication
{
_workshopRepository.EmployerWorkshop(workshop.id, e);
}
var op = _workshopRepository.EditAccountLeftWorkAndWorkshopAccounts(accountIds, workshop.id);
foreach (var item in leftWork)
{
var editLeft = _leftWorkRepository.Get(item.Id);
editLeft.EditBonuses(command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay);
_leftWorkRepository.SaveChanges();
}
transaction.Complete();
return operation.Succcedded();
}
public string GetWorkshopFullname(long id)
@@ -411,7 +396,8 @@ public class WorkshopAppliction : IWorkshopApplication
{
workshop.CreatePlan = _workshopPlanApplication.GetWorkshopPlanByWorkshopId(id);
}
return workshop;
}
@@ -425,7 +411,6 @@ public class WorkshopAppliction : IWorkshopApplication
{
return _workshopRepository.GetWorkshopAll();
}
public List<WorkshopViewModel> GetWorkshopAccount()
{
return _workshopRepository.GetWorkshopAccount();
@@ -451,17 +436,13 @@ public class WorkshopAppliction : IWorkshopApplication
InsurancePerson = x.InsurancePerson,
ContractLeft = x.ContractLeft,
InsurancetLeft = x.InsurancetLeft,
Black = ((x.ContractPerson && x.InsurancePerson && x.InsurancetLeft && x.ContractLeft) ||
(x.ContractPerson && !x.InsurancePerson && x.ContractLeft) ||
(x.InsurancePerson && !x.ContractPerson && x.InsurancetLeft))
? true
: false
Black = ((x.ContractPerson && x.InsurancePerson && x.InsurancetLeft && x.ContractLeft) || (x.ContractPerson && !x.InsurancePerson && x.ContractLeft) || (x.InsurancePerson && !x.ContractPerson && x.InsurancetLeft)) ? true : false
}).ToList();
return res;
}
#region Vafa
public List<PersonnelInfoViewModel> GetPersonnelInfo(PersonnelInfoSearchModel searchModel)
{
var res = _workshopRepository.GetPersonnelInfo(searchModel.WorkshopId);
@@ -483,11 +464,7 @@ public class WorkshopAppliction : IWorkshopApplication
InsurancePerson = x.InsurancePerson,
ContractLeft = x.ContractLeft,
InsuranceLeft = x.InsuranceLeft,
Black = ((x.ContractPerson && x.InsurancePerson && x.InsuranceLeft && x.ContractLeft) ||
(x.ContractPerson && !x.InsurancePerson && x.ContractLeft) ||
(x.InsurancePerson && !x.ContractPerson && x.InsuranceLeft))
? true
: false,
Black = ((x.ContractPerson && x.InsurancePerson && x.InsuranceLeft && x.ContractLeft) || (x.ContractPerson && !x.InsurancePerson && x.ContractLeft) || (x.InsurancePerson && !x.ContractPerson && x.InsuranceLeft)) ? true : false,
LastStartContractWork = x.LastStartContractWork,
LastLeftContractWork = x.LastLeftContractWork,
LastStartInsuranceWork = x.LastStartInsuranceWork,
@@ -537,7 +514,7 @@ public class WorkshopAppliction : IWorkshopApplication
var workshop = _workshopRepository.Get(id);
if (workshop == null)
return opration.Failed("رکورد مورد نظر یافت نشد");
var checkLeftWork = _leftWorkRepository.searchByWorkshopId(id);
var checkInsurancLeftWork = _leftWorkInsuranceRepository.searchByWorkshopId(id);
if (checkLeftWork.Count > 0 || checkInsurancLeftWork.Count > 0)
@@ -548,11 +525,14 @@ public class WorkshopAppliction : IWorkshopApplication
{
workshop.DeActive(workshop.ArchiveCode);
_workshopRepository.SaveChanges();
return opration.Succcedded(id, "عملیت با موفقیت انجام شد");
return opration.Succcedded(id,"عملیت با موفقیت انجام شد");
}
//var s = workshop.ArchiveCode;
}
public WorkshopViewModel GetWorkshopInfo(long id)
@@ -575,8 +555,10 @@ public class WorkshopAppliction : IWorkshopApplication
#region client
public OperationResult Remove(long id)
{
var opration = new OperationResult();
bool result = _workshopRepository.Remove(id);
@@ -587,15 +569,14 @@ public class WorkshopAppliction : IWorkshopApplication
}
else
return opration.Failed("حذف با خطا مواجه نشد");
return opration;
}
public List<WorkshopViewModel> GetWorkshopByTextSearchForClient(string textSearch)
{
return _workshopRepository.GetWorkshopByTextSearchForClient(textSearch);
}
public List<WorkshopViewModel> SearchForClient(WorkshopSearchModel searchModel)
{
return _workshopRepository.SearchForClient(searchModel);
@@ -603,12 +584,12 @@ public class WorkshopAppliction : IWorkshopApplication
public OperationResult CreateForClient(CreateWorkshop command)
{
throw new NotImplementedException();
throw new NotImplementedException();
}
public OperationResult EditForClient(EditWorkshop command)
{
throw new NotImplementedException();
throw new NotImplementedException();
}
//public OperationResult CreateForClient(CreateWorkshop command)
//{
@@ -669,6 +650,7 @@ public class WorkshopAppliction : IWorkshopApplication
// _workshopRepository.SaveChanges();
// foreach (var e in employer)
// {
// _workshopRepository.EmployerWorkshop(workshop.id, e);
@@ -678,6 +660,7 @@ public class WorkshopAppliction : IWorkshopApplication
// _workshopRepository.CreateWorkshopAccounts(accountIds, workshop.id);
// return operation.Succcedded();
@@ -766,7 +749,6 @@ public class WorkshopAppliction : IWorkshopApplication
{
return _workshopRepository.GetWorkshopAccountByAcountID(acountID);
}
public bool CheckAccountWorkshop(long workshopId)
{
return _workshopRepository.CheckAccountWorkshop(workshopId);
@@ -780,13 +762,17 @@ public class WorkshopAppliction : IWorkshopApplication
#endregion
#region NewByHeydari
public List<WorkshopViewModel> GetWorkshopByTextSearch(string searchText)
{
return _workshopRepository.GetWorkshopByTextSearch(searchText);
}
}
public List<WorkshopViewModel> SearchForMain(WorkshopSearchModel searchModel)
{
return _workshopRepository.SearchForMain(searchModel);
@@ -803,8 +789,7 @@ public class WorkshopAppliction : IWorkshopApplication
//var workshopObj = _workshopRepository.Get(id);
//workshopObj.DeActive(workshopObj.ArchiveCode);
//_workshopRepository.SaveChanges();
return _workshopRepository.DeActiveAll(id);
;
return _workshopRepository.DeActiveAll(id); ;
}
else
{
@@ -819,7 +804,6 @@ public class WorkshopAppliction : IWorkshopApplication
return opration;
}
public OperationResult ActiveAll(long id)
{
return _workshopRepository.ActiveAll(id);
@@ -830,6 +814,7 @@ public class WorkshopAppliction : IWorkshopApplication
return _workshopRepository.PrintWorkshopList(searchModel);
}
public AccountViewModel GetClientAccountByWorkshopId(long workshopId)
{
@@ -838,6 +823,7 @@ public class WorkshopAppliction : IWorkshopApplication
}
//public List<ConnectedPersonnelViewModel> GetConnectedPersonnelsForMain(long workshopId)
//{
// return _workshopRepository.GetConnectedPersonnelsForMain(workshopId);
@@ -847,9 +833,9 @@ public class WorkshopAppliction : IWorkshopApplication
#region Pooya
public List<PersonnelInfoViewModel> GetPersonnelInfoRemastered(PersonnelInfoSearchModel searchModel)
{
var res = _workshopRepository.GetPersonnelInfoRemastered(searchModel.WorkshopId);
res = res.Select(x => new PersonnelInfoViewModel
{
@@ -900,24 +886,23 @@ public class WorkshopAppliction : IWorkshopApplication
res = res.Where(x => x.MaritalStatus == searchModel.MaritalStatus).ToList();
return res;
}
#endregion
#region Insurance
public List<WorkshopViewModel> GetWorkshopSelectListInsuransce()
{
return _workshopRepository.GetWorkshopSelectListInsuransce();
}
{
return _workshopRepository.GetWorkshopSelectListInsuransce();
}
#endregion
#region Mahan
public async Task<List<WorkshopWithStartedEmployeesDto>> GetWorkshopsForEmployeeStartWork(long accountId)
{
return await _workshopRepository.GetWorkshopsForEmployeeStartWork(accountId);
}
public async Task<int> GetWorkshopsForEmployeeStartWorkCount(long accountId)
@@ -940,189 +925,8 @@ public class WorkshopAppliction : IWorkshopApplication
return await _workshopRepository.GetSelectList(search, id);
}
public async Task<ActionResult<OperationResult>> CreateWorkshopWorkflowRegistration(
CreateWorkshopWorkflowRegistration command)
{
bool createPlanValidations = false;
var operation = new OperationResult();
var transaction = await _workshopRepository.BeginTransactionAsync();
var contractWorkshopDetail =
await _institutionContractRepository.GetInstitutionWorkshopDetails(command
.InstitutionContractWorkshopDetailId);
if (contractWorkshopDetail == null)
return operation.Failed("جزئیات قرارداد موسسه یافت نشد");
var employerIds = contractWorkshopDetail.Employers.Select(x => x.EmployerId).ToList();
if (employerIds.Count == 0)
return operation.Failed("لطفا کارفرما را انتخاب نمایید");
if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" &&
string.IsNullOrEmpty(command.InsuranceCode))
return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode))
return operation.Failed("موارد اجباری را پر کنید");
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
// return operation.Failed("نام کارگاه تکراری است");
if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" &&
(command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
command.CutContractEndOfYear = IsActive.None;
if (!command.CreateContract)
{
command.SignContract = false;
command.CreateCheckout = false;
command.SignCheckout = false;
}
if (!command.CreateCheckout)
{
command.SignCheckout = false;
}
if (_workshopRepository.Exists(x =>
!string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode))
return operation.Failed("کد بیمه کارگاه تکراری است");
if (!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.Province))
return operation.Failed("لطفا استان و شهر را انتخاب کنید");
if ((!string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.Province)) &&
command.City == "شهرستان")
return operation.Failed("لطفا شهر را انتخاب کنید");
if (string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.Province))
return operation.Failed("لطفا آدرس را وارد کنید");
if (command.FixedSalary)
{
if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
return operation.Failed("لطفا صنف را انتخاب کنید");
if (string.IsNullOrWhiteSpace(command.Population))
return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
}
// if (command.IsClassified)
// {
// if (string.IsNullOrWhiteSpace(command.CreatePlan.ExecutionDateFa) ||
// command.CreatePlan.ExecutionDateFa.Length < 10)
// return operation.Failed("تاریخ اجرای طرح را بصورت صحیح وارد کنید");
// if (string.IsNullOrWhiteSpace(command.CreatePlan.IncludingDateFa) ||
// command.CreatePlan.IncludingDateFa.Length < 10)
// return operation.Failed("تاریخ شمول طرح را بصورت صحیح وارد کنید");
// var groupCounter = 0;
// // var planEmployeeCounter = command.CreatePlan.EditWorkshopPlanEmployeeList == null ? 0 : command.CreatePlan.EditWorkshopPlanEmployeeList.Count;
// for (int i = 0; i <= command.CreatePlan.EditGroupPlanlist.Count - 1; i++)
// {
// if (!string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].AnnualSalaryStr)
// && !string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].BaseSalaryStr)
// && !string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].JobSalaryStr)
// && command.CreatePlan.EditGroupPlanlist[i].JobIdList.Count > 0)
// {
// groupCounter += 1;
//
// }
// }
//
// if (groupCounter >= 1)
// {
// createPlanValidations = true;
//
// }
// else
// {
// createPlanValidations = false;
// return operation.Failed("وارد کردن اطلاعات تمامی گروه ها الزامی است");
// }
// }
//if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend))
// return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
var account = new AccountViewModel();
var institutionContract =
await _institutionContractRepository.GetIncludeWorkshopDetailsAsync(contractWorkshopDetail
.InstitutionContractId);
if (institutionContract == null)
{
return operation.Failed("قرارداد مالی موسسه یافت نشد");
}
if (command.HasRollCallFreeVip == "true")
{
// if (institutionContract == null)
// return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract
.ContractingPartyId);
if (account == null || account.ClientAreaPermission != "true")
return operation.Failed("بدلیل نداشتن حساب کاربری کلاینت نمیتوانید سرویس حضور غیاب را فعال کنید");
}
var workshop = new Workshop(command.WorkshopName, command.SureName, command.InsuranceCode,
command.TypeOfOwnership,
command.ArchiveCode, command.AgentName, command.AgentPhone, command.Province, command.City,
command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
, command.FixedSalary, command.Population, command.InsuranceJobId, null, false,
command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide, false,
command.ComputeOptions,
command.BonusesOptions, command.YearsOptions, command.HasRollCallFreeVip, command.OpenInHolidays,
command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract,
command.SignContract,
command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear, command.RotatingShiftCompute,
command.IsStaticCheckout, institutionContract.ContractingPartyId);
await _workshopRepository.CreateAsync(workshop);
await _workshopRepository.SaveChangesAsync();
if (command.HasRollCallFreeVip == "true")
{
var commandSave = new CreateRollCallService()
{
AccountId = account.Id,
WorkshopId = workshop.id,
ServiceType = "vip",
EndService = institutionContract.ContractEndGr,
Amount = 1000,
MaxPersonValid = 500,
Duration = "12",
HasCustomizeCheckoutService = command.HasCustomizeCheckoutService
};
_rollCallServiceApplication.Create(commandSave);
}
contractWorkshopDetail.SetWorkshopId(workshop.id);
await _workshopRepository.SaveChangesAsync();
foreach (var e in employerIds)
{
_workshopRepository.EmployerWorkshop(workshop.id, e);
}
var accountIds = StaticWorkshopAccounts.StaticAccountIds.ToList();
accountIds.Add(command.SeniorContractAccountId);
accountIds.Add(command.JuniorContractAccountId);
accountIds.Add(command.SeniorInsuranceAccountId);
accountIds.Add(command.JuniorInsuranceAccountId);
var op = _workshopRepository.CreateAccountLeftWorkAndWorkshopAccounts(accountIds.Distinct().ToList(),
workshop.id);
_institutionContractRepository.UpdateStatusIfNeeded(institutionContract.id);
if (!op.IsSuccedded)
return op;
await transaction.CommitAsync();
return operation.Succcedded();
}
#endregion
}

View File

@@ -1,12 +1,17 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using Company.Domain.YearlySalaryAgg;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.Holiday;
using CompanyManagment.App.Contracts.LeftWork;
using CompanyManagment.App.Contracts.YearlySalary;
using CompanyManagment.EFCore;
using Microsoft.EntityFrameworkCore;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
namespace CompanyManagment.Application;
@@ -128,6 +133,41 @@ public class YearlySalaryApplication : IYearlySalaryApplication
return _yearlySalaryRepository.GetYearlySalary();
}
public Task<UpgradeManualDailyWageModel> UpgradeManualDailyWage(DateTime newContractStart, DateTime lastContractStart, double lastContractManualDailyWage)
{
return _yearlySalaryRepository.UpgradeManualDailyWage(newContractStart, lastContractStart,
lastContractManualDailyWage);
}
public async Task<BaseYearDataViewModel> BaseYearComputeByContractId(long contractId)
{
var contract = await _context.Contracts.FirstOrDefaultAsync(x => x.id == contractId);
var leftWorkList = await _context.LeftWorkList.Where(x=>x.EmployeeId ==contract.EmployeeId && x.WorkshopId == contract.WorkshopIds).Select(x => new LeftWorkViewModel()
{
Id = x.id,
LeftWorkDate = x.LeftWorkDate.ToFarsi(),
StartWorkDate = x.StartWorkDate.ToFarsi(),
LeftWorkDateGr = x.LeftWorkDate,
StartWorkDateGr = x.StartWorkDate,
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
HasLeft = x.HasLeft,
}).ToListAsync();
var baseYearResult = await _yearlySalaryRepository.BaseYearCompute(contract.ContarctStart, contract.ContractEnd,
contract.EmployeeId, contract.WorkshopIds, leftWorkList);
return baseYearResult;
}
public async Task<(double dailyWage, long yearlySalaryId)> GetDailyWageByStartEnd(DateTime start, DateTime end)
{
return await _yearlySalaryRepository.GetDailyWageByStartEnd(start, end);
}
public List<YearlySalaryViewModel> Search(YearlySalarySearchModel searchModel)
{
return _yearlySalaryRepository.Search(searchModel);

View File

@@ -65,7 +65,6 @@ using Company.Domain.InsuranceYearlySalaryAgg;
using Company.Domain.InsurancJobAgg;
using Company.Domain.InsurancWorkshopInfoAgg;
using Company.Domain.JobAgg;
using Company.Domain.LawAgg;
using Company.Domain.LeaveAgg;
using Company.Domain.LeftWorkAgg;
using Company.Domain.LeftWorkInsuranceAgg;
@@ -119,7 +118,6 @@ using Company.Domain.YearlysSalaryTitleAgg;
using CompanyManagment.EFCore.Mapping;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
using Company.Domain.AuthorizedPersonAgg;
using Evidence = Company.Domain.Evidence.Evidence;
using Zone = Company.Domain.ZoneAgg.Zone;
@@ -135,7 +133,9 @@ public class CompanyContext : DbContext
public DbSet<EntityModule> EntityModules { get; set; }
public DbSet<EntityModuleTextManager> EntityModuleTextManagers { get; set; }
public DbSet<EntityBill> EntityBills { get; set; }
public DbSet<EntityContact> EntityContacts { get; set; }
//---------Files------------------------------
public DbSet<Board> Boards { get; set; }
public DbSet<BoardType> BoardTypes { get; set; }
@@ -152,6 +152,7 @@ public class CompanyContext : DbContext
public DbSet<FileTitle> FileTitles { get; set; }
public DbSet<FileTiming> FileTimings { get; set; }
public DbSet<FileState> FileStates { get; set; }
public DbSet<FileAlert> FileAlerts { get; set; }
//-------Task Manager----------------------------
//public DbSet<Task> Tasks { get; set; }
@@ -190,17 +191,10 @@ public class CompanyContext : DbContext
public DbSet<PaymentTransaction> PaymentTransactions { get; set; }
public DbSet<ContractingPartyBankAccount> ContractingPartyBankAccounts { get; set; }
public DbSet<Law> Laws { get; set; }
public DbSet<PaymentInstrument> PaymentInstruments { get; set; }
public DbSet<PaymentInstrumentGroup> PaymentInstrumentGroups { get; set; }
public DbSet<AuthorizedPerson> AuthorizedPersons { get; set; }
public DbSet<InstitutionContractContactInfoTemp> InstitutionContractContactInfoTemps { get; set; }
#endregion
#region Pooya
@@ -267,14 +261,13 @@ public class CompanyContext : DbContext
public DbSet<DateSalary> DateSalaries { get; set; }
public DbSet<DateSalaryItem> DateSalaryItems { get; set; }
public DbSet<Percentage> Percentages { get; set; }
public DbSet<InsuranceJobItem> InsuranceJobItems { get; set; }
public DbSet<InsuranceJob> InsuranceJobs { get; set; }
public DbSet<InsuranceJobAndJobs> InsuranceJobAndJobsSet { get; set; }
public DbSet<InstitutionContractContactInfo> InstitutionContractContactInfos { get; set; }
public DbSet<InstitutionContract> InstitutionContractSet { get; set; }
public DbSet<InstitutionContractWorkshopDetail> InstitutionContractWorkshopDetails { get; set; }
public DbSet<FileEmployer> FileEmployerSet { get; set; }
public DbSet<FileEmployee> FileEmployeeSet { get; set; }
public DbSet<Representative> RepresentativeSet { get; set; }
@@ -286,14 +279,14 @@ public class CompanyContext : DbContext
public DbSet<WorkingHours> WorkingHoursSet { get; set; }
public DbSet<HolidayItem> HolidayItems { get; set; }
public DbSet<Holiday> Holidays { get; set; }
public DbSet<MandatoryHours> MandatoryHoursDbSet { get; set; }
public DbSet<MandatoryHours> MandatoryHoursDbSet { get; set; }
public DbSet<WorkshopEmployer> WorkshopEmployers { get; set; }
public DbSet<Job> Jobs { get; set; }
public DbSet<Job> Jobs { get; set; }
public DbSet<Contract> Contracts { get; set; }
public DbSet<YearlySalaryTitle> YearlySalaryTitles { get; set; }
public DbSet<YearlySalaryItem> YearlySalaryItems { get; set; }
public DbSet<YearlySalary> YearlySalaries { get; set; }
public DbSet<EmployeeChildren> EmployeeChildrenSet { get; set; }
public DbSet<EmployeeChildren> EmployeeChildrenSet { get; set; }
public DbSet<Employee> Employees { get; set; }
public DbSet<Workshop> Workshops { get; set; }
public DbSet<PersonalContractingParty> PersonalContractingParties { get; set; }
@@ -308,17 +301,15 @@ public class CompanyContext : DbContext
public DbSet<Employer> Employers { get; set; }
public CompanyContext(DbContextOptions<CompanyContext> options) :base(options)
public CompanyContext(DbContextOptions<CompanyContext> options) : base(options)
{
}
public CompanyContext()
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -326,6 +317,5 @@ public class CompanyContext : DbContext
modelBuilder.ApplyConfigurationsFromAssembly(assembly);
modelBuilder.Entity<RollCall>().HasQueryFilter(x => x.RollCallModifyType != RollCallModifyType.Undefined);
base.OnModelCreating(modelBuilder);
}
}

View File

@@ -1,60 +0,0 @@
using Company.Domain.AuthorizedPersonAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class AuthorizedPersonMapping : IEntityTypeConfiguration<AuthorizedPerson>
{
public void Configure(EntityTypeBuilder<AuthorizedPerson> builder)
{
builder.ToTable("AuthorizedPersons");
builder.HasKey(x => x.id);
builder.Property(x => x.NationalCode)
.HasMaxLength(10)
.IsRequired();
builder.Property(x => x.FirstName)
.HasMaxLength(100)
.IsRequired();
builder.Property(x => x.LastName)
.HasMaxLength(100)
.IsRequired();
builder.Property(x => x.FatherName)
.HasMaxLength(100);
builder.Property(x => x.BirthDate)
.HasMaxLength(10);
builder.Property(x => x.Gender)
.HasMaxLength(50);
builder.Property(x => x.DeathStatus)
.HasMaxLength(50);
builder.Property(x => x.ShenasnameSeri)
.HasMaxLength(10);
builder.Property(x => x.ShenasnameSerial)
.HasMaxLength(10);
builder.Property(x => x.ShenasnamehNumber)
.HasMaxLength(20);
builder.Property(x => x.IsVerified)
.IsRequired();
builder.Property(x => x.VerificationDate);
builder.Property(x => x.CreationDate)
.IsRequired();
// Index for better performance on NationalCode queries
builder.HasIndex(x => x.NationalCode)
.IsUnique();
}
}

View File

@@ -26,6 +26,8 @@ public class ContractMapping : IEntityTypeConfiguration<Contract>
builder.Property(x => x.ContractPeriod).HasMaxLength(2).IsRequired(false);
builder.Property(x => x.AgreementSalary).HasMaxLength(50).IsRequired(false);
builder.Property(x => x.Signature).HasMaxLength(1).IsRequired(false);
builder.Property(x=>x.DailyWageType).HasMaxLength(30).IsRequired(false);

View File

@@ -28,8 +28,5 @@ public class ContractingPartyTempMapping : IEntityTypeConfiguration<ContractingP
v => v.ToString(),
v => (Gender)Enum.Parse(typeof(Gender), v)).HasMaxLength(6);
builder.Property(x => x.DateOfBirth);
builder.Property(x => x.Status).HasConversion<string>().HasMaxLength(20);
builder.Property(x => x.VerifyCode).HasMaxLength(12);
}
}

View File

@@ -1,22 +0,0 @@
using Company.Domain.TemporaryClientRegistrationAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class InstitutionContractContactInfoTempMapping : IEntityTypeConfiguration<InstitutionContractContactInfoTemp>
{
public void Configure(EntityTypeBuilder<InstitutionContractContactInfoTemp> builder)
{
builder.ToTable("InstitutionContractContactInfoTemp");
builder.HasKey(x => x.id);
builder.Property(x => x.FullName).HasMaxLength(50);
builder.Property(x => x.PhoneNumber).HasMaxLength(20);
builder.Property(x => x.PhoneType).HasMaxLength(20);
builder.Property(x => x.Position).HasMaxLength(50);
builder.HasOne(x => x.InstitutionContractTemp)
.WithMany(x => x.ContactInfoList)
.HasForeignKey(x => x.InstitutionContractTempId);
}
}

View File

@@ -1,23 +0,0 @@
using Company.Domain.InstitutionContractAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class InstitutionContractInstallmentMapping : IEntityTypeConfiguration<InstitutionContractInstallment>
{
public void Configure(EntityTypeBuilder<InstitutionContractInstallment> builder)
{
builder.ToTable("InstitutionContractInstallments");
builder.HasKey(x => x.Id);
builder.Property(x => x.InstallmentDateFa).HasMaxLength(10).IsRequired();
builder.Property(x => x.Description).HasMaxLength(1000);
builder.Property(x => x.Amount).IsRequired();
builder.HasOne(x => x.InstitutionContract)
.WithMany(x => x.Installments)
.HasForeignKey(x => x.InstitutionContractId)
.OnDelete(DeleteBehavior.Cascade);
}
}

View File

@@ -29,16 +29,7 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
builder.Property(x => x.TypeOfContract).HasMaxLength(30);
builder.Property(x => x.HasValueAddedTax).HasMaxLength(10);
builder.Property(x => x.Status).HasConversion<string>().HasMaxLength(122);
// Configure simple relationship with WorkshopDetails for Include() support
builder.HasMany(x => x.WorkshopDetails)
.WithOne(x => x.InstitutionContract)
.HasForeignKey(x => x.InstitutionContractId);
builder.HasMany(x => x.Installments)
.WithOne(x => x.InstitutionContract)
.HasForeignKey(x => x.InstitutionContractId);
builder.HasMany(x => x.ContactInfoList)
.WithOne(x => x.InstitutionContracts)

View File

@@ -11,7 +11,7 @@ public class InstitutionContractTempMapping : IEntityTypeConfiguration<Instituti
builder.ToTable("InstitutionContractTemps");
builder.HasKey(x => x.id);
builder.Property(x => x.RegistrationStatus).HasConversion<string>().HasMaxLength(30);
builder.Property(x => x.RegistrationStatus).HasMaxLength(30);
builder.Property(x => x.PaymentModel).HasMaxLength(30);
builder.Property(x => x.PeriodModel).HasMaxLength(3);
builder.Property(x => x.OfficialCompany).HasMaxLength(30);

View File

@@ -1,33 +0,0 @@
using Company.Domain.InstitutionContractAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class InstitutionContractWorkshopDetailMapping : IEntityTypeConfiguration<InstitutionContractWorkshopDetail>
{
public void Configure(EntityTypeBuilder<InstitutionContractWorkshopDetail> builder)
{
builder.ToTable("InstitutionContractWorkshopDetail");
builder.HasKey(x => x.id);
builder.Property(x => x.WorkshopName).HasMaxLength(100);
builder.Property(x => x.WorkshopId).IsRequired(false);
// Configure relationship with InstitutionContract
builder.HasOne(x => x.InstitutionContract)
.WithMany(x => x.WorkshopDetails)
.HasForeignKey(x => x.InstitutionContractId);
// Configure OwnsMany relationship with Employers
builder.OwnsMany(x => x.Employers, employer =>
{
employer.ToTable("InstitutionContractWorkshopDetailEmployers");
employer.HasKey(x => x.id);
employer.WithOwner().HasForeignKey(x => x.InstitutionContractWorkshopDetailId);
employer.Property(x => x.EmployerId).IsRequired();
employer.HasIndex(x => new { x.InstitutionContractWorkshopDetailId, x.EmployerId })
.IsUnique();
});
}
}

View File

@@ -1,35 +0,0 @@
using Company.Domain.LawAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping
{
public class LawMapping : IEntityTypeConfiguration<Law>
{
public void Configure(EntityTypeBuilder<Law> builder)
{
builder.ToTable("Law");
builder.HasKey(x => x.id);
builder.Property(x => x.Title).HasMaxLength(255).IsRequired();
builder.Property(x => x.IsActive).IsRequired();
builder.Property(x => x.Type).HasConversion<string>().HasMaxLength(50);
builder.OwnsMany(x => x.Items, navigationBuilder =>
{
navigationBuilder.ToTable("LawItem");
navigationBuilder.HasKey(x => x.Id);
navigationBuilder.WithOwner().HasForeignKey(x => x.LawId);
navigationBuilder.Property(x => x.Header).HasMaxLength(255);
navigationBuilder.Property(x => x.Details).IsRequired();
navigationBuilder.Property(x => x.OrderNumber).IsRequired();
});
builder.Property(x => x.NotificationsJson)
.HasColumnName("Notifications")
.HasMaxLength(3000); // Set max length to 1000, adjust as needed
builder.Property(x => x.HeadTitle).HasMaxLength(200);
}
}
}

View File

@@ -20,6 +20,7 @@ public class LeaveMapping : IEntityTypeConfiguration<Leave>
builder.Property(x => x.IsAccepted);
builder.Property(x => x.Decription).HasMaxLength(255);
builder.Property(x => x.ShiftDuration).HasTimeSpanConversion();
builder.HasQueryFilter(x => !x.IsInvalid);
}
}

View File

@@ -42,7 +42,6 @@ public class PersonalContractingpartyMapping : IEntityTypeConfiguration<Personal
builder.Property(x => x.Gender).HasConversion(
v => v.ToString(),
v => string.IsNullOrWhiteSpace(v) ? Gender.None : (Gender)Enum.Parse(typeof(Gender), v)).HasMaxLength(6);
builder.Property(x=>x.LegalPosition).HasMaxLength(50);
#endregion

View File

@@ -43,8 +43,6 @@ partial class WorkshopMapping : IEntityTypeConfiguration<Workshop>
builder.Property(x => x.CutContractEndOfYear).HasConversion(x => x.ToString()
, x => ((IsActive)Enum.Parse(typeof(IsActive), x))).HasMaxLength(5);
//builder.HasOne(x => x.Employer)
// .WithMany(x => x.Workshops)
// .HasForeignKey(x => x.EmployerId);

View File

@@ -1,52 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class AddInstitutionContractContactInfoTemp : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "InstitutionContractContactInfoTemp",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PhoneType = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
InstitutionContractTempId = table.Column<long>(type: "bigint", nullable: false),
Position = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
PhoneNumber = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
FullName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
SendSms = table.Column<bool>(type: "bit", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractContactInfoTemp", x => x.id);
table.ForeignKey(
name: "FK_InstitutionContractContactInfoTemp_InstitutionContractTemps_InstitutionContractTempId",
column: x => x.InstitutionContractTempId,
principalTable: "InstitutionContractTemps",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractContactInfoTemp_InstitutionContractTempId",
table: "InstitutionContractContactInfoTemp",
column: "InstitutionContractTempId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InstitutionContractContactInfoTemp");
}
}
}

View File

@@ -1,67 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class Addlawtable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Law",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Law", x => x.id);
});
migrationBuilder.CreateTable(
name: "LawItem",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Header = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
Details = table.Column<string>(type: "nvarchar(max)", nullable: false),
OrderNumber = table.Column<int>(type: "int", nullable: false),
LawId = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LawItem", x => x.Id);
table.ForeignKey(
name: "FK_LawItem_Law_LawId",
column: x => x.LawId,
principalTable: "Law",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_LawItem_LawId",
table: "LawItem",
column: "LawId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "LawItem");
migrationBuilder.DropTable(
name: "Law");
}
}
}

View File

@@ -1,53 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class AddPublicIdtoinstitutioncontractandcontractingparty : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "PublicId",
table: "InstitutionContractTemps",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<Guid>(
name: "PublicId",
table: "ContractingPartyTemp",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PublicId",
table: "InstitutionContractTemps");
migrationBuilder.DropColumn(
name: "PublicId",
table: "ContractingPartyTemp");
migrationBuilder.AlterColumn<string>(
name: "RegistrationStatus",
table: "InstitutionContractTemps",
type: "nvarchar(30)",
maxLength: 30,
nullable: true,
oldClrType: typeof(int),
oldType: "int",
oldMaxLength: 30);
}
}
}

View File

@@ -1,132 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class addregisterininstitutioncontract : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "ContractingPartyId",
table: "Workshops",
type: "bigint",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddColumn<string>(
name: "RegistrationStatus",
table: "Workshops",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "LegalPosition",
table: "PersonalContractingParties",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Status",
table: "InstitutionContracts",
type: "nvarchar(122)",
maxLength: 122,
nullable: false,
defaultValue: "");
migrationBuilder.CreateTable(
name: "InstitutionContractInstallments",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
InstallmentDateGr = table.Column<DateTime>(type: "datetime2", nullable: false),
InstallmentDateFa = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
Amount = table.Column<double>(type: "float", nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
InstitutionContractId = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractInstallments", x => x.Id);
table.ForeignKey(
name: "FK_InstitutionContractInstallments_InstitutionContracts_InstitutionContractId",
column: x => x.InstitutionContractId,
principalTable: "InstitutionContracts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InstitutionContractWorkshopDetail",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
WorkshopId = table.Column<long>(type: "bigint", nullable: true),
WorkshopName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
HasRollCallPlan = table.Column<bool>(type: "bit", nullable: false),
HasCustomizeCheckoutPlan = table.Column<bool>(type: "bit", nullable: false),
HasContractPlan = table.Column<bool>(type: "bit", nullable: false),
PersonnelCount = table.Column<int>(type: "int", nullable: false),
WorkshopCreated = table.Column<bool>(type: "bit", nullable: false),
InstitutionContractId = table.Column<long>(type: "bigint", nullable: false),
Price = table.Column<double>(type: "float", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractWorkshopDetail", x => x.id);
table.ForeignKey(
name: "FK_InstitutionContractWorkshopDetail_InstitutionContracts_InstitutionContractId",
column: x => x.InstitutionContractId,
principalTable: "InstitutionContracts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractInstallments_InstitutionContractId",
table: "InstitutionContractInstallments",
column: "InstitutionContractId");
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractWorkshopDetail_InstitutionContractId",
table: "InstitutionContractWorkshopDetail",
column: "InstitutionContractId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InstitutionContractInstallments");
migrationBuilder.DropTable(
name: "InstitutionContractWorkshopDetail");
migrationBuilder.DropColumn(
name: "ContractingPartyId",
table: "Workshops");
migrationBuilder.DropColumn(
name: "RegistrationStatus",
table: "Workshops");
migrationBuilder.DropColumn(
name: "LegalPosition",
table: "PersonalContractingParties");
migrationBuilder.DropColumn(
name: "Status",
table: "InstitutionContracts");
}
}
}

Some files were not shown because too many files have changed in this diff Show More