Compare commits
142 Commits
Feature/ad
...
Feature/ac
| Author | SHA1 | Date | |
|---|---|---|---|
| bd72dada76 | |||
| e79dabbb2d | |||
| f527c59603 | |||
| 518719a6b8 | |||
|
|
21aa17d856 | ||
| b8d6911756 | |||
| 2e8f098937 | |||
| c9cae74cd4 | |||
|
|
abe8774d6f | ||
|
|
eab0441f00 | ||
| 13250d9f62 | |||
| e77eb217f7 | |||
| 39200da4b5 | |||
| 49050a8990 | |||
| 9474f3ff1a | |||
| ad4cffffcd | |||
|
|
18e559f1ae | ||
|
|
e1dfd8c8e1 | ||
|
|
b1c9b2669d | ||
|
|
116f40d87d | ||
|
|
6a982a80f7 | ||
|
|
604ac76a1a | ||
|
|
5a1d2640c3 | ||
|
|
de0e21f98b | ||
|
|
80ed1e9469 | ||
|
|
0609c66e0a | ||
|
|
add5b8ef8e | ||
|
|
c5091c53a4 | ||
|
|
3f1664a844 | ||
|
|
fdc5ea950f | ||
|
|
39d62eb02d | ||
|
|
a42ef19470 | ||
|
|
7ae7d8fc07 | ||
|
|
2bc7766ba1 | ||
|
|
d780f24b36 | ||
|
|
d7b49f8fc3 | ||
|
|
14480eb683 | ||
|
|
882a295413 | ||
|
|
785e364efc | ||
|
|
bd83ed3880 | ||
|
|
fae3c7cbd3 | ||
|
|
052b94a66e | ||
|
|
369757aebe | ||
|
|
38d8e88fd6 | ||
|
|
bcedb0d690 | ||
|
|
3662502db1 | ||
|
|
0701b334e4 | ||
|
|
631bf3a920 | ||
|
|
874bce1113 | ||
|
|
1f897fa0c9 | ||
|
|
5f7c27e45c | ||
|
|
824a80d1fe | ||
|
|
9e2ec49247 | ||
|
|
f5137d0bab | ||
|
|
881bdfa7ae | ||
|
|
e063870b36 | ||
|
|
fe8335af55 | ||
|
|
5c3119d3d2 | ||
|
|
0c56240158 | ||
|
|
2e703c49f7 | ||
|
|
e9dbfb411a | ||
|
|
40a02dbede | ||
|
|
030ce880f8 | ||
|
|
2b8cc9d05a | ||
|
|
0136e219a1 | ||
|
|
60ed37b965 | ||
|
|
5355e74830 | ||
|
|
87609773e5 | ||
|
|
6112e969b6 | ||
|
|
3e4c57d813 | ||
|
|
efc510a09b | ||
|
|
a6c1ae7971 | ||
|
|
8bf707056e | ||
|
|
ee72c95d55 | ||
|
|
f4f8ab8272 | ||
|
|
1c6def5d70 | ||
|
|
87e0181a8d | ||
|
|
66d566847e | ||
|
|
dbfffafbee | ||
|
|
969a707000 | ||
|
|
57b625f3b2 | ||
|
|
62572a9b64 | ||
|
|
6d0b7de149 | ||
|
|
34d8e068df | ||
|
|
3a1dfa7e11 | ||
|
|
866725e3b4 | ||
|
|
7772bff9f4 | ||
|
|
033461641a | ||
|
|
83a251ad3b | ||
|
|
cdf282a17a | ||
|
|
4bc3fd2fbc | ||
|
|
c826c3614d | ||
|
|
b8ea59b814 | ||
|
|
f82d0d5925 | ||
|
|
701ebaeb96 | ||
|
|
a1d57b291c | ||
|
|
e7d43316ad | ||
|
|
bdc5ccae13 | ||
|
|
d37ad552df | ||
|
|
9c04fd439d | ||
|
|
2b3067dab2 | ||
|
|
86682a28e2 | ||
|
|
5720c30f7a | ||
|
|
c90a68a8cc | ||
|
|
a71205aa2b | ||
|
|
641dcc1767 | ||
|
|
b1a15bfa54 | ||
|
|
d4f9c810ea | ||
|
|
09574150b6 | ||
|
|
7ccf600885 | ||
|
|
170a0ddba0 | ||
|
|
33a736ab5d | ||
|
|
e34fef37d7 | ||
|
|
23723e4b7a | ||
|
|
859f8ea8ca | ||
|
|
3744b5f470 | ||
|
|
db78fb1cd4 | ||
|
|
8bde7aa3d1 | ||
|
|
76e5a93ee5 | ||
|
|
469a8808d1 | ||
|
|
d3157780ea | ||
|
|
2d2dc24280 | ||
|
|
362b306c48 | ||
|
|
b0c02d47c4 | ||
|
|
6869ccb436 | ||
|
|
605fe16ced | ||
|
|
dfb78db2fa | ||
|
|
f0daa0b283 | ||
|
|
82f68d1bbe | ||
|
|
48c2186110 | ||
|
|
72fe632516 | ||
|
|
2a315ff7ae | ||
|
|
204355acd6 | ||
|
|
e1ac481dc3 | ||
|
|
8fd3930393 | ||
|
|
b2694ca281 | ||
|
|
7cb3551dc8 | ||
|
|
c048e89da8 | ||
|
|
5902472b86 | ||
|
|
9aa8855a46 | ||
|
|
9556be42ea | ||
|
|
3ebaeb645c |
2
.github/workflows/dotnet-developPublish.yml
vendored
2
.github/workflows/dotnet-developPublish.yml
vendored
@@ -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=".\deployuser",password="R2rNpdnetP3j>q5b18",authType="Basic" `
|
||||
-dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName="Administrator",password="R2rNpdnetP3j>q5b18",authType="Basic" `
|
||||
-allowUntrusted `
|
||||
-enableRule:AppOffline
|
||||
|
||||
|
||||
@@ -21,4 +21,19 @@
|
||||
|
||||
</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>
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -64,4 +64,6 @@ public interface IAccountApplication
|
||||
/// <param name="userName"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckExistClientAccount(string userName);
|
||||
List<AccountViewModel> GetAdminAccountsNew();
|
||||
|
||||
}
|
||||
@@ -799,4 +799,8 @@ public class AccountApplication : IAccountApplication
|
||||
return _accountRepository.CheckExistClientAccount(userName);
|
||||
}
|
||||
|
||||
public List<AccountViewModel> GetAdminAccountsNew()
|
||||
{
|
||||
return _accountRepository.GetAdminAccountsNew();
|
||||
}
|
||||
}
|
||||
51
Company.Domain/AuthorizedPersonAgg/AuthorizedPerson.cs
Normal file
51
Company.Domain/AuthorizedPersonAgg/AuthorizedPerson.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
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() { }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.AuthorizedPersonAgg;
|
||||
|
||||
public interface IAuthorizedPersonRepository : IRepository<long, AuthorizedPerson>
|
||||
{
|
||||
AuthorizedPerson GetByNationalCode(string nationalCode);
|
||||
bool ExistsByNationalCode(string nationalCode);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public interface IPersonalContractingPartyRepository :IRepository<long, Personal
|
||||
EditPersonalContractingParty GetDetailsToEdit(long id);
|
||||
string GetFullName(long id);
|
||||
List<PersonalContractingPartyViewModel> Search(PersonalContractingPartySearchModel searchModel2);
|
||||
int GetLastArchiveCode();
|
||||
int GetLastNewArchiveCode();
|
||||
#region Mahan
|
||||
|
||||
List<string> SearchByName(string name);
|
||||
|
||||
@@ -73,12 +73,16 @@ 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
|
||||
|
||||
|
||||
@@ -94,7 +98,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 representativeFullName, int archiveCode, string state,string city, string zone, string sureName,string legalPosition=null)
|
||||
{
|
||||
|
||||
FName = fName;
|
||||
@@ -120,8 +124,7 @@ public class PersonalContractingParty : EntityBase
|
||||
IsActiveString = "true";
|
||||
IsBlock = "false";
|
||||
BlockTimes = 0;
|
||||
|
||||
|
||||
LegalPosition = legalPosition;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +154,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 state, string city, string zone, string sureName,string legalPosition = null)
|
||||
{
|
||||
|
||||
LName = lName;
|
||||
@@ -168,6 +171,8 @@ public class PersonalContractingParty : EntityBase
|
||||
State = state;
|
||||
City = city;
|
||||
Zone = zone;
|
||||
if (legalPosition != null)
|
||||
LegalPosition = legalPosition;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ public class FinancialStatment : EntityBase
|
||||
ContractingPartyId = contractingPartyId;
|
||||
ContractingPartyName = contractingPartyName;
|
||||
PublicId = Guid.NewGuid();
|
||||
FinancialTransactionList = [];
|
||||
}
|
||||
|
||||
public FinancialStatment()
|
||||
@@ -37,4 +38,12 @@ public class FinancialStatment : EntityBase
|
||||
{
|
||||
PublicId = Guid.NewGuid();
|
||||
}
|
||||
|
||||
public void AddFinancialTransaction(FinancialTransaction financialTransaction)
|
||||
{
|
||||
if (financialTransaction == null)
|
||||
throw new ArgumentNullException(nameof(financialTransaction));
|
||||
FinancialTransactionList.Add(financialTransaction);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,4 +47,9 @@ 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);
|
||||
}
|
||||
@@ -1,17 +1,22 @@
|
||||
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;
|
||||
@@ -43,6 +48,10 @@ public class InstitutionContract : EntityBase
|
||||
TypeOfContract = typeOfcontract;
|
||||
HasValueAddedTax = hasValueAddedTax;
|
||||
ValueAddedTax = valueAddedTax;
|
||||
Status = InstitutionContractStatus.Incomplete;
|
||||
ContactInfoList = [];
|
||||
WorkshopDetails = [];
|
||||
Installments = [];
|
||||
}
|
||||
|
||||
public string ContractNo { get; private set; }
|
||||
@@ -55,21 +64,24 @@ 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; }
|
||||
@@ -82,28 +94,33 @@ 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 = new List<InstitutionContractContactInfo>();
|
||||
ContactInfoList = [];
|
||||
WorkshopDetails = [];
|
||||
Installments = [];
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -124,13 +141,11 @@ public class InstitutionContract : EntityBase
|
||||
|
||||
public void Active()
|
||||
{
|
||||
|
||||
this.IsActiveString = "true";
|
||||
}
|
||||
|
||||
public void DeActive()
|
||||
{
|
||||
|
||||
this.IsActiveString = "false";
|
||||
}
|
||||
|
||||
@@ -148,4 +163,177 @@ 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() { }
|
||||
}
|
||||
15
Company.Domain/LawAgg/ILawRepository.cs
Normal file
15
Company.Domain/LawAgg/ILawRepository.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
89
Company.Domain/LawAgg/Law.cs
Normal file
89
Company.Domain/LawAgg/Law.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ public class ContractingPartyTemp : EntityBase
|
||||
IdNumberSerial = idNumberSerial;
|
||||
Gender = gender;
|
||||
DateOfBirth = dateOfBirth;
|
||||
PublicId = Guid.NewGuid();
|
||||
Status = ContractingPartyTempStatus.InComplete;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -91,10 +93,34 @@ 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
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
|
||||
public interface IInstitutionContractContactInfoTempRepository : IRepository<long, InstitutionContractContactInfoTemp>
|
||||
{
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -17,10 +18,5 @@ public interface IInstitutionContractTempRepository : IRepository<long, Institut
|
||||
/// <returns></returns>
|
||||
Task<InstitutionContractTempViewModel> GetInstitutionContractTemp(long id,long contractingPartyTempId);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
|
||||
/// جهت نمایش در کارپوشه
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<RegistrationWorkflowMainList>> GetAllCompletedRegistration();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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; }
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
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, string 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, InstitutionContractTempStatus registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
|
||||
{
|
||||
ContractingPartyTempId = contractingPartyTempId;
|
||||
PaymentModel = paymentModel;
|
||||
@@ -22,6 +24,7 @@ public class InstitutionContractTemp : EntityBase
|
||||
MessageId = messageId;
|
||||
SendVerifyCodeTime = sendVerifyCodeTime;
|
||||
VerifyCodeEndTime = verifyCodeEndTime;
|
||||
PublicId = Guid.NewGuid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -87,7 +90,7 @@ public class InstitutionContractTemp : EntityBase
|
||||
/// -
|
||||
/// Completed ثبت نام تکمیل شده
|
||||
/// </summary>
|
||||
public string RegistrationStatus { get; private set; }
|
||||
public InstitutionContractTempStatus RegistrationStatus { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی پیامک ارسال شده
|
||||
@@ -104,8 +107,16 @@ public class InstitutionContractTemp : EntityBase
|
||||
/// </summary>
|
||||
public DateTime? VerifyCodeEndTime{ get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیدی عمومی
|
||||
/// برای نمایش در آدرس
|
||||
/// </summary>
|
||||
public Guid PublicId { get; set; }
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
ContractingPartyTempId = contractingPartyTempId;
|
||||
PaymentModel = paymentModel;
|
||||
@@ -122,7 +133,7 @@ public class InstitutionContractTemp : EntityBase
|
||||
VerifyCodeEndTime = verifyCodeEndTime;
|
||||
}
|
||||
|
||||
public void Update(string verifyCode, string registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
|
||||
public void Update(string verifyCode, InstitutionContractTempStatus registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
|
||||
{
|
||||
VerifyCode = verifyCode;
|
||||
RegistrationStatus = registrationStatus;
|
||||
@@ -131,9 +142,10 @@ public class InstitutionContractTemp : EntityBase
|
||||
VerifyCodeEndTime = verifyCodeEndTime;
|
||||
}
|
||||
|
||||
public void ChangeRegistrationStatus(string registrationStatus)
|
||||
public void ChangeRegistrationStatus(InstitutionContractTempStatus registrationStatus)
|
||||
{
|
||||
RegistrationStatus = registrationStatus;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,14 +76,13 @@ 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)
|
||||
bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance, bool createContract, bool signContract, bool createCheckout, bool signCheckout,
|
||||
IsActive cutContractEndOfYear, bool rotatingShiftCompute, bool isStaticCheckout,long contractingPartyId)
|
||||
{
|
||||
WorkshopName = workshopName;
|
||||
WorkshopSureName = workshopSureName;
|
||||
@@ -134,6 +133,7 @@ public class Workshop : EntityBase
|
||||
CutContractEndOfYear = cutContractEndOfYear;
|
||||
RotatingShiftCompute = rotatingShiftCompute;
|
||||
IsStaticCheckout = isStaticCheckout;
|
||||
ContractingPartyId = contractingPartyId;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,6 +233,8 @@ public class Workshop : EntityBase
|
||||
/// </summary>
|
||||
public bool IsStaticCheckout { get; private set; }
|
||||
|
||||
public long ContractingPartyId { get; private set; }
|
||||
|
||||
public Workshop()
|
||||
{
|
||||
RollCallServicesList = new List<RollCallService>();
|
||||
@@ -344,4 +346,10 @@ public class Workshop : EntityBase
|
||||
this.IsActiveString = "false";
|
||||
ArchiveCode = "b-" + archiveCode;
|
||||
}
|
||||
}
|
||||
|
||||
public enum WorkshopRegistrationStatus
|
||||
{
|
||||
NotRegistered = 0,
|
||||
Registered = 1
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
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; }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
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; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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);
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
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;
|
||||
|
||||
@@ -125,4 +128,282 @@ 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; }
|
||||
}
|
||||
|
||||
@@ -1,29 +1,316 @@
|
||||
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
|
||||
{
|
||||
public List<CreateContactInfo> ContactInfos { get; set; }
|
||||
public long ContractingPartyId { get; set; }
|
||||
/// <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; }
|
||||
public string TypeOfContract { get; set; }
|
||||
public string ContractDateFa { get; set; }
|
||||
public string ContractStartFa { get; set; }
|
||||
public string ContractEndFa { get; set; }
|
||||
public string Address { get; set; }
|
||||
public string State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مدت زمان قرارداد
|
||||
/// </summary>
|
||||
public InstitutionContractDuration Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// استان
|
||||
/// </summary>
|
||||
public string Province { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شهر
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
/// <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 string ContractStartFa { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ خسارت روزانه
|
||||
/// </summary>
|
||||
public double DailyCompensation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وجه التزام
|
||||
/// </summary>
|
||||
public double Obligation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// توضیحات
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
public int ExtensionNo { 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; }
|
||||
}
|
||||
@@ -3,4 +3,5 @@ namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
public class EditInstitutionContractRequest:CreateInstitutionContractRequest
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long ContractingPartyId { get; set; }
|
||||
}
|
||||
@@ -77,10 +77,12 @@ public class GetInstitutionContractListItemsViewModel
|
||||
/// <summary>
|
||||
/// وضعیت قرارداد
|
||||
/// </summary>
|
||||
public InstitutionContractStatus Status { get; set; }
|
||||
public InstitutionContractListStatus ListStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا منقضی شده است
|
||||
/// </summary>
|
||||
public bool IsExpired { get; set; }
|
||||
|
||||
public long ContractingPartyId { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
@@ -10,53 +11,149 @@ 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
|
||||
@@ -82,12 +179,14 @@ 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>
|
||||
@@ -95,39 +194,108 @@ 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>
|
||||
/// 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.
|
||||
/// مجموعهای از تعداد قراردادهای مؤسسه دستهبندی شده بر اساس وضعیت
|
||||
/// این ویژگی تعداد قراردادها را برای هر وضعیت تعریف شده در
|
||||
/// شمارش InstitutionContractStatus ارائه میدهد که امکان تجزیه و تحلیل و نظارت بر توزیع قراردادها را فراهم میکند
|
||||
/// </summary>
|
||||
public List<InstitutionContractStatusCount> Counts { get; set; }
|
||||
public List<InstitutionContractStatusCount> Counts { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// شمارش وضعیت قراردادهای مؤسسه
|
||||
/// نمایش تعداد قراردادها برای هر وضعیت خاص
|
||||
/// </summary>
|
||||
public class InstitutionContractStatusCount
|
||||
{
|
||||
public InstitutionContractStatus Status { get; set; }
|
||||
/// <summary>
|
||||
/// وضعیت لیست قرارداد
|
||||
/// </summary>
|
||||
public InstitutionContractListStatus ListStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد قراردادها در این وضعیت
|
||||
/// </summary>
|
||||
public int Count { get; set; }
|
||||
}
|
||||
public class ExtenstionInstitutionContractRequest:EditInstitutionContractRequest
|
||||
|
||||
/// <summary>
|
||||
/// درخواست تمدید قرارداد مؤسسه
|
||||
/// شامل اطلاعات قرارداد قبلی برای فرآیند تمدید
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class InstitutionContractListSearchModel :PaginationRequest
|
||||
/// <summary>
|
||||
/// تب
|
||||
/// </summary>
|
||||
public InstitutionContractStatus? Status { get; set; }
|
||||
public InstitutionContractListStatus? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فعال / غیرفعال
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public enum InstitutionContractStatus
|
||||
public enum InstitutionContractListStatus
|
||||
{
|
||||
Active,
|
||||
Deactive,
|
||||
@@ -8,5 +8,5 @@ public enum InstitutionContractStatus
|
||||
Block,
|
||||
Free,
|
||||
PendingForRenewal,
|
||||
WithoutWorkshop,
|
||||
WithoutWorkshop
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
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; }
|
||||
}
|
||||
37
CompanyManagment.App.Contracts/Law/ILawApplication.cs
Normal file
37
CompanyManagment.App.Contracts/Law/ILawApplication.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
47
CompanyManagment.App.Contracts/Law/LawViewModel.cs
Normal file
47
CompanyManagment.App.Contracts/Law/LawViewModel.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
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; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class CreateInstitutionContractTemp
|
||||
/// -
|
||||
/// Completed ثبت نام تکمیل شده
|
||||
/// </summary>
|
||||
public string RegistrationStatus { get; set; }
|
||||
public InstitutionContractTempStatus RegistrationStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی پیامک ارسال شده
|
||||
|
||||
@@ -16,20 +16,7 @@ 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>
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
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;
|
||||
|
||||
@@ -16,7 +19,7 @@ public interface ITemporaryClientRegistrationApplication
|
||||
/// <param name="mobile"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<ContractingPartyTempViewModel>> CreateContractingPartyTemp(string nationalCode, string dateOfBirth, string mobile);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تکمیل اطلاعات
|
||||
/// </summary>
|
||||
@@ -52,11 +55,25 @@ public interface ITemporaryClientRegistrationApplication
|
||||
/// دریافت مبالغ بررسی و پرداخت
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <param name="periodModel"></param>
|
||||
/// <param name="duration"></param>
|
||||
/// <param name="paymentModel"></param>
|
||||
/// <returns></returns>
|
||||
Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
|
||||
string periodModel = "12", string paymentModel = "OneTime", string contractStartType = "currentMonth");
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد یا ویرایش قرارداد موقت
|
||||
@@ -94,10 +111,14 @@ public interface ITemporaryClientRegistrationApplication
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> PayOffCompleted(long contractingPartyTempId);
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
|
||||
/// جهت نمایش در کارپوشه
|
||||
/// ارسال لینک تایید قوانین و مقررات به طرف حساب
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<RegistrationWorkflowMainList>> RegistrationWorkflowMainList();
|
||||
}
|
||||
Task<OperationResult> SendAgreementLink(long contractingPartyTempId);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,4 +3,14 @@
|
||||
public class InstitutionContractTempViewModel : CreateInstitutionContractTemp
|
||||
{
|
||||
public long Id { get; set; }
|
||||
}
|
||||
|
||||
public enum InstitutionContractTempStatus
|
||||
{
|
||||
BeforeSendVerifyCode,
|
||||
VerifyCodeSent,
|
||||
PendingToCompletion,
|
||||
ReceivedCodeFromClient,
|
||||
Completed
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
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; }
|
||||
|
||||
}
|
||||
@@ -1,30 +1,22 @@
|
||||
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 SumOfWorkshopsPaymentPaymentStr { get; set; }
|
||||
|
||||
|
||||
|
||||
public string Discount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ پرداخت بدون مالیات
|
||||
/// Double
|
||||
/// مقدار جمع مبلغ کارگاه ها
|
||||
/// </summary>
|
||||
public double OneTimeWithoutTaxPaymentDouble { get; set; }
|
||||
public string SumOfWorkshopsPayment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ پرداخت بدون مالیات
|
||||
@@ -32,118 +24,44 @@ 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>
|
||||
/// مبلغ پرداخت کامل
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double MonthlyTotalPaymentDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ پرداخت کامل
|
||||
/// string
|
||||
/// مبلغ پرداخت کامل ماهانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string MonthlyTotalPaymentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مالیات بر ارزش افزوده
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double ValueAddedTaxDouble { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مالیات بر ارزش افزوده
|
||||
/// string
|
||||
/// </summary>
|
||||
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; }
|
||||
public string ValueAddedTaxStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// لیست اقساط ماهیانه
|
||||
/// </summary>
|
||||
public List<MonthlyInstallment> MonthlyInstallments { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شروع قرارداد - شمسی
|
||||
/// </summary>
|
||||
public string ContractStartFa { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ شروع قرارداد در اول ماه جاری
|
||||
/// -
|
||||
/// شمسی
|
||||
/// شروع قرارداد - میلادی
|
||||
/// </summary>
|
||||
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; }
|
||||
public DateTime ContractStartGr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ پایان قرارداد
|
||||
@@ -158,4 +76,8 @@ public class ReviewAndPaymentViewModel
|
||||
/// شمسی
|
||||
/// </summary>
|
||||
public string ContractEndFa { get; set; }
|
||||
|
||||
public string DailyCompensation { get; set; }
|
||||
public string Obligation { get; set; }
|
||||
public string DiscountedAmountForOneMonth { get; set; }
|
||||
}
|
||||
@@ -3,4 +3,16 @@
|
||||
public class WorkshopTempViewModel : CreateWorkshopTemp
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double WorkshopServicesAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// فارسی
|
||||
/// </summary>
|
||||
public string WorkshopServicesAmountStr { get; set; }
|
||||
}
|
||||
@@ -151,5 +151,6 @@ public class CreateWorkshop
|
||||
/// تصفیه حساب بصورت استاتیک محاصبه شود
|
||||
/// </summary>
|
||||
public bool IsStaticCheckout { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@@ -89,4 +90,167 @@ 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; }
|
||||
}
|
||||
119
CompanyManagment.Application/AuthorizedPersonApplication.cs
Normal file
119
CompanyManagment.Application/AuthorizedPersonApplication.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,21 +2,31 @@
|
||||
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;
|
||||
|
||||
@@ -30,13 +40,20 @@ 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)
|
||||
IFinancialStatmentApplication financialStatmentApplication, IWorkshopApplication workshopApplication,
|
||||
IContractingPartyTempRepository contractingPartyTempRepository,
|
||||
IFinancialStatmentRepository financialStatmentRepository, IContactInfoApplication contactInfoApplication,
|
||||
IAccountApplication accountApplication)
|
||||
{
|
||||
_institutionContractRepository = institutionContractRepository;
|
||||
_contractingPartyRepository = contractingPartyRepository;
|
||||
@@ -46,6 +63,10 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_financialStatmentApplication = financialStatmentApplication;
|
||||
_workshopApplication = workshopApplication;
|
||||
_contractingPartyTempRepository = contractingPartyTempRepository;
|
||||
_financialStatmentRepository = financialStatmentRepository;
|
||||
_contactInfoApplication = contactInfoApplication;
|
||||
_accountApplication = accountApplication;
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateInstitutionContract command)
|
||||
@@ -901,352 +922,349 @@ 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 contractingParty = _contractingPartyRepository.GetDetails(command.ContractingPartyId);
|
||||
//شماره قرارداد
|
||||
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 contractNo = $"{syear}{smonth}{sday}/{contractingParty.ArchiveCode}/0";
|
||||
|
||||
///////////////////////
|
||||
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("فقط یکی از شماره تلفن ها میتواند سمت طرف قرارداد داشته باشد");
|
||||
var representative = _representativeRepository.Get(command.RepresentativeId);
|
||||
if (representative == null)
|
||||
return opration.Failed("معرف مورد نظر یافت نشد");
|
||||
|
||||
contractingPartyName = contractingParty.LName;
|
||||
//نام معرف
|
||||
var representative = _representativeRepository.GetDetails(command.RepresentativeId).FullName;
|
||||
if (command.ContractStartFa.TryToGeorgianDateTime(out var contractStartGr) == false)
|
||||
return opration.Failed("تاریخ شروع قرارداد معتبر نیست");
|
||||
|
||||
var contractStartGr = command.ContractStartFa.ToGeorgianDateTime();
|
||||
var contractEndGr = command.ContractEndFa.ToGeorgianDateTime();
|
||||
|
||||
var contractDateGr = command.ContractDateFa.ToGeorgianDateTime();
|
||||
|
||||
if (command.Address != null && command.State == null)
|
||||
if (command.IsInstallment && !command.Workshops.Any(x=>x.HasContractPlanInPerson || x.HasInsurancePlanInPerson))
|
||||
{
|
||||
return opration.Failed("لطفا استان و شهر را انتخاب کنید");
|
||||
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);
|
||||
}
|
||||
|
||||
if ((command.Address != null && command.State != null) && command.City == "شهرستان")
|
||||
entity.SetWorkshopDetails(workshopDetails);
|
||||
await _financialStatmentRepository.CreateAsync(financialStatement);
|
||||
await _institutionContractRepository.CreateAsync(entity);
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
|
||||
var mainContactInfo = new CreateContactInfo
|
||||
{
|
||||
return opration.Failed("لطفا شهر را انتخاب کنید");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (command.Address == null && command.State != null)
|
||||
var userPass = contractingParty.IsLegal == "حقیقی"
|
||||
? contractingParty.Nationalcode
|
||||
: contractingParty.NationalId;
|
||||
var createAcc = new RegisterAccount
|
||||
{
|
||||
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";
|
||||
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);
|
||||
|
||||
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);
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
await transaction.CommitAsync();
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> EditAsync(EditInstitutionContractRequest command)
|
||||
{
|
||||
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);
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> ExtensionَAsync(CreateInstitutionContractRequest command)
|
||||
{
|
||||
bool dateMessages = false;
|
||||
string dateMaessageResult = String.Empty;
|
||||
var opration = new OperationResult();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
command.ExtensionNo += 1;
|
||||
if (_institutionContractRepository.Exists(x =>
|
||||
x.ExtensionNo == command.ExtensionNo && x.ContractingPartyId == command.ContractingPartyId &&
|
||||
x.TypeOfContract == command.TypeOfContract))
|
||||
return opration.Failed("برای این قرارداد قبلا تمدید ایجاد شده است");
|
||||
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("نام شرکت وارد شده تکراری است");
|
||||
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.ContractDateFa))
|
||||
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))
|
||||
{
|
||||
dateMaessageResult = "تاریخ قراراداد اجباری است. ";
|
||||
dateMessages = true;
|
||||
return opration.Failed("شناسه ملی وارد شده تکراری است");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.ContractStartFa))
|
||||
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))
|
||||
{
|
||||
dateMaessageResult += "تاریخ شروع قراراداد اجباری است. ";
|
||||
dateMessages = true;
|
||||
return operation.Failed("کد ملی وارد شده تکراری است");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.ContractEndFa))
|
||||
var archiveCode = _contractingPartyRepository.GetLastNewArchiveCode();
|
||||
|
||||
if (request.NationalCode.NationalCodeValid() != "valid")
|
||||
{
|
||||
dateMaessageResult += "تاریخ پایان قراراداد اجباری است. ";
|
||||
dateMessages = true;
|
||||
return operation.Failed("کد ملی وارد شده نا معتبر است");
|
||||
}
|
||||
|
||||
if (dateMessages)
|
||||
return opration.Failed(dateMaessageResult);
|
||||
var representative = _representativeRepository.GetDetails(representativeId);
|
||||
|
||||
var firstContract =
|
||||
_institutionContractRepository.GetFirstContract(command.ContractingPartyId, command.TypeOfContract);
|
||||
if (representative == null)
|
||||
return operation.Failed("معرف مورد نظر یافت نشد");
|
||||
|
||||
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}";
|
||||
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 contractStartGr = command.ContractStartFa.ToGeorgianDateTime();
|
||||
var contractEndGr = command.ContractEndFa.ToGeorgianDateTime();
|
||||
await _contractingPartyRepository.CreateAsync(personalContractingParty);
|
||||
await _contractingPartyRepository.SaveChangesAsync();
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
return opration.Failed("لطفا استان و شهر را انتخاب کنید");
|
||||
}
|
||||
for (int i = 1; i < installmentCount; i++)
|
||||
{
|
||||
var installment =
|
||||
new InstitutionContractInstallment(loanStartDate.ToGeorgianDateTime(), moneyPerMonth, "");
|
||||
|
||||
if ((command.Address != null && command.State != null) && command.City == "شهرستان")
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
return opration.Failed("لطفا شهر را انتخاب کنید");
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
256
CompanyManagment.Application/LawApplication.cs
Normal file
256
CompanyManagment.Application/LawApplication.cs
Normal file
@@ -0,0 +1,256 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,8 @@ public class LoanApplication : ILoanApplication
|
||||
DateGr = loanStartDate.ToGeorgianDateTime(),
|
||||
Month = loanStartDate.Substring(5, 2),
|
||||
Year = loanStartDate.Substring(0, 4),
|
||||
Day = loanStartDate.Substring(8, 2)
|
||||
Day = loanStartDate.Substring(8, 2),
|
||||
AmountDouble = moneyPerMonth
|
||||
};
|
||||
|
||||
installments.Add(installment);
|
||||
@@ -225,7 +226,8 @@ public class LoanApplication : ILoanApplication
|
||||
DateGr = loanStartDate.ToGeorgianDateTime(),
|
||||
Month = loanStartDate.Substring(5, 2),
|
||||
Year = loanStartDate.Substring(0, 4),
|
||||
Day = loanStartDate.Substring(8, 2)
|
||||
Day = loanStartDate.Substring(8, 2),
|
||||
AmountDouble = lastLoan
|
||||
|
||||
};
|
||||
installments.Add(lastInstallment);
|
||||
@@ -243,7 +245,8 @@ public class LoanApplication : ILoanApplication
|
||||
DateGr = loanStartDate.ToGeorgianDateTime(),
|
||||
Month = loanStartDate.Substring(5, 2),
|
||||
Year = loanStartDate.Substring(0, 4),
|
||||
Day = loanStartDate.Substring(8, 2)
|
||||
Day = loanStartDate.Substring(8, 2),
|
||||
AmountDouble = moneyPerMonth
|
||||
};
|
||||
|
||||
installments.Add(installment);
|
||||
@@ -278,7 +281,8 @@ public class LoanApplication : ILoanApplication
|
||||
DateGr = loanStartDate.ToGeorgianDateTime(),
|
||||
Month = loanStartDate.Substring(5, 2),
|
||||
Year = loanStartDate.Substring(0, 4),
|
||||
Day = loanStartDate.Substring(8, 2)
|
||||
Day = loanStartDate.Substring(8, 2),
|
||||
AmountDouble = lastLoan
|
||||
|
||||
};
|
||||
installments.Add(lastInstallment);
|
||||
|
||||
@@ -370,7 +370,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
|
||||
|
||||
public int GetLastArchiveCode()
|
||||
{
|
||||
return _personalContractingPartyRepository.GetLastArchiveCode();
|
||||
return _personalContractingPartyRepository.GetLastNewArchiveCode();
|
||||
}
|
||||
#region Mahan
|
||||
public List<string> SearchByName(string name)
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
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;
|
||||
@@ -28,7 +31,11 @@ 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;
|
||||
@@ -47,7 +54,8 @@ 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>();
|
||||
|
||||
@@ -67,12 +75,11 @@ 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)
|
||||
@@ -96,8 +103,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
|
||||
if (institutionContractTemp != null)
|
||||
{
|
||||
|
||||
if (institutionContractTemp.RegistrationStatus == "Completed")
|
||||
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
|
||||
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
|
||||
}
|
||||
|
||||
@@ -106,8 +112,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)
|
||||
@@ -119,13 +125,17 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
var apiRespons = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
|
||||
|
||||
if (apiRespons == null)
|
||||
return op.Failed("خطا در سرویس احراز هویت");
|
||||
throw new InternalServerException("خطا در سرویس احراز هویت");
|
||||
|
||||
if (apiRespons.ResponseContext.Status.Code ==14)
|
||||
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
|
||||
|
||||
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,
|
||||
@@ -148,9 +158,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
|
||||
return op.Succcedded(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -161,7 +168,6 @@ 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();
|
||||
@@ -191,7 +197,8 @@ 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();
|
||||
@@ -202,6 +209,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
var oldWorkshops = await _workshopTempRepository.GetWorkshopTemp(contractingPartyTempId);
|
||||
|
||||
#region Update
|
||||
|
||||
if (updateWorkshopList.Count > 0)
|
||||
{
|
||||
var updateListIds = updateWorkshopList.Select(x => x.Id).ToList();
|
||||
@@ -213,7 +221,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
|
||||
foreach (var workshop in updateWorkshopList)
|
||||
{
|
||||
|
||||
if (string.IsNullOrWhiteSpace(workshop.WorkshopName))
|
||||
return op.Failed("نام مجموعه نمی تواند خالی باشد");
|
||||
if (workshop.CountPerson == 0)
|
||||
@@ -235,7 +242,8 @@ 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();
|
||||
|
||||
//حذف سرویس های قبلی
|
||||
@@ -248,7 +256,8 @@ 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)
|
||||
@@ -270,12 +279,10 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
|
||||
await _workshopServicesTempRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Create
|
||||
@@ -284,7 +291,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
{
|
||||
foreach (var workshop in createNewWorkshopList)
|
||||
{
|
||||
|
||||
if (string.IsNullOrWhiteSpace(workshop.WorkshopName))
|
||||
return op.Failed("نام مجموعه نمی تواند خالی باشد");
|
||||
if (workshop.CountPerson == 0)
|
||||
@@ -302,23 +308,22 @@ 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)
|
||||
@@ -327,7 +332,8 @@ 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)
|
||||
@@ -336,11 +342,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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,125 +373,257 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId, string periodModel = "12", string paymentModel = "OneTime", string contractStartType = "currentMonth")
|
||||
public async Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
|
||||
InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths,
|
||||
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();
|
||||
|
||||
int months = 0;
|
||||
months = periodModel switch
|
||||
{
|
||||
"1" => 1,
|
||||
"3" => 3,
|
||||
"6" => 6,
|
||||
"12" => 12,
|
||||
_ => 12,
|
||||
};
|
||||
var months = (int)duration;
|
||||
//رند کردن مبالغ کارگاه ها
|
||||
var roundAmount = (((Convert.ToInt64(totalPayment1MonthDouble))) / 1000000) * 1000000;
|
||||
double roundAmount2 = roundAmount;
|
||||
|
||||
double roundAmount2 = totalPayment1MonthDouble;
|
||||
//بدست آوردن جمع کل مبالغ کارگاه بر اساس مدت قراداد
|
||||
result.SumOfWorkshopsPaymentDouble = months * roundAmount2;
|
||||
result.SumOfWorkshopsPaymentPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney();
|
||||
var sumOfWorkshopsPaymentDouble = months * roundAmount2;
|
||||
result.SumOfWorkshopsPayment = roundAmount2.ToMoney();
|
||||
var installmentstart = (DateTime.Now).ToFarsi();
|
||||
|
||||
var originalDay = int.Parse(installmentstart.Substring(8, 2));
|
||||
result.ContractStartFa = installmentstart;
|
||||
result.ContractStartGr = result.ContractStartFa.ToGeorgianDateTime();
|
||||
|
||||
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 findeEnd = Tools.FindEndOfContract(installmentstart, ((int)duration).ToString());
|
||||
var contractEndDate = findeEnd.endDateGr;
|
||||
result.ContractEndGr = contractEndDate;
|
||||
result.ContractEndFa = contractEndDate.ToFarsi();
|
||||
|
||||
if (periodModel == "1")
|
||||
if (hasInPersonContract)
|
||||
{
|
||||
var tenPercent = sumOfWorkshopsPaymentDouble * 10 / 100;
|
||||
//مالیات
|
||||
result.ValueAddedTaxStr = tenPercent.ToMoney();
|
||||
//پرداخت یکجا
|
||||
|
||||
installmentList.Add(new MonthlyInstallment()
|
||||
{
|
||||
InstallmentAmountStr = result.MonthlyTotalPaymentStr,
|
||||
InstallmentCounter = "سررسید پرداخت اول",
|
||||
InstalmentDate = (DateTime.Now).ToFarsi()
|
||||
#region OneTimePaymentResult
|
||||
|
||||
});
|
||||
result.MonthlyInstallments = installmentList;
|
||||
}
|
||||
else
|
||||
{
|
||||
int instalmentCount = Convert.ToInt32(periodModel);
|
||||
var instalmentAmount = result.MonthlyTotalPaymentDouble / instalmentCount;
|
||||
var findEndOfMonth = startDate.FindeEndOfMonth();
|
||||
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
|
||||
for (int i = 1; i <= instalmentCount; i++)
|
||||
{
|
||||
string installmentDate;
|
||||
// For first installment, use the initial date
|
||||
if (i == 1)
|
||||
{
|
||||
startDate = (DateTime.Now).ToFarsi();
|
||||
|
||||
installmentDate = installmentstart;
|
||||
}
|
||||
else if (i > 1)
|
||||
else
|
||||
{
|
||||
var currentMonthStart = ((findEndOfMonth.ToGeorgianDateTime()).AddDays(1)).ToFarsi();
|
||||
startDate = currentMonthStart.FindeEndOfMonth();
|
||||
findEndOfMonth = startDate;
|
||||
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;
|
||||
}
|
||||
|
||||
installmentList.Add(new MonthlyInstallment()
|
||||
@@ -493,34 +631,52 @@ 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 = startDate
|
||||
|
||||
InstalmentDate = installmentDate
|
||||
});
|
||||
}
|
||||
#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();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
result.MonthlyInstallments = installmentList;
|
||||
result.ContractingPartTempId = contractingPartyTempId;
|
||||
|
||||
result.DailyCompensation = ((roundAmount2 * 10) / 100).ToMoney();
|
||||
result.Obligation = result.OneTimeWithoutTaxPaymentStr;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -528,13 +684,12 @@ 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;
|
||||
@@ -545,7 +700,10 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
{
|
||||
var periodModelInt = Convert.ToInt32(periodModel);
|
||||
|
||||
var create = new InstitutionContractTemp(contractingPartyTempId, paymentModel, periodModel, totalPayment, contractStartDate, contractEndDate, "official", valueAddedTax, "", "BeforeSendVerifyCode", 0, null, null);
|
||||
var create = new InstitutionContractTemp(contractingPartyTempId, paymentModel, periodModel, totalPayment,
|
||||
contractStartDate, contractEndDate, "official", valueAddedTax, "",
|
||||
InstitutionContractTempStatus.BeforeSendVerifyCode, 0, null,
|
||||
null);
|
||||
_institutionContractTempRepository.Create(create);
|
||||
_institutionContractTempRepository.SaveChanges();
|
||||
|
||||
@@ -560,11 +718,13 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
if (institutionContractTemp.VerifyCodeEndTime != null)
|
||||
{
|
||||
var spaning = (DateTime.Now - institutionContractTemp.VerifyCodeEndTime.Value);
|
||||
if (institutionContractTemp.RegistrationStatus == "VerifyCodeSent" && spaning > new TimeSpan(0, 0, 0) && spaning < new TimeSpan(0, 1, 0))
|
||||
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.VerifyCodeSent &&
|
||||
spaning > new TimeSpan(0, 0, 0) &&
|
||||
spaning < new TimeSpan(0, 1, 0))
|
||||
return op.Failed("شما به تازگی پیامک دریافت نموده اید دو دقیقه صبر کنید و دوباره تلاش کنید");
|
||||
}
|
||||
|
||||
if (institutionContractTemp.RegistrationStatus == "Completed")
|
||||
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
|
||||
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
|
||||
|
||||
|
||||
@@ -572,17 +732,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, "", "BeforeSendVerifyCode", 0, null, null);
|
||||
update.Edit(contractingPartyTempId, paymentModel, periodModel, totalPayment, contractStartDate,
|
||||
contractEndDate, "official", valueAddedTax, "", InstitutionContractTempStatus.BeforeSendVerifyCode, 0,
|
||||
null, null);
|
||||
_institutionContractTempRepository.SaveChanges();
|
||||
|
||||
|
||||
//temporary
|
||||
var res = await PayOffCompleted(contractingPartyTempId);
|
||||
if (!res.IsSuccedded)
|
||||
return op.Failed(res.Message);
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -594,27 +754,25 @@ 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 == "BeforeSendVerifyCode")
|
||||
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.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)
|
||||
@@ -626,18 +784,16 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
//تغییر وضعیت به ارسال شده
|
||||
if (update != null)
|
||||
{
|
||||
update.Update(code, "VerifyCodeSent", sendResult.MessageId, DateTime.Now, DateTime.Now.AddMinutes(2));
|
||||
update.Update(code, InstitutionContractTempStatus.VerifyCodeSent, sendResult.MessageId, DateTime.Now,
|
||||
DateTime.Now.AddMinutes(2));
|
||||
_institutionContractTempRepository.SaveChanges();
|
||||
return op.Succcedded(1, "کد برای شما پیامک شد");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (institutionContractTemp.RegistrationStatus == "VerifyCodeSent")
|
||||
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.VerifyCodeSent)
|
||||
|
||||
{
|
||||
|
||||
if (DateTime.Now < institutionContractTemp.VerifyCodeEndTime.Value)
|
||||
return op.Failed("کد دریافت شده را وارد کنید");
|
||||
var spaning = (DateTime.Now - institutionContractTemp.VerifyCodeEndTime.Value);
|
||||
@@ -650,14 +806,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}");
|
||||
|
||||
|
||||
|
||||
//ذخیره کد در دیتا بیس
|
||||
//ذخیره تاریخ ارسال و مهلت پایان
|
||||
//ذخیره آیدی پیامک
|
||||
@@ -665,21 +821,19 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
|
||||
if (update != null)
|
||||
{
|
||||
update.Update(code, "VerifyCodeSent", sendResult.MessageId, DateTime.Now, DateTime.Now.AddMinutes(2));
|
||||
update.Update(code, InstitutionContractTempStatus.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 == "Completed")
|
||||
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
|
||||
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
|
||||
return op.Failed("خظا");
|
||||
}
|
||||
@@ -694,32 +848,27 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
public async Task<OperationResult> CheckVerifyCodeIsTrue(long contractingPartyTempId, string verifyCode)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var institutionContractTemp = await
|
||||
_institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
|
||||
if (institutionContractTemp == null)
|
||||
var contractingPartyTemp = _contractingPartyTempRepository.Get( contractingPartyTempId);
|
||||
if (contractingPartyTemp == null)
|
||||
return op.Failed("خظا");
|
||||
if (institutionContractTemp.RegistrationStatus != "VerifyCodeSent")
|
||||
return op.Failed("خطا");
|
||||
|
||||
if (institutionContractTemp.VerifyCodeEndTime < DateTime.Now)
|
||||
if (contractingPartyTemp.Status != ContractingPartyTempStatus.InComplete)
|
||||
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
|
||||
|
||||
if (contractingPartyTemp.VerifyCodeSentDateTime.AddMinutes(2) < DateTime.Now)
|
||||
return op.Failed("کد شما منقضی شده است");
|
||||
|
||||
if (institutionContractTemp.SendVerifyCodeTime < DateTime.Now && institutionContractTemp.VerifyCodeEndTime >= DateTime.Now)
|
||||
if (contractingPartyTemp.VerifyCodeSentDateTime < DateTime.Now &&
|
||||
contractingPartyTemp.VerifyCodeSentDateTime >= DateTime.Now)
|
||||
{
|
||||
if (institutionContractTemp.VerifyCode == verifyCode)
|
||||
if (contractingPartyTemp.VerifyCode == verifyCode)
|
||||
{
|
||||
|
||||
|
||||
contractingPartyTemp.SetCompleted();
|
||||
await _contractingPartyTempRepository.SaveChangesAsync();
|
||||
return op.Succcedded();
|
||||
}
|
||||
else
|
||||
{
|
||||
return op.Failed("کد وارد شده صحیح نیست");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return op.Failed("کد وارد شده صحیح نیست");
|
||||
}
|
||||
|
||||
@@ -736,10 +885,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.GetLastArchiveCode();
|
||||
var lastArchiveCode = _personalContractingPartyRepository.GetLastNewArchiveCode();
|
||||
var personalContractingParty = new PersonalContractingParty(temp.FName, temp.LName,
|
||||
temp.NationalCode, temp.IdNumber, "*", "*",
|
||||
"حقیقی",
|
||||
@@ -748,12 +897,13 @@ 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("Completed");
|
||||
update.ChangeRegistrationStatus(InstitutionContractTempStatus.PendingToCompletion);
|
||||
_institutionContractTempRepository.SaveChanges();
|
||||
|
||||
|
||||
@@ -761,10 +911,24 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<RegistrationWorkflowMainList>> RegistrationWorkflowMainList()
|
||||
public async Task<OperationResult> SendAgreementLink(long contractingPartyTempId)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var contractingPartyTemp = _contractingPartyTempRepository.Get(contractingPartyTempId);
|
||||
if (contractingPartyTemp == null)
|
||||
throw new NotFoundException("طرف حساب یافت نشد");
|
||||
|
||||
return await _institutionContractTempRepository.GetAllCompletedRegistration();
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@ 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;
|
||||
@@ -39,7 +40,12 @@ 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;
|
||||
@@ -58,7 +64,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)
|
||||
@@ -66,45 +72,49 @@ 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)
|
||||
@@ -115,12 +125,14 @@ 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)
|
||||
@@ -129,14 +141,12 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
&& command.CreatePlan.EditGroupPlanlist[i].JobIdList.Count > 0)
|
||||
{
|
||||
groupCounter += 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (groupCounter >= 1)
|
||||
{
|
||||
createPlanValidations = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -144,31 +154,37 @@ 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);
|
||||
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);
|
||||
_workshopRepository.Create(workshop);
|
||||
_workshopRepository.SaveChanges();
|
||||
|
||||
@@ -184,20 +200,17 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
MaxPersonValid = 500,
|
||||
Duration = "12",
|
||||
HasCustomizeCheckoutService = command.HasCustomizeCheckoutService
|
||||
|
||||
};
|
||||
};
|
||||
_rollCallServiceApplication.Create(commandSave);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//مشاغل مقطوع
|
||||
if (createPlanValidations)
|
||||
{
|
||||
command.CreatePlan.WorkshopId = workshop.id;
|
||||
var creatPlan = _workshopPlanApplication.CreateWorkshopPlan(command.CreatePlan);
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach (var e in employer)
|
||||
{
|
||||
@@ -208,9 +221,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
var op = _workshopRepository.CreateAccountLeftWorkAndWorkshopAccounts(accountIds, workshop.id);
|
||||
|
||||
|
||||
|
||||
return operation.Succcedded();
|
||||
|
||||
}
|
||||
|
||||
public OperationResult Edit(EditWorkshop command)
|
||||
@@ -228,44 +239,48 @@ 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")
|
||||
@@ -280,17 +295,19 @@ 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);
|
||||
@@ -309,7 +326,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);
|
||||
@@ -321,22 +338,18 @@ 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
|
||||
{
|
||||
@@ -352,16 +365,18 @@ 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);
|
||||
@@ -369,18 +384,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)
|
||||
@@ -396,8 +411,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
{
|
||||
workshop.CreatePlan = _workshopPlanApplication.GetWorkshopPlanByWorkshopId(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return workshop;
|
||||
}
|
||||
@@ -411,6 +425,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
{
|
||||
return _workshopRepository.GetWorkshopAll();
|
||||
}
|
||||
|
||||
public List<WorkshopViewModel> GetWorkshopAccount()
|
||||
{
|
||||
return _workshopRepository.GetWorkshopAccount();
|
||||
@@ -436,13 +451,17 @@ 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);
|
||||
@@ -464,7 +483,11 @@ 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,
|
||||
@@ -514,7 +537,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)
|
||||
@@ -525,14 +548,11 @@ 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)
|
||||
@@ -555,10 +575,8 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
|
||||
#region client
|
||||
|
||||
|
||||
public OperationResult Remove(long id)
|
||||
{
|
||||
|
||||
var opration = new OperationResult();
|
||||
|
||||
bool result = _workshopRepository.Remove(id);
|
||||
@@ -569,14 +587,15 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
}
|
||||
else
|
||||
return opration.Failed("حذف با خطا مواجه نشد");
|
||||
return opration;
|
||||
|
||||
return opration;
|
||||
}
|
||||
|
||||
public List<WorkshopViewModel> GetWorkshopByTextSearchForClient(string textSearch)
|
||||
{
|
||||
return _workshopRepository.GetWorkshopByTextSearchForClient(textSearch);
|
||||
}
|
||||
|
||||
public List<WorkshopViewModel> SearchForClient(WorkshopSearchModel searchModel)
|
||||
{
|
||||
return _workshopRepository.SearchForClient(searchModel);
|
||||
@@ -584,12 +603,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)
|
||||
//{
|
||||
@@ -650,7 +669,6 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
// _workshopRepository.SaveChanges();
|
||||
|
||||
|
||||
|
||||
// foreach (var e in employer)
|
||||
// {
|
||||
// _workshopRepository.EmployerWorkshop(workshop.id, e);
|
||||
@@ -660,7 +678,6 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
// _workshopRepository.CreateWorkshopAccounts(accountIds, workshop.id);
|
||||
|
||||
|
||||
|
||||
// return operation.Succcedded();
|
||||
|
||||
|
||||
@@ -749,6 +766,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
{
|
||||
return _workshopRepository.GetWorkshopAccountByAcountID(acountID);
|
||||
}
|
||||
|
||||
public bool CheckAccountWorkshop(long workshopId)
|
||||
{
|
||||
return _workshopRepository.CheckAccountWorkshop(workshopId);
|
||||
@@ -762,17 +780,13 @@ 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);
|
||||
@@ -789,7 +803,8 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
//var workshopObj = _workshopRepository.Get(id);
|
||||
//workshopObj.DeActive(workshopObj.ArchiveCode);
|
||||
//_workshopRepository.SaveChanges();
|
||||
return _workshopRepository.DeActiveAll(id); ;
|
||||
return _workshopRepository.DeActiveAll(id);
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -804,6 +819,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
|
||||
return opration;
|
||||
}
|
||||
|
||||
public OperationResult ActiveAll(long id)
|
||||
{
|
||||
return _workshopRepository.ActiveAll(id);
|
||||
@@ -814,7 +830,6 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
return _workshopRepository.PrintWorkshopList(searchModel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public AccountViewModel GetClientAccountByWorkshopId(long workshopId)
|
||||
{
|
||||
@@ -823,7 +838,6 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
}
|
||||
|
||||
|
||||
|
||||
//public List<ConnectedPersonnelViewModel> GetConnectedPersonnelsForMain(long workshopId)
|
||||
//{
|
||||
// return _workshopRepository.GetConnectedPersonnelsForMain(workshopId);
|
||||
@@ -833,9 +847,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
|
||||
{
|
||||
@@ -886,23 +900,24 @@ 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)
|
||||
@@ -925,8 +940,189 @@ 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
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -65,6 +65,7 @@ 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;
|
||||
@@ -118,6 +119,7 @@ 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;
|
||||
|
||||
@@ -133,9 +135,7 @@ 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,7 +152,6 @@ 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; }
|
||||
@@ -191,10 +190,17 @@ 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
|
||||
@@ -261,13 +267,14 @@ 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; }
|
||||
@@ -279,14 +286,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; }
|
||||
@@ -301,15 +308,17 @@ 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)
|
||||
{
|
||||
@@ -317,5 +326,6 @@ public class CompanyContext : DbContext
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(assembly);
|
||||
modelBuilder.Entity<RollCall>().HasQueryFilter(x => x.RollCallModifyType != RollCallModifyType.Undefined);
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
}
|
||||
}
|
||||
60
CompanyManagment.EFCore/Mapping/AuthorizedPersonMapping.cs
Normal file
60
CompanyManagment.EFCore/Mapping/AuthorizedPersonMapping.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -28,5 +28,8 @@ 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);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,16 @@ 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)
|
||||
|
||||
@@ -11,7 +11,7 @@ public class InstitutionContractTempMapping : IEntityTypeConfiguration<Instituti
|
||||
builder.ToTable("InstitutionContractTemps");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.RegistrationStatus).HasMaxLength(30);
|
||||
builder.Property(x => x.RegistrationStatus).HasConversion<string>().HasMaxLength(30);
|
||||
builder.Property(x => x.PaymentModel).HasMaxLength(30);
|
||||
builder.Property(x => x.PeriodModel).HasMaxLength(3);
|
||||
builder.Property(x => x.OfficialCompany).HasMaxLength(30);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
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();
|
||||
});
|
||||
}
|
||||
}
|
||||
35
CompanyManagment.EFCore/Mapping/LawMapping.cs
Normal file
35
CompanyManagment.EFCore/Mapping/LawMapping.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ 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
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ 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);
|
||||
|
||||
10262
CompanyManagment.EFCore/Migrations/20250812101131_AddInstitutionContractContactInfoTemp.Designer.cs
generated
Normal file
10262
CompanyManagment.EFCore/Migrations/20250812101131_AddInstitutionContractContactInfoTemp.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
10323
CompanyManagment.EFCore/Migrations/20250816094851_Add law table.Designer.cs
generated
Normal file
10323
CompanyManagment.EFCore/Migrations/20250816094851_Add law table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,67 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
10446
CompanyManagment.EFCore/Migrations/20250820122958_add register in institution contract.Designer.cs
generated
Normal file
10446
CompanyManagment.EFCore/Migrations/20250820122958_add register in institution contract.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,132 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RemoveworkshopQueryfilterandremoveworkshopstatus : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RegistrationStatus",
|
||||
table: "Workshops");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InstitutionContractWorkshopDetailEmployers",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
InstitutionContractWorkshopDetailId = table.Column<long>(type: "bigint", nullable: false),
|
||||
EmployerId = table.Column<long>(type: "bigint", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InstitutionContractWorkshopDetailEmployers", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_InstitutionContractWorkshopDetailEmployers_InstitutionContractWorkshopDetail_InstitutionContractWorkshopDetailId",
|
||||
column: x => x.InstitutionContractWorkshopDetailId,
|
||||
principalTable: "InstitutionContractWorkshopDetail",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InstitutionContractWorkshopDetailEmployers_InstitutionContractWorkshopDetailId_EmployerId",
|
||||
table: "InstitutionContractWorkshopDetailEmployers",
|
||||
columns: new[] { "InstitutionContractWorkshopDetailId", "EmployerId" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "InstitutionContractWorkshopDetailEmployers");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RegistrationStatus",
|
||||
table: "Workshops",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
}
|
||||
}
|
||||
10483
CompanyManagment.EFCore/Migrations/20250821101944_set enum to string.Designer.cs
generated
Normal file
10483
CompanyManagment.EFCore/Migrations/20250821101944_set enum to string.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class setenumtostring : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "RegistrationStatus",
|
||||
table: "InstitutionContractTemps",
|
||||
type: "nvarchar(30)",
|
||||
maxLength: 30,
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldMaxLength: 30);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "RegistrationStatus",
|
||||
table: "InstitutionContractTemps",
|
||||
type: "int",
|
||||
maxLength: 30,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(30)",
|
||||
oldMaxLength: 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
10487
CompanyManagment.EFCore/Migrations/20250826071120_add LawType to law.Designer.cs
generated
Normal file
10487
CompanyManagment.EFCore/Migrations/20250826071120_add LawType to law.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addLawTypetolaw : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "LawType",
|
||||
table: "Law",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "RegistrationStatus",
|
||||
table: "InstitutionContractTemps",
|
||||
type: "nvarchar(30)",
|
||||
maxLength: 30,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(30)",
|
||||
oldMaxLength: 30,
|
||||
oldNullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LawType",
|
||||
table: "Law");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "RegistrationStatus",
|
||||
table: "InstitutionContractTemps",
|
||||
type: "nvarchar(30)",
|
||||
maxLength: 30,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(30)",
|
||||
oldMaxLength: 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
10555
CompanyManagment.EFCore/Migrations/20250827073456_AddAuthorizedPersonTable.Designer.cs
generated
Normal file
10555
CompanyManagment.EFCore/Migrations/20250827073456_AddAuthorizedPersonTable.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddAuthorizedPersonTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AuthorizedPersons",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
NationalCode = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
|
||||
FirstName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||
LastName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||
FatherName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
||||
BirthDate = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
|
||||
Gender = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
DeathStatus = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
ShenasnameSeri = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
|
||||
ShenasnameSerial = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
|
||||
ShenasnamehNumber = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
|
||||
IsVerified = table.Column<bool>(type: "bit", nullable: false),
|
||||
VerificationDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AuthorizedPersons", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AuthorizedPersons_NationalCode",
|
||||
table: "AuthorizedPersons",
|
||||
column: "NationalCode",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AuthorizedPersons");
|
||||
}
|
||||
}
|
||||
}
|
||||
10496
CompanyManagment.EFCore/Migrations/20250827082030_Add missing plan services in workshopDetails.Designer.cs
generated
Normal file
10496
CompanyManagment.EFCore/Migrations/20250827082030_Add missing plan services in workshopDetails.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddmissingplanservicesinworkshopDetails : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "HasContractPlanInPerson",
|
||||
table: "InstitutionContractWorkshopDetail",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "HasInsurancePlan",
|
||||
table: "InstitutionContractWorkshopDetail",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "HasInsurancePlanInPerson",
|
||||
table: "InstitutionContractWorkshopDetail",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HasContractPlanInPerson",
|
||||
table: "InstitutionContractWorkshopDetail");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HasInsurancePlan",
|
||||
table: "InstitutionContractWorkshopDetail");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HasInsurancePlanInPerson",
|
||||
table: "InstitutionContractWorkshopDetail");
|
||||
}
|
||||
}
|
||||
}
|
||||
10565
CompanyManagment.EFCore/Migrations/20250907124211_add law type.Designer.cs
generated
Normal file
10565
CompanyManagment.EFCore/Migrations/20250907124211_add law type.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addlawtype : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LawType",
|
||||
table: "Law");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Type",
|
||||
table: "Law",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Type",
|
||||
table: "Law");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "LawType",
|
||||
table: "Law",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
10582
CompanyManagment.EFCore/Migrations/20250916081012_add verifyCode to contracting party temp.Designer.cs
generated
Normal file
10582
CompanyManagment.EFCore/Migrations/20250916081012_add verifyCode to contracting party temp.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addverifyCodetocontractingpartytemp : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Status",
|
||||
table: "ContractingPartyTemp",
|
||||
type: "nvarchar(20)",
|
||||
maxLength: 20,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "VerifyCode",
|
||||
table: "ContractingPartyTemp",
|
||||
type: "nvarchar(12)",
|
||||
maxLength: 12,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "VerifyCodeSentDateTime",
|
||||
table: "ContractingPartyTemp",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Status",
|
||||
table: "ContractingPartyTemp");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifyCode",
|
||||
table: "ContractingPartyTemp");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifyCodeSentDateTime",
|
||||
table: "ContractingPartyTemp");
|
||||
}
|
||||
}
|
||||
}
|
||||
10591
CompanyManagment.EFCore/Migrations/20250918070424_Add Head Title And Notification.Designer.cs
generated
Normal file
10591
CompanyManagment.EFCore/Migrations/20250918070424_Add Head Title And Notification.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddHeadTitleAndNotification : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "HeadTitle",
|
||||
table: "Law",
|
||||
type: "nvarchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Notifications",
|
||||
table: "Law",
|
||||
type: "nvarchar(3000)",
|
||||
maxLength: 3000,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HeadTitle",
|
||||
table: "Law");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Notifications",
|
||||
table: "Law");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,74 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("AndroidApkVersions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.AuthorizedPersonAgg.AuthorizedPerson", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<string>("BirthDate")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("DeathStatus")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("FatherName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("Gender")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<bool>("IsVerified")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("NationalCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<string>("ShenasnameSeri")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<string>("ShenasnameSerial")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<string>("ShenasnamehNumber")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<DateTime?>("VerificationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("NationalCode")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AuthorizedPersons", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.BankAgg.Bank", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -691,6 +759,10 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("LegalPosition")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("NationalId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
@@ -3052,6 +3124,11 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(122)
|
||||
.HasColumnType("nvarchar(122)");
|
||||
|
||||
b.Property<double>("TotalAmount")
|
||||
.HasColumnType("float");
|
||||
|
||||
@@ -3071,6 +3148,94 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("InstitutionContracts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractAgg.InstitutionContractInstallment", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("nvarchar(1000)");
|
||||
|
||||
b.Property<string>("InstallmentDateFa")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<DateTime>("InstallmentDateGr")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long>("InstitutionContractId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InstitutionContractId");
|
||||
|
||||
b.ToTable("InstitutionContractInstallments", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractAgg.InstitutionContractWorkshopDetail", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("HasContractPlan")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("HasContractPlanInPerson")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("HasCustomizeCheckoutPlan")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("HasInsurancePlan")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("HasInsurancePlanInPerson")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("HasRollCallPlan")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<long>("InstitutionContractId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("PersonnelCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<bool>("WorkshopCreated")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<long?>("WorkshopId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("WorkshopName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("InstitutionContractId");
|
||||
|
||||
b.ToTable("InstitutionContractWorkshopDetail", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractContactInfoAgg.InstitutionContractContactInfo", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -3690,6 +3855,44 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("Jobs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.LawAgg.Law", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("HeadTitle")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("NotificationsJson")
|
||||
.HasMaxLength(3000)
|
||||
.HasColumnType("nvarchar(3000)")
|
||||
.HasColumnName("Notifications");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("nvarchar(255)");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("Law", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.LeaveAgg.Leave", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -5388,15 +5591,70 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(12)
|
||||
.HasColumnType("nvarchar(12)");
|
||||
|
||||
b.Property<Guid>("PublicId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasMaxLength(35)
|
||||
.HasColumnType("nvarchar(35)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("VerifyCode")
|
||||
.HasMaxLength(12)
|
||||
.HasColumnType("nvarchar(12)");
|
||||
|
||||
b.Property<DateTime>("VerifyCodeSentDateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("ContractingPartyTemp", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TemporaryClientRegistrationAgg.InstitutionContractContactInfoTemp", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<long>("InstitutionContractTempId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("PhoneType")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("Position")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<bool>("SendSms")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("InstitutionContractTempId");
|
||||
|
||||
b.ToTable("InstitutionContractContactInfoTemp", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TemporaryClientRegistrationAgg.InstitutionContractTemp", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -5432,7 +5690,11 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(3)
|
||||
.HasColumnType("nvarchar(3)");
|
||||
|
||||
b.Property<Guid>("PublicId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("RegistrationStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
@@ -5895,6 +6157,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<long>("ContractingPartyId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("CreateCheckout")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -9373,6 +9638,58 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("Holidayss");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractAgg.InstitutionContractInstallment", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.InstitutionContractAgg.InstitutionContract", "InstitutionContract")
|
||||
.WithMany("Installments")
|
||||
.HasForeignKey("InstitutionContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InstitutionContract");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractAgg.InstitutionContractWorkshopDetail", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.InstitutionContractAgg.InstitutionContract", "InstitutionContract")
|
||||
.WithMany("WorkshopDetails")
|
||||
.HasForeignKey("InstitutionContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Company.Domain.InstitutionContractAgg.InstitutionContractWorkshopDetailEmployer", "Employers", b1 =>
|
||||
{
|
||||
b1.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<long>("id"));
|
||||
|
||||
b1.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b1.Property<long>("EmployerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<long>("InstitutionContractWorkshopDetailId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.HasKey("id");
|
||||
|
||||
b1.HasIndex("InstitutionContractWorkshopDetailId", "EmployerId")
|
||||
.IsUnique();
|
||||
|
||||
b1.ToTable("InstitutionContractWorkshopDetailEmployers", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("InstitutionContractWorkshopDetailId");
|
||||
});
|
||||
|
||||
b.Navigation("Employers");
|
||||
|
||||
b.Navigation("InstitutionContract");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractContactInfoAgg.InstitutionContractContactInfo", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.InstitutionContractAgg.InstitutionContract", "InstitutionContracts")
|
||||
@@ -9466,6 +9783,43 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("Workshop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.LawAgg.Law", b =>
|
||||
{
|
||||
b.OwnsMany("Company.Domain.LawAgg.LawItem", "Items", b1 =>
|
||||
{
|
||||
b1.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<long>("Id"));
|
||||
|
||||
b1.Property<string>("Details")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b1.Property<string>("Header")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("nvarchar(255)");
|
||||
|
||||
b1.Property<long>("LawId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<int>("OrderNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("LawId");
|
||||
|
||||
b1.ToTable("LawItem", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("LawId");
|
||||
});
|
||||
|
||||
b.Navigation("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.LeftWorkAgg.LeftWork", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee")
|
||||
@@ -9750,6 +10104,17 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("TaxLeftWorkCategory");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TemporaryClientRegistrationAgg.InstitutionContractContactInfoTemp", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.TemporaryClientRegistrationAgg.InstitutionContractTemp", "InstitutionContractTemp")
|
||||
.WithMany("ContactInfoList")
|
||||
.HasForeignKey("InstitutionContractTempId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InstitutionContractTemp");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TemporaryClientRegistrationAgg.WorkshopServicesTemp", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.TemporaryClientRegistrationAgg.WorkshopTemp", "WorkshopTemp")
|
||||
@@ -10037,6 +10402,10 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractAgg.InstitutionContract", b =>
|
||||
{
|
||||
b.Navigation("ContactInfoList");
|
||||
|
||||
b.Navigation("Installments");
|
||||
|
||||
b.Navigation("WorkshopDetails");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InsurancJobAgg.InsuranceJob", b =>
|
||||
@@ -10133,6 +10502,11 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("TaxLeftWorkItemList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TemporaryClientRegistrationAgg.InstitutionContractTemp", b =>
|
||||
{
|
||||
b.Navigation("ContactInfoList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TemporaryClientRegistrationAgg.WorkshopTemp", b =>
|
||||
{
|
||||
b.Navigation("WorkshopServicesTemps");
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Linq;
|
||||
using Company.Domain.AuthorizedPersonAgg;
|
||||
using _0_Framework.InfraStructure;
|
||||
using CompanyManagment.EFCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class AuthorizedPersonRepository : RepositoryBase<long, AuthorizedPerson>, IAuthorizedPersonRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
|
||||
public AuthorizedPersonRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public AuthorizedPerson GetByNationalCode(string nationalCode)
|
||||
{
|
||||
return _context.AuthorizedPersons
|
||||
.FirstOrDefault(x => x.NationalCode == nationalCode);
|
||||
}
|
||||
|
||||
public bool ExistsByNationalCode(string nationalCode)
|
||||
{
|
||||
return _context.AuthorizedPersons
|
||||
.Any(x => x.NationalCode == nationalCode);
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,8 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
Type = t.TypeOfTransaction == "debt"
|
||||
? FinancialTransactionType.Debt
|
||||
: FinancialTransactionType.Credit,
|
||||
TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد"
|
||||
TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد",
|
||||
Id = t.id
|
||||
};
|
||||
}).OrderByDescending(x=>x.DateTimeGr).ToList(),
|
||||
};
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class InstitutionContractContactInfoTempRepository : RepositoryBase<long, InstitutionContractContactInfoTemp>, IInstitutionContractContactInfoTempRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
public InstitutionContractContactInfoTempRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
@@ -975,9 +976,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
double result = Math.Ceiling(roundFloor / 10000.0) * 10000;
|
||||
|
||||
|
||||
|
||||
Console.WriteLine(counter + " - " + rollCallService.StartService.ToFarsi() + " - " +
|
||||
rollCallService.WorkshopId + " - " + employeeCount +
|
||||
rollCallService.WorkshopId + " - " + employeeCount +
|
||||
$" - {totalAmonut} - round {result}");
|
||||
|
||||
var financialStatment =
|
||||
@@ -1018,6 +1018,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var query = _context.InstitutionContractSet
|
||||
.Include(x => x.ContactInfoList);
|
||||
|
||||
var now = DateTime.Today;
|
||||
var nowFa = now.ToFarsi();
|
||||
var endFa = nowFa.FindeEndOfMonth();
|
||||
var endThisMontGr = endFa.ToGeorgianDateTime();
|
||||
|
||||
var joinedQuery = query.Join(_context.PersonalContractingParties
|
||||
.Include(x => x.Employers)
|
||||
@@ -1029,7 +1033,28 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.Join(_context.FinancialStatments.Include(x => x.FinancialTransactionList),
|
||||
x => x.contractingParty.id,
|
||||
statement => statement.ContractingPartyId,
|
||||
(x, statement) => new { x.contractingParty, x.contract, statement });
|
||||
(x, statement) => new { x.contractingParty, x.contract, statement })
|
||||
.Select(x => new
|
||||
{
|
||||
x.contract,
|
||||
x.contractingParty,
|
||||
x.statement,
|
||||
StatusPriority =
|
||||
x.contract.IsActiveString == "blue"
|
||||
? (int)InstitutionContractListStatus.DeactiveWithDebt
|
||||
: x.contract.ContractEndGr < now
|
||||
? (int)InstitutionContractListStatus.Deactive
|
||||
: (x.contract.ContractEndGr >= now && x.contract.ContractEndGr <= endThisMontGr)
|
||||
? (int)InstitutionContractListStatus.PendingForRenewal
|
||||
: x.contractingParty.IsBlock == "true"
|
||||
? (int)InstitutionContractListStatus.Block
|
||||
: x.contract.ContractAmount == 0
|
||||
? (int)InstitutionContractListStatus.Free
|
||||
: !x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop)).Any()
|
||||
? (int)InstitutionContractListStatus.WithoutWorkshop
|
||||
: (int)InstitutionContractListStatus.Active
|
||||
});
|
||||
|
||||
#region Search
|
||||
|
||||
@@ -1096,7 +1121,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (searchModel.IsActive != null)
|
||||
{
|
||||
var isActiveStr = searchModel.IsActive == true ? "true" : "false";
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString == isActiveStr);
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString == isActiveStr || x.contract.IsActiveString == "blue");
|
||||
}
|
||||
|
||||
if (searchModel.Type != null)
|
||||
@@ -1116,43 +1141,35 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.OfficialCompany == isOfficialStr);
|
||||
}
|
||||
|
||||
var now = DateTime.Today;
|
||||
var nowFa = now.ToFarsi();
|
||||
var endFa = nowFa.FindeEndOfMonth();
|
||||
var endThisMontGr = endFa.ToGeorgianDateTime();
|
||||
|
||||
if (searchModel.Status != null)
|
||||
{
|
||||
switch (searchModel.Status)
|
||||
{
|
||||
case InstitutionContractStatus.DeactiveWithDebt:
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString == "blue");
|
||||
break;
|
||||
case InstitutionContractStatus.PendingForRenewal:
|
||||
case InstitutionContractListStatus.DeactiveWithDebt:
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.contract.ContractEndGr >= now && x.contract.ContractEndGr <= endThisMontGr);
|
||||
x.StatusPriority == (int)InstitutionContractListStatus.DeactiveWithDebt);
|
||||
break;
|
||||
case InstitutionContractStatus.Block:
|
||||
joinedQuery = joinedQuery.Where(x => x.contractingParty.IsBlock == "true");
|
||||
break;
|
||||
case InstitutionContractStatus.Free:
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.ContractAmount == 0);
|
||||
break;
|
||||
case InstitutionContractStatus.WithoutWorkshop:
|
||||
joinedQuery = joinedQuery.Where(x => !x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop)).Any());
|
||||
break;
|
||||
case InstitutionContractStatus.Active:
|
||||
case InstitutionContractListStatus.PendingForRenewal:
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.contract.IsActiveString != "blue" && // Not DeactiveWithDebt
|
||||
!(x.contract.ContractEndGr >= now &&
|
||||
x.contract.ContractEndGr <= endThisMontGr) && // Not PendingForRenewal
|
||||
x.contractingParty.IsBlock != "true" && // Not Block
|
||||
x.contract.ContractAmount != 0 && // Not Free
|
||||
x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop))
|
||||
.Any() // Has at least one workshop => Not WithoutWorkshop
|
||||
);
|
||||
x.StatusPriority == (int)InstitutionContractListStatus.PendingForRenewal);
|
||||
break;
|
||||
case InstitutionContractListStatus.Block:
|
||||
joinedQuery = joinedQuery.Where(x => x.StatusPriority == (int)InstitutionContractListStatus.Block);
|
||||
break;
|
||||
case InstitutionContractListStatus.Free:
|
||||
joinedQuery = joinedQuery.Where(x => x.StatusPriority == (int)InstitutionContractListStatus.Free);
|
||||
break;
|
||||
case InstitutionContractListStatus.WithoutWorkshop:
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.StatusPriority == (int)InstitutionContractListStatus.WithoutWorkshop);
|
||||
break;
|
||||
case InstitutionContractListStatus.Active:
|
||||
joinedQuery = joinedQuery.Where(x => x.StatusPriority == (int)InstitutionContractListStatus.Active);
|
||||
break;
|
||||
case InstitutionContractListStatus.Deactive:
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.ContractEndGr < now);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1166,14 +1183,22 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
var orderedQuery = joinedQuery
|
||||
.OrderBy(x =>
|
||||
x.contract.IsActiveString == "blue" ? 0 : // DeactiveWithoutDebt
|
||||
(x.contract.ContractEndGr >= now && x.contract.ContractEndGr <= endOfMonth) ? 1 : // PendingToRenewal
|
||||
x.contractingParty.IsBlock == "true" ? 2 : // Block
|
||||
x.contract.ContractAmount == 0 ? 3 : // Free
|
||||
!x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers)
|
||||
.Any() ? 4 : // WithoutWorkshop
|
||||
5 // Active
|
||||
x.StatusPriority == (int)InstitutionContractListStatus.DeactiveWithDebt
|
||||
? 0
|
||||
: // DeactiveWithoutDebt
|
||||
(x.StatusPriority == (int)InstitutionContractListStatus.PendingForRenewal)
|
||||
? 1
|
||||
: // PendingToRenewal
|
||||
x.StatusPriority == (int)InstitutionContractListStatus.Block
|
||||
? 2
|
||||
: // Block
|
||||
x.StatusPriority == (int)InstitutionContractListStatus.Free
|
||||
? 3
|
||||
: // Free
|
||||
x.StatusPriority == (int)InstitutionContractListStatus.WithoutWorkshop
|
||||
? 4
|
||||
: // WithoutWorkshop
|
||||
5 // Active
|
||||
);
|
||||
|
||||
var list = await orderedQuery.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync();
|
||||
@@ -1197,7 +1222,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var minArchiveCode = arc.Count > 0 ? arc.Min(a => a) : 0;
|
||||
|
||||
var archiveCode = minArchiveCode == 10000000 ? 0 : minArchiveCode;
|
||||
var status = SetContractStatus(x.contract, x.contractingParty, x.statement);
|
||||
var status = Enum.Parse<InstitutionContractListStatus>(x.StatusPriority.ToString());
|
||||
return new GetInstitutionContractListItemsViewModel()
|
||||
{
|
||||
ContractAmount = x.contract.ContractAmount,
|
||||
@@ -1216,19 +1241,25 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.Where(l => workshops.Select(w => w.id).Contains(l.id))
|
||||
.Count(l => l.StartWorkDate <= DateTime.Now && l.LeftWorkDate >= DateTime.Now),
|
||||
EmployerNames = employers.Select(e => e.FullName).ToList(),
|
||||
Status = status.status,
|
||||
IsExpired = status.isExpiered
|
||||
ListStatus = status,
|
||||
IsExpired = x.contract.ContractEndGr <= endThisMontGr,
|
||||
ContractingPartyId = x.contractingParty.id,
|
||||
};
|
||||
}).ToList()
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<GetInstitutionContractListStatsViewModel> GetListStats(InstitutionContractListSearchModel searchModel)
|
||||
public async Task<GetInstitutionContractListStatsViewModel> GetListStats(
|
||||
InstitutionContractListSearchModel searchModel)
|
||||
{
|
||||
var query = _context.InstitutionContractSet
|
||||
var query = _context.InstitutionContractSet
|
||||
.Include(x => x.ContactInfoList);
|
||||
|
||||
var now = DateTime.Today;
|
||||
var nowFa = now.ToFarsi();
|
||||
var endFa = nowFa.FindeEndOfMonth();
|
||||
var endThisMontGr = endFa.ToGeorgianDateTime();
|
||||
|
||||
var joinedQuery = query.Join(_context.PersonalContractingParties
|
||||
.Include(x => x.Employers)
|
||||
@@ -1240,9 +1271,30 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.Join(_context.FinancialStatments.Include(x => x.FinancialTransactionList),
|
||||
x => x.contractingParty.id,
|
||||
statement => statement.ContractingPartyId,
|
||||
(x, statement) => new { x.contractingParty, x.contract, statement });
|
||||
|
||||
(x, statement) => new { x.contractingParty, x.contract, statement })
|
||||
.Select(x => new
|
||||
{
|
||||
x.contract,
|
||||
x.contractingParty,
|
||||
x.statement,
|
||||
StatusPriority =
|
||||
x.contract.IsActiveString == "blue"
|
||||
? (int)InstitutionContractListStatus.DeactiveWithDebt
|
||||
: x.contract.ContractEndGr < now
|
||||
? (int)InstitutionContractListStatus.Deactive
|
||||
: (x.contract.ContractEndGr >= now && x.contract.ContractEndGr <= endThisMontGr)
|
||||
? (int)InstitutionContractListStatus.PendingForRenewal
|
||||
: x.contractingParty.IsBlock == "true"
|
||||
? (int)InstitutionContractListStatus.Block
|
||||
: x.contract.ContractAmount == 0
|
||||
? (int)InstitutionContractListStatus.Free
|
||||
: !x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop)).Any()
|
||||
? (int)InstitutionContractListStatus.WithoutWorkshop
|
||||
: (int)InstitutionContractListStatus.Active
|
||||
});
|
||||
|
||||
#region Search
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.EmployerOrWorkshopOrContractingPartyOrRepresentativeName))
|
||||
{
|
||||
@@ -1307,7 +1359,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (searchModel.IsActive != null)
|
||||
{
|
||||
var isActiveStr = searchModel.IsActive == true ? "true" : "false";
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString == isActiveStr);
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString == isActiveStr || x.contract.IsActiveString == "blue");
|
||||
}
|
||||
|
||||
if (searchModel.Type != null)
|
||||
@@ -1326,52 +1378,45 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var isOfficialStr = searchModel.IsOfficial == true ? "Official" : "NotOfficial";
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.OfficialCompany == isOfficialStr);
|
||||
}
|
||||
|
||||
var now = DateTime.Today;
|
||||
var nowFa = now.ToFarsi();
|
||||
var endFa = nowFa.FindeEndOfMonth();
|
||||
var endThisMontGr = endFa.ToGeorgianDateTime();
|
||||
|
||||
|
||||
|
||||
if (searchModel.Status != null)
|
||||
{
|
||||
switch (searchModel.Status)
|
||||
{
|
||||
case InstitutionContractStatus.DeactiveWithDebt:
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString == "blue");
|
||||
break;
|
||||
case InstitutionContractStatus.PendingForRenewal:
|
||||
case InstitutionContractListStatus.DeactiveWithDebt:
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.contract.ContractEndGr >= now && x.contract.ContractEndGr <= endThisMontGr);
|
||||
x.StatusPriority == (int)InstitutionContractListStatus.DeactiveWithDebt);
|
||||
break;
|
||||
case InstitutionContractStatus.Block:
|
||||
joinedQuery = joinedQuery.Where(x => x.contractingParty.IsBlock == "true");
|
||||
break;
|
||||
case InstitutionContractStatus.Free:
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.ContractAmount == 0);
|
||||
break;
|
||||
case InstitutionContractStatus.WithoutWorkshop:
|
||||
joinedQuery = joinedQuery.Where(x => !x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop)).Any());
|
||||
break;
|
||||
case InstitutionContractStatus.Active:
|
||||
case InstitutionContractListStatus.PendingForRenewal:
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.contract.IsActiveString != "blue" && // Not DeactiveWithDebt
|
||||
!(x.contract.ContractEndGr >= now &&
|
||||
x.contract.ContractEndGr <= endThisMontGr) && // Not PendingForRenewal
|
||||
x.contractingParty.IsBlock != "true" && // Not Block
|
||||
x.contract.ContractAmount != 0 && // Not Free
|
||||
x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop))
|
||||
.Any() // Has at least one workshop => Not WithoutWorkshop
|
||||
);
|
||||
x.StatusPriority == (int)InstitutionContractListStatus.PendingForRenewal);
|
||||
break;
|
||||
case InstitutionContractListStatus.Block:
|
||||
joinedQuery = joinedQuery.Where(x => x.StatusPriority == (int)InstitutionContractListStatus.Block);
|
||||
break;
|
||||
case InstitutionContractListStatus.Free:
|
||||
joinedQuery = joinedQuery.Where(x => x.StatusPriority == (int)InstitutionContractListStatus.Free);
|
||||
break;
|
||||
case InstitutionContractListStatus.WithoutWorkshop:
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.StatusPriority == (int)InstitutionContractListStatus.WithoutWorkshop);
|
||||
break;
|
||||
case InstitutionContractListStatus.Active:
|
||||
joinedQuery = joinedQuery.Where(x => x.StatusPriority == (int)InstitutionContractListStatus.Active);
|
||||
break;
|
||||
case InstitutionContractListStatus.Deactive:
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.ContractEndGr < now);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString != "blue");
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
var totalAmount = await joinedQuery.SumAsync(x => x.contract.ContractAmount);
|
||||
|
||||
var totalDebt = await _context.FinancialStatments.Include(x => x.FinancialTransactionList)
|
||||
@@ -1379,12 +1424,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.SelectMany(x => x.FinancialTransactionList)
|
||||
.SumAsync(x => x.Deptor - x.Creditor);
|
||||
var counts = new List<InstitutionContractStatusCount>();
|
||||
foreach (var name in typeof(InstitutionContractStatus).GetEnumNames())
|
||||
foreach (var name in typeof(InstitutionContractListStatus).GetEnumNames())
|
||||
{
|
||||
var @enum = Enum.Parse<InstitutionContractStatus>(name);
|
||||
var @enum = Enum.Parse<InstitutionContractListStatus>(name);
|
||||
searchModel.Status = @enum;
|
||||
var count = (await GetList(searchModel)).TotalCount;
|
||||
counts.Add(new (){Status = @enum, Count = count });
|
||||
counts.Add(new() { ListStatus = @enum, Count = count });
|
||||
}
|
||||
|
||||
var res = new GetInstitutionContractListStatsViewModel()
|
||||
@@ -1396,31 +1441,122 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
return res;
|
||||
}
|
||||
|
||||
private (InstitutionContractStatus status, bool isExpiered) SetContractStatus(InstitutionContract contract,
|
||||
public async Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList()
|
||||
{
|
||||
return await _context.InstitutionContractSet.Where(x => x.Status == InstitutionContractStatus.Incomplete)
|
||||
.Include(x => x.WorkshopDetails)
|
||||
.Join(_context.PersonalContractingParties,
|
||||
institutionContract => institutionContract.ContractingPartyId,
|
||||
contractingParty => contractingParty.id,
|
||||
(institutionContract, contractingParty) => new { institutionContract, contractingParty }).Select(x =>
|
||||
new RegistrationWorkflowMainListViewModel
|
||||
{
|
||||
InstitutionContractId = x.institutionContract.id,
|
||||
ContractingPartyFullName = $"{x.contractingParty.FName} {x.contractingParty.LName}",
|
||||
Phone = x.contractingParty.Phone,
|
||||
Amount = x.institutionContract.TotalAmount,
|
||||
DoneWorkshops = x.institutionContract.WorkshopDetails.Count(w => w.WorkshopCreated),
|
||||
TotalWorkshops = x.institutionContract.WorkshopDetails.Count(),
|
||||
UnDoneWorkshops = x.institutionContract.WorkshopDetails.Count(w => !w.WorkshopCreated),
|
||||
ContractingPartyId = x.contractingParty.id
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست اقلام گردش کار ثبت نام
|
||||
/// </summary>
|
||||
/// <param name="institutionContractId">شناسه قرارداد نهاد</param>
|
||||
/// <returns>لیست اقلام گردش کار ثبت نام</returns>
|
||||
public async Task<List<RegistrationWorkflowItemsViewModel>> RegistrationWorkflowItems(long institutionContractId)
|
||||
{
|
||||
// دریافت قرارداد نهاد همراه با جزئیات کارگاهها
|
||||
var institutionContract = await _context.InstitutionContractSet
|
||||
.Include(x => x.WorkshopDetails)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractId);
|
||||
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
|
||||
// استخراج شناسههای کارگاههایی که ایجاد شدهاند
|
||||
var workshopIds = institutionContract.WorkshopDetails
|
||||
.Where(x => x.WorkshopId != null)
|
||||
.Select(x => x.WorkshopId.Value)
|
||||
.ToList();
|
||||
|
||||
// دریافت کارگاهها همراه با کارفرمایان در یک کوئری
|
||||
var workshops = await _context.Workshops
|
||||
.Where(x => workshopIds.Contains(x.id))
|
||||
.ToListAsync();
|
||||
|
||||
// استخراج تمامی شناسههای کارفرمایان از جزئیات کارگاهها
|
||||
var allEmployerIds = institutionContract.WorkshopDetails
|
||||
.SelectMany(x => x.Employers.Select(e => e.EmployerId))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
// دریافت اطلاعات کارفرمایان در یک کوئری واحد
|
||||
var employersDict = (await _context.Employers
|
||||
.Where(e => allEmployerIds.Contains(e.id))
|
||||
.Select(e => new { e.id, e.FullName })
|
||||
.ToListAsync())
|
||||
.ToDictionary(e => e.id, e => e);
|
||||
|
||||
// ساخت نتیجه نهایی با استفاده از دادههای از پیش بارگذاری شده
|
||||
var items = institutionContract.WorkshopDetails.Select(workshopDetail =>
|
||||
{
|
||||
// پیدا کردن کارگاه مرتبط
|
||||
var workshop = workshops.FirstOrDefault(w => w.id == workshopDetail.WorkshopId);
|
||||
|
||||
// ساخت لیست کارفرمایان این جزئیات کارگاه
|
||||
var employers = workshopDetail.Employers
|
||||
.Where(e => employersDict.ContainsKey(e.EmployerId))
|
||||
.Select(e => new RegistrationWorkflowItemsEmployerViewModel
|
||||
{
|
||||
Id = e.EmployerId,
|
||||
FullName = employersDict[e.EmployerId].FullName
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return new RegistrationWorkflowItemsViewModel
|
||||
{
|
||||
Price = workshopDetail.Price,
|
||||
IsDone = workshop != null,
|
||||
PersonnelCount = workshopDetail.PersonnelCount,
|
||||
WorkshopName = workshopDetail.WorkshopName,
|
||||
Employers = employers,
|
||||
WorkshopDetailsId = workshopDetail.id
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
private (InstitutionContractListStatus status, bool isExpiered) SetContractStatus(InstitutionContract contract,
|
||||
PersonalContractingParty contractingParty,
|
||||
FinancialStatment financialStatment)
|
||||
{
|
||||
//if (contract.ContractEndGr <= endThisMontGr)
|
||||
var now = DateTime.Now;
|
||||
var nowFa = now.ToFarsi();
|
||||
var endFa = nowFa.FindeEndOfMonth();
|
||||
var endThisMontGr = endFa.ToGeorgianDateTime();
|
||||
InstitutionContractStatus status = InstitutionContractStatus.Active;
|
||||
InstitutionContractListStatus listStatus = InstitutionContractListStatus.Active;
|
||||
bool isExpier = false;
|
||||
if (contract.ContractEndGr < now)
|
||||
{
|
||||
status = InstitutionContractStatus.Deactive;
|
||||
listStatus = InstitutionContractListStatus.Deactive;
|
||||
isExpier = true;
|
||||
}
|
||||
|
||||
if (contract.ContractEndGr >= now && contract.ContractEndGr <= endThisMontGr)
|
||||
{
|
||||
status = InstitutionContractStatus.PendingForRenewal;
|
||||
listStatus = InstitutionContractListStatus.PendingForRenewal;
|
||||
isExpier = true;
|
||||
}
|
||||
|
||||
if (contract.ContractAmount == 0)
|
||||
{
|
||||
status = InstitutionContractStatus.Free;
|
||||
listStatus = InstitutionContractListStatus.Free;
|
||||
if ((contract.ContractEndGr >= now && contract.ContractEndGr <= endThisMontGr) ||
|
||||
(contract.ContractEndGr < now))
|
||||
{
|
||||
@@ -1430,7 +1566,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
if (contract.IsActiveString == "blue")
|
||||
{
|
||||
status = InstitutionContractStatus.DeactiveWithDebt;
|
||||
listStatus = InstitutionContractListStatus.DeactiveWithDebt;
|
||||
isExpier = true;
|
||||
}
|
||||
|
||||
@@ -1439,15 +1575,46 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
if (workshops.Count == 0)
|
||||
{
|
||||
status = InstitutionContractStatus.Free;
|
||||
listStatus = InstitutionContractListStatus.Free;
|
||||
}
|
||||
|
||||
if (contractingParty.IsBlock == "true")
|
||||
{
|
||||
status = InstitutionContractStatus.Block;
|
||||
listStatus = InstitutionContractListStatus.Block;
|
||||
}
|
||||
|
||||
return (status, isExpier);
|
||||
return (listStatus, isExpier);
|
||||
}
|
||||
|
||||
|
||||
public async Task<InstitutionContractWorkshopDetail> GetInstitutionWorkshopDetails(
|
||||
long institutionWorkshopDetailsId)
|
||||
{
|
||||
return await _context.InstitutionContractWorkshopDetails.FirstOrDefaultAsync(x =>
|
||||
x.id == institutionWorkshopDetailsId);
|
||||
}
|
||||
|
||||
public async Task<InstitutionContract> GetIncludeWorkshopDetailsAsync(long institutionContractId)
|
||||
{
|
||||
return await _context.InstitutionContractSet
|
||||
.Include(x => x.WorkshopDetails)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractId);
|
||||
}
|
||||
|
||||
public void UpdateStatusIfNeeded(long institutionContractId)
|
||||
{
|
||||
var institutionContract = _context.InstitutionContractSet
|
||||
.Include(x => x.WorkshopDetails)
|
||||
.FirstOrDefault(x => x.id == institutionContractId);
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
|
||||
if (institutionContract.Status == InstitutionContractStatus.Completed)
|
||||
return;
|
||||
if (institutionContract.WorkshopDetails.All(x => x.WorkshopCreated))
|
||||
institutionContract.Complete();
|
||||
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@@ -48,19 +49,5 @@ public class InstitutionContractTempRepository : RepositoryBase<long, Institutio
|
||||
}).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<List<RegistrationWorkflowMainList>> GetAllCompletedRegistration()
|
||||
{
|
||||
return await _context.InstitutionContractTemps.Where(x => x.RegistrationStatus == "Completed")
|
||||
.Join(_context.ContractingPartyTemps,
|
||||
institutionContract => institutionContract.ContractingPartyTempId,
|
||||
contractingParty => contractingParty.id,
|
||||
(institutionContract, contractingParty) => new { institutionContract, contractingParty }).Select(x =>
|
||||
new RegistrationWorkflowMainList
|
||||
{
|
||||
ContractingPartyTempId = x.contractingParty.id,
|
||||
ContractingPartyFullName = $"{x.contractingParty.FName} {x.contractingParty.LName}",
|
||||
Phone = x.contractingParty.Phone
|
||||
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
103
CompanyManagment.EFCore/Repository/LawRepository.cs
Normal file
103
CompanyManagment.EFCore/Repository/LawRepository.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.LawAgg;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class LawRepository:RepositoryBase<long,Law>,ILawRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
public LawRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Law> GetWithItems(long id)
|
||||
{
|
||||
return await _context.Laws.Include(x => x.Items).FirstOrDefaultAsync(x => x.id == id);
|
||||
}
|
||||
|
||||
public async Task<List<Law>> GetActive()
|
||||
{
|
||||
return await _context.Laws.Where(x => x.IsActive).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<LawViewModel> GetByType(LawType type)
|
||||
{
|
||||
return await _context.Laws.Where(x => x.Type == type && x.IsActive)
|
||||
.Select(x => new LawViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
Title = x.Title,
|
||||
IsActive = x.IsActive,
|
||||
CreatedAt = x.CreationDate,
|
||||
HeadTitle = x.HeadTitle,
|
||||
Notifications = x.Notifications,
|
||||
Type = x.Type,
|
||||
Items = x.Items.OrderBy(i => i.OrderNumber).Select(i => new LawItemViewModel
|
||||
{
|
||||
Header = i.Header,
|
||||
Details = i.Details,
|
||||
}).ToList()
|
||||
}).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<List<LawViewModel>> GetList(LawSearchModel searchModel)
|
||||
{
|
||||
var query = _context.Laws.Include(x => x.Items).AsQueryable();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Title))
|
||||
query = query.Where(x => x.Title.Contains(searchModel.Title));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.Text))
|
||||
query = query.Where(x => x.Items.Any(i => i.Header.Contains(searchModel.Text) || i.Details.Contains(searchModel.Text)));
|
||||
|
||||
var list = await query.Select(x => new LawViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
Title = x.Title,
|
||||
IsActive = x.IsActive,
|
||||
CreatedAt = x.CreationDate,
|
||||
Type = x.Type
|
||||
}).ToListAsync();
|
||||
|
||||
// Create a set of existing law types
|
||||
var existingTypes = list.Select(x => x.Type).ToHashSet();
|
||||
if (string.IsNullOrWhiteSpace(searchModel.Text) && string.IsNullOrWhiteSpace(searchModel.Title))
|
||||
{
|
||||
// Add placeholder laws for any missing enum values
|
||||
foreach (LawType lawType in Enum.GetValues(typeof(LawType)))
|
||||
{
|
||||
if (!existingTypes.Contains(lawType))
|
||||
{
|
||||
list.Add(new LawViewModel
|
||||
{
|
||||
Id = 0, // Indicates it doesn't exist in the database yet
|
||||
Title = GetDefaultTitleForLawType(lawType),
|
||||
IsActive = false,
|
||||
CreatedAt = DateTime.Now,
|
||||
Type = lawType,
|
||||
Items = new List<LawItemViewModel>()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
private string GetDefaultTitleForLawType(LawType lawType)
|
||||
{
|
||||
return lawType switch
|
||||
{
|
||||
LawType.Register => "قوانین ثبت نام",
|
||||
_ => $"قوانین {lawType}"
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
return query.OrderByDescending(x => x.id).ToList();
|
||||
}
|
||||
|
||||
public int GetLastArchiveCode()
|
||||
public int GetLastNewArchiveCode()
|
||||
{
|
||||
|
||||
var res = _context.PersonalContractingParties.Max(x => x.ArchiveCode);
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace CompanyManagment.EFCore.Repository;
|
||||
public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IPlanPercentageRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
|
||||
public PlanPercentageRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
@@ -40,7 +41,6 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
InsuranceInPersonPercentStr = $"{x.InsuranceInPersonPercent}",
|
||||
InsurancePercentStr = $"{x.InsurancePercent}",
|
||||
RollCallPercentStr = $"{x.RollCallPercent}",
|
||||
|
||||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
@@ -60,29 +60,33 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
|
||||
if (countPeron > 0)
|
||||
{
|
||||
var planByCountPerson = _context.InstitutionPlans.Where(x => x.CountPerson == countPeron).Select(plan => new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
var planByCountPerson = _context.InstitutionPlans.Where(x => x.CountPerson == countPeron).Select(plan =>
|
||||
new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckoutDouble =
|
||||
((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson * plan.IncreasePercentage),
|
||||
ContractAndCheckoutDouble =
|
||||
((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
InsuranceDouble = (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
InsuranceDouble = (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
RollCallDouble = (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
RollCallDouble = (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
CustomizeCheckoutDouble = (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
CustomizeCheckoutDouble = (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) *
|
||||
plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
ContractAndCheckoutInPersonDouble = (((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
ContractAndCheckoutInPersonDouble =
|
||||
(((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
InsuranceInPersonDouble = (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
|
||||
}).ToList();
|
||||
InsuranceInPersonDouble = (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) *
|
||||
plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
}).ToList();
|
||||
|
||||
planByCountPerson = planByCountPerson.Select(plan => new InstitutionPlanViewModel
|
||||
{
|
||||
@@ -90,7 +94,7 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
|
||||
ContractAndCheckout = plan.ContractAndCheckoutDouble.ToMoney(),
|
||||
|
||||
Insurance= plan.InsuranceDouble.ToMoney(),
|
||||
Insurance = plan.InsuranceDouble.ToMoney(),
|
||||
|
||||
RollCall = plan.RollCallDouble.ToMoney(),
|
||||
|
||||
@@ -100,17 +104,21 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
|
||||
InsuranceInPerson = plan.InsuranceInPersonDouble.ToMoney(),
|
||||
|
||||
InPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble).ToMoney(),
|
||||
|
||||
OnlineAndInPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
InPersonSumAmountStr =
|
||||
(plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble +
|
||||
plan.InsuranceInPersonDouble).ToMoney(),
|
||||
|
||||
OnlineOnlySumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
OnlineAndInPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble +
|
||||
plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble +
|
||||
plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
OnlineOnlySumAmountStr =
|
||||
(plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.RollCallDouble +
|
||||
plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
}).ToList();
|
||||
|
||||
return planByCountPerson;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var plans = _context.InstitutionPlans
|
||||
@@ -122,7 +130,8 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckoutDouble =
|
||||
((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson * plan.IncreasePercentage),
|
||||
((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
InsuranceDouble = (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
@@ -130,13 +139,16 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
RollCallDouble = (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
CustomizeCheckoutDouble = (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) * plan.CountPerson *
|
||||
CustomizeCheckoutDouble = (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) *
|
||||
plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
ContractAndCheckoutInPersonDouble = (((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
ContractAndCheckoutInPersonDouble =
|
||||
(((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
InsuranceInPersonDouble = (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) * plan.CountPerson *
|
||||
InsuranceInPersonDouble = (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) *
|
||||
plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
}).ToList();
|
||||
|
||||
@@ -156,17 +168,21 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
|
||||
InsuranceInPerson = plan.InsuranceInPersonDouble.ToMoney(),
|
||||
|
||||
InPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble).ToMoney(),
|
||||
InPersonSumAmountStr =
|
||||
(plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble +
|
||||
plan.InsuranceInPersonDouble).ToMoney(),
|
||||
|
||||
OnlineAndInPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
OnlineOnlySumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
OnlineAndInPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble +
|
||||
plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble +
|
||||
plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
OnlineOnlySumAmountStr =
|
||||
(plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.RollCallDouble +
|
||||
plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
}).ToList();
|
||||
|
||||
|
||||
return plans;
|
||||
|
||||
}
|
||||
|
||||
public InstitutionPlanViewModel GetInstitutionPlanForWorkshop(WorkshopTempViewModel command)
|
||||
@@ -182,10 +198,10 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
|
||||
var dailyWage = dailyWageYearlySalery.YearlySalaryItemsList.Where(x => x.ItemName == "مزد روزانه")
|
||||
.Select(x => x.ItemValue).FirstOrDefault();
|
||||
if (command.ContractAndCheckout)
|
||||
command.ContractAndCheckoutInPerson = true;
|
||||
if(command.Insurance)
|
||||
command.InsuranceInPerson = true;
|
||||
// if (command.ContractAndCheckout)
|
||||
// command.ContractAndCheckoutInPerson = true;
|
||||
// if (command.Insurance)
|
||||
// command.InsuranceInPerson = true;
|
||||
|
||||
if (command.CountPerson > 0)
|
||||
{
|
||||
@@ -195,24 +211,35 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckoutDouble = command.ContractAndCheckout ?
|
||||
((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson * plan.IncreasePercentage) : 0,
|
||||
ContractAndCheckoutDouble = command.ContractAndCheckout
|
||||
? ((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
: 0,
|
||||
|
||||
InsuranceDouble = command.Insurance ? (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage) : 0,
|
||||
InsuranceDouble = command.Insurance
|
||||
? (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
: 0,
|
||||
|
||||
RollCallDouble = command.RollCall ? (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage) : 0,
|
||||
RollCallDouble = command.RollCall
|
||||
? (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
: 0,
|
||||
|
||||
CustomizeCheckoutDouble =command.CustomizeCheckout ? (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage) : 0,
|
||||
CustomizeCheckoutDouble = command.CustomizeCheckout
|
||||
? (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
: 0,
|
||||
|
||||
ContractAndCheckoutInPersonDouble = command.ContractAndCheckoutInPerson ? (((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage) : 0,
|
||||
|
||||
InsuranceInPersonDouble = command.InsuranceInPerson ? (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage) : 0,
|
||||
ContractAndCheckoutInPersonDouble = command.ContractAndCheckoutInPerson
|
||||
? (((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
: 0,
|
||||
|
||||
InsuranceInPersonDouble = command.InsuranceInPerson
|
||||
? (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
: 0,
|
||||
}).FirstOrDefault();
|
||||
|
||||
if (planByCountPerson == null)
|
||||
@@ -225,43 +252,55 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
// مبلغ کل خدمات آنلاین و حضوری
|
||||
var onlineAndInPersonSumAmount = planByCountPerson.ContractAndCheckoutDouble +
|
||||
planByCountPerson.InsuranceDouble +
|
||||
planByCountPerson.ContractAndCheckoutInPersonDouble + planByCountPerson.InsuranceInPersonDouble +
|
||||
planByCountPerson.RollCallDouble + planByCountPerson.CustomizeCheckoutDouble;
|
||||
planByCountPerson.ContractAndCheckoutInPersonDouble +
|
||||
planByCountPerson.InsuranceInPersonDouble +
|
||||
planByCountPerson.RollCallDouble +
|
||||
planByCountPerson.CustomizeCheckoutDouble;
|
||||
|
||||
|
||||
//مبلغ کل خدمات آنلاین
|
||||
var onlineOnlySumAmount = planByCountPerson.ContractAndCheckoutDouble + planByCountPerson.InsuranceDouble + planByCountPerson.RollCallDouble +
|
||||
var onlineOnlySumAmount = planByCountPerson.ContractAndCheckoutDouble + planByCountPerson.InsuranceDouble +
|
||||
planByCountPerson.RollCallDouble +
|
||||
planByCountPerson.CustomizeCheckoutDouble;
|
||||
|
||||
onlineAndInPersonSumAmount = Math.Floor(onlineAndInPersonSumAmount);
|
||||
onlineAndInPersonSumAmount = Math.Floor(onlineAndInPersonSumAmount / 10000) * 10000;
|
||||
return new InstitutionPlanViewModel()
|
||||
{
|
||||
CountPerson = planByCountPerson.CountPerson,
|
||||
|
||||
ContractAndCheckout = planByCountPerson.ContractAndCheckoutDouble > 0 ? planByCountPerson.ContractAndCheckoutDouble.ToMoney() : "0",
|
||||
ContractAndCheckout = planByCountPerson.ContractAndCheckoutDouble > 0
|
||||
? planByCountPerson.ContractAndCheckoutDouble.ToMoney()
|
||||
: "0",
|
||||
|
||||
Insurance = planByCountPerson.InsuranceDouble > 0 ? planByCountPerson.InsuranceDouble.ToMoney() : "0",
|
||||
|
||||
RollCall = planByCountPerson.RollCallDouble > 0 ? planByCountPerson.RollCallDouble.ToMoney() : "0",
|
||||
|
||||
CustomizeCheckout = planByCountPerson.CustomizeCheckoutDouble > 0 ? planByCountPerson.CustomizeCheckoutDouble.ToMoney() : "0",
|
||||
CustomizeCheckout = planByCountPerson.CustomizeCheckoutDouble > 0
|
||||
? planByCountPerson.CustomizeCheckoutDouble.ToMoney()
|
||||
: "0",
|
||||
|
||||
ContractAndCheckoutInPerson = planByCountPerson.ContractAndCheckoutInPersonDouble > 0 ? planByCountPerson.ContractAndCheckoutInPersonDouble.ToMoney() : "0",
|
||||
ContractAndCheckoutInPerson = planByCountPerson.ContractAndCheckoutInPersonDouble > 0
|
||||
? planByCountPerson.ContractAndCheckoutInPersonDouble.ToMoney()
|
||||
: "0",
|
||||
|
||||
InsuranceInPerson = planByCountPerson.InsuranceInPersonDouble > 0 ? planByCountPerson.InsuranceInPersonDouble.ToMoney() : "0",
|
||||
InsuranceInPerson = planByCountPerson.InsuranceInPersonDouble > 0
|
||||
? planByCountPerson.InsuranceInPersonDouble.ToMoney()
|
||||
: "0",
|
||||
|
||||
InPersonSumAmountDouble = inPersonSumAmount,
|
||||
InPersonSumAmountStr = inPersonSumAmount > 0 ? inPersonSumAmount.ToMoney() : "0",
|
||||
|
||||
OnlineAndInPersonSumAmountDouble = onlineAndInPersonSumAmount,
|
||||
OnlineAndInPersonSumAmountStr = onlineAndInPersonSumAmount > 0 ? onlineAndInPersonSumAmount.ToMoney() : "0",
|
||||
OnlineAndInPersonSumAmountStr =
|
||||
onlineAndInPersonSumAmount > 0 ? onlineAndInPersonSumAmount.ToMoney() : "0",
|
||||
|
||||
OnlineOnlySumAmountDouble = onlineOnlySumAmount,
|
||||
OnlineOnlySumAmountStr = onlineOnlySumAmount > 0 ? onlineOnlySumAmount.ToMoney() : "0"
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return new InstitutionPlanViewModel();
|
||||
}
|
||||
}
|
||||
148
CompanyManagment.EFCore/Services/UidService.cs
Normal file
148
CompanyManagment.EFCore/Services/UidService.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using CompanyManagment.App.Contracts.AuthorizedPerson;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.UID;
|
||||
|
||||
namespace CompanyManagment.EFCore.Services;
|
||||
|
||||
public class UidService : IUidService
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly IAuthorizedPersonApplication _authorizedPersonApplication;
|
||||
private const string BaseUrl = "https://json-api.uid.ir/api/inquiry/";
|
||||
|
||||
public UidService(IAuthorizedPersonApplication authorizedPersonApplication)
|
||||
{
|
||||
_httpClient = new HttpClient()
|
||||
{
|
||||
BaseAddress = new Uri(BaseUrl)
|
||||
};
|
||||
_authorizedPersonApplication = authorizedPersonApplication;
|
||||
}
|
||||
|
||||
public async Task<PersonalInfoResponse> GetPersonalInfo(string nationalCode, string birthDate)
|
||||
{
|
||||
// First check if person exists in database
|
||||
var existingPerson = _authorizedPersonApplication.GetByNationalCode(nationalCode);
|
||||
if (existingPerson != null)
|
||||
{
|
||||
if (birthDate !=existingPerson.BirthDate )
|
||||
{
|
||||
return new PersonalInfoResponse(new UidBasicInformation(),
|
||||
new IdentificationInformation(default, default, default, default, default), new RegistrationStatus(),
|
||||
new ResponseContext(new UidStatus(13, "تاریخ تولد وارد با کد ملی تطابق ندارد")));
|
||||
}
|
||||
// Return data from database instead of calling API
|
||||
return CreatePersonalInfoResponseFromDatabase(existingPerson);
|
||||
}
|
||||
|
||||
// If not found in database, call UID API
|
||||
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();
|
||||
}
|
||||
|
||||
// ذخیره اطلاعات در جدول AuthorizedPerson
|
||||
await SaveAuthorizedPersonData(responseResult, nationalCode, birthDate);
|
||||
|
||||
return responseResult;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new PersonalInfoResponse(new UidBasicInformation(),
|
||||
new IdentificationInformation(default, default, default, default, default), new RegistrationStatus(),
|
||||
new ResponseContext(new UidStatus(14, "")));
|
||||
}
|
||||
}
|
||||
|
||||
private PersonalInfoResponse CreatePersonalInfoResponseFromDatabase(AuthorizedPersonViewModel person)
|
||||
{
|
||||
var basicInfo = new UidBasicInformation
|
||||
{
|
||||
FirstName = person.FirstName,
|
||||
LastName = person.LastName,
|
||||
FatherName = person.FatherName,
|
||||
Gender = person.Gender
|
||||
};
|
||||
|
||||
var identificationInfo = new IdentificationInformation(
|
||||
person.NationalCode,
|
||||
person.BirthDate,
|
||||
person.ShenasnameSeri,
|
||||
person.ShenasnameSerial,
|
||||
person.ShenasnamehNumber
|
||||
);
|
||||
|
||||
var registrationStatus = new RegistrationStatus
|
||||
{
|
||||
DeathStatus = person.DeathStatus
|
||||
};
|
||||
|
||||
var responseContext = new ResponseContext(new UidStatus(0, "Success - از دیتابیس"));
|
||||
|
||||
return new PersonalInfoResponse(basicInfo, identificationInfo, registrationStatus, responseContext);
|
||||
}
|
||||
|
||||
private async Task SaveAuthorizedPersonData(PersonalInfoResponse response, string nationalCode, string birthDate)
|
||||
{
|
||||
if (response?.BasicInformation == null || response.ResponseContext?.Status?.Code != 0)
|
||||
return;
|
||||
|
||||
var command = new CreateAuthorizedPerson
|
||||
{
|
||||
NationalCode = nationalCode,
|
||||
FirstName = response.BasicInformation.FirstName ?? "",
|
||||
LastName = response.BasicInformation.LastName ?? "",
|
||||
FatherName = response.BasicInformation.FatherName ?? "",
|
||||
BirthDate = birthDate,
|
||||
Gender = response.BasicInformation.Gender ?? "",
|
||||
DeathStatus = response.RegistrationStatus?.DeathStatus ?? "",
|
||||
ShenasnameSeri = response.IdentificationInformation?.ShenasnameSeri ?? "",
|
||||
ShenasnameSerial = response.IdentificationInformation?.ShenasnameSerial ?? "",
|
||||
ShenasnamehNumber = response.IdentificationInformation?.ShenasnamehNumber ?? ""
|
||||
};
|
||||
|
||||
_authorizedPersonApplication.CreateFromUidResponse(command);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,6 @@
|
||||
<s:Boolean x:Key="/Default/CodeEditing/SuppressNullableWarningFix/Enabled/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Aqaye/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Govermentlist/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=managment/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mcls/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pardakht/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Domain.BillAgg;
|
||||
using Company.Domain.Board;
|
||||
using Company.Domain.ChapterAgg;
|
||||
@@ -21,7 +22,6 @@ using Company.Domain.FileEmployerAgg;
|
||||
using Company.Domain.FileState;
|
||||
using Company.Domain.FileTiming;
|
||||
using Company.Domain.FileTitle;
|
||||
|
||||
using Company.Domain.HolidayAgg;
|
||||
using Company.Domain.HolidayItemAgg;
|
||||
using Company.Domain.JobAgg;
|
||||
@@ -216,6 +216,11 @@ using CompanyManagment.App.Contracts.AdminMonthlyOverview;
|
||||
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using CompanyManagment.App.Contracts.AuthorizedPerson;
|
||||
using Company.Domain.AuthorizedPersonAgg;
|
||||
using Company.Domain.LawAgg;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
|
||||
namespace PersonalContractingParty.Config;
|
||||
|
||||
@@ -300,6 +305,13 @@ public class PersonalBootstrapper
|
||||
services.AddTransient<IInstitutionContractApplication, InstitutionContractApplication>();
|
||||
services.AddTransient<IInstitutionContractRepository, InstitutionContractRepository>();
|
||||
|
||||
// AuthorizedPerson Services
|
||||
services.AddTransient<IAuthorizedPersonApplication, AuthorizedPersonApplication>();
|
||||
services.AddTransient<IAuthorizedPersonRepository, AuthorizedPersonRepository>();
|
||||
|
||||
// UID Service - moved to Infrastructure layer
|
||||
services.AddTransient<IUidService, CompanyManagment.EFCore.Services.UidService>();
|
||||
|
||||
services.AddTransient<IContactInfoApplication, InstitutionContractContactInfoApplication>();
|
||||
services.AddTransient<IContactInfoRepository, InstitutionContractContactInfoRepository>();
|
||||
|
||||
@@ -401,11 +413,13 @@ public class PersonalBootstrapper
|
||||
|
||||
services.AddTransient<IRollCallEmployeeStatusRepository, RollCallEmployeeStatusRepository>();
|
||||
services.AddTransient<IRollCallEmployeeStatusApplication, RollCallEmployeeStatusApplication>();
|
||||
|
||||
#region Mahan
|
||||
|
||||
services.AddTransient<ICustomizeWorkshopSettingsApplication, CustomizeWorkshopSettingsApplication>();
|
||||
services.AddTransient<ICustomizeWorkshopSettingsRepository, CustomizeWorkshopSettingsRepository>();
|
||||
services.AddTransient<ICustomizeWorkshopEmployeeSettingsRepository, CustomizeWorkshopEmployeeSettingsRepository>();
|
||||
services
|
||||
.AddTransient<ICustomizeWorkshopEmployeeSettingsRepository, CustomizeWorkshopEmployeeSettingsRepository>();
|
||||
services.AddTransient<ICustomizeWorkshopGroupSettingsRepository, CustomizeWorkshopGroupSettingsRepository>();
|
||||
|
||||
|
||||
@@ -453,14 +467,18 @@ public class PersonalBootstrapper
|
||||
services.AddTransient<IPaymentInstrumentApplication, PaymentInstrumentApplication>();
|
||||
services.AddTransient<IPaymentInstrumentGroupRepository, PaymentInstrumentGroupRepository>();
|
||||
|
||||
services.AddTransient<ILawApplication,LawApplication>();
|
||||
services.AddTransient<ILawRepository,LawRepository>();
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
|
||||
services.AddTransient<IEmployeeDocumentsApplication, EmployeeDocumentsApplication>();
|
||||
services.AddTransient<IEmployeeDocumentsRepository, EmployeeDocumentsRepository>();
|
||||
services.AddTransient<IEmployeeDocumentItemRepository, EmployeeDocumentItemRepository>();
|
||||
services.AddTransient<IEmployeeDocumentsAdminSelectionRepository, EmployeeDocumentsAdminSelectionRepository>();
|
||||
services.AddTransient<IEmployeeDocumentsAdminSelectionApplication, EmployeeDocumentsAdminSelectionApplication>();
|
||||
services
|
||||
.AddTransient<IEmployeeDocumentsAdminSelectionApplication, EmployeeDocumentsAdminSelectionApplication>();
|
||||
|
||||
services.AddTransient<ICustomizeCheckoutRepository, CustomizeCheckoutRepository>();
|
||||
services.AddTransient<ICustomizeCheckoutApplication, CustomizeCheckoutApplication>();
|
||||
@@ -475,6 +493,7 @@ public class PersonalBootstrapper
|
||||
|
||||
services.AddTransient<IEmployeeBankInformationRepository, EmployeeBankInformationRepository>();
|
||||
services.AddTransient<IEmployeeBankInformationApplication, EmployeeBankInformationApplication>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region TemporaryClientRegisteration
|
||||
@@ -488,16 +507,17 @@ public class PersonalBootstrapper
|
||||
services.AddTransient<IInstitutionContractTempRepository, InstitutionContractTempRepository>();
|
||||
|
||||
#endregion
|
||||
|
||||
services.AddTransient<IRollCallDomainService, RollCallDomainService>();
|
||||
|
||||
|
||||
|
||||
services.AddTransient<IPlanPercentageRepository, PlanPercentageRepository>();
|
||||
services.AddTransient<IInstitutionPlanApplication, InstitutionPlanApplication>();
|
||||
//=========End Of Main====================================
|
||||
//=========End Of Main====================================
|
||||
|
||||
//---File Project------------------------------------
|
||||
//---File Project------------------------------------
|
||||
|
||||
services.AddTransient<IBoardApplication, BoardApplication>();
|
||||
services.AddTransient<IBoardApplication, BoardApplication>();
|
||||
services.AddTransient<IBoardRepository, BoardRepository>();
|
||||
|
||||
services.AddTransient<IFileApplication, FileApplication>();
|
||||
|
||||
@@ -8,6 +8,7 @@ public class AccountController:AdminBaseController
|
||||
{
|
||||
private readonly IAccountApplication _accountApplication;
|
||||
|
||||
|
||||
public AccountController(IAccountApplication accountApplication)
|
||||
{
|
||||
_accountApplication = accountApplication;
|
||||
@@ -22,4 +23,28 @@ public class AccountController:AdminBaseController
|
||||
var res = await _accountApplication.GetAdminSelectList();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("admins-by-role")]
|
||||
public ActionResult<AdminAccountByRoleResponse> GetAdminAccountsByRole()
|
||||
{
|
||||
var adminAccounts = _accountApplication.GetAdminAccountsNew().Select(x=> new AccountSelectListViewModel()
|
||||
{
|
||||
Id = x.Id,
|
||||
Name = x.Fullname,
|
||||
RoleId = x.RoleId
|
||||
}).ToList();
|
||||
|
||||
var seniorContractAccountsList = adminAccounts.Where(x => x.RoleId == 3).ToList();
|
||||
var juniorContractAccountsList = adminAccounts.Where(x => x.RoleId == 5).ToList();
|
||||
var seniorInsuranceAccountList = adminAccounts.Where(x => x.RoleId == 7).ToList();
|
||||
var juniorInsuranceAccountsList = adminAccounts.Where(x => x.RoleId == 8).ToList();
|
||||
return new AdminAccountByRoleResponse(seniorContractAccountsList, juniorContractAccountsList,
|
||||
seniorInsuranceAccountList, juniorInsuranceAccountsList);
|
||||
}
|
||||
}
|
||||
|
||||
public record AdminAccountByRoleResponse(
|
||||
List<AccountSelectListViewModel> SeniorContractAccountsList,
|
||||
List<AccountSelectListViewModel> JuniorContractAccountsList,
|
||||
List<AccountSelectListViewModel> SeniorInsuranceAccountList,
|
||||
List<AccountSelectListViewModel> JuniorInsuranceAccountsList);
|
||||
73
ServiceHost/Areas/Admin/Controllers/LawController.cs
Normal file
73
ServiceHost/Areas/Admin/Controllers/LawController.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers;
|
||||
|
||||
public class LawController : AdminBaseController
|
||||
{
|
||||
private readonly ILawApplication _lawApplication;
|
||||
|
||||
public LawController(ILawApplication lawApplication)
|
||||
{
|
||||
_lawApplication = lawApplication;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// لیست قوانین بر اساس انواع تعریف شده در enum
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<List<LawViewModel>>> GetList(LawSearchModel searchModel)
|
||||
{
|
||||
return await _lawApplication.GetList(searchModel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// جزئیات قانون بر اساس نوع
|
||||
/// </summary>
|
||||
/// <param name="type">نوع قانون</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("by-type/{type}")]
|
||||
public async Task<ActionResult<LawViewModel>> GetLawByType(LawType type)
|
||||
{
|
||||
return await _lawApplication.GetLawByType(type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد یا ویرایش قانون بر اساس نوع
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("upsert")]
|
||||
public ActionResult<OperationResult> UpsertLaw([FromBody] EditLaw command)
|
||||
{
|
||||
var result = _lawApplication.UpsertLaw(command);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// فعالسازی قانون
|
||||
/// </summary>
|
||||
/// <param name="type">نوع قانون</param>
|
||||
/// <returns></returns>
|
||||
[HttpPatch("{type}/activate")]
|
||||
public ActionResult<OperationResult> Activate(LawType type)
|
||||
{
|
||||
var result = _lawApplication.ActivateByType(type);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// غیرفعالسازی قانون
|
||||
/// </summary>
|
||||
/// <param name="type">نوع قانون</param>
|
||||
/// <returns></returns>
|
||||
[HttpPatch("{type}/deactivate")]
|
||||
public ActionResult<OperationResult> Deactivate(LawType type)
|
||||
{
|
||||
var result = _lawApplication.DeactivateByType(type);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,23 @@
|
||||
using _0_Framework.Application;
|
||||
using AccountManagement.Application.Contracts.TicketAccessAccount;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
using ServiceHost.Controllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers;
|
||||
public record GetAdminProfileDetails(long Id, string Fullname, string Mobile, string RoleName, List<int> Permissions, long? PositionValue,UserType UserType);
|
||||
public record GetAdminProfileDetails(long Id, string Fullname, string Mobile, string RoleName,
|
||||
List<int> Permissions, long? PositionValue,UserType UserType,bool HasTicketAccess);
|
||||
|
||||
public class LoginController:AdminBaseController
|
||||
{
|
||||
|
||||
|
||||
private readonly IAuthHelper _authHelper;
|
||||
|
||||
public LoginController(IAuthHelper authHelper)
|
||||
private readonly ITicketAccessAccountApplication _ticketAccessAccount;
|
||||
public LoginController(IAuthHelper authHelper, ITicketAccessAccountApplication ticketAccessAccount)
|
||||
{
|
||||
_authHelper = authHelper;
|
||||
_ticketAccessAccount = ticketAccessAccount;
|
||||
}
|
||||
/// <summary>
|
||||
/// جزئیات پروفایل کاربر ادمین را برمی گرداند
|
||||
@@ -36,6 +39,8 @@ public class LoginController:AdminBaseController
|
||||
if (userTypeWithId.userType is not UserType.Admin)
|
||||
return Unauthorized();
|
||||
|
||||
var hasTicketAccess = _ticketAccessAccount.HasTicketAccess(data.Id);
|
||||
|
||||
var details = new GetAdminProfileDetails(
|
||||
data.Id,
|
||||
data.Fullname,
|
||||
@@ -43,7 +48,8 @@ public class LoginController:AdminBaseController
|
||||
data.RoleName,
|
||||
data.Permissions,
|
||||
data.PositionValue,
|
||||
userTypeWithId.userType
|
||||
userTypeWithId.userType,
|
||||
hasTicketAccess
|
||||
);
|
||||
return details;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user