Merge branch 'Feature/InstitutionContract/add-registration-style' into Main
This commit is contained in:
@@ -50,4 +50,6 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList();
|
||||
Task<List<RegistrationWorkflowItemsViewModel>> RegistrationWorkflowItems(long institutionContractId);
|
||||
Task<InstitutionContractWorkshopDetail> GetInstitutionWorkshopDetails(long institutionWorkshopDetailsId);
|
||||
Task<InstitutionContract> GetIncludeWorkshopDetailsAsync(long institutionContractId);
|
||||
void UpdateStatusIfNeeded(long institutionContractId);
|
||||
}
|
||||
@@ -1047,16 +1047,18 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
// return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
|
||||
var account = new AccountViewModel();
|
||||
|
||||
var institutionContract = _institutionContractRepository.Get(contractWorkshopDetail.InstitutionContractId);
|
||||
var institutionContract =
|
||||
await _institutionContractRepository.GetIncludeWorkshopDetailsAsync(contractWorkshopDetail
|
||||
.InstitutionContractId);
|
||||
if (institutionContract == null)
|
||||
{
|
||||
return operation.Failed("قرارداد مالی موسسه یافت نشد");
|
||||
}
|
||||
|
||||
if (command.HasRollCallFreeVip == "true")
|
||||
{
|
||||
|
||||
// if (institutionContract == null)
|
||||
// return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
|
||||
// if (institutionContract == null)
|
||||
// return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
|
||||
|
||||
account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract
|
||||
.ContractingPartyId);
|
||||
@@ -1096,6 +1098,8 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
_rollCallServiceApplication.Create(commandSave);
|
||||
}
|
||||
|
||||
contractWorkshopDetail.SetWorkshopId(workshop.id);
|
||||
await _workshopRepository.SaveChangesAsync();
|
||||
|
||||
foreach (var e in employerIds)
|
||||
{
|
||||
@@ -1110,11 +1114,12 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
|
||||
var op = _workshopRepository.CreateAccountLeftWorkAndWorkshopAccounts(accountIds.Distinct().ToList(),
|
||||
workshop.id);
|
||||
|
||||
_institutionContractRepository.UpdateStatusIfNeeded(institutionContract.id);
|
||||
|
||||
if (!op.IsSuccedded)
|
||||
return op;
|
||||
|
||||
|
||||
await transaction.CommitAsync();
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
@@ -1560,6 +1560,31 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
return await _context.InstitutionContractWorkshopDetails.FirstOrDefaultAsync(x =>
|
||||
x.id == institutionWorkshopDetailsId);
|
||||
}
|
||||
|
||||
public async Task<InstitutionContract> GetIncludeWorkshopDetailsAsync(long institutionContractId)
|
||||
{
|
||||
return await _context.InstitutionContractSet
|
||||
.Include(x=>x.WorkshopDetails)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractId);
|
||||
}
|
||||
|
||||
public void UpdateStatusIfNeeded(long institutionContractId)
|
||||
{
|
||||
var institutionContract = _context.InstitutionContractSet
|
||||
.Include(x => x.WorkshopDetails)
|
||||
.FirstOrDefault(x => x.id == institutionContractId);
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
|
||||
if (institutionContract.Status == InstitutionContractStatus.Completed)
|
||||
return;
|
||||
if (institutionContract.WorkshopDetails.All(x => x.WorkshopCreated))
|
||||
institutionContract.Complete();
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
@@ -618,6 +618,8 @@ public class institutionContractController : AdminBaseController
|
||||
OneTimeTotalAmount = res.OneTimeTotalPaymentStr,
|
||||
MonthlyTotalAmount= res.MonthlyTotalPaymentStr,
|
||||
TotalTax = res.ValueAddedTaxStr,
|
||||
ContractStart = request.ContractStartType == "currentMonth"?res.ContractStartCurrentMonthFa:res.ContractStartNextMonthFa,
|
||||
ContractEnd = res.ContractEndFa
|
||||
};
|
||||
return response;
|
||||
}
|
||||
@@ -672,6 +674,8 @@ public class InstitutionPlanCalculatorResponse
|
||||
public string OneTimeTotalAmount { get; set; }
|
||||
public string MonthlyTotalAmount { get; set; }
|
||||
public string MonthlyTotalAmountWithoutTax { get; set; }
|
||||
public string ContractStart { get; set; }
|
||||
public string ContractEnd { get; set; }
|
||||
}
|
||||
|
||||
public class WorkshopServiceCalculatorResponse
|
||||
@@ -681,7 +685,6 @@ public class WorkshopServiceCalculatorResponse
|
||||
|
||||
public record InstitutionPlanCalculatorRequest(double TotalAmountMonth,
|
||||
InstitutionContractDuration Duration = InstitutionContractDuration.TwelveMonths,
|
||||
string PaymentModel = "OneTime",
|
||||
string ContractStartType = "currentMonth");
|
||||
|
||||
public class CreateInquiryRequest
|
||||
|
||||
Reference in New Issue
Block a user