diff --git a/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs b/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs index 54f0e897..993e8309 100644 --- a/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs +++ b/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs @@ -58,7 +58,11 @@ public interface IInstitutionContractRepository : IRepository GetByPublicIdAsync(Guid id); InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request,string contractStart = null); InstitutionContractDiscountResponse ResetDiscountCreate(InstitutionContractResetDiscountForCreateRequest request); + + #region Creation + + #endregion #region Extension @@ -160,4 +164,5 @@ public interface IInstitutionContractRepository : IRepository GetIdByInstallmentId(long installmentId); Task GetPreviousContract(long currentInstitutionContractId); + Task CreationInquiry(InstitutionContractCreationInquiryRequest request); } \ No newline at end of file diff --git a/Company.Domain/InstitutionContractCreationTempAgg/InstitutionContractCreationTemp.cs b/Company.Domain/InstitutionContractCreationTempAgg/InstitutionContractCreationTemp.cs new file mode 100644 index 00000000..9a34955e --- /dev/null +++ b/Company.Domain/InstitutionContractCreationTempAgg/InstitutionContractCreationTemp.cs @@ -0,0 +1,320 @@ +using System; +using System.Collections.Generic; +using _0_Framework.Application; +using _0_Framework.Application.Enums; +using CompanyManagment.App.Contracts.InstitutionContract; +using CompanyManagment.App.Contracts.InstitutionContractContactinfo; +using MongoDB.Bson; +using MongoDB.Bson.Serialization.Attributes; + +namespace Company.Domain.InstitutionContractCreationTempAgg; + +public class InstitutionContractCreationTemp +{ + public InstitutionContractCreationTemp() + { + Id = Guid.NewGuid(); + } + + [BsonId] // Specifies this field as the _id in MongoDB + [BsonRepresentation(BsonType.String)] // Ensures the GUID is stored as a string + public Guid Id { get; set; } + + /// + /// نوع حقوقی طرف قرارداد (حقیقی یا حقوقی) + /// + public LegalType ContractingPartyLegalType { get; set; } + + /// + /// اطلاعات شخص حقیقی + /// + public InstitutionContractCreationTempRealParty RealParty { get; set; } + + /// + /// اطلاعات شخص حقوقی + /// + public InstitutionContractCreationTempLegalParty LegalParty { get; set; } + + public string Address { get; set; } + public string City { get; set; } + public string Province { get; set; } + public List ContactInfos { get; set; } + + public List Workshops { get; set; } + + public InstitutionContractCreationPlanDetail OneMonth { get; set; } + public InstitutionContractCreationPlanDetail ThreeMonths { get; set; } + public InstitutionContractCreationPlanDetail SixMonths { get; set; } + public InstitutionContractCreationPlanDetail TwelveMonths { get; set; } + public InstitutionContractPaymentMonthlyViewModel MonthlyPayment { get; set; } + public InstitutionContractPaymentOneTimeViewModel OneTimePayment { get; set; } + + public bool HasContractInPerson { get; set; } + + public InstitutionContractDuration? Duration { get; set; } + + public void SetContractingPartyInfo(LegalType legalType, + InstitutionContractCreationTempRealParty realParty, + InstitutionContractCreationTempLegalParty legalParty) + { + ContractingPartyLegalType = legalType; + RealParty = realParty; + LegalParty = legalParty; + } + + public void SetWorkshopsAndPlanAmounts(List workshops, + InstitutionContractCreationPlanDetail oneMonth, + InstitutionContractCreationPlanDetail threeMonth, InstitutionContractCreationPlanDetail sixMonth, + InstitutionContractCreationPlanDetail twelveMonth, bool hasContractInPerson) + { + Workshops = workshops; + OneMonth = oneMonth; + ThreeMonths = threeMonth; + SixMonths = sixMonth; + TwelveMonths = twelveMonth; + HasContractInPerson = hasContractInPerson; + } + + public void SetAmountAndDuration(InstitutionContractDuration duration,InstitutionContractPaymentMonthlyViewModel monthly, + InstitutionContractPaymentOneTimeViewModel oneTime) + { + Duration = duration; + MonthlyPayment = monthly; + OneTimePayment = oneTime; + } + + +} + +public class InstitutionContractCreationTempLegalParty +{ + /// + /// نام شرکت + /// + public string CompanyName { get; set; } + + /// + /// شماره ثبت + /// + public string RegisterId { get; set; } + + /// + /// شناسه ملی شرکت + /// + public string NationalId { get; set; } + + /// + /// شماره تلفن شرکت + /// + public string PhoneNumber { get; set; } + + /// + /// شناسه موقت طرف قرارداد + /// + public long ContractingPartyTempId { get; set; } + + /// + /// کد ملی نماینده قانونی + /// + public string NationalCode { get; set; } + + /// + /// تاریخ تولد نماینده قانونی فارسی + /// + public string BirthDateFa { get; set; } + + /// + /// نام نماینده قانونی + /// + public string FName { get; set; } + + /// + /// نام خانوادگی نماینده قانونی + /// + public string LName { get; set; } + + /// + /// نام پدر نماینده قانونی + /// + public string FatherName { get; set; } + + /// + /// شماره شناسنامه نماینده قانونی + /// + public string IdNumber { get; set; } + + /// + /// وضعیت احراز هویت نماینده قانونی + /// + public bool IsAuth { get; set; } + + /// + /// سمت نماینده قانونی در شرکت + /// + public string Position { get; set; } + + /// + /// جنسیت نماینده قانونی + /// + public Gender Gender { get; set; } + + public string IdNumberSeri { get; set; } + + public string IdNumberSerial { get; set; } +} + +public class InstitutionContractCreationTempRealParty +{ + /// + /// کد ملی + /// + public string NationalCode { get; set; } + + /// + /// تاریخ تولد فارسی + /// + public string BirthDateFa { get; set; } + + /// + /// شماره تلفن + /// + public string PhoneNumber { get; set; } + + /// + /// وضعیت احراز هویت + /// + public bool IsAuth { get; set; } + + /// + /// نام + /// + public string FName { get; set; } + + /// + /// نام خانوادگی + /// + public string LName { get; set; } + + /// + /// نام پدر + /// + public string FatherName { get; set; } + + /// + /// شماره شناسنامه + /// + public string IdNumber { get; set; } + + /// + /// شناسه موقت طرف قرارداد + /// + public long ContractingPartyTempId { get; set; } + + /// + /// جنسیت + /// + public Gender Gender { get; set; } + + public string IdNumberSeri { get; set; } + + public string IdNumberSerial { get; set; } +} + +public class InstitutionContractCreationTempPlan +{ + public InstitutionContractCreationTempPlan(string contractStart, string contractEnd, + string oneMonthPaymentDiscounted, string oneMonthDiscount, string oneMonthOriginalPayment, + string totalPayment, string dailyCompensation, string obligation) + { + ContractStart = contractStart; + ContractEnd = contractEnd; + OneMonthPaymentDiscounted = oneMonthPaymentDiscounted; + OneMonthDiscount = oneMonthDiscount; + OneMonthOriginalPayment = oneMonthOriginalPayment; + TotalPayment = totalPayment; + DailyCompensation = dailyCompensation; + Obligation = obligation; + } + + public string ContractStart { get; set; } + public string ContractEnd { get; set; } + public string OneMonthPaymentDiscounted { get; set; } + public string OneMonthDiscount { get; set; } + public string OneMonthOriginalPayment { get; set; } + public string TotalPayment { get; set; } + public string DailyCompensation { get; set; } + public string Obligation { get; set; } +} + +public class InstitutionContractCreationTempWorkshop +{ + public InstitutionContractCreationTempWorkshop(string workshopName, int countPerson, bool contractAndCheckout, bool contractAndCheckoutInPerson, + bool insurance, bool insuranceInPerson, + bool rollCall,bool rollCallInPerson, bool customizeCheckout,double price,long workshopId) + { + WorkshopName = workshopName; + CountPerson = countPerson; + ContractAndCheckout = contractAndCheckout; + Insurance = insurance; + RollCall = rollCall; + CustomizeCheckout = customizeCheckout; + ContractAndCheckoutInPerson = contractAndCheckoutInPerson; + InsuranceInPerson = insuranceInPerson; + RollCallInPerson = rollCallInPerson; + Price = price; + WorkshopId = workshopId; + } + + public long WorkshopId { get; set; } + + /// + /// نام کارگاه + /// + public string WorkshopName { get; private set; } + + /// + /// تعداد پرسنل + /// + public int CountPerson { get; private set; } + + + #region ServiceSelection + + /// + /// قرارداد و تصفیه + /// + public bool ContractAndCheckout { get; private set; } + + /// + /// بیمه + /// + public bool Insurance { get; private set; } + + /// + /// حضورغباب + /// + public bool RollCall { get; private set; } + + public bool RollCallInPerson { get; set; } + + /// + /// فیش غیر رسمی + /// + public bool CustomizeCheckout { get;private set; } + + /// + /// خدمات حضوری قرداد و تصفیه + /// + public bool ContractAndCheckoutInPerson { get; private set; } + + /// + /// خدمات حضوری بیمه + /// + public bool InsuranceInPerson { get; private set; } + + public double Price{ get; set; } + + #endregion +} + + diff --git a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs index 424d71b0..d53b5d5c 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs @@ -216,6 +216,14 @@ public interface IInstitutionContractApplication Task GetWorkshopInitialDetails(long workshopDetailsId); InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request); InstitutionContractDiscountResponse ResetDiscountCreate(InstitutionContractResetDiscountForCreateRequest request); + + #region Creation + + + Task CreationInquiry(InstitutionContractCreationInquiryRequest request); + + + #endregion #region Extension diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractCreationInquiryRequest.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractCreationInquiryRequest.cs new file mode 100644 index 00000000..07948863 --- /dev/null +++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractCreationInquiryRequest.cs @@ -0,0 +1,11 @@ +using _0_Framework.Application.Enums; + +namespace CompanyManagment.App.Contracts.InstitutionContract; + +public class InstitutionContractCreationInquiryRequest +{ + public string NationalCode { get; set; } + public string DateOfBirth { get; set; } + public string Mobile { get; set; } + public LegalType LegalType { get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionInquiryResult.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionInquiryResult.cs index b11bcbf8..39cc238e 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionInquiryResult.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionInquiryResult.cs @@ -24,4 +24,21 @@ public class InstitutionContractExtensionInquiryResult public string Province { get; set; } public List ContactInfoViewModels { get; set; } public long RepresentativeId { get; set; } +} + +public class InstitutionContractCreationInquiryResult +{ + /// + /// اطلاعات شخص حقیقی + /// + public CreateInstitutionContractRealPartyRequest RealParty { get; set; } + + /// + /// اطلاعات شخص حقوقی + /// + public CreateInstitutionContractLegalPartyRequest LegalParty { get; set; } + + public LegalType LegalType { get; set; } + + public Guid TempId { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionPlanResponse.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionPlanResponse.cs index dcdff4ca..a38e001b 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionPlanResponse.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionPlanResponse.cs @@ -8,6 +8,25 @@ public class InstitutionContractExtensionPlanResponse public InstitutionContractExtensionPlanDetail TwelveMonths { get; set; } } public class InstitutionContractExtensionPlanDetail +{ + public string ContractStart { get; set; } + public string ContractEnd { get; set; } + public string OneMonthPaymentDiscounted { get; set; } + public string OneMonthDiscount { get; set; } + public string OneMonthOriginalPayment { get; set; } + public string TotalPayment { get; set; } + public string DailyCompenseation { get; set; } + public string Obligation { get; set; } +} + +public class InstitutionContractCreationPlanResponse +{ + public InstitutionContractCreationPlanDetail OneMonth { get; set; } + public InstitutionContractCreationPlanDetail ThreeMonths { get; set; } + public InstitutionContractCreationPlanDetail SixMonths { get; set; } + public InstitutionContractCreationPlanDetail TwelveMonths { get; set; } +} +public class InstitutionContractCreationPlanDetail { public string ContractStart { get; set; } public string ContractEnd { get; set; } diff --git a/CompanyManagment.Application/InstitutionContractApplication.cs b/CompanyManagment.Application/InstitutionContractApplication.cs index 82373502..580bdf1d 100644 --- a/CompanyManagment.Application/InstitutionContractApplication.cs +++ b/CompanyManagment.Application/InstitutionContractApplication.cs @@ -1444,6 +1444,13 @@ public class InstitutionContractApplication : IInstitutionContractApplication return _institutionContractRepository.ResetDiscountCreate(request); } + public Task CreationInquiry(InstitutionContractCreationInquiryRequest request) + { + return _institutionContractRepository.CreationInquiry(request); + } + + + public async Task GetExtensionInquiry(long previousContractId) { return await _institutionContractRepository.GetExtensionInquiry(previousContractId); diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs index f15189ca..c4b16059 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -35,6 +35,9 @@ using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; +using _0_Framework.Application.UID; +using Company.Domain.InstitutionContractCreationTempAgg; +using Company.Domain.TemporaryClientRegistrationAgg; using ContractingPartyAccount = Company.Domain.ContractingPartyAccountAgg.ContractingPartyAccount; using FinancialStatment = Company.Domain.FinancialStatmentAgg.FinancialStatment; using String = System.String; @@ -49,6 +52,7 @@ public class InstitutionContractRepository : RepositoryBase _institutionExtensionTemp; private readonly IMongoCollection _institutionAmendmentTemp; + private readonly IMongoCollection _institutionContractCreationTemp; private readonly IPlanPercentageRepository _planPercentageRepository; private readonly ISmsService _smsService; private readonly ISmsResultRepository _smsResultRepository; @@ -56,6 +60,8 @@ public class InstitutionContractRepository : RepositoryBase _hubContext; private readonly ILogger _logger; + private readonly IUidService _uidService; + private readonly InstitutionContratVerificationParty _firstParty = new() { @@ -67,11 +73,15 @@ public class InstitutionContractRepository : RepositoryBase hubContext, ILogger logger) : base(context) + IFinancialStatmentRepository financialStatmentRepository, IHubContext hubContext, + ILogger logger, IUidService uidService, IContractingPartyTempRepository contractingPartyTempRepository) : base(context) { _context = context; _employerRepository = employerRepository; @@ -83,78 +93,82 @@ public class InstitutionContractRepository : RepositoryBase("InstitutionContractExtensionTemp"); _institutionAmendmentTemp = database.GetCollection("InstitutionContractAmendmentTemp"); + _institutionContractCreationTemp = + database.GetCollection("InstitutionContractCreationTemp"); } public EditInstitutionContract GetDetails(long id) { return _context.InstitutionContractSet.Select(x => new EditInstitutionContract() - { - Id = x.id, - ContractNo = x.ContractNo, - ContractStartGr = x.ContractStartGr, - ContractStartFa = x.ContractStartFa, - ContractEndGr = x.ContractEndGr, - ContractEndFa = x.ContractEndFa, - RepresentativeName = x.RepresentativeName, - ContractingPartyName = x.ContractingPartyName, - RepresentativeId = x.RepresentativeId, - ContractingPartyId = x.ContractingPartyId, - ContractDateFa = x.ContractDateFa, - State = x.State, - City = x.City, - Address = x.Address, - Description = x.Description, - WorkshopManualCount = x.WorkshopManualCount, - EmployeeManualCount = x.EmployeeManualCount, - ContractAmountString = x.ContractAmount.ToMoney(), - ContractAmount = x.ContractAmount, - DailyCompenseationString = x.DailyCompenseation.ToMoney(), - ObligationString = x.Obligation.ToMoney(), - TotalAmountString = x.TotalAmount.ToMoney(), - ExtensionNo = x.ExtensionNo, - OfficialCompany = x.OfficialCompany, - TypeOfContract = x.TypeOfContract, - Signature = x.Signature, - HasValueAddedTax = x.HasValueAddedTax, - ValueAddedTax = x.ValueAddedTax, - }) + { + Id = x.id, + ContractNo = x.ContractNo, + ContractStartGr = x.ContractStartGr, + ContractStartFa = x.ContractStartFa, + ContractEndGr = x.ContractEndGr, + ContractEndFa = x.ContractEndFa, + RepresentativeName = x.RepresentativeName, + ContractingPartyName = x.ContractingPartyName, + RepresentativeId = x.RepresentativeId, + ContractingPartyId = x.ContractingPartyId, + ContractDateFa = x.ContractDateFa, + State = x.State, + City = x.City, + Address = x.Address, + Description = x.Description, + WorkshopManualCount = x.WorkshopManualCount, + EmployeeManualCount = x.EmployeeManualCount, + ContractAmountString = x.ContractAmount.ToMoney(), + ContractAmount = x.ContractAmount, + DailyCompenseationString = x.DailyCompenseation.ToMoney(), + ObligationString = x.Obligation.ToMoney(), + TotalAmountString = x.TotalAmount.ToMoney(), + ExtensionNo = x.ExtensionNo, + OfficialCompany = x.OfficialCompany, + TypeOfContract = x.TypeOfContract, + Signature = x.Signature, + HasValueAddedTax = x.HasValueAddedTax, + ValueAddedTax = x.ValueAddedTax, + }) .FirstOrDefault(x => x.Id == id); } public EditInstitutionContract GetFirstContract(long contractingPartyId, string typeOfContract) { return _context.InstitutionContractSet.Select(x => new EditInstitutionContract() - { - Id = x.id, - ContractNo = x.ContractNo, - ContractStartGr = x.ContractStartGr, - ContractStartFa = x.ContractStartFa, - ContractEndGr = x.ContractEndGr, - ContractEndFa = x.ContractEndFa, - RepresentativeName = x.RepresentativeName, - ContractingPartyName = x.ContractingPartyName, - RepresentativeId = x.RepresentativeId, - ContractingPartyId = x.ContractingPartyId, - ContractDateFa = x.ContractDateFa, - State = x.State, - City = x.City, - Address = x.Address, - Description = x.Description, - WorkshopManualCount = x.WorkshopManualCount, - EmployeeManualCount = x.EmployeeManualCount, - ContractAmountString = x.ContractAmount.ToMoney(), - DailyCompenseationString = x.DailyCompenseation.ToMoney(), - ObligationString = x.Obligation.ToMoney(), - TotalAmountString = x.TotalAmount.ToMoney(), - ExtensionNo = x.ExtensionNo, - OfficialCompany = x.OfficialCompany, - TypeOfContract = x.TypeOfContract, - Signature = x.Signature - }) + { + Id = x.id, + ContractNo = x.ContractNo, + ContractStartGr = x.ContractStartGr, + ContractStartFa = x.ContractStartFa, + ContractEndGr = x.ContractEndGr, + ContractEndFa = x.ContractEndFa, + RepresentativeName = x.RepresentativeName, + ContractingPartyName = x.ContractingPartyName, + RepresentativeId = x.RepresentativeId, + ContractingPartyId = x.ContractingPartyId, + ContractDateFa = x.ContractDateFa, + State = x.State, + City = x.City, + Address = x.Address, + Description = x.Description, + WorkshopManualCount = x.WorkshopManualCount, + EmployeeManualCount = x.EmployeeManualCount, + ContractAmountString = x.ContractAmount.ToMoney(), + DailyCompenseationString = x.DailyCompenseation.ToMoney(), + ObligationString = x.Obligation.ToMoney(), + TotalAmountString = x.TotalAmount.ToMoney(), + ExtensionNo = x.ExtensionNo, + OfficialCompany = x.OfficialCompany, + TypeOfContract = x.TypeOfContract, + Signature = x.Signature + }) .Where(x => x.ContractingPartyId == contractingPartyId && x.TypeOfContract == typeOfContract) .OrderBy(x => x.ExtensionNo).FirstOrDefault(); } @@ -572,40 +586,40 @@ public class InstitutionContractRepository : RepositoryBase new InstitutionContractViewModel() - { - Id = x.Id, - ContractNo = x.ContractNo, - ContractStartGr = x.ContractStartGr, - ContractStartFa = x.ContractStartFa, - ContractEndGr = x.ContractEndGr, - ContractEndFa = x.ContractEndFa, - RepresentativeId = x.RepresentativeId, - RepresentativeName = x.RepresentativeName, - ContractingPartyName = x.ContractingPartyName, - ContractingPartyId = x.ContractingPartyId, - ContractAmount = x.ContractAmount, - TotalAmount = x.TotalAmount, - SearchAmount = x.SearchAmount, - IsActiveString = x.IsActiveString, - OfficialCompany = x.OfficialCompany, - TypeOfContract = x.TypeOfContract, - Signature = x.Signature, - ExpireColor = x.ExpireColor, - IsExpier = x.IsExpier, - BalanceDouble = x.BalanceDouble, - BalanceStr = x.BalanceStr, - EmployerViewModels = x.EmployerViewModels, - EmployerNo = x.EmployerNo, - EmployerName = x.EmployerViewModels.Select(n => n.FullName).FirstOrDefault(), - WorkshopViewModels = x.WorkshopViewModels, - WorkshopCount = x.WorkshopCount, - IsContractingPartyBlock = x.IsContractingPartyBlock, - BlockTimes = x.BlockTimes, - EmployeeCount = + { + Id = x.Id, + ContractNo = x.ContractNo, + ContractStartGr = x.ContractStartGr, + ContractStartFa = x.ContractStartFa, + ContractEndGr = x.ContractEndGr, + ContractEndFa = x.ContractEndFa, + RepresentativeId = x.RepresentativeId, + RepresentativeName = x.RepresentativeName, + ContractingPartyName = x.ContractingPartyName, + ContractingPartyId = x.ContractingPartyId, + ContractAmount = x.ContractAmount, + TotalAmount = x.TotalAmount, + SearchAmount = x.SearchAmount, + IsActiveString = x.IsActiveString, + OfficialCompany = x.OfficialCompany, + TypeOfContract = x.TypeOfContract, + Signature = x.Signature, + ExpireColor = x.ExpireColor, + IsExpier = x.IsExpier, + BalanceDouble = x.BalanceDouble, + BalanceStr = x.BalanceStr, + EmployerViewModels = x.EmployerViewModels, + EmployerNo = x.EmployerNo, + EmployerName = x.EmployerViewModels.Select(n => n.FullName).FirstOrDefault(), + WorkshopViewModels = x.WorkshopViewModels, + WorkshopCount = x.WorkshopCount, + IsContractingPartyBlock = x.IsContractingPartyBlock, + BlockTimes = x.BlockTimes, + EmployeeCount = ((x.WorkshopViewModels.Sum(w => w.LeftWorkIds.Count)) + (x.WorkshopViewModels.Sum(w => w.InsuranceLeftWorkIds.Count(c => !w.LeftWorkIds.Contains(c))))).ToString(), - ArchiveCode = x.WorkshopViewModels.Count > 0 ? ArchiveCodeFinder(x.WorkshopViewModels) : 0, - }).OrderBy(x => x.WorkshopCount != "0" && string.IsNullOrWhiteSpace(x.ExpireColor)) + ArchiveCode = x.WorkshopViewModels.Count > 0 ? ArchiveCodeFinder(x.WorkshopViewModels) : 0, + }).OrderBy(x => x.WorkshopCount != "0" && string.IsNullOrWhiteSpace(x.ExpireColor)) .ThenBy(x => x.WorkshopCount == "0" && string.IsNullOrWhiteSpace(x.ExpireColor)) .ThenBy(x => x.IsExpier == "true") .ThenBy(x => x.ExpireColor == "purple") @@ -666,7 +680,6 @@ public class InstitutionContractRepository : RepositoryBase x.ContractingPartyId == institutionContarct.ContractingPartyId); if (financialStatement != null) { - var sumDebtor = financialStatement.FinancialTransactionList .Sum(x => x.Deptor); var sumCreditor = financialStatement.FinancialTransactionList @@ -1114,9 +1127,9 @@ public class InstitutionContractRepository : RepositoryBase g.Key, // g => g.Max(x => x.ExtensionNo) // ); - + var rawQuery = _context.InstitutionContractSet - .Include(x=>x.Installments) + .Include(x => x.Installments) .AsNoTracking() .Join(_context.PersonalContractingParties .AsNoTracking() @@ -1131,33 +1144,33 @@ public class InstitutionContractRepository : RepositoryBase c.IsActiveString == "true" && // c.ContractEndGr >= now && // c.ContractEndGr <= endThisMontGr); - - var joinedQuery = rawQuery.Select(x => new - { - x.contract, - x.contractingParty, - StatusPriority = - x.contract.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify - ? (int)InstitutionContractListStatus.PendingForVerify - : x.contract.IsActiveString == "blue" - ? (int)InstitutionContractListStatus.DeactiveWithDebt - : x.contract.ContractEndGr < now - ? (int)InstitutionContractListStatus.Deactive - : (x.contract.ContractEndGr >= now && x.contract.ContractEndGr <= endThisMontGr && - !_context.InstitutionContractSet.Any(i => - i.ContractingPartyId == x.contract.ContractingPartyId && - x.contract.ExtensionNo + 1 <= i.ExtensionNo && i.IsActiveString == "true")) - ? (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 - }); + + var joinedQuery = rawQuery.Select(x => new + { + x.contract, + x.contractingParty, + StatusPriority = + x.contract.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify + ? (int)InstitutionContractListStatus.PendingForVerify + : x.contract.IsActiveString == "blue" + ? (int)InstitutionContractListStatus.DeactiveWithDebt + : x.contract.ContractEndGr < now + ? (int)InstitutionContractListStatus.Deactive + : (x.contract.ContractEndGr >= now && x.contract.ContractEndGr <= endThisMontGr && + !_context.InstitutionContractSet.Any(i => + i.ContractingPartyId == x.contract.ContractingPartyId && + x.contract.ExtensionNo + 1 <= i.ExtensionNo && i.IsActiveString == "true")) + ? (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 @@ -1322,7 +1335,7 @@ public class InstitutionContractRepository : RepositoryBasex.InitialWorkshops ) + .Include(x => x.InitialWorkshops) .Include(x => x.CurrentWorkshops) .Where(x => contractIds.Contains(x.InstitutionContractId)) .ToDictionaryAsync(x => x.InstitutionContractId, x => x); @@ -1349,10 +1362,10 @@ public class InstitutionContractRepository : RepositoryBase(x.StatusPriority.ToString()); - + // دریافت WorkshopGroup از dictionary بارگذاری شده workshopGroups.TryGetValue(x.contract.id, out var workshopGroup); - + List currentStateWorkshops = workshopGroup?.CurrentWorkshops .Cast().ToList(); @@ -1394,21 +1407,25 @@ public class InstitutionContractRepository : RepositoryBase x.InitialWorkshops) .Include(x => x.WorkshopGroup) .ThenInclude(x => x.CurrentWorkshops) - .Include(x=>x.Installments) + .Include(x => x.Installments) .FirstOrDefaultAsync(x => x.id == institutionContractId); } @@ -1949,7 +1966,8 @@ public class InstitutionContractRepository : RepositoryBase x.PublicId == id); } - public InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request,string contractStart=null) + public InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request, + string contractStart = null) { var baseAmount = request.TotalAmount; var discountAmount = (baseAmount * request.DiscountPercentage) / 100; @@ -2208,10 +2226,12 @@ public class InstitutionContractRepository : RepositoryBase x.WorkshopGroup) .ThenInclude(institutionContractWorkshopGroup => institutionContractWorkshopGroup.CurrentWorkshops) .FirstOrDefaultAsync(x => x.id == extenstionTemp.PreviousId); - - var employerWorkshopIds = _context.Employers.Where(x=>x.ContractingPartyId == prevInstitutionContracts.ContractingPartyId).Include(x=>x.WorkshopEmployers) - .SelectMany(x=>x.WorkshopEmployers).Select(x=>x.WorkshopId).Distinct().ToList(); - + + var employerWorkshopIds = _context.Employers + .Where(x => x.ContractingPartyId == prevInstitutionContracts.ContractingPartyId) + .Include(x => x.WorkshopEmployers) + .SelectMany(x => x.WorkshopEmployers).Select(x => x.WorkshopId).Distinct().ToList(); + if (prevInstitutionContracts == null) { throw new BadRequestException("قرارداد مالی قبلی یافت نشد"); @@ -2224,12 +2244,13 @@ public class InstitutionContractRepository : RepositoryBase x.WorkshopId.Value); - - var workshopsNotInInstitution = employerWorkshopIds.Where(x=> !workshopIds.Contains(x)).ToList(); - - var workshops = await _context.Workshops.Where(x => workshopIds.Contains(x.id) || employerWorkshopIds.Contains(x.id)) + + var workshopsNotInInstitution = employerWorkshopIds.Where(x => !workshopIds.Contains(x)).ToList(); + + var workshops = await _context.Workshops + .Where(x => workshopIds.Contains(x.id) || employerWorkshopIds.Contains(x.id)) .ToListAsync(); - + var workshopDetails = prevInstitutionContracts.WorkshopGroup.CurrentWorkshops .Select(x => { @@ -2271,14 +2292,14 @@ public class InstitutionContractRepository : RepositoryBase workshopsNotInInstitution.Contains(x.WorkshopId) && x.StartWorkDate <= DateTime.Now && x.LeftWorkDate >= DateTime.Now) .GroupBy(x => x.WorkshopId).ToListAsync(); - var notIncludeWorskhopsInContract = workshopsNotInInstitution.Select(x => + var notIncludeWorskhopsInContract = workshopsNotInInstitution.Select(x => { var workshop = workshops.FirstOrDefault(w => w.id == x); - var leftWorks = notIncludeWorskhopsLeftWork.FirstOrDefault(l=>l.Key ==x); + var leftWorks = notIncludeWorskhopsLeftWork.FirstOrDefault(l => l.Key == x); return new WorkshopTempViewModel() { WorkshopName = workshop?.WorkshopName ?? "فاقد کارگاه", @@ -2289,7 +2310,7 @@ public class InstitutionContractRepository : RepositoryBase=100) + if (request.DiscountPercentage >= 100) { throw new BadRequestException("مقدار تخفیف نمی‌تواند برابر یا بیشتر از صد باشد"); } + var institutionTemp = await _institutionExtensionTemp.Find(x => x.Id == request.TempId) .FirstOrDefaultAsync(); if (institutionTemp == null) @@ -2432,7 +2454,7 @@ public class InstitutionContractRepository : RepositoryBase 0) throw new BadRequestException("تخفیف قبلا برای این قرارداد اعمال شده است"); } - + var selectedPlan = institutionTemp.Duration switch { InstitutionContractDuration.OneMonth => institutionTemp.OneMonth, @@ -2449,18 +2471,18 @@ public class InstitutionContractRepository : RepositoryBase(); var institutionContracts = await _context.InstitutionContractSet.Select(x => new InstitutionContractViewModel - { - Id = x.id, - ContractingPartyId = x.ContractingPartyId, - ContractingPartyName = x.ContractingPartyName, - ContractStartGr = x.ContractStartGr, - ContractStartFa = x.ContractStartFa, - ContractEndGr = x.ContractEndGr, - ContractEndFa = x.ContractEndFa, - IsActiveString = x.IsActiveString, - ContractAmountDouble = x.ContractAmount, - OfficialCompany = x.OfficialCompany - }).Where(x => x.ContractStartGr < checkDate && x.ContractEndGr >= checkDate && - x.ContractAmountDouble > 0).GroupBy(x => x.ContractingPartyId).Select(x => x.First()) + { + Id = x.id, + ContractingPartyId = x.ContractingPartyId, + ContractingPartyName = x.ContractingPartyName, + ContractStartGr = x.ContractStartGr, + ContractStartFa = x.ContractStartFa, + ContractEndGr = x.ContractEndGr, + ContractEndFa = x.ContractEndFa, + IsActiveString = x.IsActiveString, + ContractAmountDouble = x.ContractAmount, + OfficialCompany = x.OfficialCompany + }).Where(x => x.ContractStartGr < checkDate && x.ContractEndGr >= checkDate && + x.ContractAmountDouble > 0).GroupBy(x => x.ContractingPartyId).Select(x => x.First()) .ToListAsync(); @@ -4361,8 +4383,6 @@ public class InstitutionContractRepository : RepositoryBase @@ -4408,6 +4428,7 @@ public class InstitutionContractRepository : RepositoryBase /// ارسال پیامک یادآور تایید قراداد مالی /// @@ -4454,18 +4475,23 @@ public class InstitutionContractRepository : RepositoryBase x.CreationDate >= fromAmonthAgo && x.CreationDate.Date != now.Date && x.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify) + .Where(x => x.CreationDate >= fromAmonthAgo && x.CreationDate.Date != now.Date && + x.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify) .Join(_context.PersonalContractingParties, - contract => contract.ContractingPartyId, + contract => contract.ContractingPartyId, contractingParty => contractingParty.id, - (contract, contractingParty) => new { contract, contractingParty }).Select(x => new InstitutionCreationVerificationSmsDto + (contract, contractingParty) => new { contract, contractingParty }).Select(x => + new InstitutionCreationVerificationSmsDto { Number = x.contractingParty.Phone, - FullName = x.contractingParty.IsLegal == "حقیقی" ? $"{x.contractingParty.FName} {x.contractingParty.LName}" : $"{x.contractingParty.LName}", + FullName = x.contractingParty.IsLegal == "حقیقی" + ? $"{x.contractingParty.FName} {x.contractingParty.LName}" + : $"{x.contractingParty.LName}", ContractingPartyId = x.contract.ContractingPartyId, InstitutionContractId = x.contract.id, InstitutionId = x.contract.PublicId, @@ -4474,20 +4500,15 @@ public class InstitutionContractRepository : RepositoryBase new InstitutionContractInstallmentViewModel - { AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr }) + { AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr }) .OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(), }).Where(x => - x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify) + x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0 && + x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify) .ToListAsync(); #endregion @@ -4553,13 +4575,14 @@ public class InstitutionContractRepository : RepositoryBase futureContractIds = futureContracts.Select(x => x.ContractingPartyId).ToList(); List deatcivedContract = await _context.InstitutionContractSet .Where(x => x.IsActiveString == "false" && futureContractIds.Contains(x.ContractingPartyId) && - x.ContractEndGr.Date == endOfCurrentMonth.Date && x.ContractAmount > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify) + x.ContractEndGr.Date == endOfCurrentMonth.Date && x.ContractAmount > 0 && + x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify) .Select(x => new InstitutionContractViewModel { Id = x.id, @@ -4577,7 +4600,7 @@ public class InstitutionContractRepository : RepositoryBase new InstitutionContractInstallmentViewModel - { AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr }) + { AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr }) .OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(), }).ToListAsync(); @@ -4587,7 +4610,9 @@ public class InstitutionContractRepository : RepositoryBase - x.SigningType != InstitutionContractSigningType.Legacy && x.IsInstallment == false && x.SigningType != null).ToList(); + x.SigningType != InstitutionContractSigningType.Legacy && x.IsInstallment == false && + x.SigningType != null) + .ToList(); //حذف قراداد هایی که یکجا پرداخت شده اند از لیست ایجاد سند ماهانه institutionContracts = institutionContracts.Except(paidInFull).ToList(); @@ -4699,10 +4724,12 @@ public class InstitutionContractRepository : RepositoryBase GetPreviousContract(long currentInstitutionContractId) { - var institutionContract =await _context.InstitutionContractSet - .FirstOrDefaultAsync(x=>x.id ==currentInstitutionContractId); + var institutionContract = await _context.InstitutionContractSet + .FirstOrDefaultAsync(x => x.id == currentInstitutionContractId); if (institutionContract == null) return null; var previousContract = await _context.InstitutionContractSet @@ -4898,6 +4925,266 @@ public class InstitutionContractRepository : RepositoryBase CreationInquiry( + InstitutionContractCreationInquiryRequest request) + { + var op = new OperationResult(); + + var result = new InstitutionContractCreationInquiryResult(); + + var contractTemp = new InstitutionContractCreationTemp(); + + result.TempId = contractTemp.Id; + + + string idNumberSeri; + string idNumberSerial; + + var dateOfBirth = request.DateOfBirth.Trim(); + var nationalCode = request.NationalCode.Trim(); + var mobile = request.Mobile.Trim(); + + #region Validations + + if (string.IsNullOrWhiteSpace(request.NationalCode) || string.IsNullOrWhiteSpace(request.DateOfBirth) || + string.IsNullOrWhiteSpace(request.Mobile)) + + throw new BadRequestException("هیچ یک از فیلد ها نمیتواند خالی باشد"); + + + if (request.NationalCode.NationalCodeValid() != "valid") + throw new BadRequestException("کد ملی نا معتبر است"); + + if (!request.DateOfBirth.IsPersianDateValid()) + throw new BadRequestException("تاریخ تولد نا معتبر است"); + + if (!request.Mobile.IsMobileValid()) + throw new BadRequestException("شماره همراه نا معتبر است"); + + #endregion + + var dateOfBirthGr = dateOfBirth.ToGeorgianDateTime(); + + var contractingParty = + await _context.PersonalContractingParties.FirstOrDefaultAsync(x => x.Nationalcode == nationalCode); + + if (contractingParty != null) + { + + if (contractingParty.DateOfBirth != null && contractingParty.DateOfBirth != dateOfBirthGr) + throw new BadRequestException("تاریخ تولد مطابقت ندارد"); + + + var idNumberParty = contractingParty.IdNumber; + if (!contractingParty.IsAuthenticated) + { + //دریافت اطلاعات احراز هویت + var apiResponseParty = await _uidService + .GetPersonalInfo(nationalCode, dateOfBirth); + + if (apiResponseParty == null) + throw new InternalServerException("خطا در سرویس احراز هویت"); + + if (apiResponseParty.ResponseContext.Status.Code is 14 or 3) + throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد"); + + if (apiResponseParty.ResponseContext.Status.Code != 0) + throw new BadRequestException($"{apiResponseParty.ResponseContext.Status.Message}"); + + idNumberParty = apiResponseParty.IdentificationInformation.ShenasnamehNumber == "0" + ? apiResponseParty.IdentificationInformation.NationalId + : apiResponseParty.IdentificationInformation.ShenasnamehNumber; + + //چک کردن مطابقت شماره همراه و کد ملی + var isMachMobilAndNationalCode = await _uidService + .IsMachPhoneWithNationalCode(nationalCode, mobile); + + if (isMachMobilAndNationalCode == null) + throw new InternalServerException("خطا در سرویس تطابق کد ملی و شماره همراه"); + + if (!isMachMobilAndNationalCode.IsMatched) + throw new BadRequestException("شماره همراه وارد شده با کد ملی مطابقت ندارد"); + + contractingParty.Authentication(apiResponseParty.BasicInformation.FirstName, + apiResponseParty.BasicInformation.LastName, + apiResponseParty.BasicInformation.FatherName, idNumberParty, + apiResponseParty.IdentificationInformation.ShenasnameSeri, + apiResponseParty.IdentificationInformation.ShenasnameSerial, dateOfBirth, + apiResponseParty.BasicInformation.GenderEnum, + mobile); + idNumberSeri = apiResponseParty.IdentificationInformation.ShenasnameSeri; + idNumberSerial = apiResponseParty.IdentificationInformation.ShenasnameSerial; + + await _context.SaveChangesAsync(); + } + + if (contractingParty.Phone != mobile) + throw new BadRequestException("شما قبلا با شماره همراه دیگری احراز هویت شده اید"); + + if (contractingParty.IsLegal == "حقیقی") + { + var realParty = new CreateInstitutionContractRealPartyRequest + { + FName = contractingParty.FName, + LName = contractingParty.LName, + NationalCode = contractingParty.Nationalcode, + IdNumber = contractingParty.IdNumber, + FatherName = contractingParty.FatherName, + Gender = contractingParty.Gender, + PhoneNumber = contractingParty.Phone, + IsAuth = true, + }; + result.RealParty = realParty; + result.LegalParty = null; + result.LegalType = LegalType.Real; + } + else + { + var legalParty = new CreateInstitutionContractLegalPartyRequest + { + CompanyName = contractingParty.LName, + NationalCode = contractingParty.Nationalcode, + IdNumber = contractingParty.IdNumber, + RegisterId = contractingParty.RegisterId, + FName = contractingParty.CeoFName, + LName = contractingParty.CeoLName, + FatherName = contractingParty.FatherName, + Gender = contractingParty.Gender, + PhoneNumber = contractingParty.Phone, + BirthDateFa = contractingParty.DateOfBirth.ToFarsi(), + NationalId = contractingParty.NationalId, + Position = contractingParty.LegalPosition, + IsAuth = true, + }; + result.LegalParty = legalParty; + result.RealParty = null; + result.LegalType = LegalType.Legal; + } + idNumberSeri = contractingParty.IdNumberSeri; + idNumberSerial = contractingParty.IdNumberSerial; + + } + else + { + //چک کردن مطابقت شماره همراه و کد ملی + var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile); + + if (isMachMobilAndNationalCode == null) + throw new BadRequestException("خطا در سرویس احراز هویت"); + + if (!isMachMobilAndNationalCode.IsMatched) + throw new BadRequestException("شماره همراه وارد شده با کد ملی مطابقت ندارد"); + + //دریافت اطلاعات احراز هویت + var apiRespons = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth); + + if (apiRespons == null) + throw new InternalServerException("خطا در سرویس احراز هویت"); + + if (apiRespons.ResponseContext.Status.Code is 14 or 3) + throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد"); + + if (apiRespons.ResponseContext.Status.Code == 2) + { + throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد"); + } + + if (apiRespons.ResponseContext.Status.Code != 0) + throw new BadRequestException($"{apiRespons.ResponseContext.Status.Message}"); + + var idNumber = apiRespons.IdentificationInformation.ShenasnamehNumber == "0" + ? apiRespons.IdentificationInformation.NationalId + : apiRespons.IdentificationInformation.ShenasnamehNumber; + + if (request.LegalType == LegalType.Real) + { + result.RealParty = new CreateInstitutionContractRealPartyRequest() + { + FName = apiRespons.BasicInformation.FirstName, + LName = apiRespons.BasicInformation.LastName, + NationalCode = nationalCode, + IdNumber = idNumber, + FatherName = apiRespons.BasicInformation.FatherName, + Gender = apiRespons.BasicInformation.GenderEnum, + PhoneNumber = mobile, + IsAuth = true, + BirthDateFa = apiRespons.IdentificationInformation.BirthDate, + }; + result.LegalParty = null; + } + else + { + result.LegalParty = new CreateInstitutionContractLegalPartyRequest() + { + FName = apiRespons.BasicInformation.FirstName, + LName = apiRespons.BasicInformation.LastName, + NationalCode = nationalCode, + IdNumber = idNumber, + FatherName = apiRespons.BasicInformation.FatherName, + Gender = apiRespons.BasicInformation.GenderEnum, + BirthDateFa = apiRespons.IdentificationInformation.BirthDate, + IsAuth = true, + PhoneNumber = request.Mobile, + + }; + result.RealParty = null; + } + idNumberSeri = apiRespons.IdentificationInformation.ShenasnameSeri; + idNumberSerial = apiRespons.IdentificationInformation.ShenasnameSerial; + } + + InstitutionContractCreationTempRealParty tempRealParty = null; + InstitutionContractCreationTempLegalParty tempLegalParty = null; + if (result.RealParty != null) + { + var realParty = result.RealParty; + tempRealParty = new() + { + BirthDateFa = realParty.BirthDateFa, + FatherName = realParty.FatherName, + FName = realParty.FName, + Gender = realParty.Gender, + IdNumber = realParty.IdNumber, + NationalCode = realParty.NationalCode, + IsAuth = realParty.IsAuth, + LName = realParty.LName, + PhoneNumber = realParty.PhoneNumber, + IdNumberSerial = idNumberSerial, + IdNumberSeri = idNumberSeri, + + }; + } + + if (result.LegalParty !=null) + { + var legalParty = result.LegalParty; + tempLegalParty = new() + { + BirthDateFa = legalParty.BirthDateFa, + FatherName = legalParty.FatherName, + FName = legalParty.FName, + IdNumberSerial = idNumberSerial, + IdNumberSeri = idNumberSeri, + Gender = legalParty.Gender, + IdNumber = legalParty.IdNumber, + LName = legalParty.LName, + NationalCode = legalParty.NationalCode, + CompanyName = legalParty.CompanyName, + RegisterId = legalParty.RegisterId, + NationalId = legalParty.NationalId, + PhoneNumber = legalParty.PhoneNumber, + Position = legalParty.Position, + IsAuth = legalParty.IsAuth, + }; + } + + + contractTemp.SetContractingPartyInfo(result.LegalType,tempRealParty, tempLegalParty); + await _institutionContractCreationTemp.InsertOneAsync(contractTemp); + + return result; + } + #endregion diff --git a/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs b/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs index f77e0964..0548a2b4 100644 --- a/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs +++ b/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs @@ -349,7 +349,7 @@ public class institutionContractController : AdminBaseController [HttpPost("create/inquiry")] public async Task>> CreateInquiry( - [FromBody] CreateInquiryRequest request) + [FromBody] InstitutionContractCreationInquiryRequest request) { var res = await _temporaryClientRegistration.CreateContractingPartyTemp(request.NationalCode, request.DateOfBirth, @@ -529,10 +529,10 @@ public class institutionContractController : AdminBaseController } #region Create - [HttpGet("creation/inquiry/{previousContractId}")] - public async Task> ExtensionInquiry(long previousContractId) + [HttpPost("creation/inquiry/")] + public async Task> CreationInquiry(InstitutionContractCreationInquiryRequest request) { - var res= await _institutionContractApplication.GetExtensionInquiry(previousContractId); + var res= await _institutionContractApplication.CreationInquiry(request); return res; } @@ -936,12 +936,6 @@ public class WorkshopServiceCalculatorResponse public record InstitutionPlanCalculatorRequest(double TotalAmountMonth,bool HasInPersonContract, InstitutionContractDuration Duration = InstitutionContractDuration.TwelveMonths); -public class CreateInquiryRequest -{ - public string NationalCode { get; set; } - public string DateOfBirth { get; set; } - public string Mobile { get; set; } -} public class VerifyCodeRequest {