diff --git a/Company.Domain/ContarctingPartyAgg/PersonalContractingParty.cs b/Company.Domain/ContarctingPartyAgg/PersonalContractingParty.cs index 9e0ba0f8..81058985 100644 --- a/Company.Domain/ContarctingPartyAgg/PersonalContractingParty.cs +++ b/Company.Domain/ContarctingPartyAgg/PersonalContractingParty.cs @@ -235,6 +235,20 @@ public class PersonalContractingParty : EntityBase this.IsAuthenticated = true; } + public void LegalAuthentication(string fName, string lName, string fatherName,string idNumber, string idNumberSeri, + string idNumberSerial, string dateOfBirth, Gender gender) + { + CeoFName = fName; + CeoLName = lName; + this.FatherName = fatherName; + this.IdNumberSeri = idNumberSeri; + this.IdNumberSerial = idNumberSerial; + this.DateOfBirth = !string.IsNullOrWhiteSpace(dateOfBirth) ? dateOfBirth.ToGeorgianDateTime() : null; + this.IdNumber = idNumber; + this.Gender = gender; + this.IsAuthenticated = true; + } + public void RegisterComplete(string fatherName, string idNumberSeri, string idNumberSerial, DateTime dateOfBirth, Gender gender) { this.FatherName = fatherName; diff --git a/CompanyManagment.Application/InstitutionContractApplication.cs b/CompanyManagment.Application/InstitutionContractApplication.cs index 75356991..470069f9 100644 --- a/CompanyManagment.Application/InstitutionContractApplication.cs +++ b/CompanyManagment.Application/InstitutionContractApplication.cs @@ -953,13 +953,12 @@ public class InstitutionContractApplication : IInstitutionContractApplication && x.IsActiveString == "true")) { throw new BadRequestException("امکان ایجاد قرارداد تکراری وجود ندارد"); - } + } } - } else if (command.ContractingPartyLegalType == LegalType.Real) { - existingContractingParty = + existingContractingParty = await _contractingPartyRepository.GetByNationalCode(command.RealParty.NationalCode); if (_contractingPartyRepository.Exists(x => x.LName == command.RealParty.LName && x.Nationalcode == command.RealParty.NationalCode)) @@ -997,7 +996,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication contractingParty = contractingPartyResult.Data; } - + var contractNo = $"{syear}{smonth}{sday}/{contractingParty.ArchiveCode}/0"; @@ -1042,7 +1041,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication FinancialStatment financialStatement; - if (_financialStatmentRepository.Exists(x=>x.ContractingPartyId == contractingParty.id)) + if (_financialStatmentRepository.Exists(x => x.ContractingPartyId == contractingParty.id)) { financialStatement = await _financialStatmentRepository.GetByContractingPartyId(contractingParty.id); } @@ -1145,6 +1144,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication { throw new NotImplementedException(); } + public async Task ExtensionAsync(CreateInstitutionContractRequest command) { throw new NotImplementedException(); @@ -1276,7 +1276,8 @@ public class InstitutionContractApplication : IInstitutionContractApplication return await _institutionContractRepository.GetExtenstionInquiry(previousContractId); } - public async Task GetExtenstionWorkshops(InstitutionContractExtensionWorkshopsRequest request) + public async Task GetExtenstionWorkshops( + InstitutionContractExtensionWorkshopsRequest request) { return await _institutionContractRepository.GetExtenstionWorkshops(request); } @@ -1315,8 +1316,14 @@ public class InstitutionContractApplication : IInstitutionContractApplication "*", "*", request.RegisterId, request.NationalId, "حقوقی", request.PhoneNumber, request.PhoneNumber, address, representativeId, representative.FullName, - archiveCode, state, city, null, null, request.FName, request.LName, request.Position); + archiveCode, state, city, null, null, + request.FName, request.LName, request.Position); + if (request.IsAuth) + { + legalContractingParty.LegalAuthentication(request.FName,request.LName,request.FatherName, + request.IdNumber,null,null,request.BirthDateFa,request.Gender); + } await _contractingPartyRepository.CreateAsync(legalContractingParty); await _contractingPartyRepository.SaveChangesAsync(); @@ -1357,6 +1364,11 @@ public class InstitutionContractApplication : IInstitutionContractApplication request.PhoneNumber, request.PhoneNumber, address, representativeId, representative.FullName, archiveCode, province, city, null, null, null, null); + if (request.IsAuth) + { + personalContractingParty.Authentication(request.FName, request.LName, request.FatherName, + request.IdNumber, null,null, request.BirthDateFa, request.Gender); + } await _contractingPartyRepository.CreateAsync(personalContractingParty); await _contractingPartyRepository.SaveChangesAsync();