Compare commits

...

18 Commits

Author SHA1 Message Date
87d47fa0d9 feat: remove temporary institution amendment record after saving changes 2025-11-06 12:53:00 +03:30
c7d4481a6d Merge branch 'master' into Feature/InstitutionContract/upgrade
# Conflicts:
#	0_Framework/Application/Sms/ISmsService.cs
#	CompanyManagment.EFCore/Services/SmsService.cs
2025-11-06 12:38:57 +03:30
4b52d144e0 feat: add LawId column to InstitutionContractAmendments migration 2025-11-06 11:57:17 +03:30
90a1683047 feat: add WorkshopName property to institution contract amendment payment workshop response 2025-11-05 18:55:00 +03:30
d078feccf9 feat: sort institution contract responses by price in descending order 2025-11-02 11:28:29 +03:30
c6a7e0a0bd feat: add workshop response handling to institution contract amendment payment response 2025-10-29 15:08:14 +03:30
fcf2b38457 feat: add previous ID handling and price difference validation to institution contract amendment workshops 2025-10-28 13:13:55 +03:30
7b71bd36b1 feat: add verification status and amendment tracking to institution contract models 2025-10-27 15:22:45 +03:30
62900a22a1 feat: add amendment verification details retrieval methods and update related classes 2025-10-27 11:30:56 +03:30
e6977b29fc feat: add methods for creating institution contract amendment changes and enhance personnel count handling 2025-10-26 14:00:03 +03:30
6e902011ca feat: enhance institution contract verification process and update SMS service methods 2025-10-26 12:21:14 +03:30
7cce903f6e Merge branch 'Feature/InstitutionContract/print-api' into Feature/InstitutionContract/upgrade
# Conflicts:
#	Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs
#	CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs
#	CompanyManagment.Application/InstitutionContractApplication.cs
#	CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs
2025-10-26 12:03:39 +03:30
4d6077c93d Merge branch 'refs/heads/master' into Feature/InstitutionContract/upgrade 2025-10-26 11:50:48 +03:30
c36e81e263 feat: update InstitutionContractRepository to enhance workshop change tracking and improve data handling 2025-10-25 15:23:48 +03:30
818d88d859 feat: update InstitutionContractAmendmentChange to include roll call options and current workshop ID 2025-10-23 16:32:45 +03:30
1a70569a36 feat: implement amendment completion functionality with payment details 2025-10-23 11:44:12 +03:30
8d24339f04 Merge branch 'master' into Feature/InstitutionContract/upgrade
# Conflicts:
#	ServiceHost/Areas/Admin/Controllers/institutionContractController.cs
2025-10-23 09:29:05 +03:30
bea858d4e7 feat: add AmendmentComplete method and request class to InstitutionContractApplication 2025-10-22 13:33:30 +03:30
25 changed files with 44958 additions and 34 deletions

View File

@@ -28,6 +28,7 @@ public interface ISmsService
Task<double> GetCreditAmount(); Task<double> GetCreditAmount();
public Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId); public Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
public Task<bool> SendInstitutionAmendmentVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName, public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
long contractingPartyId, long institutionContractId); long contractingPartyId, long institutionContractId);

View File

@@ -6,7 +6,6 @@ using _0_Framework.Application;
using _0_Framework.Domain; using _0_Framework.Domain;
using CompanyManagment.App.Contracts.InstitutionContract; using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.Workshop; using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Mvc;
namespace Company.Domain.InstitutionContractAgg; namespace Company.Domain.InstitutionContractAgg;
@@ -77,4 +76,6 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected); Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids); Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request);
Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id, long amendmentId);
} }

View File

@@ -252,6 +252,11 @@ public class InstitutionContract : EntityBase
{ {
WorkshopGroup = null; WorkshopGroup = null;
} }
public void AddAmendment(InstitutionContractAmendment amendment)
{
Amendments.Add(amendment);
}
} }
public class InstitutionContractAmendment : EntityBase public class InstitutionContractAmendment : EntityBase
@@ -259,14 +264,15 @@ public class InstitutionContractAmendment : EntityBase
private InstitutionContractAmendment(){} private InstitutionContractAmendment(){}
public InstitutionContractAmendment(long institutionContractId, public InstitutionContractAmendment(long institutionContractId,
List<InstitutionContractInstallment> installments, double amount, bool hasInstallment, List<InstitutionContractInstallment> installments, double amount, bool hasInstallment,
InstitutionContractAmendmentChange amendmentChange, long lawId) List<InstitutionContractAmendmentChange> amendmentChanges, long lawId)
{ {
InstitutionContractId = institutionContractId; InstitutionContractId = institutionContractId;
Installments = installments is { Count: > 0} ? installments : []; Installments = installments is { Count: > 0} ? installments : [];
Amount = amount; Amount = amount;
HasInstallment = hasInstallment; HasInstallment = hasInstallment;
AmendmentChanges = [amendmentChange]; AmendmentChanges = amendmentChanges;
LawId = lawId; LawId = lawId;
VerificationStatus = InstitutionContractVerificationStatus.PendingForVerify;
} }
public long InstitutionContractId { get; set; } public long InstitutionContractId { get; set; }
@@ -280,6 +286,15 @@ public class InstitutionContractAmendment : EntityBase
public long LawId { get; set; } public long LawId { get; set; }
public string VerifierPhoneNumber { get; private set; }
public string VerifierFullName { get; private set; }
public InstitutionContractVerificationStatus VerificationStatus { get; set; }
public DateTime VerifyCodeCreation { get; set; }
public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber) public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
{ {
VerifyCode = code; VerifyCode = code;
@@ -287,25 +302,22 @@ public class InstitutionContractAmendment : EntityBase
VerifierFullName = verifierFullName; VerifierFullName = verifierFullName;
VerifierPhoneNumber = verifierPhoneNumber; VerifierPhoneNumber = verifierPhoneNumber;
} }
public void Verified()
public string VerifierPhoneNumber { get; private set; } {
VerificationStatus = InstitutionContractVerificationStatus.Verified;
public string VerifierFullName { get; private set; } }
public DateTime VerifyCodeCreation { get; set; }
} }
public class InstitutionContractAmendmentChange : EntityBase public class InstitutionContractAmendmentChange : EntityBase
{ {
private InstitutionContractAmendmentChange() { } private InstitutionContractAmendmentChange() { }
private InstitutionContractAmendmentChange(long institutionContractAmendmentId,
InstitutionContractAmendment institutionContractAmendment, InstitutionContractAmendmentChangeType changeType, private InstitutionContractAmendmentChange(InstitutionContractAmendmentChangeType changeType,
DateTime changeDateGr, bool? hasRollCallPlan, bool? hasCustomizeCheckoutPlan, bool? hasContractPlan, DateTime changeDateGr, bool? hasCustomizeCheckoutPlan, bool? hasContractPlan,
bool? hasContractPlanInPerson, bool? hasInsurancePlan, bool? hasInsurancePlanInPerson, int? personnelCount, bool? hasContractPlanInPerson, bool? hasInsurancePlan, bool? hasInsurancePlanInPerson, int? personnelCount,
long? workshopDetailsId) bool? hasRollCallPlan, bool? hasRollCallInPerson,
long? currentWorkshopId, int personnelCountDifference)
{ {
InstitutionContractAmendmentId = institutionContractAmendmentId;
InstitutionContractAmendment = institutionContractAmendment;
ChangeType = changeType; ChangeType = changeType;
ChangeDateGr = changeDateGr; ChangeDateGr = changeDateGr;
HasRollCallPlan = hasRollCallPlan; HasRollCallPlan = hasRollCallPlan;
@@ -315,9 +327,80 @@ public class InstitutionContractAmendmentChange : EntityBase
HasInsurancePlan = hasInsurancePlan; HasInsurancePlan = hasInsurancePlan;
HasInsurancePlanInPerson = hasInsurancePlanInPerson; HasInsurancePlanInPerson = hasInsurancePlanInPerson;
PersonnelCount = personnelCount; PersonnelCount = personnelCount;
WorkshopDetailsId = workshopDetailsId; PersonnelCountDifference = personnelCountDifference;
CurrentWorkshopId = currentWorkshopId;
HasRollCallInPerson = hasRollCallInPerson;
} }
/// <summary>
/// تغییر تعداد پرسنل
/// </summary>
public static InstitutionContractAmendmentChange CreatePersonCountChange(
DateTime changeDateGr, int personnelCount, int personnelCountDifference,
long currentWorkshopId)
{
return new InstitutionContractAmendmentChange(
changeType: InstitutionContractAmendmentChangeType.PersonCount,
changeDateGr: changeDateGr,
hasCustomizeCheckoutPlan: null,
hasContractPlan: null,
hasContractPlanInPerson: null,
hasInsurancePlan: null,
hasInsurancePlanInPerson: null,
personnelCount: personnelCount,
hasRollCallPlan: null,
hasRollCallInPerson: null,
currentWorkshopId: currentWorkshopId,
personnelCountDifference: personnelCountDifference);
}
/// <summary>
/// تغییر خدمات
/// </summary>
public static InstitutionContractAmendmentChange CreateServicesChange(
DateTime changeDateGr, long currentWorkshopId, bool hasRollCallPlan, bool hasRollCallInPerson,
bool hasCustomizeCheckoutPlan, bool hasContractPlan, bool hasContractPlanInPerson,
bool hasInsurancePlan, bool hasInsurancePlanInPerson)
{
return new InstitutionContractAmendmentChange(
changeType: InstitutionContractAmendmentChangeType.Services,
changeDateGr: changeDateGr,
hasCustomizeCheckoutPlan: hasCustomizeCheckoutPlan,
hasContractPlan: hasContractPlan,
hasContractPlanInPerson: hasContractPlanInPerson,
hasInsurancePlan: hasInsurancePlan,
hasInsurancePlanInPerson: hasInsurancePlanInPerson,
personnelCount: null,
hasRollCallPlan: hasRollCallPlan,
hasRollCallInPerson: hasRollCallInPerson,
currentWorkshopId: currentWorkshopId,
personnelCountDifference: 0);
}
/// <summary>
/// ایجاد کارگاه جدید
/// </summary>
public static InstitutionContractAmendmentChange CreateWorkshopCreatedChange(
DateTime changeDateGr, bool hasRollCallPlan, bool hasRollCallInPerson,
bool hasCustomizeCheckoutPlan, bool hasContractPlan, bool hasContractPlanInPerson,
bool hasInsurancePlan, bool hasInsurancePlanInPerson,int personnelCount)
{
return new InstitutionContractAmendmentChange(
changeType: InstitutionContractAmendmentChangeType.WorkshopCreated,
changeDateGr: changeDateGr,
hasCustomizeCheckoutPlan: hasCustomizeCheckoutPlan,
hasContractPlan: hasContractPlan,
hasContractPlanInPerson: hasContractPlanInPerson,
hasInsurancePlan: hasInsurancePlan,
hasInsurancePlanInPerson: hasInsurancePlanInPerson,
personnelCount: personnelCount,
hasRollCallPlan: hasRollCallPlan,
hasRollCallInPerson: hasRollCallInPerson,
currentWorkshopId: null,
personnelCountDifference: 0);
}
public long InstitutionContractAmendmentId { get; private set; } public long InstitutionContractAmendmentId { get; private set; }
public InstitutionContractAmendment InstitutionContractAmendment { get; private set; } public InstitutionContractAmendment InstitutionContractAmendment { get; private set; }
public InstitutionContractAmendmentChangeType ChangeType { get; private set; } public InstitutionContractAmendmentChangeType ChangeType { get; private set; }
@@ -328,6 +411,8 @@ public class InstitutionContractAmendmentChange : EntityBase
/// </summary> /// </summary>
public bool? HasRollCallPlan { get; private set; } public bool? HasRollCallPlan { get; private set; }
public bool? HasRollCallInPerson { get; set; }
/// <summary> /// <summary>
/// پلن فیش غیر رسمی /// پلن فیش غیر رسمی
/// </summary> /// </summary>
@@ -358,10 +443,16 @@ public class InstitutionContractAmendmentChange : EntityBase
/// </summary> /// </summary>
public int? PersonnelCount { get; private set; } public int? PersonnelCount { get; private set; }
/// <summary>
/// مقدار تغییرات تعداد پرسنل
/// </summary>
public int PersonnelCountDifference { get; set; }
/// <summary> /// <summary>
/// تعداد کارگاه /// تعداد کارگاه
/// </summary> /// </summary>
public long? WorkshopDetailsId { get; private set; } public long? CurrentWorkshopId { get; private set; }
} }
public enum InstitutionContractAmendmentChangeType public enum InstitutionContractAmendmentChangeType

View File

@@ -9,7 +9,7 @@ public class InstitutionContractWorkshopBase:EntityBase
protected InstitutionContractWorkshopBase(){} protected InstitutionContractWorkshopBase(){}
public InstitutionContractWorkshopBase(string workshopName, bool hasRollCallPlan,bool hasRollCallPlanInPerson, public InstitutionContractWorkshopBase(string workshopName, bool hasRollCallPlan,bool hasRollCallPlanInPerson,
bool hasCustomizeCheckoutPlan, bool hasContractPlan,bool hasContractPlanInPerson,bool hasInsurancePlan,bool hasInsurancePlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,bool hasContractPlanInPerson,bool hasInsurancePlan,bool hasInsurancePlanInPerson,
int personnelCount, double price ) int personnelCount, double price,bool isAmendment )
{ {
WorkshopName = workshopName; WorkshopName = workshopName;
Services = new WorkshopServices(hasInsurancePlan, hasInsurancePlanInPerson, Services = new WorkshopServices(hasInsurancePlan, hasInsurancePlanInPerson,
@@ -17,7 +17,10 @@ public class InstitutionContractWorkshopBase:EntityBase
PersonnelCount = personnelCount; PersonnelCount = personnelCount;
Price = price; Price = price;
Employers = []; Employers = [];
IsAmendment = isAmendment;
} }
/// <summary> /// <summary>
/// شناسه کارگاه /// شناسه کارگاه
/// </summary> /// </summary>
@@ -43,6 +46,10 @@ public class InstitutionContractWorkshopBase:EntityBase
public double Price { get; private set; } public double Price { get; private set; }
/// <summary>
/// جهت نمایش دادن اینکه آیا این کارگاه مربوط به ارتقا قرارداد است یا خیر
/// </summary>
public bool IsAmendment { get; set; }
public List<InstitutionContractWorkshopDetailEmployer> Employers { get; private set; } = new(); public List<InstitutionContractWorkshopDetailEmployer> Employers { get; private set; } = new();

View File

@@ -10,9 +10,10 @@ public class InstitutionContractWorkshopCurrent:InstitutionContractWorkshopBase
public InstitutionContractWorkshopCurrent(string workshopName, bool hasRollCallPlan, public InstitutionContractWorkshopCurrent(string workshopName, bool hasRollCallPlan,
bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan, bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson, bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
int personnelCount, double price,long institutionContractWorkshopGroupId,InstitutionContractWorkshopGroup workshopGroup,long workshopId) : base(workshopName, hasRollCallPlan, int personnelCount, double price,long institutionContractWorkshopGroupId,
InstitutionContractWorkshopGroup workshopGroup,long workshopId,bool isAmendment) : base(workshopName, hasRollCallPlan,
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan,
hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price) hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price,isAmendment)
{ {
InstitutionContractWorkshopGroupId = institutionContractWorkshopGroupId; InstitutionContractWorkshopGroupId = institutionContractWorkshopGroupId;
WorkshopGroup = workshopGroup; WorkshopGroup = workshopGroup;

View File

@@ -32,6 +32,13 @@ public class InstitutionContractWorkshopGroup : EntityBase
LastModifiedDate = DateTime.Now; LastModifiedDate = DateTime.Now;
} }
public void AddAmendmentWorkshops(List<InstitutionContractWorkshopInitial> amendmentDetails)
{
InitialWorkshops.AddRange(amendmentDetails);
LastModifiedDate = DateTime.Now;
}
public void UpdateCurrentWorkshops(List<InstitutionContractWorkshopCurrent> updatedDetails) public void UpdateCurrentWorkshops(List<InstitutionContractWorkshopCurrent> updatedDetails)
{ {
CurrentWorkshops = updatedDetails.ToList(); CurrentWorkshops = updatedDetails.ToList();

View File

@@ -11,9 +11,9 @@ public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase
public InstitutionContractWorkshopInitial(string workshopName, bool hasRollCallPlan, public InstitutionContractWorkshopInitial(string workshopName, bool hasRollCallPlan,
bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan, bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson, bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
int personnelCount, double price) : base(workshopName, hasRollCallPlan, int personnelCount, double price,bool isAmendment =false) : base(workshopName, hasRollCallPlan,
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasContractPlanInPerson, hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasContractPlanInPerson,
hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price) hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price,isAmendment)
{ {
WorkshopCreated = false; WorkshopCreated = false;
} }
@@ -31,7 +31,8 @@ public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase
WorkshopCreated = true; WorkshopCreated = true;
WorkshopCurrent = new InstitutionContractWorkshopCurrent(WorkshopName,Services.RollCall,Services.RollCallInPerson, WorkshopCurrent = new InstitutionContractWorkshopCurrent(WorkshopName,Services.RollCall,Services.RollCallInPerson,
Services.CustomizeCheckout,Services.Contract,Services.ContractInPerson,Services.Insurance, Services.CustomizeCheckout,Services.Contract,Services.ContractInPerson,Services.Insurance,
Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId); Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId,
IsAmendment);
WorkshopCurrent.SetEmployers(Employers.Select(x=>x.EmployerId).ToList()); WorkshopCurrent.SetEmployers(Employers.Select(x=>x.EmployerId).ToList());
} }

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using CompanyManagment.App.Contracts.InstitutionContract;
using MongoDB.Bson; using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Attributes;
@@ -16,7 +17,7 @@ public class InstitutionContractAmendmentTemp
NewWorkshops = prevWorkshops.Select(x=> new InstitutionContractAmendmentTempNewWorkshop( NewWorkshops = prevWorkshops.Select(x=> new InstitutionContractAmendmentTempNewWorkshop(
x.WorkshopName, x.CountPerson, x.ContractAndCheckout, x.ContractAndCheckoutInPerson, x.Insurance, x.WorkshopName, x.CountPerson, x.ContractAndCheckout, x.ContractAndCheckoutInPerson, x.Insurance,
x.InsuranceInPerson, x.RollCall, x.RollCallInPerson, x.CustomizeCheckout, x.Price, x.WorkshopId, x.InsuranceInPerson, x.RollCall, x.RollCallInPerson, x.CustomizeCheckout, x.Price, x.WorkshopId,
x.CurrentWorkshopId, 0)).ToList(); x.CurrentWorkshopId, 0,x.Id)).ToList();
InstitutionContractId = institutionContractId; InstitutionContractId = institutionContractId;
} }
@@ -25,17 +26,32 @@ public class InstitutionContractAmendmentTemp
public Guid Id { get; private set; } public Guid Id { get; private set; }
public List<InstitutionContractAmendmentTempPrevWorkshop> PrevWorkshops { get; private set; } public List<InstitutionContractAmendmentTempPrevWorkshop> PrevWorkshops { get; private set; }
public List<InstitutionContractAmendmentTempNewWorkshop> NewWorkshops { get; private set; } public List<InstitutionContractAmendmentTempNewWorkshop> NewWorkshops { get; private set; }
public InstitutionContractPaymentMonthlyViewModel MonthlyPayment { get; set; }
public InstitutionContractPaymentOneTimeViewModel OneTimePayment { get; set; }
public long InstitutionContractId { get; private set; } public long InstitutionContractId { get; private set; }
public int MonthDifference { get; set; }
public void AddPaymentDetails(InstitutionContractPaymentMonthlyViewModel resMonthly, InstitutionContractPaymentOneTimeViewModel resOneTime, int monthDiff)
{
MonthlyPayment = resMonthly;
OneTimePayment = resOneTime;
MonthDifference = monthDiff;
}
} }
public class InstitutionContractAmendmentTempNewWorkshop : InstitutionContractAmendmentTempPrevWorkshop public class InstitutionContractAmendmentTempNewWorkshop : InstitutionContractAmendmentTempPrevWorkshop
{ {
public InstitutionContractAmendmentTempNewWorkshop(string workshopName, int countPerson, bool contractAndCheckout, public InstitutionContractAmendmentTempNewWorkshop(string workshopName, int countPerson, bool contractAndCheckout,
bool contractAndCheckoutInPerson, bool insurance, bool insuranceInPerson, bool rollCall, bool rollCallInPerson, bool contractAndCheckoutInPerson, bool insurance, bool insuranceInPerson, bool rollCall, bool rollCallInPerson,
bool customizeCheckout, double price, long workshopId, long currentWorkshopId,double priceDifference) : base( bool customizeCheckout, double price, long workshopId, long currentWorkshopId,double priceDifference,Guid prevId) : base(
workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance, insuranceInPerson, workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance, insuranceInPerson,
rollCall, rollCallInPerson, customizeCheckout, price, workshopId, currentWorkshopId) rollCall, rollCallInPerson, customizeCheckout, price, workshopId, currentWorkshopId)
{ {
Id = prevId;
PriceDifference = priceDifference; PriceDifference = priceDifference;
} }

View File

@@ -4,6 +4,8 @@ public class GetInstitutionVerificationDetailsWorkshopsViewModel
{ {
public string Name { get; set; } public string Name { get; set; }
public int PersonnelCount { get; set; } public int PersonnelCount { get; set; }
public WorkshopServicesViewModel OldServices { get; set; }
public WorkshopServicesViewModel Services { get; set; } public WorkshopServicesViewModel Services { get; set; }
public string Price { get; set; } public string Price { get; set; }
} }

View File

@@ -244,13 +244,41 @@ public interface IInstitutionContractApplication
#endregion #endregion
Task<OperationResult> ResendVerifyLink(long institutionContractId); Task<OperationResult> ResendVerifyLink(long institutionContractId);
Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request);
/// <summary> /// <summary>
/// دیتای پرینت قرارداد مالی /// دیتای پرینت قرارداد مالی
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id); Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id, long amendmentId);
}
public class GetInstitutionAmendmentVerificationDetailsViewModel
{
public InstitutionContratVerificationParty FirstParty { get; set; }
public InstitutionContratVerificationParty SecondParty { get; set; }
public string ContractNo { get; set; }
public string AmendmentCreationDate { get; set; }
public string AmendmentStart { get; set; }
public string AmendmentEnd { get; set; }
public List<GetInstitutionVerificationDetailsWorkshopsViewModel> Workshops { get; set; }
public string TotalPrice { get; set; }
public string TaxPrice { get; set; }
public string PaymentPrice { get; set; }
public List<InstitutionContractInstallmentViewModel> Installments { get; set; }
public bool IsInstallment { get; set; }
}
public class InstitutionContractAmendmentCompleteRequest
{
public Guid TempId { get; set; }
public bool IsInstallment { get; set; }
public long LawId { get; set; }
} }
public class InstitutionContractPrintViewModel public class InstitutionContractPrintViewModel

View File

@@ -1,7 +1,10 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.InstitutionContract; namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InsitutionContractAmendmentPaymentResponse public class InsitutionContractAmendmentPaymentResponse
{ {
public List<InsitutionContractAmendmentPaymentWorkshopResponse> workshops { get; set; }
public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; } public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; }
public InstitutionContractPaymentMonthlyViewModel Monthly { get; set; } public InstitutionContractPaymentMonthlyViewModel Monthly { get; set; }
public string ContractStart { get; set; } public string ContractStart { get; set; }
@@ -9,3 +12,17 @@ public class InsitutionContractAmendmentPaymentResponse
public string OneMonthAmount { get; set; } public string OneMonthAmount { get; set; }
public string TotalAmount { get; set; } public string TotalAmount { get; set; }
} }
public class InsitutionContractAmendmentPaymentWorkshopResponse
{
public string WorkshopName { get; set; }
public WorkshopServicesViewModel OldServices { get; set; }
public WorkshopServicesViewModel NewServices { get; set; }
public bool IsNewWorkshop { get; set; }
public int PrevPersonnelCount { get; set; }
public int NewPersonnelCount { get; set; }
public double Price { get; set; }
}

View File

@@ -1387,6 +1387,16 @@ public class InstitutionContractApplication : IInstitutionContractApplication
return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault(); return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault();
} }
public async Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id, long amendmentId)
{
return await _institutionContractRepository.GetAmendmentVerificationDetails(id,amendmentId);
}
public async Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request)
{
await _institutionContractRepository.AmendmentComplete(request);
}
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity( private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city, CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city,

View File

@@ -15,6 +15,8 @@ public class InstitutionContractAmendmentMapping:IEntityTypeConfiguration<Instit
builder.Property(x => x.VerifierFullName).HasMaxLength(100); builder.Property(x => x.VerifierFullName).HasMaxLength(100);
builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20); builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20);
builder.Property(x=>x.VerificationStatus).HasConversion<string>().HasMaxLength(50);
builder.HasOne(x => x.InstitutionContract) builder.HasOne(x => x.InstitutionContract)
.WithMany(x => x.Amendments) .WithMany(x => x.Amendments)
.HasForeignKey(x => x.InstitutionContractId); .HasForeignKey(x => x.InstitutionContractId);

View File

@@ -0,0 +1,83 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class AddIsAmendmentininstitutioncontractWorkshopDetials : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "WorkshopDetailsId",
table: "InstitutionContractAmendmentChange",
newName: "CurrentWorkshopId");
migrationBuilder.AddColumn<bool>(
name: "IsAmendment",
table: "InstitutionContractWorkshopInitials",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsAmendment",
table: "InstitutionContractWorkshopCurrents",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "VerificationStatus",
table: "InstitutionContractAmendments",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<bool>(
name: "HasRollCallInPerson",
table: "InstitutionContractAmendmentChange",
type: "bit",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "PersonnelCountDifference",
table: "InstitutionContractAmendmentChange",
type: "int",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsAmendment",
table: "InstitutionContractWorkshopInitials");
migrationBuilder.DropColumn(
name: "IsAmendment",
table: "InstitutionContractWorkshopCurrents");
migrationBuilder.DropColumn(
name: "VerificationStatus",
table: "InstitutionContractAmendments");
migrationBuilder.DropColumn(
name: "HasRollCallInPerson",
table: "InstitutionContractAmendmentChange");
migrationBuilder.DropColumn(
name: "PersonnelCountDifference",
table: "InstitutionContractAmendmentChange");
migrationBuilder.RenameColumn(
name: "CurrentWorkshopId",
table: "InstitutionContractAmendmentChange",
newName: "WorkshopDetailsId");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class institutioncontractAmendmentlawid : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class ignorelawid : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "LawId",
table: "InstitutionContractAmendments",
type: "bigint",
nullable: false,
defaultValue: 0L);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "LawId",
table: "InstitutionContractAmendments");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class lawIdtest : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -3288,6 +3288,11 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<DateTime>("VerificationCreation") b.Property<DateTime>("VerificationCreation")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<string>("VerificationStatus")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("VerifierFullName") b.Property<string>("VerifierFullName")
.HasMaxLength(100) .HasMaxLength(100)
.HasColumnType("nvarchar(100)"); .HasColumnType("nvarchar(100)");
@@ -3327,6 +3332,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<DateTime>("CreationDate") b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<long?>("CurrentWorkshopId")
.HasColumnType("bigint");
b.Property<bool?>("HasContractPlan") b.Property<bool?>("HasContractPlan")
.HasColumnType("bit"); .HasColumnType("bit");
@@ -3342,6 +3350,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<bool?>("HasInsurancePlanInPerson") b.Property<bool?>("HasInsurancePlanInPerson")
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<bool?>("HasRollCallInPerson")
.HasColumnType("bit");
b.Property<bool?>("HasRollCallPlan") b.Property<bool?>("HasRollCallPlan")
.HasColumnType("bit"); .HasColumnType("bit");
@@ -3351,8 +3362,8 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<int?>("PersonnelCount") b.Property<int?>("PersonnelCount")
.HasColumnType("int"); .HasColumnType("int");
b.Property<long?>("WorkshopDetailsId") b.Property<int>("PersonnelCountDifference")
.HasColumnType("bigint"); .HasColumnType("int");
b.HasKey("id"); b.HasKey("id");
@@ -3419,6 +3430,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<long>("InstitutionContractWorkshopGroupId") b.Property<long>("InstitutionContractWorkshopGroupId")
.HasColumnType("bigint"); .HasColumnType("bigint");
b.Property<bool>("IsAmendment")
.HasColumnType("bit");
b.Property<int>("PersonnelCount") b.Property<int>("PersonnelCount")
.HasColumnType("int"); .HasColumnType("int");
@@ -3484,6 +3498,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<long>("InstitutionContractWorkshopGroupId") b.Property<long>("InstitutionContractWorkshopGroupId")
.HasColumnType("bigint"); .HasColumnType("bigint");
b.Property<bool>("IsAmendment")
.HasColumnType("bit");
b.Property<int>("PersonnelCount") b.Property<int>("PersonnelCount")
.HasColumnType("int"); .HasColumnType("int");

View File

@@ -29,7 +29,6 @@ using CompanyManagment.App.Contracts.Law;
using CompanyManagment.App.Contracts.TemporaryClientRegistration; using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.App.Contracts.Workshop; using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.WorkshopPlan; using CompanyManagment.App.Contracts.WorkshopPlan;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@@ -2374,6 +2373,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
x.WorkshopId??0,x.id)).ToList(); x.WorkshopId??0,x.id)).ToList();
await _institutionAmendmentTemp
.DeleteManyAsync(x => x.InstitutionContractId == institutionContractId);;
var temp = new InstitutionContractAmendmentTemp(workshops, institutionContractId); var temp = new InstitutionContractAmendmentTemp(workshops, institutionContractId);
@@ -2456,19 +2457,56 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
if (endDay > startDay) if (endDay > startDay)
monthDiff++; monthDiff++;
var sumOneMonth = institutionContractAmendmentTemp.NewWorkshops.Sum(x => x.PriceDifference); var sumOneMonth = institutionContractAmendmentTemp
.NewWorkshops.Sum(x => x.PriceDifference);
var baseAmount = monthDiff * sumOneMonth; var baseAmount = monthDiff * sumOneMonth;
var tax = baseAmount*0.10; var tax = baseAmount*0.10;
var totalPayment = tax+baseAmount; var totalPayment = tax+baseAmount;
var res = new InsitutionContractAmendmentPaymentResponse() var res = new InsitutionContractAmendmentPaymentResponse()
{ {
ContractStart = amendmentStart.ToFarsi(), ContractStart = amendmentStart.ToFarsi(),
ContractEnd = amendmentEnd.ToFarsi(), ContractEnd = amendmentEnd.ToFarsi(),
OneMonthAmount = sumOneMonth.ToMoney(), OneMonthAmount = sumOneMonth.ToMoney(),
TotalAmount = baseAmount.ToMoney(), TotalAmount = baseAmount.ToMoney(),
workshops = institutionContractAmendmentTemp.NewWorkshops
.Select(x=>
{
var prevWorkshop = institutionContractAmendmentTemp.PrevWorkshops
.FirstOrDefault(w=> w.Id == x.Id);
var isNewWorkshop = prevWorkshop == null;
return new InsitutionContractAmendmentPaymentWorkshopResponse()
{
WorkshopName = x.WorkshopName,
IsNewWorkshop = isNewWorkshop,
NewPersonnelCount = x.CountPerson,
PrevPersonnelCount = prevWorkshop?.CountPerson??0,
Price = x.PriceDifference,
OldServices = prevWorkshop != null? new WorkshopServicesViewModel()
{
Contract = prevWorkshop.ContractAndCheckout,
ContractInPerson = prevWorkshop.ContractAndCheckoutInPerson,
CustomizeCheckout = prevWorkshop.CustomizeCheckout,
Insurance = prevWorkshop.Insurance,
InsuranceInPerson = prevWorkshop.InsuranceInPerson,
RollCall = prevWorkshop.RollCall,
RollCallInPerson = prevWorkshop.RollCallInPerson,
}: new WorkshopServicesViewModel(),
NewServices = new WorkshopServicesViewModel()
{
Contract = x.ContractAndCheckout,
ContractInPerson = x.ContractAndCheckoutInPerson,
CustomizeCheckout = x.CustomizeCheckout,
Insurance = x.Insurance,
InsuranceInPerson = x.InsuranceInPerson,
RollCall = x.RollCall,
RollCallInPerson = x.RollCallInPerson,
},
};
}).OrderByDescending(x=>x.Price).ToList()
}; };
res.OneTime = new InstitutionContractPaymentOneTimeViewModel() res.OneTime = new InstitutionContractPaymentOneTimeViewModel()
@@ -2515,6 +2553,13 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
}; };
} }
institutionContractAmendmentTemp.AddPaymentDetails(res.Monthly, res.OneTime, monthDiff);
await _institutionAmendmentTemp
.ReplaceOneAsync(x => x.Id == institutionContractAmendmentTemp.Id, institutionContractAmendmentTemp);
return res; return res;
} }
@@ -2553,7 +2598,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
request.Insurance, request.InsuranceInPerson, request.Insurance, request.InsuranceInPerson,
request.RollCall, request.RollCallInPerson, request.RollCall, request.RollCallInPerson,
request.CustomizeCheckout, price, request.CustomizeCheckout, price,
request.WorkshopId,0,price); request.WorkshopId,0,price,Guid.NewGuid());
workshopTemp = newWorkshopTemp; workshopTemp = newWorkshopTemp;
@@ -2565,9 +2610,24 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
} }
else else
{ {
var prevWorkshop = amendmentTemp.PrevWorkshops
.FirstOrDefault(x => x.Id == workshopTemp.Id);
var differencePrice = 0d;
if (prevWorkshop != null)
{
differencePrice = price - prevWorkshop.Price;
}
else
{
differencePrice = price;
}
amendmentTemp.NewWorkshops.Remove(workshopTemp); amendmentTemp.NewWorkshops.Remove(workshopTemp);
var differencePrice = price - workshopTemp.Price;
if (differencePrice<0)
{
differencePrice = 0;
}
workshopTemp.Edit(request.WorkshopName, request.CountPerson, workshopTemp.Edit(request.WorkshopName, request.CountPerson,
request.ContractAndCheckout, request.ContractAndCheckoutInPerson, request.ContractAndCheckout, request.ContractAndCheckoutInPerson,
request.Insurance, request.InsuranceInPerson, request.Insurance, request.InsuranceInPerson,
@@ -2768,6 +2828,146 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
return res; return res;
} }
public async Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request)
{
var amendmentTemp = await _institutionAmendmentTemp
.Find(x=>x.Id == request.TempId).FirstOrDefaultAsync();
if (amendmentTemp == null)
throw new BadRequestException("دیتای وارد شده نامعتبر است");
var institutionContract = await _context.InstitutionContractSet
.Include(x=>x.Amendments)
.Include(x=>x.WorkshopGroup)
.ThenInclude(x=>x.CurrentWorkshops)
.FirstOrDefaultAsync(x => x.id == amendmentTemp.InstitutionContractId);
List<InstitutionContractInstallment> installments = [];
double amount = 0;
if (request.IsInstallment)
{
installments = amendmentTemp.MonthlyPayment.Installments.Select(x=>
new InstitutionContractInstallment(x.InstalmentDate.ToGeorgianDateTime(),
x.InstallmentAmountStr.MoneyToDouble(), "")).ToList();
amount = amendmentTemp.MonthlyPayment.PaymentAmount.MoneyToDouble();
}
else
{
amount = amendmentTemp.OneTimePayment.PaymentAmount.MoneyToDouble();
}
var newWorkshops = amendmentTemp
.NewWorkshops.Where(x=>x.CurrentWorkshopId ==0).ToList();
var newWorkshopTempIds = newWorkshops.Select(x=>x.Id).ToList();
var changes = newWorkshops.Select(x=>
InstitutionContractAmendmentChange.CreateWorkshopCreatedChange(DateTime.Now,x.RollCall,x.RollCallInPerson,x.CustomizeCheckout,
x.ContractAndCheckout,x.ContractAndCheckoutInPerson,x.Insurance,x.InsuranceInPerson,x.CountPerson)).ToList();
var changedWorkshops = amendmentTemp.NewWorkshops
.Where(x => !newWorkshopTempIds.Contains(x.Id)).ToList();
foreach (var changedWorkshop in changedWorkshops)
{
var prev = amendmentTemp.PrevWorkshops.FirstOrDefault(x => x.Id == changedWorkshop.Id);
if (prev == null)
throw new BadRequestException("دیتای وارد شده ناقص ذخیره شده است");
// مقایسه مقادیر بولین بین prev و changedWorkshop برای تشخیص تغییرات
var changedBooleans = new Dictionary<string, (bool Previous, bool Current)>();
if (prev.CustomizeCheckout != changedWorkshop.CustomizeCheckout)
changedBooleans.Add("CustomizeCheckout", (prev.CustomizeCheckout, changedWorkshop.CustomizeCheckout));
if (prev.ContractAndCheckout != changedWorkshop.ContractAndCheckout)
changedBooleans.Add("ContractAndCheckout", (prev.ContractAndCheckout, changedWorkshop.ContractAndCheckout));
if (prev.ContractAndCheckoutInPerson != changedWorkshop.ContractAndCheckoutInPerson)
changedBooleans.Add("ContractAndCheckoutInPerson", (prev.ContractAndCheckoutInPerson, changedWorkshop.ContractAndCheckoutInPerson));
if (prev.Insurance != changedWorkshop.Insurance)
changedBooleans.Add("Insurance", (prev.Insurance, changedWorkshop.Insurance));
if (prev.InsuranceInPerson != changedWorkshop.InsuranceInPerson)
changedBooleans.Add("InsuranceInPerson", (prev.InsuranceInPerson, changedWorkshop.InsuranceInPerson));
if (prev.RollCall != changedWorkshop.RollCall)
changedBooleans.Add("RollCall", (prev.RollCall, changedWorkshop.RollCall));
if (prev.RollCallInPerson != changedWorkshop.RollCallInPerson)
changedBooleans.Add("RollCallInPerson", (prev.RollCallInPerson, changedWorkshop.RollCallInPerson));
// اگر تغییری وجود داشته باشد، آن را به لیست تغییرات اضافه کن
if (changedBooleans.Any())
{
var change = InstitutionContractAmendmentChange.CreateServicesChange(
DateTime.Now,
changedWorkshop.WorkshopId,
changedWorkshop.RollCall,
changedWorkshop.RollCallInPerson,
changedWorkshop.CustomizeCheckout,
changedWorkshop.ContractAndCheckout,
changedWorkshop.ContractAndCheckoutInPerson,
changedWorkshop.Insurance,
changedWorkshop.InsuranceInPerson);
changes.Add(change);
}
if (changedWorkshop.CountPerson != prev.CountPerson)
{
var difference = changedWorkshop.CountPerson - prev.CountPerson;
var change = InstitutionContractAmendmentChange.CreatePersonCountChange(
DateTime.Now,
changedWorkshop.CountPerson,
difference,changedWorkshop.WorkshopId);
changes.Add(change);
}
}
var amendment = new InstitutionContractAmendment(institutionContract.id,installments,amount,
request.IsInstallment,changes,request.LawId);
institutionContract.AddAmendment(amendment);
await _smsService.SendInstitutionAmendmentVerificationLink(
institutionContract.VerifierPhoneNumber,
institutionContract.ContractingPartyName,
institutionContract.PublicId,
institutionContract.ContractingPartyId,
institutionContract.id
);
await _institutionAmendmentTemp.DeleteOneAsync(x=>x.Id == amendmentTemp.Id);
await _context.SaveChangesAsync();
}
public async Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id,
long amendmentId)
{
var institutionContract = await _context.InstitutionContractSet
.Include(x => x.Amendments)
.FirstOrDefaultAsync(x => x.PublicId == id);
if (institutionContract == null)
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
var amendment = institutionContract.Amendments
.FirstOrDefault(x => x.id == amendmentId);
if (amendment == null)
throw new NotFoundException("ارتقا یافت نشد");
if (amendment.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
throw new BadRequestException("این ارتقا قبلا تایید شده است");
throw new NotImplementedException();
}
private InstitutionContractExtensionPaymentResponse CalculateInPersonPayment( private InstitutionContractExtensionPaymentResponse CalculateInPersonPayment(
InstitutionContractExtensionPlanDetail selectedPlan, double baseAmount, double tenPercent, InstitutionContractExtensionPlanDetail selectedPlan, double baseAmount, double tenPercent,

View File

@@ -541,12 +541,14 @@ public class institutionContractController : AdminBaseController
var res =await _institutionContractApplication.InsertAmendmentTempWorkshops(request); var res =await _institutionContractApplication.InsertAmendmentTempWorkshops(request);
return res; return res;
} }
[HttpDelete("amendment/remove-temp-workshops/{workshopTempId:guid}")] [HttpDelete("amendment/remove-temp-workshops/{workshopTempId:guid}")]
public async Task<ActionResult> RemoveAmendmentWorkshops(Guid workshopTempId) public async Task<ActionResult> RemoveAmendmentWorkshops(Guid workshopTempId)
{ {
await _institutionContractApplication.RemoveAmendmentWorkshops(workshopTempId); await _institutionContractApplication.RemoveAmendmentWorkshops(workshopTempId);
return Ok(); return Ok();
} }
[HttpPost("amendment/payment-details")] [HttpPost("amendment/payment-details")]
public async Task<ActionResult<InsitutionContractAmendmentPaymentResponse>> GetAmendmentPaymentDetails([FromBody]InsitutionContractAmendmentPaymentRequest request) public async Task<ActionResult<InsitutionContractAmendmentPaymentResponse>> GetAmendmentPaymentDetails([FromBody]InsitutionContractAmendmentPaymentRequest request)
{ {
@@ -554,6 +556,38 @@ public class institutionContractController : AdminBaseController
return res; return res;
} }
[HttpPost("amendment/complete")]
public async Task<ActionResult> AmendmentComplete(
[FromBody] InstitutionContractAmendmentCompleteRequest request)
{
await _institutionContractApplication.AmendmentComplete(request);
return Ok();
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("/api/institutionContract/amendment-Verification/{id:guid}/{amendmentId:long}")]
[AllowAnonymous]
public async Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id,long amendmentId)
{
return await _institutionContractApplication.GetAmendmentVerificationDetails(id,amendmentId);
}
[HttpPost("/api/institutionContract/Verify-amendment")]
[AllowAnonymous]
public async Task<ActionResult<OperationResult>> VerifyAmendment([FromBody] InstitutionVerificationRequest command)
{
throw new NotImplementedException();
//var res = await _institutionContractApplication.AmendmentVerifyOtp(command.Id, command.Code);
//return res;
}
[HttpGet("edit-old/{id}")] [HttpGet("edit-old/{id}")]
public ActionResult<EditInstitutionContract> GetEditOldDetails(long id) public ActionResult<EditInstitutionContract> GetEditOldDetails(long id)

View File

@@ -737,7 +737,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
x.PersonnelCount, x.PersonnelCount,
x.Price, x.InstitutionContractWorkshopGroupId, x.Price, x.InstitutionContractWorkshopGroupId,
group, group,
x.WorkshopId.Value); x.WorkshopId.Value,false);
entity.SetEmployers(x.Employers.Select(e => e.EmployerId).ToList()); entity.SetEmployers(x.Employers.Select(e => e.EmployerId).ToList());
return entity; return entity;