Compare commits
18 Commits
Fix/instit
...
Feature/Re
| Author | SHA1 | Date | |
|---|---|---|---|
| f5d95b21b0 | |||
| 1f7785581c | |||
| d44a9224be | |||
| 13a2cd78cd | |||
| 91fc560355 | |||
| 8acb25dd67 | |||
|
|
397280d0a2 | ||
| 5975a92aa1 | |||
| 0cec7c0cce | |||
| be6cb6430f | |||
| 76aa1eae88 | |||
| f1106deff9 | |||
| 94a5741906 | |||
| 221d06a0fc | |||
| 2b993fb746 | |||
| 761ac352df | |||
| ecfb7af386 | |||
| 92fd8d6b0e |
@@ -70,6 +70,7 @@ public interface IWorkshopRepository : IRepository<long, Workshop>
|
||||
Task<List<WorkshopWithLeftWorkTempEmployeesDto>> GetWorkshopsForLeftWorkTemp(long accountId);
|
||||
Task<int> GetWorkshopsForLeftWorkTempCount(long accountId);
|
||||
Task<List<WorkshopSelectListViewModel>> GetSelectList(string search, long id);
|
||||
int GetLastArchiveCode();
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.AccessControl;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.ContractAgg;
|
||||
@@ -66,6 +68,11 @@ public class Employer : EntityBase
|
||||
public string SanaPassword { get; private set; }
|
||||
|
||||
public string EmployerNo { get; set; }
|
||||
public bool IsAuth { get; set; }
|
||||
public string IdNumberSerial { get; set; }
|
||||
|
||||
public string IdNumberSeri { get; set; }
|
||||
|
||||
public PersonalContractingParty ContractingParty { get; set; }
|
||||
|
||||
//public List<Workshop> Workshops { get; private set; }
|
||||
@@ -227,4 +234,35 @@ public class Employer : EntityBase
|
||||
this.IsActive = false;
|
||||
this.Address = "false";
|
||||
}
|
||||
|
||||
public void Authentication(string fName, string lName, string fatherName,string idNumber,
|
||||
string idNumberSeri, string idNumberSerial, string dateOfBirth, Gender gender,string phone)
|
||||
{
|
||||
this.FName = fName;
|
||||
this.LName = lName;
|
||||
this.FatherName = fatherName;
|
||||
this.IdNumberSeri = idNumberSeri;
|
||||
this.IdNumberSerial = idNumberSerial;
|
||||
this.DateOfBirth = !string.IsNullOrWhiteSpace(dateOfBirth) ? dateOfBirth.ToGeorgianDateTime() : new();
|
||||
this.IdNumber = idNumber;
|
||||
this.Gender = gender == _0_Framework.Application.Gender.Male? "مرد" : "زن";
|
||||
this.IsAuth = true;
|
||||
Phone = phone;
|
||||
}
|
||||
|
||||
|
||||
public void LegalAuthentication(string fName, string lName, string fatherName,string idNumber, string idNumberSeri,
|
||||
string idNumberSerial, string dateOfBirth, Gender gender,string phone)
|
||||
{
|
||||
FName = fName;
|
||||
EmployerLName = lName;
|
||||
this.FatherName = fatherName;
|
||||
this.IdNumberSeri = idNumberSeri;
|
||||
this.IdNumberSerial = idNumberSerial;
|
||||
this.DateOfBirth = !string.IsNullOrWhiteSpace(dateOfBirth) ? dateOfBirth.ToGeorgianDateTime() : new();
|
||||
this.IdNumber = idNumber;
|
||||
this.Gender =gender == _0_Framework.Application.Gender.Male? "مرد" : "زن";
|
||||
this.IsAuth = true;
|
||||
Phone = phone;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Company.Domain.empolyerAgg;
|
||||
|
||||
@@ -34,7 +36,7 @@ public interface IEmployerRepository : IRepository<long, Employer>
|
||||
|
||||
List<EmployerViewModel> GetEmployersHasWorkshop();
|
||||
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search,long id);
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id, LegalType? legalType);
|
||||
|
||||
|
||||
#endregion
|
||||
@@ -68,5 +70,5 @@ public interface IEmployerRepository : IRepository<long, Employer>
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
Task<ActionResult<EditEmployerWorkflowRegistration>> GetWorkflowRegistrationForEdit(long employerId, long institutionWorkshopDetailsId);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
@@ -46,8 +47,9 @@ public interface IEmployerApplication
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="legalType"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id);
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id, LegalType? legalType = null);
|
||||
|
||||
#endregion
|
||||
#region NewByHeydari
|
||||
@@ -145,6 +147,7 @@ public interface IEmployerApplication
|
||||
Task<OperationResult> DeleteWorkflowRegistration(long employerId, long institutionWorkshopDetailsId);
|
||||
|
||||
Task<OperationResult<AuthenticateUserViewModel>> AuthenticateEmployer(string nationalCode, string dateOfBirth, string mobile);
|
||||
Task<ActionResult<EditEmployerWorkflowRegistration>> GetWorkflowRegistrationForEdit(long employerId, long institutionWorkshopDetailsId);
|
||||
}
|
||||
|
||||
public class AuthenticateUserViewModel
|
||||
@@ -207,6 +210,11 @@ public class AuthenticateUserViewModel
|
||||
/// </summary>
|
||||
public class CreateEmployerWorkflowRegistration
|
||||
{
|
||||
/// <summary>
|
||||
/// درزمانی که یوزر کارفرمایی رو انتخاب کرد که از قبل ثبت شده است
|
||||
/// این فیلد باید مقدار داشته باشد
|
||||
/// </summary>
|
||||
public long EmployerId { get; set; }
|
||||
/// <summary>
|
||||
/// اطلاعات کارفرمای حقیقی
|
||||
/// </summary>
|
||||
@@ -323,7 +331,9 @@ public class CreateLegalEmployerWorkflowRegistration
|
||||
/// اطلاعات سیستم دولتی
|
||||
/// </summary>
|
||||
public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
|
||||
|
||||
|
||||
public string IdNumberSeri { get; set; }
|
||||
public string IdNumberSerial { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -395,6 +405,9 @@ public class CreateRealEmployerWorkflowRegistration
|
||||
/// شماره تلفن
|
||||
/// </summary>
|
||||
public string Telephone { get; set; }
|
||||
|
||||
public string IdNumberSeri { get; set; }
|
||||
public string IdNumberSerial { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,4 +3,6 @@ namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
public class InstitutionContractWorkshopDetailViewModel
|
||||
{
|
||||
public WorkshopServicesViewModel ServicesViewModel { get; set; }
|
||||
public string WorkshopName { get; set; }
|
||||
public int ArchiveCode { get; set; }
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Application.UID;
|
||||
@@ -13,6 +14,7 @@ using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Identity.Client;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
@@ -42,7 +44,6 @@ public class EmployerApplication : IEmployerApplication
|
||||
}
|
||||
|
||||
|
||||
|
||||
public OperationResult Active(long id)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
@@ -1029,7 +1030,7 @@ public class EmployerApplication : IEmployerApplication
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Api
|
||||
|
||||
public async Task<List<GetEmployerListViewModel>> GetEmployerList(GetEmployerSearchModel searchModel)
|
||||
@@ -1285,9 +1286,10 @@ public class EmployerApplication : IEmployerApplication
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id)
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id,
|
||||
LegalType? legalType = null)
|
||||
{
|
||||
return await _EmployerRepository.GetSelectList(search, id);
|
||||
return await _EmployerRepository.GetSelectList(search, id, legalType);
|
||||
}
|
||||
|
||||
async Task<OperationResult<string>> IEmployerApplication.Remove(long id)
|
||||
@@ -1312,19 +1314,36 @@ public class EmployerApplication : IEmployerApplication
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
var tranasction = await _EmployerRepository.BeginTransactionAsync();
|
||||
OperationResult<Employer> createEmployerResult = command.LegalType switch
|
||||
Employer employer;
|
||||
if (command.EmployerId != 0)
|
||||
{
|
||||
LegalType.Real => await CreateRealEmployerRegistration(command.RealEmployer, command.ContractingPartyId),
|
||||
LegalType.Legal => await CreateLegalEmployerRegistration(command.LegalEmployer, command.ContractingPartyId),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
var employer = createEmployerResult.Data;
|
||||
employer = _EmployerRepository.Get(command.EmployerId);
|
||||
if (employer == null)
|
||||
throw new NotFoundException("کارفرمای مورد نظر یافت نشد");
|
||||
}
|
||||
else
|
||||
{
|
||||
OperationResult<Employer> createEmployerResult = command.LegalType switch
|
||||
{
|
||||
LegalType.Real =>
|
||||
await CreateRealEmployerRegistration(command.RealEmployer, command.ContractingPartyId),
|
||||
LegalType.Legal => await CreateLegalEmployerRegistration(command.LegalEmployer,
|
||||
command.ContractingPartyId),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
employer = createEmployerResult.Data;
|
||||
|
||||
if (!createEmployerResult.IsSuccedded)
|
||||
return operation.Failed(createEmployerResult.Message);
|
||||
if (!createEmployerResult.IsSuccedded)
|
||||
return operation.Failed(createEmployerResult.Message);
|
||||
}
|
||||
|
||||
var workshopDetails =
|
||||
await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(command.InstitutionWorkshopInitialId);
|
||||
await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(command
|
||||
.InstitutionWorkshopInitialId);
|
||||
if (workshopDetails.Employers.Any(x => x.EmployerId == employer.id))
|
||||
{
|
||||
throw new BadRequestException("این کارفرما قبلا در این کارگاه ثبت شده است");
|
||||
}
|
||||
workshopDetails.AddEmployer(employer.id);
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
@@ -1335,7 +1354,7 @@ public class EmployerApplication : IEmployerApplication
|
||||
public async Task<OperationResult> EditWorkflowRegistration(EditEmployerWorkflowRegistration command)
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
|
||||
|
||||
// Get the existing employer
|
||||
var employer = _EmployerRepository.Get(command.EmployerId);
|
||||
if (employer == null)
|
||||
@@ -1364,55 +1383,55 @@ public class EmployerApplication : IEmployerApplication
|
||||
public async Task<OperationResult> DeleteWorkflowRegistration(long employerId, long institutionWorkshopDetailsId)
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
|
||||
|
||||
// Check if employer exists
|
||||
var employer = _EmployerRepository.Get(employerId);
|
||||
if (employer == null)
|
||||
return operation.Failed("کارفرمای مورد نظر یافت نشد");
|
||||
|
||||
|
||||
// Get workshop details
|
||||
var workshopDetails = await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(institutionWorkshopDetailsId);
|
||||
var workshopDetails =
|
||||
await _institutionContractRepository
|
||||
.GetInstitutionWorkshopInitialDetails(institutionWorkshopDetailsId);
|
||||
if (workshopDetails == null)
|
||||
return operation.Failed("جزئیات کارگاه موسسه یافت نشد");
|
||||
|
||||
|
||||
// Find and remove the employer from workshop details
|
||||
var employerDetail = workshopDetails.Employers.FirstOrDefault(e => e.EmployerId == employerId);
|
||||
var employerDetail = workshopDetails
|
||||
.Employers.FirstOrDefault(e => e.EmployerId == employerId);
|
||||
if (employerDetail == null)
|
||||
return operation.Failed("کارفرما در لیست کارگاه یافت نشد");
|
||||
|
||||
|
||||
// Remove the employer from the list
|
||||
workshopDetails.Employers.Remove(employerDetail);
|
||||
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
|
||||
// Delete the employer
|
||||
_EmployerRepository.Remove(employerId);
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
public async Task<OperationResult<AuthenticateUserViewModel>> AuthenticateEmployer(string nationalCode,
|
||||
string dateOfBirth,
|
||||
string mobile)
|
||||
{
|
||||
var op = new OperationResult<AuthenticateUserViewModel>();
|
||||
|
||||
|
||||
var dateOfBirthGr = dateOfBirth.ToGeorgianDateTime();
|
||||
|
||||
|
||||
var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
|
||||
if (isMachMobilAndNationalCode == null)
|
||||
return op.Failed("خطا در سرویس احراز هویت");
|
||||
if (!isMachMobilAndNationalCode.IsMatched)
|
||||
return op.Failed("شماره همراه وارد شده با کد ملی مطابقت ندارد");
|
||||
var apiRespons = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
|
||||
|
||||
|
||||
if (apiRespons == null)
|
||||
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
|
||||
|
||||
if (apiRespons.ResponseContext.Status.Code ==14)
|
||||
|
||||
if (apiRespons.ResponseContext.Status.Code == 14)
|
||||
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
|
||||
|
||||
|
||||
if (apiRespons.ResponseContext.Status.Code != 0)
|
||||
return op.Failed($"{apiRespons.ResponseContext.Status.Message}");
|
||||
|
||||
@@ -1420,6 +1439,7 @@ public class EmployerApplication : IEmployerApplication
|
||||
? apiRespons.IdentificationInformation.NationalId
|
||||
: apiRespons.IdentificationInformation.ShenasnamehNumber;
|
||||
|
||||
|
||||
var res = new AuthenticateUserViewModel()
|
||||
{
|
||||
DateOfBirth = dateOfBirth,
|
||||
@@ -1436,6 +1456,12 @@ public class EmployerApplication : IEmployerApplication
|
||||
return op.Succcedded(res);
|
||||
}
|
||||
|
||||
public Task<ActionResult<EditEmployerWorkflowRegistration>> GetWorkflowRegistrationForEdit(long employerId,
|
||||
long institutionWorkshopDetailsId)
|
||||
{
|
||||
return _EmployerRepository.GetWorkflowRegistrationForEdit(employerId, institutionWorkshopDetailsId);
|
||||
}
|
||||
|
||||
private async Task<OperationResult<Employer>> CreateLegalEmployerRegistration(
|
||||
CreateLegalEmployerWorkflowRegistration command, long contractingPartyId)
|
||||
{
|
||||
@@ -1502,6 +1528,11 @@ public class EmployerApplication : IEmployerApplication
|
||||
command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
|
||||
command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
|
||||
command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
|
||||
if (command.IsAuth)
|
||||
{
|
||||
legalEmployerData.LegalAuthentication(command.CeoFName,command.CeoLName,command.CeoFatherName,
|
||||
command.CeoIdNumber,command.IdNumberSeri,command.IdNumberSerial,command.CeoDateOfBirth,command.Gender,command.PhoneNumber);
|
||||
}
|
||||
|
||||
await _EmployerRepository.CreateAsync(legalEmployerData);
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
@@ -1555,6 +1586,12 @@ public class EmployerApplication : IEmployerApplication
|
||||
command.GovernmentSystemInfo.EServicePassword,
|
||||
command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
|
||||
command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
|
||||
if (command.IsAuth)
|
||||
{
|
||||
employerData.Authentication(command.FName, command.LName, command.FatherName, command.IdNumber,
|
||||
command.IdNumberSeri,
|
||||
command.IdNumberSerial, command.DateOfBirth, command.Gender, command.PhoneNumber);
|
||||
}
|
||||
|
||||
await _EmployerRepository.CreateAsync(employerData);
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
@@ -1664,5 +1701,6 @@ public class EmployerApplication : IEmployerApplication
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -318,7 +318,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
command.DailyCompenseation, command.Obligation,
|
||||
command.TotalAmount, command.ExtensionNo, command.WorkshopManualCount, command.EmployeeManualCount,
|
||||
command.Description, command.OfficialCompany, command.TypeOfContract, command.HasValueAddedTax,
|
||||
command.ValueAddedTax, [],command.LawId);
|
||||
command.ValueAddedTax, [], command.LawId);
|
||||
|
||||
_institutionContractRepository.Create(createContract);
|
||||
_institutionContractRepository.SaveChanges();
|
||||
@@ -1046,7 +1046,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
command.Workshops.Count.ToString(),
|
||||
command.Workshops.Sum(x => x.PersonnelCount).ToString(), command.Description,
|
||||
"NotOfficial", "JobRelation", hasValueAddedTax,
|
||||
command.TaxAmount, workshopDetails,command.LawId);
|
||||
command.TaxAmount, workshopDetails, command.LawId);
|
||||
|
||||
|
||||
FinancialStatment financialStatement;
|
||||
@@ -1139,11 +1139,11 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
if (res.IsSuccedded)
|
||||
CreateContractingPartyAccount(contractingParty.id, res.SendId);
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId);
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
|
||||
await transaction.CommitAsync();
|
||||
return opration.Succcedded();
|
||||
@@ -1153,7 +1153,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList()
|
||||
{
|
||||
@@ -1249,8 +1249,31 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
|
||||
if (institutionContract.VerifyCode != code)
|
||||
return op.Failed("کد وارد شده صحیح نمی باشد");
|
||||
|
||||
var transaction = await _institutionContractRepository.BeginTransactionAsync();
|
||||
institutionContract.SetPendingWorkflow();
|
||||
|
||||
var phone = institutionContract.ContactInfoList.FirstOrDefault(x =>
|
||||
x.SendSms && x.Position == "طرف قرارداد" && x.PhoneType == "شماره همراه");
|
||||
if (phone !=null)
|
||||
{
|
||||
var userPass = contractingParty.IsLegal == "حقیقی"
|
||||
? contractingParty.Nationalcode
|
||||
: contractingParty.NationalId;
|
||||
var createAcc = new RegisterAccount
|
||||
{
|
||||
Fullname = contractingParty.LName,
|
||||
Username = userPass,
|
||||
Password = userPass,
|
||||
Mobile = phone.PhoneNumber,
|
||||
NationalCode = userPass
|
||||
};
|
||||
var res = _accountApplication.RegisterClient(createAcc);
|
||||
if (res.IsSuccedded)
|
||||
CreateContractingPartyAccount(contractingParty.id, res.SendId);
|
||||
}
|
||||
|
||||
await transaction.CommitAsync();
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
return op.Succcedded();
|
||||
}
|
||||
@@ -1259,6 +1282,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
{
|
||||
var details = await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(workshopDetailsId);
|
||||
var services = details.Services;
|
||||
var newArchiveCode = _workshopRepository.GetLastArchiveCode() + 1;
|
||||
|
||||
var res = new InstitutionContractWorkshopDetailViewModel()
|
||||
{
|
||||
@@ -1271,7 +1295,9 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
InsuranceInPerson = services.InsuranceInPerson,
|
||||
RollCall = services.RollCall,
|
||||
RollCallInPerson = services.RollCallInPerson
|
||||
}
|
||||
},
|
||||
WorkshopName = details.WorkshopName,
|
||||
ArchiveCode = newArchiveCode
|
||||
};
|
||||
return res;
|
||||
}
|
||||
@@ -1287,12 +1313,14 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return await _institutionContractRepository.GetExtensionWorkshops(request);
|
||||
}
|
||||
|
||||
public async Task<InstitutionContractExtensionPlanResponse> GetExtensionInstitutionPlan(InstitutionContractExtensionPlanRequest request)
|
||||
public async Task<InstitutionContractExtensionPlanResponse> GetExtensionInstitutionPlan(
|
||||
InstitutionContractExtensionPlanRequest request)
|
||||
{
|
||||
return await _institutionContractRepository.GetExtensionInstitutionPlan(request);
|
||||
}
|
||||
|
||||
public async Task<InstitutionContractExtensionPaymentResponse> GetExtensionPaymentMethod(InstitutionContractExtensionPaymentRequest request)
|
||||
public async Task<InstitutionContractExtensionPaymentResponse> GetExtensionPaymentMethod(
|
||||
InstitutionContractExtensionPaymentRequest request)
|
||||
{
|
||||
return await _institutionContractRepository.GetExtensionPaymentMethod(request);
|
||||
}
|
||||
@@ -1347,8 +1375,8 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
|
||||
if (request.IsAuth)
|
||||
{
|
||||
legalContractingParty.LegalAuthentication(request.FName,request.LName,request.FatherName,
|
||||
request.IdNumber,null,null,request.BirthDateFa,request.Gender,request.PhoneNumber);
|
||||
legalContractingParty.LegalAuthentication(request.FName, request.LName, request.FatherName,
|
||||
request.IdNumber, null, null, request.BirthDateFa, request.Gender, request.PhoneNumber);
|
||||
}
|
||||
|
||||
await _contractingPartyRepository.CreateAsync(legalContractingParty);
|
||||
@@ -1393,7 +1421,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
if (request.IsAuth)
|
||||
{
|
||||
personalContractingParty.Authentication(request.FName, request.LName, request.FatherName,
|
||||
request.IdNumber, null,null, request.BirthDateFa, request.Gender,request.PhoneNumber);
|
||||
request.IdNumber, null, null, request.BirthDateFa, request.Gender, request.PhoneNumber);
|
||||
}
|
||||
|
||||
await _contractingPartyRepository.CreateAsync(personalContractingParty);
|
||||
@@ -1510,4 +1538,4 @@ public class WorkshopsAndEmployeeViewModel
|
||||
public int ArchiveCode { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
@@ -1048,7 +1048,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
|
||||
var institutionContract =
|
||||
await _institutionContractRepository.GetIncludeWorkshopDetailsAsync(contractWorkshopInitial
|
||||
.InstitutionContractId);
|
||||
.WorkshopGroup.InstitutionContractId);
|
||||
if (institutionContract == null)
|
||||
{
|
||||
return operation.Failed("قرارداد مالی موسسه یافت نشد");
|
||||
|
||||
10971
CompanyManagment.EFCore/Migrations/20251014082438_add authenticate columns to employer.Designer.cs
generated
Normal file
10971
CompanyManagment.EFCore/Migrations/20251014082438_add authenticate columns to employer.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,49 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addauthenticatecolumnstoemployer : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "IdNumberSeri",
|
||||
table: "Employers",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "IdNumberSerial",
|
||||
table: "Employers",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsAuth",
|
||||
table: "Employers",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IdNumberSeri",
|
||||
table: "Employers");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IdNumberSerial",
|
||||
table: "Employers");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsAuth",
|
||||
table: "Employers");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6779,9 +6779,18 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("IdNumberSeri")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("IdNumberSerial")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsAuth")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("IsLegal")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -266,8 +266,6 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
|
||||
public async Task<FinancialStatmentDetailsByContractingPartyViewModel> GetDetailsByContractingParty(long contractingPartyId,FinancialStatementSearchModel searchModel)
|
||||
{
|
||||
|
||||
|
||||
var financialStatement = await _context.FinancialStatments
|
||||
.Include(x=>x.FinancialTransactionList)
|
||||
.FirstOrDefaultAsync(x=>x.ContractingPartyId == contractingPartyId);
|
||||
@@ -323,6 +321,70 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
}
|
||||
#endregion
|
||||
double balance = 0;
|
||||
// var list = financialStatement.FinancialTransactionList.Select(t =>
|
||||
// {
|
||||
// if (!searched)
|
||||
// {
|
||||
// if (t.TypeOfTransaction == "debt")
|
||||
// {
|
||||
// balance += t.Deptor;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// balance -= t.Creditor;
|
||||
// }
|
||||
// }
|
||||
// return new FinancialTransactionDetailViewModel()
|
||||
// {
|
||||
// Id = t.id,
|
||||
// DateTimeGr = t.TdateGr,
|
||||
// DateFa = t.TdateGr.ToFarsi(),
|
||||
// TimeFa = $"{t.TdateGr:HH:mm}",
|
||||
// Description = t.DescriptionOption + " " + t.Description,
|
||||
// Debtor = t.Deptor,
|
||||
// Creditor = t.Creditor,
|
||||
// Balance = balance,
|
||||
// Type = t.TypeOfTransaction == "debt"
|
||||
// ? FinancialTransactionType.Debt
|
||||
// : FinancialTransactionType.Credit,
|
||||
// TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد"
|
||||
// };
|
||||
// }).OrderByDescending(t => t.DateTimeGr).ToList();
|
||||
|
||||
|
||||
var list = new List<FinancialTransactionDetailViewModel>();
|
||||
foreach (var financialTransaction in financialStatement.FinancialTransactionList.OrderBy(t=>t.TdateGr))
|
||||
{
|
||||
if (!searched)
|
||||
{
|
||||
if (financialTransaction.TypeOfTransaction == "debt")
|
||||
{
|
||||
balance += financialTransaction.Deptor;
|
||||
}
|
||||
else
|
||||
{
|
||||
balance -= financialTransaction.Creditor;
|
||||
}
|
||||
}
|
||||
var item = new FinancialTransactionDetailViewModel()
|
||||
{
|
||||
Id = financialTransaction.id,
|
||||
DateTimeGr = financialTransaction.TdateGr,
|
||||
DateFa = financialTransaction.TdateGr.ToFarsi(),
|
||||
TimeFa = $"{financialTransaction.TdateGr:HH:mm}",
|
||||
Description = financialTransaction.DescriptionOption + " " + financialTransaction.Description,
|
||||
Debtor = financialTransaction.Deptor,
|
||||
Creditor = financialTransaction.Creditor,
|
||||
Balance = balance,
|
||||
Type = financialTransaction.TypeOfTransaction == "debt"
|
||||
? FinancialTransactionType.Debt
|
||||
: FinancialTransactionType.Credit,
|
||||
TypeStr = financialTransaction.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد"
|
||||
};
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
|
||||
var res = new FinancialStatmentDetailsByContractingPartyViewModel()
|
||||
{
|
||||
Id = financialStatement.id,
|
||||
@@ -330,35 +392,7 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
TotalCredit = financialStatement.FinancialTransactionList.Sum(x => x.Creditor),
|
||||
TotalDebt = financialStatement.FinancialTransactionList.Sum(x => x.Deptor),
|
||||
ContractingPartyName = financialStatement.ContractingPartyName,
|
||||
List = financialStatement.FinancialTransactionList.Select(t =>
|
||||
{
|
||||
if (!searched)
|
||||
{
|
||||
if (t.TypeOfTransaction == "debt")
|
||||
{
|
||||
balance += t.Deptor;
|
||||
}
|
||||
else
|
||||
{
|
||||
balance -= t.Creditor;
|
||||
}
|
||||
}
|
||||
return new FinancialTransactionDetailViewModel()
|
||||
{
|
||||
Id = t.id,
|
||||
DateTimeGr = t.TdateGr,
|
||||
DateFa = t.TdateGr.ToFarsi(),
|
||||
TimeFa = $"{t.TdateGr:HH:mm}",
|
||||
Description = t.DescriptionOption + " " + t.Description,
|
||||
Debtor = t.Deptor,
|
||||
Creditor = t.Creditor,
|
||||
Balance = balance,
|
||||
Type = t.TypeOfTransaction == "debt"
|
||||
? FinancialTransactionType.Debt
|
||||
: FinancialTransactionType.Credit,
|
||||
TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد"
|
||||
};
|
||||
}).OrderByDescending(t => t.DateTimeGr).ToList(),
|
||||
List = list.OrderByDescending(x=>x.DateTimeGr).ToList(),
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1820,7 +1820,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
public async Task<InstitutionContract> GetByPublicIdAsync(Guid id)
|
||||
{
|
||||
return await _context.InstitutionContractSet.FirstOrDefaultAsync(x => x.PublicId == id);
|
||||
return await _context.InstitutionContractSet.Include(x=>x.ContactInfoList).FirstOrDefaultAsync(x => x.PublicId == id);
|
||||
}
|
||||
|
||||
public async Task<InstitutionContractExtensionInquiryResult> GetExtensionInquiry(long previousContractId)
|
||||
|
||||
@@ -1181,6 +1181,33 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
|
||||
return list.DistinctBy(x => x.Id).ToList();
|
||||
}
|
||||
|
||||
public int GetLastArchiveCode()
|
||||
{
|
||||
var archiveCodes = _context.Workshops
|
||||
.Where(x => !string.IsNullOrEmpty(x.ArchiveCode))
|
||||
.Select(x => x.ArchiveCode)
|
||||
.ToList();
|
||||
|
||||
int maxArchiveCode = 0;
|
||||
|
||||
foreach (var code in archiveCodes)
|
||||
{
|
||||
// Remove "b-" prefix if exists
|
||||
string cleanCode = code.StartsWith("b-") ? code.Substring(2) : code;
|
||||
|
||||
// Try to parse the clean code to an integer
|
||||
if (int.TryParse(cleanCode, out int codeValue))
|
||||
{
|
||||
if (codeValue > maxArchiveCode)
|
||||
{
|
||||
maxArchiveCode = codeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return maxArchiveCode;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region NewByHeydari
|
||||
//public List<WorkshopViewModel> GetWorkshopByWorkshopIds(List<long> workshopIds)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
@@ -115,9 +116,9 @@ public class EmployerController : AdminBaseController
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select_list")]
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id)
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id,LegalType? legalType=null)
|
||||
{
|
||||
return await _employerApplication.GetSelectList(search, id);
|
||||
return await _employerApplication.GetSelectList(search, id,legalType);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -79,6 +79,13 @@ namespace ServiceHost.Areas.Admin.Controllers
|
||||
return result;
|
||||
}
|
||||
[HttpGet("edit-employer/{employerId}/{institutionWorkshopDetailsId}")]
|
||||
|
||||
public async Task<ActionResult<EditEmployerWorkflowRegistration>> GetEmployerForEdit(long employerId, long institutionWorkshopDetailsId)
|
||||
{
|
||||
var result = await _employerApplication.GetWorkflowRegistrationForEdit(employerId, institutionWorkshopDetailsId);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// حذف کارفرما از گردش کار ثبت نام
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user