diff --git a/.github/workflows/dotnet-developPublish.yml b/.github/workflows/dotnet-developPublish.yml
index a594b21a..aace164d 100644
--- a/.github/workflows/dotnet-developPublish.yml
+++ b/.github/workflows/dotnet-developPublish.yml
@@ -37,7 +37,7 @@ jobs:
& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
-verb:sync `
-source:contentPath="$publishFolder" `
- -dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName=".\deployuser",password="R2rNpdnetP3j>q5b18",authType="Basic" `
+ -dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName="Administrator",password="R2rNpdnetP3j>q5b18",authType="Basic" `
-allowUntrusted `
-enableRule:AppOffline
diff --git a/0_Framework/0_Framework.csproj b/0_Framework/0_Framework.csproj
index 1de86aff..54b62986 100644
--- a/0_Framework/0_Framework.csproj
+++ b/0_Framework/0_Framework.csproj
@@ -21,4 +21,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/0_Framework/Application/AppSettingConfiguration.cs b/0_Framework/Application/AppSettingConfiguration.cs
index 414949f1..127f11d5 100644
--- a/0_Framework/Application/AppSettingConfiguration.cs
+++ b/0_Framework/Application/AppSettingConfiguration.cs
@@ -3,4 +3,6 @@
public class AppSettingConfiguration
{
public string Domain { get; set; }
+ public string ClientDomain =>"client"+Domain;
+ public string AdminDomain =>"admin"+Domain;
}
\ No newline at end of file
diff --git a/0_Framework/Application/Sms/ISmsService.cs b/0_Framework/Application/Sms/ISmsService.cs
index 36a38030..743b18e4 100644
--- a/0_Framework/Application/Sms/ISmsService.cs
+++ b/0_Framework/Application/Sms/ISmsService.cs
@@ -26,6 +26,10 @@ public interface ISmsService
#region Mahan
Task GetCreditAmount();
+
+ public Task SendInstitutionVerificationLink(string number,string fullName, Guid institutionId);
+
+ public Task SendInstitutionVerificationCode(string number, string code);
#endregion
diff --git a/0_Framework/Application/Sms/OtpResultViewModel.cs b/0_Framework/Application/Sms/OtpResultViewModel.cs
new file mode 100644
index 00000000..ea85d622
--- /dev/null
+++ b/0_Framework/Application/Sms/OtpResultViewModel.cs
@@ -0,0 +1,7 @@
+namespace _0_Framework.Application.Sms;
+
+public class OtpResultViewModel
+{
+ public int ExpireTimeSec { get; set; }
+ public int ReSendTimeSec { get; set; }
+}
\ No newline at end of file
diff --git a/0_Framework/Application/Sms/SmsService.cs b/0_Framework/Application/Sms/SmsService.cs
index 9513791c..68207ff0 100644
--- a/0_Framework/Application/Sms/SmsService.cs
+++ b/0_Framework/Application/Sms/SmsService.cs
@@ -331,7 +331,28 @@ public class SmsService : ISmsService
}
}
+ public async Task SendInstitutionVerificationLink(string number,string fullName, Guid institutionId)
+ {
+ var guidStr=institutionId.ToString();
+ var firstPart = guidStr.Substring(0, 15);
+ var secondPart = guidStr.Substring(15);
+ var verificationSendResult =await SmsIr.VerifySendAsync(number, 527519, new VerifySendParameter[]
+ {
+ new("FULLNAME", fullName),
+ new("CODE1",firstPart),
+ new("CODE2",secondPart)
+ });
+ return verificationSendResult.Status == 0;
+ }
+ public async Task SendInstitutionVerificationCode(string number, string code)
+ {
+ var verificationSendResult =await SmsIr.VerifySendAsync(number, 965348, new VerifySendParameter[]
+ {
+ new("VERIFYCODE", code)
+ });
+ return verificationSendResult.Status == 0;
+ }
#endregion
}
diff --git a/0_Framework/Application/UID/UidService.cs b/0_Framework/Application/UID/UidService.cs
deleted file mode 100644
index ccf3c0ef..00000000
--- a/0_Framework/Application/UID/UidService.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System;
-using System.Net.Http;
-using System.Net.Http.Json;
-using System.Text;
-using System.Text.Json;
-using System.Threading.Tasks;
-using Newtonsoft.Json;
-
-namespace _0_Framework.Application.UID;
-
-public class UidService : IUidService
-{
- private readonly HttpClient _httpClient;
- private const string BaseUrl = "https://json-api.uid.ir/api/inquiry/";
-
- public UidService()
- {
- _httpClient = new HttpClient()
- {
- BaseAddress = new Uri(BaseUrl)
- };
- }
-
- public async Task GetPersonalInfo(string nationalCode, string birthDate)
- {
- var request = new PersonalInfoRequest
- {
- BirthDate = birthDate,
- NationalId = nationalCode,
- RequestContext = new UidRequestContext()
- };
- var json = JsonConvert.SerializeObject(request);
- var contentType = new StringContent(json, Encoding.UTF8, "application/json");
-
- try
- {
- var requestResult = await _httpClient.PostAsync("person/v2", contentType);
- if (!requestResult.IsSuccessStatusCode)
- return null;
- var responseResult = await requestResult.Content.ReadFromJsonAsync();
- if (responseResult.BasicInformation != null)
- {
- responseResult.BasicInformation.FirstName = responseResult.BasicInformation.FirstName?.ToPersian();
- responseResult.BasicInformation.LastName = responseResult.BasicInformation.LastName?.ToPersian();
- responseResult.BasicInformation.FatherName = responseResult.BasicInformation.FatherName?.ToPersian();
- }
-
- return responseResult;
- }
- catch
- {
-
- return new PersonalInfoResponse(new UidBasicInformation(),
- new IdentificationInformation(default, default, default, default, default), new RegistrationStatus(),
- new ResponseContext(new UidStatus(14, "")));
- }
-
- }
-
-
- public async Task IsMachPhoneWithNationalCode(string nationalCode, string phoneNumber)
- {
- var request = new PersonalInfoRequest
- {
- MobileNumber = phoneNumber,
- NationalId = nationalCode,
- RequestContext = new UidRequestContext()
- };
- var json = JsonConvert.SerializeObject(request);
- var contentType = new StringContent(json, Encoding.UTF8, "application/json");
-
- var requestResult = await _httpClient.PostAsync("mobile/owner/v2", contentType);
- if (!requestResult.IsSuccessStatusCode)
- return null;
-
- var responseResult = await requestResult.Content.ReadFromJsonAsync();
- return responseResult;
- }
-}
\ No newline at end of file
diff --git a/0_Framework/Exceptions/BadRequestException.cs b/0_Framework/Exceptions/BadRequestException.cs
index ac8324b7..7a85e96f 100644
--- a/0_Framework/Exceptions/BadRequestException.cs
+++ b/0_Framework/Exceptions/BadRequestException.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
namespace _0_Framework.Exceptions;
@@ -14,5 +15,13 @@ public class BadRequestException:Exception
Details = details;
}
+ public BadRequestException(string message, Dictionary extra) :
+ base(message)
+ {
+ Extra = extra;
+ }
+
public string Details { get; }
+ public Dictionary Extra { get; set; }
+
}
\ No newline at end of file
diff --git a/0_Framework/Exceptions/Handler/CustomExceptionHandler.cs b/0_Framework/Exceptions/Handler/CustomExceptionHandler.cs
index a3a8fc4c..e6fd9da1 100644
--- a/0_Framework/Exceptions/Handler/CustomExceptionHandler.cs
+++ b/0_Framework/Exceptions/Handler/CustomExceptionHandler.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Diagnostics;
@@ -24,37 +25,42 @@ public class CustomExceptionHandler : IExceptionHandler
"Error Message: {exceptionMessage}, Time of occurrence {time}",
exception.Message, DateTime.UtcNow);
- (string Detail, string Title, int StatusCode) details = exception switch
+ (string Detail, string Title, int StatusCode, Dictionary? Extra) details = exception switch
{
InternalServerException =>
(
exception.Message,
exception.GetType().Name,
- context.Response.StatusCode = StatusCodes.Status500InternalServerError
+ context.Response.StatusCode = StatusCodes.Status500InternalServerError,
+ null
),
- BadRequestException =>
+ BadRequestException bre =>
(
exception.Message,
exception.GetType().Name,
- context.Response.StatusCode = StatusCodes.Status400BadRequest
+ context.Response.StatusCode = StatusCodes.Status400BadRequest,
+ bre.Extra
),
NotFoundException =>
(
exception.Message,
exception.GetType().Name,
- context.Response.StatusCode = StatusCodes.Status404NotFound
+ context.Response.StatusCode = StatusCodes.Status404NotFound,
+ null
),
UnAuthorizeException =>
(
exception.Message,
exception.GetType().Name,
- context.Response.StatusCode = StatusCodes.Status401Unauthorized
+ context.Response.StatusCode = StatusCodes.Status401Unauthorized,
+ null
),
_ =>
(
exception.Message,
exception.GetType().Name,
- context.Response.StatusCode = StatusCodes.Status500InternalServerError
+ context.Response.StatusCode = StatusCodes.Status500InternalServerError,
+ null
)
};
@@ -63,9 +69,12 @@ public class CustomExceptionHandler : IExceptionHandler
Title = details.Title,
Detail = details.Detail,
Status = details.StatusCode,
- Instance = context.Request.Path
+ Instance = context.Request.Path,
+ Extensions = details.Extra ?? new Dictionary()
};
+
+
problemDetails.Extensions.Add("traceId", context.TraceIdentifier);
await context.Response.WriteAsJsonAsync(problemDetails, cancellationToken: cancellationToken);
diff --git a/0_Framework/InfraStructure/Mongo/MongoDbConfig.cs b/0_Framework/InfraStructure/Mongo/MongoDbConfig.cs
new file mode 100644
index 00000000..bcb351bd
--- /dev/null
+++ b/0_Framework/InfraStructure/Mongo/MongoDbConfig.cs
@@ -0,0 +1,8 @@
+namespace _0_Framework.InfraStructure.Mongo;
+
+public class MongoDbConfig
+{
+ public string ConnectionString { get; set; } = null!;
+
+ public string DatabaseName { get; set; } = null!;
+}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Account/IAccountApplication.cs b/AccountManagement.Application.Contracts/Account/IAccountApplication.cs
index 89f9693a..3c31d726 100644
--- a/AccountManagement.Application.Contracts/Account/IAccountApplication.cs
+++ b/AccountManagement.Application.Contracts/Account/IAccountApplication.cs
@@ -64,4 +64,6 @@ public interface IAccountApplication
///
///
public bool CheckExistClientAccount(string userName);
+ List GetAdminAccountsNew();
+
}
\ No newline at end of file
diff --git a/AccountManagement.Application/AccountApplication.cs b/AccountManagement.Application/AccountApplication.cs
index ff4e5a25..4204be40 100644
--- a/AccountManagement.Application/AccountApplication.cs
+++ b/AccountManagement.Application/AccountApplication.cs
@@ -799,4 +799,8 @@ public class AccountApplication : IAccountApplication
return _accountRepository.CheckExistClientAccount(userName);
}
+ public List GetAdminAccountsNew()
+ {
+ return _accountRepository.GetAdminAccountsNew();
+ }
}
\ No newline at end of file
diff --git a/Company.Domain/AuthorizedPersonAgg/AuthorizedPerson.cs b/Company.Domain/AuthorizedPersonAgg/AuthorizedPerson.cs
new file mode 100644
index 00000000..93819400
--- /dev/null
+++ b/Company.Domain/AuthorizedPersonAgg/AuthorizedPerson.cs
@@ -0,0 +1,51 @@
+using System;
+using _0_Framework.Domain;
+
+namespace Company.Domain.AuthorizedPersonAgg;
+
+public class AuthorizedPerson : EntityBase
+{
+ public string NationalCode { get; private set; }
+ public string FirstName { get; private set; }
+ public string LastName { get; private set; }
+ public string FatherName { get; private set; }
+ public string BirthDate { get; private set; }
+ public string Gender { get; private set; }
+ public string DeathStatus { get; private set; }
+ public string ShenasnameSeri { get; private set; }
+ public string ShenasnameSerial { get; private set; }
+ public string ShenasnamehNumber { get; private set; }
+ public bool IsVerified { get; private set; }
+ public DateTime? VerificationDate { get; private set; }
+
+ public AuthorizedPerson(string nationalCode, string firstName, string lastName, string fatherName,
+ string birthDate, string gender, string deathStatus, string shenasnameSeri,
+ string shenasnameSerial, string shenasnamehNumber)
+ {
+ NationalCode = nationalCode;
+ FirstName = firstName;
+ LastName = lastName;
+ FatherName = fatherName;
+ BirthDate = birthDate;
+ Gender = gender;
+ DeathStatus = deathStatus;
+ ShenasnameSeri = shenasnameSeri;
+ ShenasnameSerial = shenasnameSerial;
+ ShenasnamehNumber = shenasnamehNumber;
+ IsVerified = true;
+ VerificationDate = DateTime.Now;
+ }
+
+ public void UpdatePersonalInfo(string firstName, string lastName, string fatherName,
+ string gender, string deathStatus)
+ {
+ FirstName = firstName;
+ LastName = lastName;
+ FatherName = fatherName;
+ Gender = gender;
+ DeathStatus = deathStatus;
+ VerificationDate = DateTime.Now;
+ }
+
+ protected AuthorizedPerson() { }
+}
diff --git a/Company.Domain/AuthorizedPersonAgg/IAuthorizedPersonRepository.cs b/Company.Domain/AuthorizedPersonAgg/IAuthorizedPersonRepository.cs
new file mode 100644
index 00000000..2157150a
--- /dev/null
+++ b/Company.Domain/AuthorizedPersonAgg/IAuthorizedPersonRepository.cs
@@ -0,0 +1,9 @@
+using _0_Framework.Domain;
+
+namespace Company.Domain.AuthorizedPersonAgg;
+
+public interface IAuthorizedPersonRepository : IRepository
+{
+ AuthorizedPerson GetByNationalCode(string nationalCode);
+ bool ExistsByNationalCode(string nationalCode);
+}
diff --git a/Company.Domain/Company.Domain.csproj b/Company.Domain/Company.Domain.csproj
index 76106517..09e112b7 100644
--- a/Company.Domain/Company.Domain.csproj
+++ b/Company.Domain/Company.Domain.csproj
@@ -18,4 +18,8 @@
+
+
+
+
diff --git a/Company.Domain/ContarctingPartyAgg/IPersonalContractingPartyRepository.cs b/Company.Domain/ContarctingPartyAgg/IPersonalContractingPartyRepository.cs
index d76c5fd4..26e6e6df 100644
--- a/Company.Domain/ContarctingPartyAgg/IPersonalContractingPartyRepository.cs
+++ b/Company.Domain/ContarctingPartyAgg/IPersonalContractingPartyRepository.cs
@@ -15,7 +15,7 @@ public interface IPersonalContractingPartyRepository :IRepository Search(PersonalContractingPartySearchModel searchModel2);
- int GetLastArchiveCode();
+ int GetLastNewArchiveCode();
#region Mahan
List SearchByName(string name);
@@ -74,4 +74,6 @@ public interface IPersonalContractingPartyRepository :IRepository GetRealDetails(long id);
Task GetLegalDetails(long id);
+ Task GetByNationalCode(string nationalCode);
+ Task GetByRegisterId(string registerId);
}
\ No newline at end of file
diff --git a/Company.Domain/ContarctingPartyAgg/PersonalContractingParty.cs b/Company.Domain/ContarctingPartyAgg/PersonalContractingParty.cs
index d2dc26bf..abe676c0 100644
--- a/Company.Domain/ContarctingPartyAgg/PersonalContractingParty.cs
+++ b/Company.Domain/ContarctingPartyAgg/PersonalContractingParty.cs
@@ -73,12 +73,27 @@ public class PersonalContractingParty : EntityBase
/// آیا از طریق ای پی ای احراز هویت شده است
///
public bool IsAuthenticated { get; private set; }
-
-
+
///
/// جنسیت
///
public Gender Gender { get; private set; }
+
+ ///
+ /// سمت و صاحب امضاء اوراق (فقط برای طرف حقوقی)
+ ///
+ public string LegalPosition { get; private set; }
+
+ ///
+ /// نام مدیر عامل (فقط برای طرف حقوقی)
+ ///
+ public string CeoFName { get; private set; }
+
+ ///
+ /// نام خانوادگی مدیر عامل (فقط برای طرف حقوقی)
+ ///
+ public string CeoLName { get; private set; }
+
#endregion
@@ -94,7 +109,8 @@ public class PersonalContractingParty : EntityBase
public PersonalContractingParty(string fName, string lName, string nationalcode, string idNumber,
/*string legalName,*/ string registerId, string nationalId, string isLegal,
string phone, string agentPhone, string address,long representativeId,
- string representativeFullName, int archiveCode, string state,string city, string zone, string sureName)
+ string representativeFullName, int archiveCode, string state,string city,
+ string zone, string sureName,string ceoFName,string ceoLName,string legalPosition=null)
{
FName = fName;
@@ -120,8 +136,9 @@ public class PersonalContractingParty : EntityBase
IsActiveString = "true";
IsBlock = "false";
BlockTimes = 0;
-
-
+ LegalPosition = legalPosition;
+ CeoFName = ceoFName;
+ CeoLName = ceoLName;
}
@@ -151,7 +168,7 @@ public class PersonalContractingParty : EntityBase
}
public void EditLegal(string lName, string registerId, string nationalId, string phone, string agentPhone, string address, long representativeId, string representativeFullName, int archiveCode,
- string state, string city, string zone, string sureName)
+ string state, string city, string zone, string sureName,string legalPosition = null)
{
LName = lName;
@@ -168,6 +185,8 @@ public class PersonalContractingParty : EntityBase
State = state;
City = city;
Zone = zone;
+ if (legalPosition != null)
+ LegalPosition = legalPosition;
}
@@ -203,7 +222,8 @@ public class PersonalContractingParty : EntityBase
IsAuthenticated = true;
}
- public void Authentication(string fName, string lName, string fatherName,string idNumber, string idNumberSeri, string idNumberSerial, string dateOfBirth, Gender gender)
+ 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;
@@ -214,6 +234,22 @@ public class PersonalContractingParty : EntityBase
this.IdNumber = idNumber;
this.Gender = gender;
this.IsAuthenticated = true;
+ Phone = phone;
+ }
+
+ public void LegalAuthentication(string fName, string lName, string fatherName,string idNumber, string idNumberSeri,
+ string idNumberSerial, string dateOfBirth, Gender gender,string phone)
+ {
+ CeoFName = fName;
+ CeoLName = lName;
+ this.FatherName = fatherName;
+ this.IdNumberSeri = idNumberSeri;
+ this.IdNumberSerial = idNumberSerial;
+ this.DateOfBirth = !string.IsNullOrWhiteSpace(dateOfBirth) ? dateOfBirth.ToGeorgianDateTime() : null;
+ this.IdNumber = idNumber;
+ this.Gender = gender;
+ this.IsAuthenticated = true;
+ Phone = phone;
}
public void RegisterComplete(string fatherName, string idNumberSeri, string idNumberSerial, DateTime dateOfBirth, Gender gender)
diff --git a/Company.Domain/FinancialStatmentAgg/FinancialStatment.cs b/Company.Domain/FinancialStatmentAgg/FinancialStatment.cs
index bd6f6858..bae877fb 100644
--- a/Company.Domain/FinancialStatmentAgg/FinancialStatment.cs
+++ b/Company.Domain/FinancialStatmentAgg/FinancialStatment.cs
@@ -17,6 +17,7 @@ public class FinancialStatment : EntityBase
ContractingPartyId = contractingPartyId;
ContractingPartyName = contractingPartyName;
PublicId = Guid.NewGuid();
+ FinancialTransactionList = [];
}
public FinancialStatment()
@@ -37,4 +38,12 @@ public class FinancialStatment : EntityBase
{
PublicId = Guid.NewGuid();
}
+
+ public void AddFinancialTransaction(FinancialTransaction financialTransaction)
+ {
+ if (financialTransaction == null)
+ throw new ArgumentNullException(nameof(financialTransaction));
+ FinancialTransactionList.Add(financialTransaction);
+ }
+
}
\ No newline at end of file
diff --git a/Company.Domain/FinancialStatmentAgg/IFinancialStatmentRepository.cs b/Company.Domain/FinancialStatmentAgg/IFinancialStatmentRepository.cs
index 859f9a35..60a1d8f6 100644
--- a/Company.Domain/FinancialStatmentAgg/IFinancialStatmentRepository.cs
+++ b/Company.Domain/FinancialStatmentAgg/IFinancialStatmentRepository.cs
@@ -23,4 +23,5 @@ public interface IFinancialStatmentRepository : IRepository GetBalanceAmount(long id);
Task GetClientDebtAmount(long accountId);
Task GetDetailsByContractingParty(long contractingPartyId,FinancialStatementSearchModel searchModel);
+ Task GetByContractingPartyId(long contractingPartyId);
}
\ No newline at end of file
diff --git a/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs b/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs
index fe1bef23..ecc07005 100644
--- a/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs
+++ b/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs
@@ -47,4 +47,16 @@ public interface IInstitutionContractRepository : IRepository> GetList(InstitutionContractListSearchModel searchModel);
Task GetListStats(InstitutionContractListSearchModel searchModel);
+ Task> RegistrationWorkflowMainList();
+ Task> RegistrationWorkflowItems(long institutionContractId);
+ Task GetInstitutionWorkshopInitialDetails(long institutionWorkshopInitialId);
+ Task GetIncludeWorkshopDetailsAsync(long institutionContractId);
+ void UpdateStatusIfNeeded(long institutionContractId);
+ Task GetVerificationDetails(Guid id);
+ Task GetByPublicIdAsync(Guid id);
+ Task GetExtensionInquiry(long previousContractId);
+ Task GetExtensionWorkshops(InstitutionContractExtensionWorkshopsRequest request);
+ Task GetExtensionInstitutionPlan(InstitutionContractExtensionPlanRequest request);
+ Task GetExtensionPaymentMethod(InstitutionContractExtensionPaymentRequest request);
+ Task ExtensionComplete(InstitutionContractExtensionCompleteRequest request);
}
\ No newline at end of file
diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContract.cs b/Company.Domain/InstitutionContractAgg/InstitutionContract.cs
index 95a30277..735976a8 100644
--- a/Company.Domain/InstitutionContractAgg/InstitutionContract.cs
+++ b/Company.Domain/InstitutionContractAgg/InstitutionContract.cs
@@ -1,17 +1,23 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Security.Cryptography;
using _0_Framework.Domain;
using Company.Domain.InstitutionContractContactInfoAgg;
+using CompanyManagment.App.Contracts.InstitutionContract;
namespace Company.Domain.InstitutionContractAgg;
public class InstitutionContract : EntityBase
{
- public InstitutionContract(string contractNo, long representativeId, string representativeName, long contractingPartyId,
+ public InstitutionContract(string contractNo, long representativeId, string representativeName,
+ long contractingPartyId,
string contractingPartyName, DateTime contractDateGr, string contractDateFa, string state, string city,
string address, DateTime contractStartGr, string contractStartFa, DateTime contractEndGr,
string contractEndFa, double contractAmount, double dailyCompenseation, double obligation,
- double totalAmount, int extensionNo, string workshopManualCount, string employeeManualCount, string description, string officialCompany,string typeOfcontract, string hasValueAddedTax, double valueAddedTax)
+ double totalAmount, int extensionNo, string workshopManualCount, string employeeManualCount, string description,
+ string officialCompany, string typeOfcontract, string hasValueAddedTax, double valueAddedTax,
+ List workshopDetails)
{
ContractNo = contractNo;
RepresentativeId = representativeId;
@@ -43,67 +49,121 @@ public class InstitutionContract : EntityBase
TypeOfContract = typeOfcontract;
HasValueAddedTax = hasValueAddedTax;
ValueAddedTax = valueAddedTax;
+ VerificationStatus = InstitutionContractVerificationStatus.PendingForVerify;
+ ContactInfoList = [];
+ Installments = [];
+ WorkshopGroup = new InstitutionContractWorkshopGroup(id, workshopDetails);
+ PublicId = Guid.NewGuid();
}
public string ContractNo { get; private set; }
public long RepresentativeId { get; private set; }
+
public string RepresentativeName { get; private set; }
+
public long ContractingPartyId { get; private set; }
+
public string ContractingPartyName { get; private set; }
+
public DateTime ContractDateGr { get; private set; }
+
public string ContractDateFa { get; private set; }
+
public string State { get; private set; }
+
public string City { get; private set; }
+
public string Address { get; private set; }
+
//public long ContactInfoId { get; private set; }
public DateTime ContractStartGr { get; private set; }
+
public string ContractStartFa { get; private set; }
+
public DateTime ContractEndGr { get; private set; }
+
public string ContractEndFa { get; private set; }
-
+
// مبلغ قرارداد
public double ContractAmount { get; private set; }
-
+
//خسارت روزانه
public double DailyCompenseation { get; private set; }
//وجه التزام
public double Obligation { get; private set; }
+
// مبلغ کل قرارداد
public double TotalAmount { get; private set; }
+
public string WorkshopManualCount { get; private set; }
+
public string EmployeeManualCount { get; private set; }
+
public string IsActiveString { get; private set; }
+
public int ExtensionNo { get; private set; }
+
public string Description { get; private set; }
+
public string Signature { get; private set; }
+
public string OfficialCompany { get; private set; }
+
public string TypeOfContract { get; private set; }
- public string HasValueAddedTax { get; set; }
- public double ValueAddedTax { get; set; }
+
+ public string HasValueAddedTax { get; private set; }
+
+ public double ValueAddedTax { get; private set; }
+
+ public Guid PublicId { get; private set; }
+
+ public string VerifyCode { get; private set; }
+ public DateTime VerifyCodeCreation { get; private set; }
+
+ [NotMapped]
+ public bool VerifyCodeExpired => VerifyCodeCreation.Add(ExpireTime) <= DateTime.Now;
+
+ [NotMapped]
+ public bool CanResendVerifyCode => VerifyCodeCreation.Add(ReSendTime) <= DateTime.Now;
+
+ [NotMapped] public TimeSpan ExpireTime => TimeSpan.FromMinutes(5);
+
+
+
+ [NotMapped] public TimeSpan ReSendTime => TimeSpan.FromMinutes(2);
+
+ public bool IsInstallment { get; set; }
+
+ public InstitutionContractVerificationStatus VerificationStatus { get; private set; }
+
+ public InstitutionContractWorkshopGroup WorkshopGroup { get; private set; }
public List ContactInfoList { get; set; }
+ public List Installments { get; set; }
+
+ public List Amendments { get; private set; }
+
public InstitutionContract()
{
-
- ContactInfoList = new List();
+ ContactInfoList = [];
+ Installments = [];
}
public void Edit(DateTime contractDateGr, string contractDateFa, string state, string city, string address,
DateTime contractStartGr, string contractStartFa, DateTime contractEndGr, string contractEndFa,
double contractAmount, double dailyCompenseation, double obligation, double totalAmount,
- string workshopManualCount, string employeeManualCount, string description, string officialCompany,
+ string workshopManualCount, string employeeManualCount, string description, string officialCompany,
string typeOfcontract, double valueAddedTax, string hasValueAddedTax)
{
-
ContractDateGr = contractDateGr;
ContractDateFa = contractDateFa;
State = state;
City = city;
Address = address;
-
+
ContractStartGr = contractStartGr;
ContractStartFa = contractStartFa;
ContractEndGr = contractEndGr;
@@ -124,13 +184,11 @@ public class InstitutionContract : EntityBase
public void Active()
{
-
this.IsActiveString = "true";
}
public void DeActive()
{
-
this.IsActiveString = "false";
}
@@ -148,4 +206,132 @@ public class InstitutionContract : EntityBase
{
this.Signature = "0";
}
+
+ public void Verified()
+ {
+ VerificationStatus = InstitutionContractVerificationStatus.Verified;
+ }
+
+ public void SetPendingWorkflow()
+ {
+ VerificationStatus = InstitutionContractVerificationStatus.PendingWorkflow;
+ }
+
+ public void SetInstallments(List installments)
+ {
+ Installments = installments;
+ IsInstallment = true;
+ }
+
+
+ public void SetVerifyCode(string code)
+ {
+ VerifyCode = code;
+ VerifyCodeCreation = DateTime.Now;
+ }
+
+ public void SetWorkshopGroup(InstitutionContractWorkshopGroup workshopGroup)
+ {
+ WorkshopGroup = workshopGroup;
+ }
+
+ public void SetAmount(double totalAmount, double tax, double oneMonthPayment)
+ {
+ ContractAmount = oneMonthPayment;
+ TotalAmount = totalAmount;
+ ValueAddedTax = tax;
+ HasValueAddedTax = tax > 0 ? "true" : "false";
+ }
+
+ public void ClearGroup()
+ {
+ WorkshopGroup = null;
+ }
+}
+
+public class InstitutionContractAmendment : EntityBase
+{
+ public long InstitutionContractId { get; set; }
+ public InstitutionContract InstitutionContract { get; set; }
+ public List Installments { get; set; }
+ public double Amount { get; set; }
+ public bool HasInstallment { get; set; }
+ public string VerifyCode { get; set; }
+ public DateTime VerificationCreation { get; set; }
+ public List AmendmentChanges { get; set; }
+}
+
+public class InstitutionContractAmendmentChange : EntityBase
+{
+ public long InstitutionContractAmendmentId { get; private set; }
+ public InstitutionContractAmendment InstitutionContractAmendment { get; private set; }
+ public InstitutionContractAmendmentChangeType ChangeType { get; private set; }
+ public DateTime ChangeDateGr { get; private set; }
+
+ ///
+ /// پلن حضور و غیاب
+ ///
+ public bool? HasRollCallPlan { get; private set; }
+
+ ///
+ /// پلن فیش غیر رسمی
+ ///
+ public bool? HasCustomizeCheckoutPlan { get; private set; }
+
+ ///
+ /// پلن قرارداد و تصفیه
+ ///
+ public bool? HasContractPlan { get; private set; }
+
+ ///
+ /// پلن قرارداد و تصفیه حضوری
+ ///
+ public bool? HasContractPlanInPerson { get; private set; }
+
+ ///
+ /// پلن بیمه
+ ///
+ public bool? HasInsurancePlan { get; private set; }
+
+ ///
+ /// پلن بیمه حضوری
+ ///
+ public bool? HasInsurancePlanInPerson { get; private set; }
+
+ ///
+ /// تعداد پرسنل
+ ///
+ public int? PersonnelCount { get; private set; }
+
+ ///
+ /// تعداد کارگاه
+ ///
+ public long? WorkshopDetailsId { get; private set; }
+
+
+}
+
+public enum InstitutionContractAmendmentChangeType
+{
+ PersonCount,
+ Services,
+ WorkshopCreated
+}
+
+public enum InstitutionContractVerificationStatus
+{
+ ///
+ /// در انتظار تایید
+ ///
+ PendingForVerify = 0,
+
+ ///
+ /// در انتظار کارپوشه
+ ///
+ PendingWorkflow = 1,
+
+ ///
+ /// تایید شده
+ ///
+ Verified = 2
}
\ No newline at end of file
diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContractInstallment.cs b/Company.Domain/InstitutionContractAgg/InstitutionContractInstallment.cs
new file mode 100644
index 00000000..bdbfa535
--- /dev/null
+++ b/Company.Domain/InstitutionContractAgg/InstitutionContractInstallment.cs
@@ -0,0 +1,28 @@
+using System;
+using _0_Framework.Application;
+
+namespace Company.Domain.InstitutionContractAgg;
+
+public class InstitutionContractInstallment
+{
+ public InstitutionContractInstallment(DateTime installmentDateGr, double amount,
+ string description)
+ {
+ InstallmentDateGr = installmentDateGr;
+ InstallmentDateFa = installmentDateGr.ToFarsi();
+ Amount = amount;
+ Description = description;
+ }
+
+ public long Id { get; private set; }
+ public DateTime InstallmentDateGr { get; private set; }
+ public string InstallmentDateFa { get; private set; }
+ public double Amount { get; private set; }
+ public string Description { get; private set; }
+
+ public long InstitutionContractId { get; private set; }
+ public long? InstitutionContractAmendmentId { get; private set; }
+
+ public InstitutionContract InstitutionContract { get; private set; }
+ public InstitutionContractAmendment InstitutionContractAmendment { get; set; }
+}
diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopBase.cs b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopBase.cs
new file mode 100644
index 00000000..046cfe21
--- /dev/null
+++ b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopBase.cs
@@ -0,0 +1,84 @@
+using System;
+using System.Collections.Generic;
+using _0_Framework.Domain;
+
+namespace Company.Domain.InstitutionContractAgg;
+
+public class InstitutionContractWorkshopBase:EntityBase
+{
+ protected InstitutionContractWorkshopBase(){}
+ public InstitutionContractWorkshopBase(string workshopName, bool hasRollCallPlan,bool hasRollCallPlanInPerson,
+ bool hasCustomizeCheckoutPlan, bool hasContractPlan,bool hasContractPlanInPerson,bool hasInsurancePlan,bool hasInsurancePlanInPerson,
+ int personnelCount, double price )
+ {
+ WorkshopName = workshopName;
+ Services = new WorkshopServices(hasInsurancePlan, hasInsurancePlanInPerson,
+ hasContractPlan, hasContractPlanInPerson, hasRollCallPlan, hasRollCallPlanInPerson,hasCustomizeCheckoutPlan);
+ PersonnelCount = personnelCount;
+ Price = price;
+ Employers = [];
+ }
+ ///
+ /// شناسه کارگاه
+ ///
+ public long? WorkshopId { get; protected set; }
+
+ ///
+ /// نام کارگاه
+ ///
+ public string WorkshopName { get; private set; }
+
+ public WorkshopServices Services { get; set; } = new (false, false,
+ false, false, false,
+ false, false);
+ public int PersonnelCount { get; private set; }
+
+
+
+ ///
+ /// شناسه قرارداد نهاد مرتبط
+ ///
+ public long InstitutionContractId { get; private set; }
+
+
+ public double Price { get; private set; }
+
+
+ public List Employers { get; private set; } = new();
+
+ public void SetEmployers(List employerIds)
+ {
+ Employers.Clear();
+ foreach (var employerId in employerIds)
+ {
+ Employers.Add(new InstitutionContractWorkshopDetailEmployer(employerId));
+ }
+ }
+ public void AddEmployer(long employerId)
+ {
+ if (Employers.Exists(x => x.EmployerId == employerId))
+ return;
+
+ Employers.Add(new InstitutionContractWorkshopDetailEmployer(employerId));
+ }
+
+ // ⚡️ Equality Implementation
+ public override bool Equals(object? obj)
+ {
+ if (obj is not InstitutionContractWorkshopBase other)
+ return false;
+
+ return WorkshopName == other.WorkshopName &&
+ PersonnelCount == other.PersonnelCount &&
+ Price == other.Price &&
+ Services == other.Services;
+ }
+
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(WorkshopName, PersonnelCount, Price, Services);
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopCurrent.cs b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopCurrent.cs
new file mode 100644
index 00000000..f133fa70
--- /dev/null
+++ b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopCurrent.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using _0_Framework_b.Domain;
+
+namespace Company.Domain.InstitutionContractAgg;
+
+public class InstitutionContractWorkshopCurrent:InstitutionContractWorkshopBase
+{
+ private InstitutionContractWorkshopCurrent(){}
+ public InstitutionContractWorkshopCurrent(string workshopName, bool hasRollCallPlan,
+ bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
+ bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
+ int personnelCount, double price,long institutionContractWorkshopGroupId,InstitutionContractWorkshopGroup workshopGroup,long workshopId) : base(workshopName, hasRollCallPlan,
+ hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan,
+ hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
+ {
+ InstitutionContractWorkshopGroupId = institutionContractWorkshopGroupId;
+ WorkshopGroup = workshopGroup;
+ WorkshopId = workshopId;
+ }
+ public long InstitutionContractWorkshopGroupId { get; private set; }
+ public InstitutionContractWorkshopGroup WorkshopGroup { get; private set; }
+ public long InitialWorkshopId { get; private set; }
+ public InstitutionContractWorkshopInitial WorkshopInitial { get; private set; }
+
+
+}
\ No newline at end of file
diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopGroup.cs b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopGroup.cs
new file mode 100644
index 00000000..20797f04
--- /dev/null
+++ b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopGroup.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using _0_Framework_b.Domain;
+
+namespace Company.Domain.InstitutionContractAgg;
+
+public class InstitutionContractWorkshopGroup : EntityBase
+{
+ private InstitutionContractWorkshopGroup()
+ {
+ }
+
+ public long InstitutionContractId { get; private set; }
+ public InstitutionContract InstitutionContract { get; set; }
+ public List InitialWorkshops { get; private set; }
+ public List CurrentWorkshops { get; private set; }
+ public DateTime LastModifiedDate { get; private set; }
+
+ [NotMapped]
+ public bool HasChanges =>
+ !InitialWorkshops.Cast()
+ .SequenceEqual(CurrentWorkshops.Cast());
+
+ public InstitutionContractWorkshopGroup(long institutionContractId,
+ List initialDetails)
+ {
+ InstitutionContractId = institutionContractId;
+ var initialWorkshops = initialDetails.ToList();
+ InitialWorkshops = initialWorkshops.ToList();
+ LastModifiedDate = DateTime.Now;
+ }
+
+ public void UpdateCurrentWorkshops(List updatedDetails)
+ {
+ CurrentWorkshops = updatedDetails.ToList();
+ LastModifiedDate = DateTime.Now;
+ }
+}
\ No newline at end of file
diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopInitial.cs b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopInitial.cs
new file mode 100644
index 00000000..cceaeefb
--- /dev/null
+++ b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopInitial.cs
@@ -0,0 +1,70 @@
+using System.Collections.Generic;
+using System.Linq;
+using _0_Framework.Domain;
+using CompanyManagment.App.Contracts.InstitutionContract;
+
+namespace Company.Domain.InstitutionContractAgg;
+
+public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase
+{
+ private InstitutionContractWorkshopInitial(){}
+ public InstitutionContractWorkshopInitial(string workshopName, bool hasRollCallPlan,
+ bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
+ bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
+ int personnelCount, double price) : base(workshopName, hasRollCallPlan,
+ hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasContractPlanInPerson,
+ hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
+ {
+ WorkshopCreated = false;
+ }
+
+ public long InstitutionContractWorkshopGroupId { get; private set; }
+ public InstitutionContractWorkshopGroup WorkshopGroup { get; private set; }
+ public bool WorkshopCreated { get; private set; }
+
+ public InstitutionContractWorkshopCurrent? WorkshopCurrent { get; private set; }
+ public long? InstitutionContractWorkshopCurrentId { get; private set; }
+
+ public void SetWorkshopId(long workshopId)
+ {
+ WorkshopId = workshopId;
+ WorkshopCreated = true;
+ WorkshopCurrent = new InstitutionContractWorkshopCurrent(WorkshopName,Services.RollCall,Services.RollCallInPerson,
+ Services.CustomizeCheckout,Services.Contract,Services.ContractInPerson,Services.Insurance,
+ Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId);
+ WorkshopCurrent.SetEmployers(Employers.Select(x=>x.EmployerId).ToList());
+ }
+
+ public static InstitutionContractWorkshopInitial CreateManual(string workshopName, bool hasRollCallPlan,
+ bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
+ bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
+ int personnelCount, double price, long workshopId,List employerIds)
+ {
+
+ var entity = new InstitutionContractWorkshopInitial(workshopName, hasRollCallPlan,
+ hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasContractPlanInPerson,
+ hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price);
+ entity.WorkshopCreated = true;
+ entity.WorkshopId = workshopId;
+ entity.SetEmployers(employerIds);
+ return entity;
+ }
+
+ public void SetWorkshopGroup(InstitutionContractWorkshopGroup entityWorkshopGroup)
+ {
+ InstitutionContractWorkshopGroupId = entityWorkshopGroup.id;
+ WorkshopGroup = entityWorkshopGroup;
+ }
+}
+
+public class InstitutionContractWorkshopDetailEmployer : EntityBase
+{
+ public long EmployerId { get; private set; }
+
+ public InstitutionContractWorkshopDetailEmployer(long employerId)
+ {
+ EmployerId = employerId;
+ }
+
+ private InstitutionContractWorkshopDetailEmployer() { }
+}
\ No newline at end of file
diff --git a/Company.Domain/InstitutionContractAgg/WorkshopServices.cs b/Company.Domain/InstitutionContractAgg/WorkshopServices.cs
new file mode 100644
index 00000000..95d71066
--- /dev/null
+++ b/Company.Domain/InstitutionContractAgg/WorkshopServices.cs
@@ -0,0 +1,23 @@
+namespace Company.Domain.InstitutionContractAgg;
+public record WorkshopServices
+{
+ public WorkshopServices(bool insurance, bool insuranceInPerson, bool contract, bool contractInPerson, bool rollCall, bool rollCallInPerson, bool customizeCheckout)
+ {
+ Insurance = insurance;
+ InsuranceInPerson = insuranceInPerson;
+ Contract = contract;
+ ContractInPerson = contractInPerson;
+ RollCall = rollCall;
+ CustomizeCheckout = customizeCheckout;
+ RollCallInPerson = rollCallInPerson;
+ }
+
+ public bool Insurance { get; private set; }
+ public bool InsuranceInPerson { get; private set; }
+ public bool Contract { get; private set; }
+ public bool ContractInPerson { get; private set; }
+ public bool RollCall { get; private set; }
+
+ public bool RollCallInPerson { get; private set; }
+ public bool CustomizeCheckout { get; private set; }
+}
\ No newline at end of file
diff --git a/Company.Domain/InstitutionContractInsertTempAgg/IInstitutionContractExtenstionTempRepository.cs b/Company.Domain/InstitutionContractInsertTempAgg/IInstitutionContractExtenstionTempRepository.cs
new file mode 100644
index 00000000..e85b9377
--- /dev/null
+++ b/Company.Domain/InstitutionContractInsertTempAgg/IInstitutionContractExtenstionTempRepository.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Threading.Tasks;
+using _0_Framework.Application;
+
+namespace Company.Domain.InstitutionContractInsertTempAgg;
+
+public interface IInstitutionContractExtenstionTempRepository
+{
+ Task Create(InstitutionContractExtensionTemp institutionContract);
+
+ Task GetPreviousExtenstionData(long contractingPartyId);
+ Task Remove(Guid id);
+}
\ No newline at end of file
diff --git a/Company.Domain/InstitutionContractInsertTempAgg/InstitutionContractExtensionTemp.cs b/Company.Domain/InstitutionContractInsertTempAgg/InstitutionContractExtensionTemp.cs
new file mode 100644
index 00000000..219c6dbe
--- /dev/null
+++ b/Company.Domain/InstitutionContractInsertTempAgg/InstitutionContractExtensionTemp.cs
@@ -0,0 +1,168 @@
+using System;
+using System.Collections.Generic;
+using CompanyManagment.App.Contracts.InstitutionContract;
+using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
+using MongoDB.Bson;
+using MongoDB.Bson.Serialization.Attributes;
+
+namespace Company.Domain.InstitutionContractInsertTempAgg;
+
+public class InstitutionContractExtensionTemp
+{
+ public InstitutionContractExtensionTemp(long previousContractingPartyId)
+ {
+ Id = Guid.NewGuid();
+ PreviousId = previousContractingPartyId;
+ }
+
+ [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 long PreviousId { 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 InstitutionContractExtensionPlanDetail OneMonth { get; set; }
+ public InstitutionContractExtensionPlanDetail ThreeMonths { get; set; }
+ public InstitutionContractExtensionPlanDetail SixMonths { get; set; }
+ public InstitutionContractExtensionPlanDetail TwelveMonths { get; set; }
+ public InstitutionContractExtensionPaymentMonthly MonthlyPayment { get; set; }
+ public InstitutionContractExtensionPaymentOneTime OneTimePayment { get; set; }
+
+ public bool HasContractInPerson { get; set; }
+
+ public InstitutionContractDuration? Duration { get; set; }
+
+ public void SetContractingPartyInfos(string address, string city, string province, List contactInfos)
+ {
+ Address = address;
+ City = city;
+ Province = province;
+ ContactInfos = contactInfos;
+ }
+
+ public void SetWorkshopsAndPlanAmounts(List workshops,
+ InstitutionContractExtensionPlanDetail oneMonth,
+ InstitutionContractExtensionPlanDetail threeMonth, InstitutionContractExtensionPlanDetail sixMonth,
+ InstitutionContractExtensionPlanDetail twelveMonth, bool hasContractInPerson)
+ {
+ Workshops = workshops;
+ OneMonth = oneMonth;
+ ThreeMonths = threeMonth;
+ SixMonths = sixMonth;
+ TwelveMonths = twelveMonth;
+ HasContractInPerson = hasContractInPerson;
+ }
+
+ public void SetAmountAndDuration(InstitutionContractDuration duration,InstitutionContractExtensionPaymentMonthly monthly,
+ InstitutionContractExtensionPaymentOneTime oneTime)
+ {
+ Duration = duration;
+ MonthlyPayment = monthly;
+ OneTimePayment = oneTime;
+ }
+
+}
+
+public class InstitutionContractExtenstionTempPlan
+{
+ public InstitutionContractExtenstionTempPlan(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 InstitutionContractExtensionTempWorkshop
+{
+ public InstitutionContractExtensionTempWorkshop(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/Company.Domain/InsurancJobAgg/IInsuranceJobRepositpry.cs b/Company.Domain/InsurancJobAgg/IInsuranceJobRepositpry.cs
index 27a906a7..fc889ab0 100644
--- a/Company.Domain/InsurancJobAgg/IInsuranceJobRepositpry.cs
+++ b/Company.Domain/InsurancJobAgg/IInsuranceJobRepositpry.cs
@@ -25,5 +25,6 @@ public interface IInsuranceJobRepositpry:IRepository
OperationResult EditInsuranceJob(EditInsuranceJob command);
+ Task> GetSelectList();
}
diff --git a/Company.Domain/LawAgg/ILawRepository.cs b/Company.Domain/LawAgg/ILawRepository.cs
new file mode 100644
index 00000000..08708532
--- /dev/null
+++ b/Company.Domain/LawAgg/ILawRepository.cs
@@ -0,0 +1,15 @@
+using _0_Framework.Domain;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using CompanyManagment.App.Contracts.Law;
+
+namespace Company.Domain.LawAgg
+{
+ public interface ILawRepository : IRepository
+ {
+ Task GetWithItems(long id);
+ Task> GetActive();
+ Task GetByType(LawType type);
+ Task> GetList(LawSearchModel searchModel);
+ }
+}
diff --git a/Company.Domain/LawAgg/Law.cs b/Company.Domain/LawAgg/Law.cs
new file mode 100644
index 00000000..d181e8b9
--- /dev/null
+++ b/Company.Domain/LawAgg/Law.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Collections.Generic;
+using _0_Framework.Domain;
+using CompanyManagment.App.Contracts.Law;
+using System.Text.Json;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Company.Domain.LawAgg
+{
+ public class Law : EntityBase
+ {
+ private Law(){}
+ public string Title { get; private set; }
+ public bool IsActive { get; private set; }
+ public List Items { get; private set; }
+ public LawType Type { get; private set; }
+ public string HeadTitle { get; private set; }
+ public string NotificationsJson { get; private set; }
+
+ [NotMapped]
+ public List Notifications
+ {
+ get => string.IsNullOrEmpty(NotificationsJson)
+ ? new List()
+ : JsonSerializer.Deserialize>(NotificationsJson);
+ set => NotificationsJson = JsonSerializer.Serialize(value);
+ }
+
+ public Law(string title, LawType lawType, List notifications, string headTitle )
+ {
+ Title = title;
+ IsActive = true;
+ Items = new List();
+ Type = lawType;
+ Notifications = notifications ?? new List();
+ HeadTitle = headTitle;
+ }
+
+ public void Edit(string title)
+ {
+ Title = title;
+ }
+
+ public void AddItem(string header, string details, int orderNumber)
+ {
+ Items.Add(new LawItem(header, details, orderNumber));
+ }
+
+
+ public void SetItem(List items)
+ {
+ Items = items ?? new List();
+ }
+ public void RemoveItem(int orderNumber)
+ {
+ var item = Items.Find(x => x.OrderNumber == orderNumber);
+ if (item != null)
+ Items.Remove(item);
+ }
+
+ public void Activate()
+ {
+ IsActive = true;
+ }
+
+ public void Deactivate()
+ {
+ IsActive = false;
+ }
+ }
+
+ public class LawItem
+ {
+ public long Id { get; set; }
+ public string Header { get; private set; }
+ public string Details { get; private set; }
+ public int OrderNumber { get; private set; }
+ public long LawId { get; set; }
+
+ protected LawItem() { }
+
+ public LawItem(string header, string details, int orderNumber)
+ {
+ Header = header;
+ Details = details;
+ OrderNumber = orderNumber;
+ }
+ }
+}
diff --git a/Company.Domain/TemporaryClientRegistrationAgg/ContractingPartyTemp.cs b/Company.Domain/TemporaryClientRegistrationAgg/ContractingPartyTemp.cs
index e6ee8870..5e24becb 100644
--- a/Company.Domain/TemporaryClientRegistrationAgg/ContractingPartyTemp.cs
+++ b/Company.Domain/TemporaryClientRegistrationAgg/ContractingPartyTemp.cs
@@ -21,6 +21,8 @@ public class ContractingPartyTemp : EntityBase
IdNumberSerial = idNumberSerial;
Gender = gender;
DateOfBirth = dateOfBirth;
+ PublicId = Guid.NewGuid();
+ Status = ContractingPartyTempStatus.InComplete;
}
///
@@ -91,10 +93,34 @@ public class ContractingPartyTemp : EntityBase
///
public string Address { get; private set; }
+ public ContractingPartyTempStatus Status { get; set; }
+
+ public string VerifyCode { get; set; }
+ public DateTime VerifyCodeSentDateTime { get; set; }
+
+ public Guid PublicId { get; set; }
+
public void UpdateAddress(string state, string city, string address)
{
this.State = state;
this.City = city;
this.Address = address;
}
+
+ public void SetCompleted()
+ {
+ Status = ContractingPartyTempStatus.Completed;
+ }
+
+ public void SetVerifyCode(string verifyCode)
+ {
+ VerifyCode = verifyCode;
+ VerifyCodeSentDateTime = DateTime.Now;
+ }
+}
+
+public enum ContractingPartyTempStatus
+{
+ InComplete,
+ Completed
}
\ No newline at end of file
diff --git a/Company.Domain/TemporaryClientRegistrationAgg/IInstitutionContractContactInfoTempRepository.cs b/Company.Domain/TemporaryClientRegistrationAgg/IInstitutionContractContactInfoTempRepository.cs
new file mode 100644
index 00000000..584029f9
--- /dev/null
+++ b/Company.Domain/TemporaryClientRegistrationAgg/IInstitutionContractContactInfoTempRepository.cs
@@ -0,0 +1,7 @@
+using _0_Framework.Domain;
+
+namespace Company.Domain.TemporaryClientRegistrationAgg;
+
+public interface IInstitutionContractContactInfoTempRepository : IRepository
+{
+}
\ No newline at end of file
diff --git a/Company.Domain/TemporaryClientRegistrationAgg/IInstitutionContractTempRepository.cs b/Company.Domain/TemporaryClientRegistrationAgg/IInstitutionContractTempRepository.cs
index 60212417..45443466 100644
--- a/Company.Domain/TemporaryClientRegistrationAgg/IInstitutionContractTempRepository.cs
+++ b/Company.Domain/TemporaryClientRegistrationAgg/IInstitutionContractTempRepository.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework_b.Domain;
+using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
namespace Company.Domain.TemporaryClientRegistrationAgg;
@@ -17,10 +18,5 @@ public interface IInstitutionContractTempRepository : IRepository
Task GetInstitutionContractTemp(long id,long contractingPartyTempId);
- ///
- /// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
- /// جهت نمایش در کارپوشه
- ///
- ///
- Task> GetAllCompletedRegistration();
+
}
\ No newline at end of file
diff --git a/Company.Domain/TemporaryClientRegistrationAgg/InstitutionContractContactInfoTemp.cs b/Company.Domain/TemporaryClientRegistrationAgg/InstitutionContractContactInfoTemp.cs
new file mode 100644
index 00000000..4d616f77
--- /dev/null
+++ b/Company.Domain/TemporaryClientRegistrationAgg/InstitutionContractContactInfoTemp.cs
@@ -0,0 +1,25 @@
+using _0_Framework.Domain;
+
+namespace Company.Domain.TemporaryClientRegistrationAgg;
+
+public class InstitutionContractContactInfoTemp : EntityBase
+{
+ public InstitutionContractContactInfoTemp(string phoneType, string position, string phoneNumber,
+ string fullName, long institutionContractTempId, bool sendSms)
+ {
+ PhoneType = phoneType;
+ Position = position;
+ PhoneNumber = phoneNumber;
+ FullName = fullName;
+ InstitutionContractTempId = institutionContractTempId;
+ SendSms = sendSms;
+ }
+
+ public string PhoneType { get; private set; }
+ public long InstitutionContractTempId { get; private set; }
+ public string Position { get; private set; }
+ public string PhoneNumber { get; private set; }
+ public string FullName { get; private set; }
+ public bool SendSms { get; private set; }
+ public InstitutionContractTemp InstitutionContractTemp { get; set; }
+}
\ No newline at end of file
diff --git a/Company.Domain/TemporaryClientRegistrationAgg/InstitutionContractTemp.cs b/Company.Domain/TemporaryClientRegistrationAgg/InstitutionContractTemp.cs
index 198c3737..b21d9b9c 100644
--- a/Company.Domain/TemporaryClientRegistrationAgg/InstitutionContractTemp.cs
+++ b/Company.Domain/TemporaryClientRegistrationAgg/InstitutionContractTemp.cs
@@ -1,13 +1,15 @@
using System;
+using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application.UID;
using _0_Framework.Domain;
+using CompanyManagment.App.Contracts.TemporaryClientRegistration;
namespace Company.Domain.TemporaryClientRegistrationAgg;
public class InstitutionContractTemp : EntityBase
{
- public InstitutionContractTemp(long contractingPartyTempId, string paymentModel, string periodModel, double totalPayment, DateTime contractStartGr, DateTime contractEndGr, string officialCompany, double valueAddedTax, string verifyCode, string registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
+ public InstitutionContractTemp(long contractingPartyTempId, string paymentModel, string periodModel, double totalPayment, DateTime contractStartGr, DateTime contractEndGr, string officialCompany, double valueAddedTax, string verifyCode, InstitutionContractTempStatus registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
{
ContractingPartyTempId = contractingPartyTempId;
PaymentModel = paymentModel;
@@ -22,6 +24,7 @@ public class InstitutionContractTemp : EntityBase
MessageId = messageId;
SendVerifyCodeTime = sendVerifyCodeTime;
VerifyCodeEndTime = verifyCodeEndTime;
+ PublicId = Guid.NewGuid();
}
///
@@ -87,7 +90,7 @@ public class InstitutionContractTemp : EntityBase
/// -
/// Completed ثبت نام تکمیل شده
///
- public string RegistrationStatus { get; private set; }
+ public InstitutionContractTempStatus RegistrationStatus { get; private set; }
///
/// آی دی پیامک ارسال شده
@@ -104,8 +107,16 @@ public class InstitutionContractTemp : EntityBase
///
public DateTime? VerifyCodeEndTime{ get; private set; }
+ ///
+ /// آیدی عمومی
+ /// برای نمایش در آدرس
+ ///
+ public Guid PublicId { get; set; }
- public void Edit(long contractingPartyTempId, string paymentModel, string periodModel, double totalPayment, DateTime contractStartGr, DateTime contractEndGr, string officialCompany, double valueAddedTax, string verifyCode, string registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
+ public List ContactInfoList { get; set; }
+
+
+ public void Edit(long contractingPartyTempId, string paymentModel, string periodModel, double totalPayment, DateTime contractStartGr, DateTime contractEndGr, string officialCompany, double valueAddedTax, string verifyCode, InstitutionContractTempStatus registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
{
ContractingPartyTempId = contractingPartyTempId;
PaymentModel = paymentModel;
@@ -122,7 +133,7 @@ public class InstitutionContractTemp : EntityBase
VerifyCodeEndTime = verifyCodeEndTime;
}
- public void Update(string verifyCode, string registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
+ public void Update(string verifyCode, InstitutionContractTempStatus registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
{
VerifyCode = verifyCode;
RegistrationStatus = registrationStatus;
@@ -131,9 +142,10 @@ public class InstitutionContractTemp : EntityBase
VerifyCodeEndTime = verifyCodeEndTime;
}
- public void ChangeRegistrationStatus(string registrationStatus)
+ public void ChangeRegistrationStatus(InstitutionContractTempStatus registrationStatus)
{
RegistrationStatus = registrationStatus;
}
-}
\ No newline at end of file
+}
+
diff --git a/Company.Domain/WorkshopAgg/Workshop.cs b/Company.Domain/WorkshopAgg/Workshop.cs
index 96e61911..99226c05 100644
--- a/Company.Domain/WorkshopAgg/Workshop.cs
+++ b/Company.Domain/WorkshopAgg/Workshop.cs
@@ -76,14 +76,13 @@ public class Workshop : EntityBase
ClientEmployeeWorkshopList = new List();
}
-
-
-
+
public Workshop(string workshopName,string workshopSureName, string insuranceCode, string typeOfOwnership, string archiveCode, string agentName, string agentPhone,
string state, string city, string address, string typeOfInsuranceSend, string typeOfContract, string contractTerm,
string agreementNumber, bool fixedSalary, string population,long? insuranceJobId, string zoneName, bool addBonusesPay, bool addYearsPay, bool addLeavePay, bool totalPaymentHide,
bool isClassified, string computeOptions, string bonusesOptions, string yearsOptions, string hasRollCallFreeVip, bool workshopHolidayWorking,
- bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance, bool createContract, bool signContract, bool createCheckout, bool signCheckout, IsActive cutContractEndOfYear, bool rotatingShiftCompute, bool isStaticCheckout)
+ bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance, bool createContract, bool signContract, bool createCheckout, bool signCheckout,
+ IsActive cutContractEndOfYear, bool rotatingShiftCompute, bool isStaticCheckout,long contractingPartyId)
{
WorkshopName = workshopName;
WorkshopSureName = workshopSureName;
@@ -134,6 +133,7 @@ public class Workshop : EntityBase
CutContractEndOfYear = cutContractEndOfYear;
RotatingShiftCompute = rotatingShiftCompute;
IsStaticCheckout = isStaticCheckout;
+ ContractingPartyId = contractingPartyId;
}
@@ -233,6 +233,8 @@ public class Workshop : EntityBase
///
public bool IsStaticCheckout { get; private set; }
+ public long ContractingPartyId { get; private set; }
+
public Workshop()
{
RollCallServicesList = new List();
@@ -344,4 +346,10 @@ public class Workshop : EntityBase
this.IsActiveString = "false";
ArchiveCode = "b-" + archiveCode;
}
+}
+
+public enum WorkshopRegistrationStatus
+{
+ NotRegistered = 0,
+ Registered = 1
}
\ No newline at end of file
diff --git a/CompanyManagement.Infrastructure.Mongo/CompanyManagement.Infrastructure.Mongo.csproj b/CompanyManagement.Infrastructure.Mongo/CompanyManagement.Infrastructure.Mongo.csproj
new file mode 100644
index 00000000..4c09d4ae
--- /dev/null
+++ b/CompanyManagement.Infrastructure.Mongo/CompanyManagement.Infrastructure.Mongo.csproj
@@ -0,0 +1,17 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CompanyManagement.Infrastructure.Mongo/InstitutionContractInsertTempRepo/InstitutionContractExtenstionTempRepository.cs b/CompanyManagement.Infrastructure.Mongo/InstitutionContractInsertTempRepo/InstitutionContractExtenstionTempRepository.cs
new file mode 100644
index 00000000..71ddf741
--- /dev/null
+++ b/CompanyManagement.Infrastructure.Mongo/InstitutionContractInsertTempRepo/InstitutionContractExtenstionTempRepository.cs
@@ -0,0 +1,32 @@
+using Company.Domain.InstitutionContractInsertTempAgg;
+using MongoDB.Driver;
+
+namespace CompanyManagement.Infrastructure.Mongo.InstitutionContractInsertTempRepo;
+
+public class InstitutionContractExtenstionTempRepository:IInstitutionContractExtenstionTempRepository
+{
+ private readonly IMongoCollection _institutionExtenstionTemp;
+
+ public InstitutionContractExtenstionTempRepository(IMongoDatabase database)
+ {
+ _institutionExtenstionTemp = database.GetCollection("InstitutionContractExtenstionTemp");
+ }
+
+ public async Task Create(InstitutionContractExtensionTemp institutionContract)
+ {
+ await _institutionExtenstionTemp.InsertOneAsync(institutionContract);
+ }
+
+ public async Task GetPreviousExtenstionData(long contractingPartyId)
+ {
+ var entity = await _institutionExtenstionTemp
+ .Find(x => x.PreviousId == contractingPartyId)
+ .FirstOrDefaultAsync();
+ return entity;
+ }
+
+ public async Task Remove(Guid id)
+ {
+ await _institutionExtenstionTemp.DeleteOneAsync(x=>x.Id == id);
+ }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/AuthorizedPerson/AuthorizedPersonViewModel.cs b/CompanyManagment.App.Contracts/AuthorizedPerson/AuthorizedPersonViewModel.cs
new file mode 100644
index 00000000..762a3c4a
--- /dev/null
+++ b/CompanyManagment.App.Contracts/AuthorizedPerson/AuthorizedPersonViewModel.cs
@@ -0,0 +1,19 @@
+namespace CompanyManagment.App.Contracts.AuthorizedPerson;
+
+public class AuthorizedPersonViewModel
+{
+ public long Id { get; set; }
+ public string NationalCode { get; set; }
+ public string FirstName { get; set; }
+ public string LastName { get; set; }
+ public string FatherName { get; set; }
+ public string BirthDate { get; set; }
+ public string Gender { get; set; }
+ public string DeathStatus { get; set; }
+ public string ShenasnameSeri { get; set; }
+ public string ShenasnameSerial { get; set; }
+ public string ShenasnamehNumber { get; set; }
+ public bool IsVerified { get; set; }
+ public string VerificationDate { get; set; }
+ public string CreationDate { get; set; }
+}
diff --git a/CompanyManagment.App.Contracts/AuthorizedPerson/CreateAuthorizedPerson.cs b/CompanyManagment.App.Contracts/AuthorizedPerson/CreateAuthorizedPerson.cs
new file mode 100644
index 00000000..f00a3220
--- /dev/null
+++ b/CompanyManagment.App.Contracts/AuthorizedPerson/CreateAuthorizedPerson.cs
@@ -0,0 +1,15 @@
+namespace CompanyManagment.App.Contracts.AuthorizedPerson;
+
+public class CreateAuthorizedPerson
+{
+ public string NationalCode { get; set; }
+ public string FirstName { get; set; }
+ public string LastName { get; set; }
+ public string FatherName { get; set; }
+ public string BirthDate { get; set; }
+ public string Gender { get; set; }
+ public string DeathStatus { get; set; }
+ public string ShenasnameSeri { get; set; }
+ public string ShenasnameSerial { get; set; }
+ public string ShenasnamehNumber { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/AuthorizedPerson/IAuthorizedPersonApplication.cs b/CompanyManagment.App.Contracts/AuthorizedPerson/IAuthorizedPersonApplication.cs
new file mode 100644
index 00000000..809dca56
--- /dev/null
+++ b/CompanyManagment.App.Contracts/AuthorizedPerson/IAuthorizedPersonApplication.cs
@@ -0,0 +1,13 @@
+using System.Collections.Generic;
+using _0_Framework.Application;
+
+namespace CompanyManagment.App.Contracts.AuthorizedPerson;
+
+public interface IAuthorizedPersonApplication
+{
+ OperationResult Create(CreateAuthorizedPerson command);
+ OperationResult CreateFromUidResponse(CreateAuthorizedPerson command);
+ AuthorizedPersonViewModel GetByNationalCode(string nationalCode);
+ List Search(string nationalCode = null, string firstName = null, string lastName = null);
+ bool ExistsByNationalCode(string nationalCode);
+}
diff --git a/CompanyManagment.App.Contracts/Employer/IEmployerApplication.cs b/CompanyManagment.App.Contracts/Employer/IEmployerApplication.cs
index ca7187c3..5c148784 100644
--- a/CompanyManagment.App.Contracts/Employer/IEmployerApplication.cs
+++ b/CompanyManagment.App.Contracts/Employer/IEmployerApplication.cs
@@ -1,6 +1,9 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Threading.Tasks;
+using System.Transactions;
using _0_Framework.Application;
+using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Employee;
@@ -125,4 +128,282 @@ public interface IEmployerApplication
#endregion
-}
\ No newline at end of file
+ Task CreateWorkflowRegistration(CreateEmployerWorkflowRegistration command);
+ ///
+ /// ویرایش کارفرما در گردش کار ثبت نام
+ ///
+ ///
+ ///
+ Task EditWorkflowRegistration(EditEmployerWorkflowRegistration command);
+
+ ///
+ /// حذف کارفرما از گردش کار ثبت نام
+ ///
+ /// شناسه کارفرما
+ /// شناسه جزئیات کارگاه موسسه
+ ///
+ Task DeleteWorkflowRegistration(long employerId, long institutionWorkshopDetailsId);
+
+ Task> AuthenticateEmployer(string nationalCode, string dateOfBirth, string mobile);
+}
+
+public class AuthenticateUserViewModel
+{
+ ///
+ /// نام
+ ///
+ public string FName { get; set; }
+ ///
+ /// نام خانوادگی
+ ///
+ public string LName { get; set; }
+
+ ///
+ /// نام پدر
+ ///
+ public string FatherName { get; set; }
+
+ ///
+ /// جنسیت
+ ///
+ public Gender Gender { get; set; }
+
+ ///
+ /// کد ملی
+ ///
+ public string NationalCode { get; set; }
+
+
+ public string DateOfBirth { get; set; }
+
+ ///
+ /// سری شناسنامه
+ ///
+ public string IdNumberSeri { get; set; }
+
+ ///
+ /// سریال شناسنامه
+ ///
+ public string IdNumberSerial { get; set; }
+
+
+ ///
+ /// شماره شناسنامه
+ ///
+ public string IdNumber { get; set; }
+
+
+
+ ///
+ /// شماره همراه
+ ///
+ public string Phone { get; set; }
+
+
+}
+
+///
+/// کلاس ثبت کارفرما در گردش کار - شامل اطلاعات کارفرمای حقیقی و حقوقی
+///
+public class CreateEmployerWorkflowRegistration
+{
+ ///
+ /// اطلاعات کارفرمای حقیقی
+ ///
+ public CreateRealEmployerWorkflowRegistration RealEmployer { get; set; }
+
+ ///
+ /// اطلاعات کارفرمای حقوقی
+ ///
+ public CreateLegalEmployerWorkflowRegistration LegalEmployer { get; set; }
+
+ ///
+ /// نوع حقوقی
+ ///
+ public LegalType LegalType { get; set; }
+
+ ///
+ /// شناسه جزئیات کارگاه موسسه
+ ///
+ public long InstitutionWorkshopInitialId { get; set; }
+
+ ///
+ /// شناسه قرارداد موسسه
+ ///
+ public long InstitutionContractId { get; set; }
+
+ ///
+ /// شناسه طرف قرارداد
+ ///
+ public long ContractingPartyId { get; set; }
+
+}
+
+///
+/// کلاس ثبت کارفرمای حقوقی در گردش کار - شامل اطلاعات شرکت و مدیرعامل
+///
+public class CreateLegalEmployerWorkflowRegistration
+{
+ ///
+ /// نام شرکت
+ ///
+ public string CompanyName { get; set; }
+
+ ///
+ /// شماره ثبت
+ ///
+ public string RegisterId { get; set; }
+
+ ///
+ /// شناسه ملی شرکت
+ ///
+ public string NationalId { get; set; }
+
+ ///
+ /// جنسیت
+ ///
+ public Gender Gender { get; set; }
+
+ ///
+ /// وضعیت احراز هویت
+ ///
+ public bool IsAuth { get; set; }
+
+ ///
+ /// کد ملی مدیرعامل
+ ///
+ public string CeoNationalCode { get; set; }
+
+ ///
+ /// شماره شناسنامه مدیرعامل
+ ///
+ public string CeoIdNumber { get; set; }
+
+ ///
+ /// نام مدیرعامل
+ ///
+ public string CeoFName { get; set; }
+
+ ///
+ /// نام خانوادگی مدیرعامل
+ ///
+ public string CeoLName { get; set; }
+
+ ///
+ /// نام پدر مدیرعامل
+ ///
+ public string CeoFatherName { get; set; }
+
+ ///
+ /// تاریخ تولد مدیرعامل
+ ///
+ public string CeoDateOfBirth { get; set; }
+
+ ///
+ /// محل صدور شناسنامه مدیرعامل
+ ///
+ public string CeoPlaceOfIssue { get; set; }
+
+ ///
+ /// تاریخ صدور شناسنامه مدیرعامل
+ ///
+ public string CeoDateOfIssue { get; set; }
+
+ ///
+ /// شماره موبایل
+ ///
+ public string PhoneNumber { get; set; }
+
+ ///
+ /// شماره تلفن ثابت
+ ///
+ public string TelephoneNumber { get; set; }
+
+ ///
+ /// اطلاعات سیستم دولتی
+ ///
+ public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
+
+}
+
+///
+/// کلاس ثبت کارفرمای حقیقی در گردش کار - شامل اطلاعات شخصی کارفرما
+///
+public class CreateRealEmployerWorkflowRegistration
+{
+ ///
+ /// جنسیت
+ ///
+ public Gender Gender { get; set; }
+
+ ///
+ /// وضعیت احراز هویت
+ ///
+ public bool IsAuth { get; set; }
+
+ ///
+ /// کد ملی
+ ///
+ public string NationalCode { get; set; }
+
+ ///
+ /// شماره شناسنامه
+ ///
+ public string IdNumber { get; set; }
+
+ ///
+ /// نام
+ ///
+ public string FName { get; set; }
+
+ ///
+ /// نام خانوادگی
+ ///
+ public string LName { get; set; }
+
+ ///
+ /// نام پدر
+ ///
+ public string FatherName { get; set; }
+
+ ///
+ /// تاریخ تولد
+ ///
+ public string DateOfBirth { get; set; }
+
+ ///
+ /// شماره موبایل
+ ///
+ public string PhoneNumber { get; set; }
+
+ ///
+ /// محل صدور شناسنامه
+ ///
+ public string PlaceOfIssue { get; set; }
+
+ ///
+ /// تاریخ صدور شناسنامه
+ ///
+ public string DateOfIssue { get; set; }
+
+ ///
+ /// اطلاعات سیستم دولتی
+ ///
+ public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
+
+ ///
+ /// شماره تلفن
+ ///
+ public string Telephone { get; set; }
+}
+
+///
+/// کلاس ویرایش کارفرما در گردش کار - شامل اطلاعات کارفرمای حقیقی و حقوقی
+///
+public class EditEmployerWorkflowRegistration : CreateEmployerWorkflowRegistration
+{
+ ///
+ /// شناسه کارفرما
+ ///
+ public long EmployerId { get; set; }
+}
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/CreateInstitutionContractRequest.cs b/CompanyManagment.App.Contracts/InstitutionContract/CreateInstitutionContractRequest.cs
index 0707a07d..a11261b4 100644
--- a/CompanyManagment.App.Contracts/InstitutionContract/CreateInstitutionContractRequest.cs
+++ b/CompanyManagment.App.Contracts/InstitutionContract/CreateInstitutionContractRequest.cs
@@ -1,29 +1,317 @@
using System.Collections.Generic;
+using System.Security.AccessControl;
+using _0_Framework.Application;
+using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
+using CompanyManagment.App.Contracts.Workshop;
namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+
+///
+/// درخواست ایجاد قرارداد نهاد
+///
public class CreateInstitutionContractRequest
{
- public List ContactInfos { get; set; }
- public long ContractingPartyId { get; set; }
+ ///
+ /// نوع حقوقی طرف قرارداد (حقیقی یا حقوقی)
+ ///
+ public LegalType ContractingPartyLegalType { get; set; }
+
+ ///
+ /// اطلاعات شخص حقیقی
+ ///
+ public CreateInstitutionContractRealPartyRequest RealParty { get; set; }
+
+ ///
+ /// اطلاعات شخص حقوقی
+ ///
+ public CreateInstitutionContractLegalPartyRequest LegalParty { get; set; }
+
+ ///
+ /// آیدی معرف
+ ///
public long RepresentativeId { get; set; }
- public string TypeOfContract { get; set; }
- public string ContractDateFa { get; set; }
- public string ContractStartFa { get; set; }
- public string ContractEndFa { get; set; }
- public string Address { get; set; }
- public string State { get; set; }
+
+ ///
+ /// مدت زمان قرارداد
+ ///
+ public InstitutionContractDuration Duration { get; set; }
+
+ ///
+ /// استان
+ ///
+ public string Province { get; set; }
+
+ ///
+ /// شهر
+ ///
public string City { get; set; }
- public string OfficialCompany { get; set; }
- public string HasValueAddedTax { get; set; }
- public string ContractAmountString { get; set; }
- public string DailyCompenseationString { get; set; }
- public string ObligationString { get; set; }
- public string TotalAmountString { get; set; }
- public string ValueAddedTaxStr { get; set; }
- public string WorkshopManualCount { get; set; }
- public string EmployeeManualCount { get; set; }
+
+ ///
+ /// آدرس
+ ///
+ public string Address { get; set; }
+
+ ///
+ /// اطلاعات تماس
+ ///
+ public List ContactInfos { get; set; }
+
+ ///
+ /// لیست کارگاههای مورد نظر برای قرارداد
+ ///
+ public List Workshops { get; set; }
+
+ ///
+ /// تاریخ شروع قرارداد (فارسی)
+ ///
+ public string ContractStartFa { get; set; }
+
+ ///
+ /// مبلغ خسارت روزانه
+ ///
+ public double DailyCompensation { get; set; }
+
+ ///
+ /// وجه التزام
+ ///
+ public double Obligation { get; set; }
+
+ ///
+ /// توضیحات
+ ///
public string Description { get; set; }
- public int ExtensionNo { get; set; }
+
+ ///
+ /// مبلغ کل قرارداد
+ ///
+ public double TotalAmount { get; set; }
+
+ ///
+ /// آیا قرارداد اقساطی است؟
+ ///
+ public bool IsInstallment { get; set; }
+
+ ///
+ /// مالیات ارزش افزوده
+ ///
+ public double TaxAmount { get; set; }
+
+ public double OneMonthAmount { get; set; }
+}
+///
+/// مدت زمان قرارداد نهاد
+///
+public enum InstitutionContractDuration
+{
+ ///
+ /// یک ماهه
+ ///
+ OneMonth = 1,
+
+ ///
+ /// سه ماهه
+ ///
+ ThreeMonths = 3,
+
+ ///
+ /// شش ماهه
+ ///
+ SixMonths = 6,
+
+ ///
+ /// دوازده ماهه
+ ///
+ TwelveMonths = 12
+}
+
+///
+/// جزئیات کارگاه در درخواست ایجاد قرارداد نهاد
+///
+public class CreateInstitutionContractWorkshopDetail
+{
+ ///
+ /// شناسه کارگاه (اختیاری - در صورت وجود کارگاه از قبل)
+ ///
+ public long? WorkshopId { get; set; }
+
+ ///
+ /// نام کارگاه
+ ///
+ public string WorkshopName { get; set; }
+
+ ///
+ /// پلن حضور و غیاب
+ ///
+ public bool HasRollCallPlan { get; set; }
+
+ ///
+ /// پلن فیش غیر رسمی
+ ///
+ public bool HasCustomizeCheckoutPlan { get; set; }
+
+ ///
+ /// پلن قرارداد و تصفیه
+ ///
+ public bool HasContractPlan { get; set; }
+
+ ///
+ /// پلن قرارداد و تصفیه حضوری
+ ///
+ public bool HasContractPlanInPerson { get; set; }
+
+ ///
+ /// پلن بیمه
+ ///
+ public bool HasInsurancePlan { get; set; }
+ ///
+ /// پلن بیمه حضوری
+ ///
+ public bool HasInsurancePlanInPerson { get; set; }
+
+ ///
+ /// تعداد پرسنل کارگاه
+ ///
+ public int PersonnelCount { get; set; }
+
+ ///
+ /// مبلغ
+ ///
+ public double Price { get; set; }
+}
+
+///
+/// درخواست ایجاد طرف حقیقی در قرارداد نهاد
+///
+public class CreateInstitutionContractRealPartyRequest
+{
+ ///
+ /// کد ملی
+ ///
+ 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 class CreateInstitutionContractLegalPartyRequest
+{
+ ///
+ /// نام شرکت
+ ///
+ 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; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/EditInstitutionContractRequest.cs b/CompanyManagment.App.Contracts/InstitutionContract/EditInstitutionContractRequest.cs
index c45b5b9a..4f6d26b8 100644
--- a/CompanyManagment.App.Contracts/InstitutionContract/EditInstitutionContractRequest.cs
+++ b/CompanyManagment.App.Contracts/InstitutionContract/EditInstitutionContractRequest.cs
@@ -3,4 +3,5 @@ namespace CompanyManagment.App.Contracts.InstitutionContract;
public class EditInstitutionContractRequest:CreateInstitutionContractRequest
{
public long Id { get; set; }
+ public long ContractingPartyId { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/ExtenstionInstitutionContractRequest.cs b/CompanyManagment.App.Contracts/InstitutionContract/ExtenstionInstitutionContractRequest.cs
new file mode 100644
index 00000000..ddb67145
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/ExtenstionInstitutionContractRequest.cs
@@ -0,0 +1,13 @@
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+///
+/// درخواست تمدید قرارداد مؤسسه
+/// شامل اطلاعات قرارداد قبلی برای فرآیند تمدید
+///
+public class ExtenstionInstitutionContractRequest : EditInstitutionContractRequest
+{
+ ///
+ /// شناسه قرارداد قبلی که قرار است تمدید شود
+ ///
+ public long PreviousContractId { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListItemsViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListItemsViewModel.cs
index be7e0f5f..c32f345d 100644
--- a/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListItemsViewModel.cs
+++ b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListItemsViewModel.cs
@@ -77,10 +77,45 @@ public class GetInstitutionContractListItemsViewModel
///
/// وضعیت قرارداد
///
- public InstitutionContractStatus Status { get; set; }
+ public InstitutionContractListStatus ListStatus { get; set; }
///
/// آیا منقضی شده است
///
public bool IsExpired { get; set; }
+
+ public long ContractingPartyId { get; set; }
+
+ public List Workshops { get; set; }
+}
+
+public class InstitutionContractListWorkshop
+{
+ public string WorkshopName { get; set; }
+ public int EmployeeCount { get; set; }
+ public WorkshopServicesViewModel WorkshopServices { get; set; }
+}
+
+public class WorkshopServicesViewModel
+{
+ public bool Insurance { get; set; }
+ public string InsuranceLabel => "ارسال لیست بیمه";
+
+ public bool InsuranceInPerson { get; set; }
+ public string InsuranceInPersonLabel => "خدمات حضوری";
+
+ public bool Contract { get; set; }
+ public string ContractLabel => "قرارداد و تصفیه حساب";
+
+ public bool ContractInPerson { get; set; }
+ public string ContractInPersonLabel => "خدمات حضوری";
+
+ public bool RollCall { get; set; }
+ public string RollCallLabel => "ساعت حضور و غیاب";
+
+ public bool RollCallInPerson { get; set; }
+ public string RollCallInPersonLabel => "خدمات مستقیم";
+
+ public bool CustomizeCheckout { get; set; }
+ public string CustomizeCheckoutLabel => "فیش غیر رسمی";
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListStatsViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListStatsViewModel.cs
new file mode 100644
index 00000000..4c47e047
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListStatsViewModel.cs
@@ -0,0 +1,27 @@
+using System.Collections.Generic;
+
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class GetInstitutionContractListStatsViewModel
+{
+ ///
+ /// مجموع بدهی قراردادهای مؤسسه
+ /// این ویژگی بدهیهای قراردادهای مربوطه را تجمیع میکند و
+ /// یک معیار واحد برای اندازهگیری تعهدات مالی ارائه میدهد
+ ///
+ public double TotalDebt { get; set; }
+
+ ///
+ /// مجموع ارزش پولی مرتبط با قراردادهای مؤسسه
+ /// این ویژگی مبلغ کل قراردادهای مربوطه را برای
+ /// گزارشگیری و تجزیه و تحلیل مالی تجمیع میکند
+ ///
+ public double TotalAmount { get; set; }
+
+ ///
+ /// مجموعهای از تعداد قراردادهای مؤسسه دستهبندی شده بر اساس وضعیت
+ /// این ویژگی تعداد قراردادها را برای هر وضعیت تعریف شده در
+ /// شمارش InstitutionContractStatus ارائه میدهد که امکان تجزیه و تحلیل و نظارت بر توزیع قراردادها را فراهم میکند
+ ///
+ public List Counts { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionVerificationDetailsViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionVerificationDetailsViewModel.cs
new file mode 100644
index 00000000..0e3cc092
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionVerificationDetailsViewModel.cs
@@ -0,0 +1,31 @@
+using _0_Framework.Application.Enums;
+
+using System.Collections.Generic;
+
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class GetInstitutionVerificationDetailsViewModel
+{
+ public InstitutionContratVerificationParty FirstParty { get; set; }
+ public InstitutionContratVerificationParty SecondParty { get; set; }
+ public string ContractNo { get; set; }
+ public string CreationDate { get; set; }
+ public string ContractStart { get; set; }
+ public string ContractEnd { get; set; }
+ public List Workshops { get; set; }
+ public string TotalPrice { get; set; }
+ public string TaxPrice { get; set; }
+ public string PaymentPrice { get; set; }
+ public List Installments { get; set; }
+ public bool IsInstallment { get; set; }
+}
+public class InstitutionContratVerificationParty
+{
+ public string CompanyNameOrFullName { get; set; }
+ public string NationalCodeOrNationalId { get; set; }
+ public string CeoName { get; set; }
+ public string Address { get; set; }
+ public string PostalCode { get; set; }
+ public string PhoneNumber { get; set; }
+ public LegalType LegalType { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionVerificationDetailsWorkshopsViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionVerificationDetailsWorkshopsViewModel.cs
new file mode 100644
index 00000000..cd1ef514
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionVerificationDetailsWorkshopsViewModel.cs
@@ -0,0 +1,9 @@
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class GetInstitutionVerificationDetailsWorkshopsViewModel
+{
+ public string Name { get; set; }
+ public int PersonnelCount { get; set; }
+ public WorkshopServicesViewModel Services { get; set; }
+ public string Price { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs
index 6638dec5..5e54eb15 100644
--- a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs
+++ b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs
@@ -1,62 +1,162 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
+using _0_Framework.Application.Sms;
using CompanyManagment.App.Contracts.Checkout;
+using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.App.Contracts.Workshop;
+using CompanyManagment.App.Contracts.WorkshopPlan;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.InstitutionContract;
+///
+/// رابط اپلیکیشن قراردادهای مؤسسه
+/// مدیریت عملیات مربوط به قراردادهای مالی مؤسسات
+///
public interface IInstitutionContractApplication
{
+ ///
+ /// ایجاد قرارداد جدید
+ ///
+ /// اطلاعات قرارداد جدید
+ /// نتیجه عملیات
OperationResult Create(CreateInstitutionContract command);
+
+ ///
+ /// تمدید قرارداد موجود
+ ///
+ /// اطلاعات قرارداد برای تمدید
+ /// نتیجه عملیات
OperationResult Extension(CreateInstitutionContract command);
+
+ ///
+ /// ویرایش قرارداد موجود
+ ///
+ /// اطلاعات جدید قرارداد
+ /// نتیجه عملیات
OperationResult Edit(EditInstitutionContract command);
+
+ ///
+ /// دریافت جزئیات قرارداد برای ویرایش
+ ///
+ /// شناسه قرارداد
+ /// اطلاعات قرارداد
EditInstitutionContract GetDetails(long id);
+ ///
+ /// جستجو در قراردادها
+ ///
+ /// مدل جستجو
+ /// لیست قراردادها
List Search(InstitutionContractSearchModel searchModel);
+
+ ///
+ /// جستجوی جدید در قراردادها
+ ///
+ /// مدل جستجو
+ /// لیست قراردادها
List NewSearch(InstitutionContractSearchModel searchModel);
///
- /// دریافت اطلاعات قزداد های مالی فعال
+ /// دریافت اطلاعات قرارداد های مالی فعال
///دارای کارگاه
/// جهت ست کردن سرویس ها از طریق اکسل
///
///
List GetInstitutionContractToSetServicesExcelImport();
+ ///
+ /// چاپ مجموعه قراردادها
+ ///
+ /// لیست شناسه قراردادها
+ /// لیست قراردادها برای چاپ
List PrintAll(List id);
+
+ ///
+ /// چاپ یک قرارداد
+ ///
+ /// شناسه قرارداد
+ /// اطلاعات قرارداد برای چاپ
InstitutionContractViewModel PrintOne(long id);
+ ///
+ /// فعال کردن قرارداد
+ ///
+ /// شناسه قرارداد
+ /// نتیجه عملیات
OperationResult Active(long id);
-
+ ///
+ /// غیرفعال کردن قرارداد
+ ///
+ /// شناسه قرارداد
+ /// نتیجه عملیات
OperationResult DeActive(long id);
-
+ ///
+ /// غیرفعال کردن قرارداد (حالت آبی)
+ ///
+ /// شناسه قرارداد
+ /// نتیجه عملیات
OperationResult DeActiveBlue(long id);
-
+ ///
+ /// غیرفعال کردن تمام اتصالات قرارداد
+ ///
+ /// شناسه قرارداد
+ /// نتیجه عملیات
OperationResult DeActiveAllConnections(long id);
-
+ ///
+ /// فعال کردن مجدد تمام اتصالات قرارداد
+ ///
+ /// شناسه قرارداد
+ /// نتیجه عملیات
OperationResult ReActiveAllConnections(long id);
+ ///
+ /// فعال کردن مجدد تمام قراردادها بعد از ایجاد قرارداد جدید
+ ///
+ /// شناسه طرف قرارداد
void ReActiveAllAfterCreateNew(long contractingPartyId);
-
+ ///
+ /// حذف قرارداد
+ ///
+ /// شناسه قرارداد
void RemoveContract(long id);
-
+ ///
+ /// امضای قرارداد
+ ///
+ /// شناسه قرارداد
+ /// نتیجه عملیات
OperationResult Sign(long id);
-
+ ///
+ /// لغو امضای قرارداد
+ ///
+ /// شناسه قرارداد
+ /// نتیجه عملیات
OperationResult UnSign(long id);
+
+ ///
+ /// ایجاد حساب کاربری برای طرف قرارداد
+ ///
+ /// شناسه طرف قرارداد
+ /// شناسه حساب کاربری
void CreateContractingPartyAccount(long contractingPartyid, long accountId);
+ ///
+ /// محاسبه مبلغ قرارداد بر اساس تعداد افراد
+ ///
+ /// تعداد افراد
+ /// مبلغ قرارداد
double GetcontractAmount(int countPerson);
#region Api
@@ -82,52 +182,92 @@ public interface IInstitutionContractApplication
///
///
Task CreateAsync(CreateInstitutionContractRequest command);
+
///
/// ویرایش
///
///
///
Task EditAsync(EditInstitutionContractRequest command);
- ///
- /// تمدید قرارداد
- ///
- ///
- ///
- Task ExtensionَAsync(CreateInstitutionContractRequest command);
+
+ ///
+ /// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
+ /// جهت نمایش در کارپوشه
+ ///
+ ///
+ Task> RegistrationWorkflowMainList();
+ ///
+ /// دریافت آیتم های کارپوشه ثبت نام
+ ///
+ ///
+ ///
+ Task> RegistrationWorkflowItems(long institutionContractId);
+
+
+
#endregion
+
+ Task GetVerificationDetails(Guid id);
+ Task> SendVerifyOtp(Guid id);
+ Task VerifyOtp(Guid publicId, string code);
+ Task GetWorkshopInitialDetails(long workshopDetailsId);
+ Task GetExtensionInquiry(long previousContractId);
+ Task GetExtensionWorkshops(InstitutionContractExtensionWorkshopsRequest request);
+ Task GetExtensionInstitutionPlan(InstitutionContractExtensionPlanRequest request);
+ Task GetExtensionPaymentMethod(
+ InstitutionContractExtensionPaymentRequest request);
+
+ Task ExtensionComplete(InstitutionContractExtensionCompleteRequest request);
}
-public class GetInstitutionContractListStatsViewModel
+public class InstitutionContractExtensionInquiryResponse
{
- ///
- /// Represents the total outstanding debt of institution contracts.
- /// This property aggregates the liabilities of the respective contracts and provides
- /// a single metric to measure financial obligations.
- ///
- public double TotalDebt { get; set; }
-
- ///
- /// Represents the total monetary value associated with institution contracts.
- /// This property consolidates the aggregate amount from relevant contracts
- /// for financial reporting and analysis.
- ///
- public double TotalAmount { get; set; }
-
- ///
- /// Represents a collection of counts for institution contracts categorized by their status.
- /// This property provides the count of contracts for each status defined in the
- /// InstitutionContractStatus enumeration, enabling analysis and monitoring of contract distribution.
- ///
- public List Counts { get; set; }
+ public long Id { get; set; }
+ public string FName { get; set; }
+ public string LName { get; set; }
+ public string DateOfBirthFa { get; set; }
+ public string FatherName { get; set; }
+ public string IdNumberSerial { get; set; }
+ public string IdNumber { get; set; }
+ public string Address { get; set; }
+ public string Phone { get; set; }
+ public string City { get; set; }
+ public string State { get; set; }
+ public long RepresentativeId { get; set; }
+ public string NationalCode { get; set; }
}
-public class InstitutionContractStatusCount
+public class InstitutionContractExtensionCompleteRequest
{
- public InstitutionContractStatus Status { get; set; }
- public int Count { get; set; }
+ public Guid TemporaryId { get; set; }
+ public bool IsInstallment { get; set; }
}
-public class ExtenstionInstitutionContractRequest:EditInstitutionContractRequest
+
+public class InstitutionContractExtensionPaymentResponse
{
- public long PreviousContractId { get; set; }
+ public InstitutionContractExtensionPaymentOneTime OneTime { get; set; }
+ public InstitutionContractExtensionPaymentMonthly Monthly { get; set; }
+
+}
+
+public class InstitutionContractExtensionPaymentMonthly:InstitutionContractExtensionPaymentOneTime
+{
+ public List Installments { get; set; }
+}
+
+public class InstitutionContractExtensionPaymentOneTime
+{
+ ///
+ /// مجموع مبالغ
+ ///
+ public string TotalAmount { get; set; }
+ ///
+ /// ارزش افزوده
+ ///
+ public string Tax { get; set; }
+ ///
+ /// مبلغ قابل پرداخت
+ ///
+ public string PaymentAmount { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionInquiryRequest.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionInquiryRequest.cs
new file mode 100644
index 00000000..89578139
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionInquiryRequest.cs
@@ -0,0 +1,9 @@
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class InstitutionContractExtensionInquiryRequest
+{
+ public long ContractingPartyId { get; set; }
+ public string NationalCode { get; set; }
+ public string BirthDate { get; set; }
+ public string Mobile { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionInquiryResult.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionInquiryResult.cs
new file mode 100644
index 00000000..b11bcbf8
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionInquiryResult.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using _0_Framework.Application.Enums;
+using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
+
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class InstitutionContractExtensionInquiryResult
+{
+ ///
+ /// اطلاعات شخص حقیقی
+ ///
+ public CreateInstitutionContractRealPartyRequest RealParty { get; set; }
+
+ ///
+ /// اطلاعات شخص حقوقی
+ ///
+ public CreateInstitutionContractLegalPartyRequest LegalParty { get; set; }
+
+ public LegalType LegalType { get; set; }
+ public Guid TemporaryId { get; set; }
+ public string Address { get; set; }
+ public string City { get; set; }
+ public string Province { get; set; }
+ public List ContactInfoViewModels { get; set; }
+ public long RepresentativeId { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionPaymentRequest.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionPaymentRequest.cs
new file mode 100644
index 00000000..8406a53a
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionPaymentRequest.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class InstitutionContractExtensionPaymentRequest
+{
+ public InstitutionContractDuration Duration { get; set; }
+ public Guid TempId { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionPlanRequest.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionPlanRequest.cs
new file mode 100644
index 00000000..40804842
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionPlanRequest.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using CompanyManagment.App.Contracts.TemporaryClientRegistration;
+
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class InstitutionContractExtensionPlanRequest
+{
+ public List WorkshopTemps { get; set; }
+ public string TotalAmount { 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
new file mode 100644
index 00000000..dcdff4ca
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionPlanResponse.cs
@@ -0,0 +1,20 @@
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class InstitutionContractExtensionPlanResponse
+{
+ public InstitutionContractExtensionPlanDetail OneMonth { get; set; }
+ public InstitutionContractExtensionPlanDetail ThreeMonths { get; set; }
+ public InstitutionContractExtensionPlanDetail SixMonths { get; set; }
+ 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; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionWorkshopsRequest.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionWorkshopsRequest.cs
new file mode 100644
index 00000000..c741cdf8
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionWorkshopsRequest.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
+
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class InstitutionContractExtensionWorkshopsRequest
+{
+ public Guid TempId { get; set; }
+ public string City {get; set;}
+ public string Province { get; set; }
+ public string Address { get; set; }
+ public List ContactInfos { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionWorkshopsResponse.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionWorkshopsResponse.cs
new file mode 100644
index 00000000..c8b61061
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractExtensionWorkshopsResponse.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+using CompanyManagment.App.Contracts.TemporaryClientRegistration;
+
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class InstitutionContractExtensionWorkshopsResponse
+{
+ public List WorkshopTemps { get; set; }
+ public string TotalAmount { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractInstallmentViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractInstallmentViewModel.cs
new file mode 100644
index 00000000..86655873
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractInstallmentViewModel.cs
@@ -0,0 +1,40 @@
+using System;
+
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+///
+/// مدل نمایش اقساط قرارداد مؤسسه
+/// شامل اطلاعات مربوط به هر قسط از قرارداد
+///
+public class InstitutionContractInstallmentViewModel
+{
+ ///
+ /// شناسه یکتای قسط
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// تاریخ میلادی قسط
+ ///
+ public DateTime InstallmentDateGr { get; set; }
+
+ ///
+ /// تاریخ فارسی قسط
+ ///
+ public string InstallmentDateFa { get; set; }
+
+ ///
+ /// مبلغ قسط
+ ///
+ public string Amount { get; set; }
+
+ ///
+ /// عدد قسط فارسی
+ ///
+ public string InstallmentIndex { get; set; }
+
+ ///
+ /// شناسه قرارداد مؤسسه مربوط به این قسط
+ ///
+ public long InstitutionContractId { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractListSearchModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractListSearchModel.cs
index 18cc2af0..c033b124 100644
--- a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractListSearchModel.cs
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractListSearchModel.cs
@@ -42,7 +42,7 @@ public class InstitutionContractListSearchModel :PaginationRequest
///
/// تب
///
- public InstitutionContractStatus? Status { get; set; }
+ public InstitutionContractListStatus? Status { get; set; }
///
/// فعال / غیرفعال
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractStatus.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractListStatus.cs
similarity index 73%
rename from CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractStatus.cs
rename to CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractListStatus.cs
index 103f4dd3..fa5bd93a 100644
--- a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractStatus.cs
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractListStatus.cs
@@ -1,6 +1,6 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
-public enum InstitutionContractStatus
+public enum InstitutionContractListStatus
{
Active,
Deactive,
@@ -9,4 +9,5 @@ public enum InstitutionContractStatus
Free,
PendingForRenewal,
WithoutWorkshop,
+ PendingForVerify
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractStatusCount.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractStatusCount.cs
new file mode 100644
index 00000000..a6f6bf35
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractStatusCount.cs
@@ -0,0 +1,18 @@
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+///
+/// شمارش وضعیت قراردادهای مؤسسه
+/// نمایش تعداد قراردادها برای هر وضعیت خاص
+///
+public class InstitutionContractStatusCount
+{
+ ///
+ /// وضعیت لیست قرارداد
+ ///
+ public InstitutionContractListStatus ListStatus { get; set; }
+
+ ///
+ /// تعداد قراردادها در این وضعیت
+ ///
+ public int Count { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractWorkshopDetailViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractWorkshopDetailViewModel.cs
new file mode 100644
index 00000000..4916ac39
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractWorkshopDetailViewModel.cs
@@ -0,0 +1,6 @@
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class InstitutionContractWorkshopDetailViewModel
+{
+ public WorkshopServicesViewModel ServicesViewModel { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/RegistrationWorkflowMainListViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/RegistrationWorkflowMainListViewModel.cs
new file mode 100644
index 00000000..72c95cdb
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/RegistrationWorkflowMainListViewModel.cs
@@ -0,0 +1,92 @@
+using System.Collections.Generic;
+
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class RegistrationWorkflowMainListViewModel
+{
+ ///
+ /// شناسه قرارداد موسسه
+ ///
+ public long InstitutionContractId { get; set; }
+
+ ///
+ /// نام کامل طرف حساب
+ ///
+ public string ContractingPartyFullName { get; set; }
+
+ ///
+ /// شماره همراه
+ ///
+ public string Phone { get; set; }
+
+ ///
+ /// تعداد کارگاههای انجام شده
+ ///
+ public int DoneWorkshops { get; set; }
+
+ ///
+ /// تعداد کارگاههای انجام نشده
+ ///
+ public int UnDoneWorkshops { get; set; }
+
+ ///
+ /// تعداد کل کارگاهها
+ ///
+ public int TotalWorkshops { get; set; }
+
+ ///
+ /// مبلغ
+ ///
+ public double Amount { get; set; }
+
+ public long ContractingPartyId { get; set; }
+}
+
+///
+/// مدل نمایش آیتمهای گردش کار ثبت نام
+///
+public class RegistrationWorkflowItemsViewModel
+{
+ ///
+ /// لیست کارفرمایان
+ ///
+ public List Employers { get; set; }
+
+ ///
+ /// نام کارگاه
+ ///
+ public string WorkshopName { get; set; }
+
+ ///
+ /// تعداد پرسنل
+ ///
+ public int PersonnelCount { get; set; }
+
+ ///
+ /// قیمت
+ ///
+ public double Price { get; set; }
+
+ ///
+ /// وضعیت انجام شدن
+ ///
+ public bool IsDone { get; set; }
+
+ public long WorkshopDetailsId { get; set; }
+}
+
+///
+/// مدل نمایش کارفرما در آیتمهای گردش کار ثبت نام
+///
+public class RegistrationWorkflowItemsEmployerViewModel
+{
+ ///
+ /// نام و نام خانوادگی
+ ///
+ public string FullName { get; set; }
+
+ ///
+ /// شناسه
+ ///
+ public long Id { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InsuranceJob/IInsuranceJobApplication.cs b/CompanyManagment.App.Contracts/InsuranceJob/IInsuranceJobApplication.cs
index 5f1132d7..e1934372 100644
--- a/CompanyManagment.App.Contracts/InsuranceJob/IInsuranceJobApplication.cs
+++ b/CompanyManagment.App.Contracts/InsuranceJob/IInsuranceJobApplication.cs
@@ -21,4 +21,12 @@ public interface IInsuranceJobApplication
List Search(InsuranceJobSearchModel searchModel);
OperationResult Remove(long id);
+ Task> GetSelectList();
+}
+
+public class InsuranceJobSelectListViewModel
+{
+ public long Id { get; set; }
+ public string InsuranceJobTitle { get; set; }
+ public string EconomicCode { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/Law/ILawApplication.cs b/CompanyManagment.App.Contracts/Law/ILawApplication.cs
new file mode 100644
index 00000000..5b628f24
--- /dev/null
+++ b/CompanyManagment.App.Contracts/Law/ILawApplication.cs
@@ -0,0 +1,37 @@
+using _0_Framework.Application;
+using System.Collections.Generic;
+using System.Security.AccessControl;
+using System.Threading.Tasks;
+using CompanyManagment.App.Contracts.Workshop;
+
+namespace CompanyManagment.App.Contracts.Law
+{
+ public interface ILawApplication
+ {
+ OperationResult Create(CreateLaw command);
+ OperationResult Edit(EditLaw command);
+ OperationResult Activate(long id);
+ OperationResult Deactivate(long id);
+ OperationResult ActivateByType(LawType type);
+ OperationResult DeactivateByType(LawType type);
+ EditLaw GetDetails(long id);
+ Task> GetList(LawSearchModel searchModel);
+ Task GetLawWithItems(long id);
+ Task GetLawByType(LawType type);
+ OperationResult UpsertLaw(EditLaw command);
+ }
+
+ public class LawSearchModel
+ {
+ public string Title { get; set; }
+ public string Text { get; set; }
+ }
+
+ public enum LawType
+ {
+ ///
+ /// ثبت نام
+ ///
+ Register
+ }
+}
diff --git a/CompanyManagment.App.Contracts/Law/LawViewModel.cs b/CompanyManagment.App.Contracts/Law/LawViewModel.cs
new file mode 100644
index 00000000..13c0bf57
--- /dev/null
+++ b/CompanyManagment.App.Contracts/Law/LawViewModel.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+namespace CompanyManagment.App.Contracts.Law
+{
+ public class LawViewModel
+ {
+ public long Id { get; set; }
+ public string Title { get; set; }
+ public bool IsActive { get; set; }
+ public DateTime CreatedAt { get; set; }
+ public List Items { get; set; }
+ public LawType Type { get; set; }
+ public string HeadTitle { get; set; }
+ public List Notifications { get; set; }
+ }
+
+ public class LawItemViewModel
+ {
+ public string Header { get; set; }
+ public string Details { get; set; }
+ // public int OrderNumber { get; set; }
+ }
+
+ public class CreateLaw
+ {
+ public string Title { get; set; }
+ public List Items { get; set; }
+ public LawType Type { get; set; }
+ public string HeadTitle { get; set; }
+ public List Notifications { get; set; }
+ }
+
+
+
+ public class EditLaw
+ {
+ public long Id { get; set; }
+ public string Title { get; set; }
+ public List Items { get; set; }
+ public LawType Type { get; set; }
+ public string HeadTitle { get; set; }
+ public List Notifications { get; set; }
+
+ }
+}
diff --git a/CompanyManagment.App.Contracts/PersonalContractingParty/ContractingPartyGetListViewModel.cs b/CompanyManagment.App.Contracts/PersonalContractingParty/ContractingPartyGetListViewModel.cs
index ab435f57..9fd90608 100644
--- a/CompanyManagment.App.Contracts/PersonalContractingParty/ContractingPartyGetListViewModel.cs
+++ b/CompanyManagment.App.Contracts/PersonalContractingParty/ContractingPartyGetListViewModel.cs
@@ -57,4 +57,12 @@ public class ContractingPartyGetListViewModel
///
public ActivationStatus Status { get; set; }
+
+ public string Address { get; set; }
+ public string PhoneNumber { get; set; }
+ public string NationalId { get; set; }
+ public string RepresentativeName { get; set; }
+
+
+
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/TemporaryClientRegistration/ContractingPartyTempViewModel.cs b/CompanyManagment.App.Contracts/TemporaryClientRegistration/ContractingPartyTempViewModel.cs
index 5067c36f..87e5a00a 100644
--- a/CompanyManagment.App.Contracts/TemporaryClientRegistration/ContractingPartyTempViewModel.cs
+++ b/CompanyManagment.App.Contracts/TemporaryClientRegistration/ContractingPartyTempViewModel.cs
@@ -8,4 +8,8 @@ public class ContractingPartyTempViewModel : CreateContractingPartyTemp
///
public string DateOfBirthFa { get; set; }
+ public string Address { get; set; }
+ public string City { get; set; }
+ public long RepresentativeId { get; set; }
+
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/TemporaryClientRegistration/CreateInstitutionContractTemp.cs b/CompanyManagment.App.Contracts/TemporaryClientRegistration/CreateInstitutionContractTemp.cs
index 85594646..21a72843 100644
--- a/CompanyManagment.App.Contracts/TemporaryClientRegistration/CreateInstitutionContractTemp.cs
+++ b/CompanyManagment.App.Contracts/TemporaryClientRegistration/CreateInstitutionContractTemp.cs
@@ -67,7 +67,7 @@ public class CreateInstitutionContractTemp
/// -
/// Completed ثبت نام تکمیل شده
///
- public string RegistrationStatus { get; set; }
+ public InstitutionContractTempStatus RegistrationStatus { get; set; }
///
/// آی دی پیامک ارسال شده
diff --git a/CompanyManagment.App.Contracts/TemporaryClientRegistration/CreateWorkshopTemp.cs b/CompanyManagment.App.Contracts/TemporaryClientRegistration/CreateWorkshopTemp.cs
index bf051dea..83e3b675 100644
--- a/CompanyManagment.App.Contracts/TemporaryClientRegistration/CreateWorkshopTemp.cs
+++ b/CompanyManagment.App.Contracts/TemporaryClientRegistration/CreateWorkshopTemp.cs
@@ -16,20 +16,7 @@ public class CreateWorkshopTemp
/// ای دی طرف حساب
///
public long ContractingPartyTempId { get; set; }
-
- ///
- /// جمع کل مبالغ سرویس ها برای کارگاه
- /// Double
- ///
- public double WorkshopServicesAmount { get; set; }
-
- ///
- /// جمع کل مبالغ سرویس ها برای کارگاه
- /// فارسی
- ///
- public string WorkshopServicesAmountStr { get; set; }
-
-
+
#region ServiceSelection
///
@@ -46,6 +33,7 @@ public class CreateWorkshopTemp
/// حضورغباب
///
public bool RollCall { get; set; }
+ public bool RollCallInPerson { get; set; }
///
/// فیش غیر رسمی
diff --git a/CompanyManagment.App.Contracts/TemporaryClientRegistration/ITemporaryClientRegistrationApplication.cs b/CompanyManagment.App.Contracts/TemporaryClientRegistration/ITemporaryClientRegistrationApplication.cs
index 6de66312..f2cc87c8 100644
--- a/CompanyManagment.App.Contracts/TemporaryClientRegistration/ITemporaryClientRegistrationApplication.cs
+++ b/CompanyManagment.App.Contracts/TemporaryClientRegistration/ITemporaryClientRegistrationApplication.cs
@@ -2,7 +2,10 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application;
+using _0_Framework.Application.Enums;
+using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.InstitutionPlan;
+using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
@@ -16,7 +19,7 @@ public interface ITemporaryClientRegistrationApplication
///
///
Task> CreateContractingPartyTemp(string nationalCode, string dateOfBirth, string mobile);
-
+
///
/// تکمیل اطلاعات
///
@@ -52,11 +55,25 @@ public interface ITemporaryClientRegistrationApplication
/// دریافت مبالغ بررسی و پرداخت
///
///
- ///
+ ///
///
///
Task GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
- string periodModel = "12", string paymentModel = "OneTime", string contractStartType = "currentMonth");
+ InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string paymentModel = "OneTime", string contractStartType = "currentMonth");
+
+ ///
+ /// دریافت مبالغ بررسی و پرداخت با لیست کارگاه ها
+ /// این متد برای زمانی است که کارگاه ها در مرحله ثبت نام موقت هستند
+ /// و هنوز در دیتابیس ثبت نشده اند
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task GetTotalPaymentAndWorkshopList(double totalPaymentMonth,
+ InstitutionContractDuration duration , bool hasInPersonContract);
///
/// ایجاد یا ویرایش قرارداد موقت
@@ -94,10 +111,14 @@ public interface ITemporaryClientRegistrationApplication
///
Task PayOffCompleted(long contractingPartyTempId);
+
+
+
///
- /// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
- /// جهت نمایش در کارپوشه
+ /// ارسال لینک تایید قوانین و مقررات به طرف حساب
///
+ ///
///
- Task> RegistrationWorkflowMainList();
-}
\ No newline at end of file
+ Task SendAgreementLink(long contractingPartyTempId);
+}
+
diff --git a/CompanyManagment.App.Contracts/TemporaryClientRegistration/InstitutionContractTempViewModel.cs b/CompanyManagment.App.Contracts/TemporaryClientRegistration/InstitutionContractTempViewModel.cs
index 5f1ea794..4a571649 100644
--- a/CompanyManagment.App.Contracts/TemporaryClientRegistration/InstitutionContractTempViewModel.cs
+++ b/CompanyManagment.App.Contracts/TemporaryClientRegistration/InstitutionContractTempViewModel.cs
@@ -3,4 +3,14 @@
public class InstitutionContractTempViewModel : CreateInstitutionContractTemp
{
public long Id { get; set; }
+}
+
+public enum InstitutionContractTempStatus
+{
+ BeforeSendVerifyCode,
+ VerifyCodeSent,
+ PendingToCompletion,
+ ReceivedCodeFromClient,
+ Completed
+
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/TemporaryClientRegistration/RegistrationWorkflowMainList.cs b/CompanyManagment.App.Contracts/TemporaryClientRegistration/RegistrationWorkflowMainList.cs
deleted file mode 100644
index 773a3130..00000000
--- a/CompanyManagment.App.Contracts/TemporaryClientRegistration/RegistrationWorkflowMainList.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
-
-public class RegistrationWorkflowMainList
-{
- ///
- /// آی دی طرف حساب ثبت شده موقت
- ///
- public long ContractingPartyTempId { get; set; }
-
-
- ///
- /// نام کامل طرف حساب
- ///
- public string ContractingPartyFullName { get; set; }
-
- ///
- /// شماره همراه
- ///
- public string Phone { get; set; }
-
-}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/TemporaryClientRegistration/ReviewAndPaymentViewModel.cs b/CompanyManagment.App.Contracts/TemporaryClientRegistration/ReviewAndPaymentViewModel.cs
index 10912190..d3e2a661 100644
--- a/CompanyManagment.App.Contracts/TemporaryClientRegistration/ReviewAndPaymentViewModel.cs
+++ b/CompanyManagment.App.Contracts/TemporaryClientRegistration/ReviewAndPaymentViewModel.cs
@@ -1,30 +1,22 @@
using System;
using System.Collections.Generic;
+using CompanyManagment.App.Contracts.InstitutionContract;
+using CompanyManagment.App.Contracts.Workshop;
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
public class ReviewAndPaymentViewModel
{
- ///
- /// جمع کل
- /// double
- ///
- public double SumOfWorkshopsPaymentDouble { get; set; }
///
- /// جمع کل
- /// string
+ /// تخفیف
///
- public string SumOfWorkshopsPaymentPaymentStr { get; set; }
-
-
-
+ public string Discount { get; set; }
///
- /// مبلغ پرداخت بدون مالیات
- /// Double
+ /// مقدار جمع مبلغ کارگاه ها
///
- public double OneTimeWithoutTaxPaymentDouble { get; set; }
+ public string SumOfWorkshopsPayment { get; set; }
///
/// مبلغ پرداخت بدون مالیات
@@ -32,118 +24,46 @@ public class ReviewAndPaymentViewModel
///
public string OneTimeWithoutTaxPaymentStr { get; set; }
-
- ///
- /// مبلغ پرداخت کامل
- /// Double
- ///
- public double OneTimeTotalPaymentDouble { get; set; }
-
///
/// مبلغ پرداخت کامل
/// string
///
public string OneTimeTotalPaymentStr { get; set; }
-
-
///
- /// مبلغ پرداخت بدون مالیات
- /// Double
- ///
- public double MonthlyWithoutTaxPaymentDouble { get; set; }
-
- ///
- /// مبلغ پرداخت بدون مالیات
+ /// مبلغ پرداخت بدون مالیات ماهانه
/// string
///
public string MonthlyWithoutTaxPaymentStr { get; set; }
-
///
- /// مبلغ پرداخت کامل
- /// Double
- ///
- public double MonthlyTotalPaymentDouble { get; set; }
-
- ///
- /// مبلغ پرداخت کامل
- /// string
+ /// مبلغ پرداخت کامل ماهانه
+ /// string
///
public string MonthlyTotalPaymentStr { get; set; }
-
- ///
- /// مالیات بر ارزش افزوده
- /// Double
- ///
- public double ValueAddedTaxDouble { get; set; }
-
+
///
/// مالیات بر ارزش افزوده
/// string
///
- public string ValueAddedTaxSt { get; set; }
-
-
-
-
- ///
- /// بازه قرداد
- /// با عدد مشخص میشود
- /// مثلا یک ماه عدد 1
- ///
- public string PeriodModel { get; set; }
-
- ///
- /// OneTime پرداخت یکجا
- /// -
- /// Monthly پرداخت ماهانه
- ///
- public string PaymentModel { get; set; }
-
- ///
- /// لیست کارگاه های ایجاد شده
- ///
- public List WorkshopTempViewList { get; set; }
-
- ///
- /// آی دی طرف حساب
- ///
- public long ContractingPartTempId { get; set; }
+ public string MonthlyValueAddedTaxStr { get; set; }
+
+ public string OneTimeValueAddedTaxStr { get; set; }
///
/// لیست اقساط ماهیانه
///
public List MonthlyInstallments { get; set; }
+ ///
+ /// شروع قرارداد - شمسی
+ ///
+ public string ContractStartFa { get; set; }
///
- /// تاریخ شروع قرارداد در اول ماه جاری
- /// -
- /// شمسی
+ /// شروع قرارداد - میلادی
///
- public string ContractStartCurrentMonthFa { get; set; }
-
- ///
- /// تاریخ شروع قرارداد در اول ماه جاری
- /// -
- /// میلادی
- ///
- public DateTime ContractStartCurrentMonthGr { get; set; }
-
- ///
- /// تاریخ شروع قرارداد در اول ماه بعد
- /// -
- /// شمسی
- ///
- public string ContractStartNextMonthFa{ get; set; }
-
- ///
- /// تاریخ شروع قرارداد در اول ماه بعد
- /// -
- /// میلادی
- ///
- public DateTime ContractStartNextMonthGr { get; set; }
+ public DateTime ContractStartGr { get; set; }
///
/// تاریخ پایان قرارداد
@@ -158,4 +78,8 @@ public class ReviewAndPaymentViewModel
/// شمسی
///
public string ContractEndFa { get; set; }
+
+ public string DailyCompensation { get; set; }
+ public string Obligation { get; set; }
+ public string DiscountedAmountForOneMonth { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/TemporaryClientRegistration/WorkshopTempViewModel.cs b/CompanyManagment.App.Contracts/TemporaryClientRegistration/WorkshopTempViewModel.cs
index c0bc27f2..21f9b570 100644
--- a/CompanyManagment.App.Contracts/TemporaryClientRegistration/WorkshopTempViewModel.cs
+++ b/CompanyManagment.App.Contracts/TemporaryClientRegistration/WorkshopTempViewModel.cs
@@ -3,4 +3,18 @@
public class WorkshopTempViewModel : CreateWorkshopTemp
{
public long Id { get; set; }
+
+ ///
+ /// جمع کل مبالغ سرویس ها برای کارگاه
+ /// Double
+ ///
+ public double WorkshopServicesAmount { get; set; }
+
+ ///
+ /// جمع کل مبالغ سرویس ها برای کارگاه
+ /// فارسی
+ ///
+ public string WorkshopServicesAmountStr { get; set; }
+
+ public long WorkshopId { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs b/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs
index 57b654cd..98355cbc 100644
--- a/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs
+++ b/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs
@@ -151,5 +151,6 @@ public class CreateWorkshop
/// تصفیه حساب بصورت استاتیک محاصبه شود
///
public bool IsStaticCheckout { get; set; }
+
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/Workshop/IWorkshopApplication.cs b/CompanyManagment.App.Contracts/Workshop/IWorkshopApplication.cs
index fc437ad4..9e9ec0ac 100644
--- a/CompanyManagment.App.Contracts/Workshop/IWorkshopApplication.cs
+++ b/CompanyManagment.App.Contracts/Workshop/IWorkshopApplication.cs
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Account;
using CompanyManagment.App.Contracts.Workshop.DTOs;
+using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.Workshop;
@@ -89,4 +90,175 @@ public interface IWorkshopApplication
#endregion
+
+ Task> CreateWorkshopWorkflowRegistration(CreateWorkshopWorkflowRegistration command);
+}
+
+public class CreateWorkshopWorkflowRegistration
+{
+ ///
+ /// شناسه جزئیات کارگاه قرارداد نهاد مرتبط
+ ///
+ public long InstitutionContractWorkshopInitialId { get; set; }
+ ///
+ /// نام کارگاه
+ ///
+ public string WorkshopName { get; set; }
+ ///
+ /// نام مستعار
+ ///
+ public string SureName { get; set; }
+ ///
+ /// نوع مالکیت
+ ///
+ public string TypeOfOwnership { get; set; }
+ ///
+ /// کد بایگانی
+ ///
+ public string ArchiveCode { get; set; }
+ ///
+ /// نام نماینده
+ ///
+ public string AgentName { get; set; }
+ ///
+ /// شناسه طرف قرارداد
+ ///
+ public long ContractingPartyId { get; set; }
+ ///
+ /// شهر
+ ///
+ public string City { get; set; }
+ ///
+ /// استان
+ ///
+ public string Province { get; set; }
+ ///
+ /// آدرس
+ ///
+ public string Address { get; set; }
+ ///
+ /// شناسه حساب کارشناس ارشد قرارداد
+ ///
+ public long SeniorContractAccountId { get; set; }
+ ///
+ /// شناسه حساب کارشناس قرارداد
+ ///
+ public long JuniorContractAccountId { get; set; }
+ ///
+ /// شناسه حساب کارشناس ارشد بیمه
+ ///
+ public long SeniorInsuranceAccountId { get; set; }
+ ///
+ /// شناسه حساب کارشناس بیمه
+ ///
+ public long JuniorInsuranceAccountId { get; set; }
+ ///
+ /// باز بودن در تعطیلات
+ ///
+ public bool WorkingInHoliday { get; set; }
+ ///
+ /// محاسبه نوبت کاری در فیش حقوقی
+ ///
+ public bool RotatingShiftCompute { get; set; }
+
+ ///
+ /// ایجاد قرارداد
+ ///
+ public bool CreateContract { get; set; }
+ ///
+ /// امضاء قراداد
+ ///
+ public bool SignContract { get; set; }
+ ///
+ /// ایجات تصفیه حساب
+ ///
+ public bool CreateCheckout { get; set; }
+ ///
+ /// امضاء تصفیه حساب
+ ///
+ public bool SignCheckout { get; set; }
+ ///
+ /// تصفیه حساب بصورت استاتیک محاصبه شود
+ ///
+ public bool IsStaticCheckout { get; set; }
+ ///
+ /// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
+ /// این آیتم
+ /// True
+ /// است
+ ///
+ public IsActive CutContractEndOfYear { get; set; }
+ ///
+ /// سرویس تصفیه حساب سفارشی
+ ///
+ public string HasCustomizeCheckoutService { get; set; }
+
+ ///
+ /// محاسبه اضافه کار فیش حقوقی در لیست بیمه
+ ///
+ public bool InsuranceCheckoutOvertime { get; set; }
+ ///
+ /// محاسبه حق اولاد در لیست بیمه
+ ///
+ public bool InsuranceCheckoutFamilyAllowance { get; set; }
+ ///
+ /// حضور و غیاب رایگان ویژه
+ ///
+ public string HasRollCallFreeVip { get; set; }
+ ///
+ /// مدت قرارداد
+ ///
+ public string ContractTerm { get; set; }
+ ///
+ /// مخفی کردن کل پرداخت
+ ///
+ public bool TotalPaymentHide { get; set; }
+ ///
+ /// نوع ارسال بیمه
+ ///
+ public string TypeOfInsuranceSend { get; set; }
+ ///
+ /// کد بیمه
+ ///
+ public string InsuranceCode { get; set; }
+
+ ///
+ /// مشمول دستمزد مقطوع
+ ///
+ public bool FixedSalary { get; set; }
+
+ ///
+ /// صنف
+ ///
+ public long InsuranceJobId { get; set; }
+
+ ///
+ /// جمعیت شهر
+ ///
+ public string Population { get; set; }
+
+ ///
+ /// شماره تماس نماینده کارگاه
+ ///
+ public string AgentPhone { get; set; }
+
+ public string TypeOfContract { get; set; }
+ ///
+ /// ردیف پیمان
+ ///
+ public string AgreementNumber { get; set; }
+
+ ///
+ /// نوع محاسبه طلب مرخصی
+ ///
+ public string ComputeOptions { get; set; }
+
+ ///
+ /// نوع محسبه عیدی و پاداش
+ ///
+ public string BonusesOptions { get; set; }
+ ///
+ /// نوع محاسبه سنوات
+ ///
+ public string YearsOptions { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.Application/AuthorizedPersonApplication.cs b/CompanyManagment.Application/AuthorizedPersonApplication.cs
new file mode 100644
index 00000000..075e1e38
--- /dev/null
+++ b/CompanyManagment.Application/AuthorizedPersonApplication.cs
@@ -0,0 +1,119 @@
+using System.Collections.Generic;
+using System.Linq;
+using _0_Framework.Application;
+using Company.Domain.AuthorizedPersonAgg;
+using CompanyManagment.App.Contracts.AuthorizedPerson;
+
+namespace CompanyManagment.Application;
+
+public class AuthorizedPersonApplication : IAuthorizedPersonApplication
+{
+ private readonly IAuthorizedPersonRepository _authorizedPersonRepository;
+
+ public AuthorizedPersonApplication(IAuthorizedPersonRepository authorizedPersonRepository)
+ {
+ _authorizedPersonRepository = authorizedPersonRepository;
+ }
+
+ public OperationResult Create(CreateAuthorizedPerson command)
+ {
+ var operation = new OperationResult();
+
+ if (_authorizedPersonRepository.ExistsByNationalCode(command.NationalCode))
+ return operation.Failed("شخص با این کد ملی قبلاً ثبت شده است");
+
+ var authorizedPerson = new AuthorizedPerson(
+ command.NationalCode, command.FirstName, command.LastName,
+ command.FatherName, command.BirthDate, command.Gender,
+ command.DeathStatus, command.ShenasnameSeri,
+ command.ShenasnameSerial, command.ShenasnamehNumber);
+
+ _authorizedPersonRepository.Create(authorizedPerson);
+ _authorizedPersonRepository.SaveChanges();
+
+ return operation.Succcedded();
+ }
+
+ public OperationResult CreateFromUidResponse(CreateAuthorizedPerson command)
+ {
+ var operation = new OperationResult();
+
+ var existingPerson = _authorizedPersonRepository.GetByNationalCode(command.NationalCode);
+ if (existingPerson != null)
+ {
+ existingPerson.UpdatePersonalInfo(command.FirstName, command.LastName,
+ command.FatherName, command.Gender, command.DeathStatus);
+ _authorizedPersonRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+
+ var authorizedPerson = new AuthorizedPerson(
+ command.NationalCode, command.FirstName, command.LastName,
+ command.FatherName, command.BirthDate, command.Gender,
+ command.DeathStatus, command.ShenasnameSeri,
+ command.ShenasnameSerial, command.ShenasnamehNumber);
+
+ _authorizedPersonRepository.Create(authorizedPerson);
+ _authorizedPersonRepository.SaveChanges();
+
+ return operation.Succcedded();
+ }
+
+ public AuthorizedPersonViewModel GetByNationalCode(string nationalCode)
+ {
+ var authorizedPerson = _authorizedPersonRepository.GetByNationalCode(nationalCode);
+ if (authorizedPerson == null) return null;
+
+ return new AuthorizedPersonViewModel
+ {
+ Id = authorizedPerson.id,
+ NationalCode = authorizedPerson.NationalCode,
+ FirstName = authorizedPerson.FirstName,
+ LastName = authorizedPerson.LastName,
+ FatherName = authorizedPerson.FatherName,
+ BirthDate = authorizedPerson.BirthDate,
+ Gender = authorizedPerson.Gender,
+ DeathStatus = authorizedPerson.DeathStatus,
+ ShenasnameSeri = authorizedPerson.ShenasnameSeri,
+ ShenasnameSerial = authorizedPerson.ShenasnameSerial,
+ ShenasnamehNumber = authorizedPerson.ShenasnamehNumber,
+ IsVerified = authorizedPerson.IsVerified,
+ VerificationDate = authorizedPerson.VerificationDate?.ToString("yyyy/MM/dd HH:mm"),
+ CreationDate = authorizedPerson.CreationDate.ToString("yyyy/MM/dd HH:mm")
+ };
+ }
+
+ public List Search(string nationalCode = null, string firstName = null, string lastName = null)
+ {
+ var allPersons = _authorizedPersonRepository.Get();
+
+ var filteredPersons = allPersons.Where(x =>
+ (string.IsNullOrEmpty(nationalCode) || x.NationalCode.Contains(nationalCode)) &&
+ (string.IsNullOrEmpty(firstName) || x.FirstName.Contains(firstName)) &&
+ (string.IsNullOrEmpty(lastName) || x.LastName.Contains(lastName)))
+ .Select(x => new AuthorizedPersonViewModel
+ {
+ Id = x.id,
+ NationalCode = x.NationalCode,
+ FirstName = x.FirstName,
+ LastName = x.LastName,
+ FatherName = x.FatherName,
+ BirthDate = x.BirthDate,
+ Gender = x.Gender,
+ DeathStatus = x.DeathStatus,
+ ShenasnameSeri = x.ShenasnameSeri,
+ ShenasnameSerial = x.ShenasnameSerial,
+ ShenasnamehNumber = x.ShenasnamehNumber,
+ IsVerified = x.IsVerified,
+ VerificationDate = x.VerificationDate?.ToString("yyyy/MM/dd HH:mm"),
+ CreationDate = x.CreationDate.ToString("yyyy/MM/dd HH:mm")
+ }).ToList();
+
+ return filteredPersons;
+ }
+
+ public bool ExistsByNationalCode(string nationalCode)
+ {
+ return _authorizedPersonRepository.ExistsByNationalCode(nationalCode);
+ }
+}
diff --git a/CompanyManagment.Application/EmployerApplication.cs b/CompanyManagment.Application/EmployerApplication.cs
index 5a088754..b6edf65c 100644
--- a/CompanyManagment.Application/EmployerApplication.cs
+++ b/CompanyManagment.Application/EmployerApplication.cs
@@ -1,13 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Security.AccessControl;
using System.Threading.Tasks;
using _0_Framework.Application;
+using _0_Framework.Application.Enums;
+using _0_Framework.Application.UID;
using _0_Framework.Exceptions;
using Company.Domain.empolyerAgg;
+using Company.Domain.InstitutionContractAgg;
using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Employer;
+using CompanyManagment.EFCore.Repository;
+using Microsoft.Identity.Client;
namespace CompanyManagment.Application;
@@ -23,12 +29,20 @@ public class EmployerApplication : IEmployerApplication
public bool registerIdIsOk = true;
public bool nationalIdIsOk = true;
- public EmployerApplication(IEmployerRepository employerRepository, IWorkshopRepository workshopRepository)
+ private readonly IInstitutionContractRepository _institutionContractRepository;
+ private readonly IUidService _uidService;
+
+ public EmployerApplication(IEmployerRepository employerRepository, IWorkshopRepository workshopRepository,
+ IInstitutionContractRepository institutionContractRepository, IUidService uidService)
{
_EmployerRepository = employerRepository;
_workshopRepository = workshopRepository;
+ _institutionContractRepository = institutionContractRepository;
+ _uidService = uidService;
}
+
+
public OperationResult Active(long id)
{
var opration = new OperationResult();
@@ -46,7 +60,8 @@ public class EmployerApplication : IEmployerApplication
{
var opration = new OperationResult();
if (_EmployerRepository.Exists(x =>
- (x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.Nationalcode && x.Nationalcode != null))
+ (x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.Nationalcode &&
+ x.Nationalcode != null))
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
//if (_EmployerRepository.Exists(x => x.IdNumber == command.IdNumber && x.IdNumber != null))
// return opration.Failed("شماره شناسنامه وارد شده تکراری است");
@@ -68,6 +83,7 @@ public class EmployerApplication : IEmployerApplication
{
numArray[i] = (int)char.GetNumericValue(chArray[i]);
}
+
int num2 = numArray[9];
switch (command.Nationalcode)
{
@@ -84,9 +100,14 @@ public class EmployerApplication : IEmployerApplication
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده صحیح نمی باشد");
}
- int num3 = ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) + (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) + (numArray[8] * 2);
+
+ int num3 =
+ ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) +
+ (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) +
+ (numArray[8] * 2);
int num4 = num3 - ((num3 / 11) * 11);
- if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) || ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
+ if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) ||
+ ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
{
nationalCodValid = true;
}
@@ -101,19 +122,27 @@ public class EmployerApplication : IEmployerApplication
nationalCodValid = false;
return opration.Failed("لطفا کد ملی 10 رقمی وارد کنید");
}
- if (_EmployerRepository.Exists(x => x.Nationalcode == command.Nationalcode && !string.IsNullOrWhiteSpace(command.Nationalcode)))
+
+ if (_EmployerRepository.Exists(x =>
+ x.Nationalcode == command.Nationalcode && !string.IsNullOrWhiteSpace(command.Nationalcode)))
{
nationalcodeIsOk = false;
return opration.Failed("کد ملی وارد شده تکراری است");
}
}
+
string initial = "1300/10/11";
- var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
- var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
- var employerData = new Employer(command.FName, command.LName, command.ContractingPartyId,command.Gender,
+ var dateOfBirth = command.DateOfBirth != null
+ ? command.DateOfBirth.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue != null
+ ? command.DateOfIssue.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
+ var employerData = new Employer(command.FName, command.LName, command.ContractingPartyId, command.Gender,
command.Nationalcode, command.IdNumber, command.Nationality, command.FatherName, dateOfBirth,
- dateOfIssue, command.PlaceOfIssue, "*","*","*","حقیقی", command.Phone,
- command.AgentPhone, "true", command.MclsUserName, command.MclsPassword, command.EserviceUserName, command.EservicePassword,
+ dateOfIssue, command.PlaceOfIssue, "*", "*", "*", "حقیقی", command.Phone,
+ command.AgentPhone, "true", command.MclsUserName, command.MclsPassword, command.EserviceUserName,
+ command.EservicePassword,
command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword);
_EmployerRepository.Create(employerData);
_EmployerRepository.SaveChanges();
@@ -126,25 +155,32 @@ public class EmployerApplication : IEmployerApplication
command.EmployerLName = "#";
var opration = new OperationResult();
if (_EmployerRepository.Exists(x =>
- x.LName == command.LName && x.NationalId == command.NationalId && x.EmployerLName == command.EmployerLName))
+ x.LName == command.LName && x.NationalId == command.NationalId &&
+ x.EmployerLName == command.EmployerLName))
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
- if (_EmployerRepository.Exists(x => x.NationalId == command.NationalId && !string.IsNullOrWhiteSpace(command.NationalId) && x.NationalId != null))
+ if (_EmployerRepository.Exists(x =>
+ x.NationalId == command.NationalId && !string.IsNullOrWhiteSpace(command.NationalId) &&
+ x.NationalId != null))
{
nationalIdIsOk = false;
return opration.Failed(" شناسه ملی وارد شده تکراری است");
}
+
if (_EmployerRepository.Exists(x => x.LName == command.LName))
{
nameIsOk = false;
return opration.Failed("نام شرکت وارد شده تکراری است");
}
- if (_EmployerRepository.Exists(x => x.RegisterId == command.RegisterId && !string.IsNullOrWhiteSpace(command.RegisterId) && x.RegisterId !=null))
+
+ if (_EmployerRepository.Exists(x =>
+ x.RegisterId == command.RegisterId && !string.IsNullOrWhiteSpace(command.RegisterId) &&
+ x.RegisterId != null))
{
registerIdIsOk = false;
return opration.Failed(" شماره ثبت وارد شده تکراری است");
}
- if (!string.IsNullOrEmpty(command.NationalId )&& command.NationalId.Length !=11)
+ if (!string.IsNullOrEmpty(command.NationalId) && command.NationalId.Length != 11)
{
return opration.Failed(" شناسه ملی باید 11 رقم باشد");
}
@@ -170,6 +206,7 @@ public class EmployerApplication : IEmployerApplication
{
numArray[i] = (int)char.GetNumericValue(chArray[i]);
}
+
int num2 = numArray[9];
switch (command.Nationalcode)
{
@@ -186,9 +223,14 @@ public class EmployerApplication : IEmployerApplication
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده صحیح نمی باشد");
}
- int num3 = ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) + (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) + (numArray[8] * 2);
+
+ int num3 =
+ ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) +
+ (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) +
+ (numArray[8] * 2);
int num4 = num3 - ((num3 / 11) * 11);
- if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) || ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
+ if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) ||
+ ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
{
nationalCodValid = true;
}
@@ -209,13 +251,20 @@ public class EmployerApplication : IEmployerApplication
// return opration.Failed(" کد ملی وارد شده تکراری است");
//}
}
+
string initial = "1300/10/11";
- var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
- var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
+ var dateOfBirth = command.DateOfBirth != null
+ ? command.DateOfBirth.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue != null
+ ? command.DateOfIssue.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
var LegalEmployerData = new Employer(command.FName, command.LName, command.ContractingPartyId, command.Gender,
command.Nationalcode, command.IdNumber, command.Nationality, command.FatherName, dateOfBirth,
- dateOfIssue, command.PlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName, "حقوقی", command.Phone,
- command.AgentPhone, "true", command.MclsUserName, command.MclsPassword, command.EserviceUserName, command.EservicePassword,
+ dateOfIssue, command.PlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName, "حقوقی",
+ command.Phone,
+ command.AgentPhone, "true", command.MclsUserName, command.MclsPassword, command.EserviceUserName,
+ command.EservicePassword,
command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword);
@@ -223,8 +272,6 @@ public class EmployerApplication : IEmployerApplication
_EmployerRepository.SaveChanges();
return opration.Succcedded();
-
-
}
public OperationResult DeActive(long id)
@@ -252,8 +299,10 @@ public class EmployerApplication : IEmployerApplication
}
else
return opration.Failed("حذف با خطا مواجه نشد");
+
return opration;
}
+
public List GetEmployers()
{
return _EmployerRepository.GetEmployers();
@@ -267,14 +316,13 @@ public class EmployerApplication : IEmployerApplication
return opration.Failed("رکورد مورد نظر یافت نشد");
if (_EmployerRepository.Exists(x =>
- (x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.Nationalcode && x.id != command.Id))
+ (x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.Nationalcode &&
+ x.id != command.Id))
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
if (!string.IsNullOrWhiteSpace(command.Nationalcode))
{
try
{
-
-
char[] chArray = command.Nationalcode.ToCharArray();
int[] numArray = new int[chArray.Length];
var cunt = chArray.Length;
@@ -282,6 +330,7 @@ public class EmployerApplication : IEmployerApplication
{
numArray[i] = (int)char.GetNumericValue(chArray[i]);
}
+
int num2 = numArray[9];
switch (command.Nationalcode)
{
@@ -297,39 +346,35 @@ public class EmployerApplication : IEmployerApplication
case "9999999999":
-
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده صحیح نمی باشد");
-
-
}
- int num3 = ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) + (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) + (numArray[8] * 2);
+
+ int num3 =
+ ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) +
+ (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) +
+ (numArray[8] * 2);
int num4 = num3 - ((num3 / 11) * 11);
- if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) || ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
+ if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) ||
+ ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
{
-
-
-
nationalCodValid = true;
-
-
}
else
{
-
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
}
-
}
catch (Exception)
{
-
nationalCodValid = false;
return opration.Failed("لطفا کد ملی 10 رقمی وارد کنید");
-
}
- if (_EmployerRepository.Exists(x => x.Nationalcode == command.Nationalcode && !string.IsNullOrWhiteSpace(command.Nationalcode) && x.id != command.Id))
+
+ if (_EmployerRepository.Exists(x =>
+ x.Nationalcode == command.Nationalcode && !string.IsNullOrWhiteSpace(command.Nationalcode) &&
+ x.id != command.Id))
{
nationalcodeIsOk = false;
@@ -337,20 +382,23 @@ public class EmployerApplication : IEmployerApplication
}
}
-
+
string initial = "1300/10/11";
- var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
- var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
+ var dateOfBirth = command.DateOfBirth != null
+ ? command.DateOfBirth.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue != null
+ ? command.DateOfIssue.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
employer.Edit(command.FName, command.LName, command.ContractingPartyId,
command.Gender, command.Nationalcode, command.IdNumber, command.Nationality, command.FatherName,
dateOfBirth, dateOfIssue, command.PlaceOfIssue, command.Phone, command.AgentPhone,
command.MclsUserName, command.MclsPassword, command.EserviceUserName, command.EservicePassword,
- command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword, command.EmployerNo);
+ command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword,
+ command.EmployerNo);
_EmployerRepository.SaveChanges();
return opration.Succcedded();
-
-
}
public OperationResult EditEmployerNo(EditEmployer command)
@@ -370,7 +418,6 @@ public class EmployerApplication : IEmployerApplication
{
return null;
}
-
}
public OperationResult EditLegal(EditEmployer command)
@@ -381,7 +428,8 @@ public class EmployerApplication : IEmployerApplication
return opration.Failed("رکورد مورد نظر یافت نشد");
if (_EmployerRepository.Exists(x =>
- x.LName == command.LName && x.NationalId == command.NationalId && !string.IsNullOrWhiteSpace(command.NationalId) && x.id != command.Id))
+ x.LName == command.LName && x.NationalId == command.NationalId &&
+ !string.IsNullOrWhiteSpace(command.NationalId) && x.id != command.Id))
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
@@ -395,8 +443,6 @@ public class EmployerApplication : IEmployerApplication
{
try
{
-
-
char[] chArray = command.Nationalcode.ToCharArray();
int[] numArray = new int[chArray.Length];
var cunt = chArray.Length;
@@ -404,6 +450,7 @@ public class EmployerApplication : IEmployerApplication
{
numArray[i] = (int)char.GetNumericValue(chArray[i]);
}
+
int num2 = numArray[9];
switch (command.Nationalcode)
{
@@ -419,37 +466,30 @@ public class EmployerApplication : IEmployerApplication
case "9999999999":
-
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده صحیح نمی باشد");
-
-
}
- int num3 = ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) + (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) + (numArray[8] * 2);
+
+ int num3 =
+ ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) +
+ (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) +
+ (numArray[8] * 2);
int num4 = num3 - ((num3 / 11) * 11);
- if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) || ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
+ if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) ||
+ ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
{
-
-
-
nationalCodValid = true;
-
-
}
else
{
-
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
}
-
}
catch (Exception)
{
-
nationalCodValid = false;
return opration.Failed("لطفا کد ملی 10 رقمی وارد کنید");
-
}
//if (_EmployerRepository.Exists(x => x.Nationalcode == command.Nationalcode && x.id != command.Id))
//{
@@ -458,18 +498,24 @@ public class EmployerApplication : IEmployerApplication
// return opration.Failed(" کد ملی وارد شده تکراری است");
//}
}
+
string initial = "1300/10/11";
- var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
- var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
+ var dateOfBirth = command.DateOfBirth != null
+ ? command.DateOfBirth.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue != null
+ ? command.DateOfIssue.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
legalEmployer.EditLegal(command.FName, command.LName, command.ContractingPartyId, command.Gender,
command.Nationalcode, command.IdNumber, command.Nationality, command.FatherName, dateOfBirth,
dateOfIssue, command.PlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName,
- command.Phone, command.AgentPhone, command.MclsUserName, command.MclsPassword, command.EserviceUserName, command.EservicePassword,
- command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword, command.EmployerNo);
+ command.Phone, command.AgentPhone, command.MclsUserName, command.MclsPassword, command.EserviceUserName,
+ command.EservicePassword,
+ command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword,
+ command.EmployerNo);
_EmployerRepository.SaveChanges();
return opration.Succcedded();
-
}
public EditEmployer GetDetails(long id)
@@ -479,7 +525,7 @@ public class EmployerApplication : IEmployerApplication
public List Search(EmployerSearchModel searchModel)
{
- var result= _EmployerRepository.Search(searchModel);
+ var result = _EmployerRepository.Search(searchModel);
var workshopList = _workshopRepository.GetWorkshop();
var WorkshopEmployers = _workshopRepository.WorkshopEmployers();
@@ -492,6 +538,7 @@ public class EmployerApplication : IEmployerApplication
//employerList = new List { item.Id };
//item.WorkshopList = _workshopRepository.GetWorkshopsByEmployerId(employerList);
}
+
return result;
}
@@ -499,14 +546,17 @@ public class EmployerApplication : IEmployerApplication
{
return _EmployerRepository.GetEmployerByWorkshopId(workshopId);
}
+
public List GetEmployerByContracrtingPartyID(long id)
{
return _EmployerRepository.GetEmployerByContracrtingPartyID(id);
}
+
public List GetEmployerByEmployerIds(List employerIds)
{
return _EmployerRepository.GetEmployerByEmployerIds(employerIds);
}
+
public OperationResult CreateForClient(CreateEmployer command)
{
var opration = new OperationResult();
@@ -514,7 +564,6 @@ public class EmployerApplication : IEmployerApplication
{
if (_EmployerRepository.ExistsEmployerAccount(command.Nationalcode))
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
-
}
if (string.IsNullOrWhiteSpace(command.FName))
@@ -530,6 +579,7 @@ public class EmployerApplication : IEmployerApplication
{
numArray[i] = (int)char.GetNumericValue(chArray[i]);
}
+
int num2 = numArray[9];
switch (command.Nationalcode)
{
@@ -547,9 +597,14 @@ public class EmployerApplication : IEmployerApplication
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده صحیح نمی باشد");
}
- int num3 = ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) + (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) + (numArray[8] * 2);
+
+ int num3 =
+ ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) +
+ (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) +
+ (numArray[8] * 2);
int num4 = num3 - ((num3 / 11) * 11);
- if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) || ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
+ if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) ||
+ ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
{
nationalCodValid = true;
}
@@ -558,27 +613,27 @@ public class EmployerApplication : IEmployerApplication
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
}
-
}
catch (Exception)
{
-
nationalCodValid = false;
return opration.Failed("لطفا کد ملی 10 رقمی وارد کنید");
-
}
-
-
}
string initial = "1300/10/11";
- var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
- var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
+ var dateOfBirth = command.DateOfBirth != null
+ ? command.DateOfBirth.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue != null
+ ? command.DateOfIssue.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
var employerData = new Employer(command.FName, command.LName, command.ContractingPartyId, command.Gender,
command.Nationalcode, command.IdNumber, command.Nationality, command.FatherName, dateOfBirth,
dateOfIssue, command.PlaceOfIssue, "*", "*", "*", "حقیقی", command.Phone,
- command.AgentPhone, "true", command.MclsUserName, command.MclsPassword, command.EserviceUserName, command.EservicePassword,
+ command.AgentPhone, "true", command.MclsUserName, command.MclsPassword, command.EserviceUserName,
+ command.EservicePassword,
command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword);
@@ -588,19 +643,20 @@ public class EmployerApplication : IEmployerApplication
return opration.Succcedded();
else
return opration.Failed("ثبت با خطا مواجه شد!");
-
}
+
public List SearchForClient(EmployerSearchModel searchModel)
{
return _EmployerRepository.SearchForClient(searchModel);
}
+
public List GetEmployersForClient(long acountID)
{
return _EmployerRepository.GetEmployersForClient(acountID);
}
+
public OperationResult CreateLegalsForClient(CreateEmployer command)
{
-
if (string.IsNullOrWhiteSpace(command.EmployerLName))
command.EmployerLName = "#";
var opration = new OperationResult();
@@ -611,6 +667,7 @@ public class EmployerApplication : IEmployerApplication
if (_EmployerRepository.ExistsEmployerAccountNationalId(command.NationalId))
return opration.Failed(" شناسه ملی وارد شده تکراری است");
}
+
if (_EmployerRepository.Exists(x => x.LName == command.LName))
{
if (_EmployerRepository.ExistsEmployerAccountLName(command.LName))
@@ -619,6 +676,7 @@ public class EmployerApplication : IEmployerApplication
return opration.Failed("نام شرکت وارد شده تکراری است");
}
}
+
if (_EmployerRepository.Exists(x => x.RegisterId == command.RegisterId && x.RegisterId != null))
{
if (_EmployerRepository.ExistsEmployerAccountRegisterId(command.RegisterId))
@@ -632,8 +690,6 @@ public class EmployerApplication : IEmployerApplication
{
try
{
-
-
char[] chArray = command.Nationalcode.ToCharArray();
int[] numArray = new int[chArray.Length];
var cunt = chArray.Length;
@@ -641,6 +697,7 @@ public class EmployerApplication : IEmployerApplication
{
numArray[i] = (int)char.GetNumericValue(chArray[i]);
}
+
int num2 = numArray[9];
switch (command.Nationalcode)
{
@@ -656,37 +713,30 @@ public class EmployerApplication : IEmployerApplication
case "9999999999":
-
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده صحیح نمی باشد");
-
-
}
- int num3 = ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) + (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) + (numArray[8] * 2);
+
+ int num3 =
+ ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) +
+ (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) +
+ (numArray[8] * 2);
int num4 = num3 - ((num3 / 11) * 11);
- if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) || ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
+ if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) ||
+ ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
{
-
-
-
nationalCodValid = true;
-
-
}
else
{
-
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
}
-
}
catch (Exception)
{
-
nationalCodValid = false;
return opration.Failed("لطفا کد ملی 10 رقمی وارد کنید");
-
}
//if (_EmployerRepository.Exists(x => x.Nationalcode == command.Nationalcode))
//{
@@ -698,12 +748,18 @@ public class EmployerApplication : IEmployerApplication
string initial = "1300/10/11";
- var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
- var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
+ var dateOfBirth = command.DateOfBirth != null
+ ? command.DateOfBirth.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue != null
+ ? command.DateOfIssue.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
var LegalEmployerData = new Employer(command.FName, command.LName, command.ContractingPartyId, command.Gender,
command.Nationalcode, command.IdNumber, command.Nationality, command.FatherName, dateOfBirth,
- dateOfIssue, command.PlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName, "حقوقی", command.Phone,
- command.AgentPhone, "true", command.MclsUserName, command.MclsPassword, command.EserviceUserName, command.EservicePassword,
+ dateOfIssue, command.PlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName, "حقوقی",
+ command.Phone,
+ command.AgentPhone, "true", command.MclsUserName, command.MclsPassword, command.EserviceUserName,
+ command.EservicePassword,
command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword);
@@ -714,8 +770,8 @@ public class EmployerApplication : IEmployerApplication
return opration.Succcedded();
else
return opration.Failed("ثبت با خطا مواجه شد!");
-
}
+
public OperationResult EditForClient(EditEmployer command)
{
var opration = new OperationResult();
@@ -728,7 +784,6 @@ public class EmployerApplication : IEmployerApplication
{
if (_EmployerRepository.ExistsEmployerAccountById(command.Nationalcode, command.Id))
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
-
}
if (!string.IsNullOrWhiteSpace(command.Nationalcode))
@@ -742,6 +797,7 @@ public class EmployerApplication : IEmployerApplication
{
numArray[i] = (int)char.GetNumericValue(chArray[i]);
}
+
int num2 = numArray[9];
switch (command.Nationalcode)
{
@@ -758,9 +814,14 @@ public class EmployerApplication : IEmployerApplication
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده صحیح نمی باشد");
}
- int num3 = ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) + (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) + (numArray[8] * 2);
+
+ int num3 =
+ ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) +
+ (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) +
+ (numArray[8] * 2);
int num4 = num3 - ((num3 / 11) * 11);
- if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) || ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
+ if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) ||
+ ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
{
nationalCodValid = true;
}
@@ -769,7 +830,6 @@ public class EmployerApplication : IEmployerApplication
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
}
-
}
catch (Exception)
{
@@ -777,23 +837,35 @@ public class EmployerApplication : IEmployerApplication
return opration.Failed("لطفا کد ملی 10 رقمی وارد کنید");
}
+ if (_EmployerRepository.Exists(x =>
+ x.Nationalcode == command.Nationalcode && !string.IsNullOrWhiteSpace(command.Nationalcode) &&
+ x.id != command.Id))
+ {
+ nationalcodeIsOk = false;
+
+ return opration.Failed(" کد ملی وارد شده تکراری است");
+ }
}
string initial = "1300/10/11";
- var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
- var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
+ var dateOfBirth = command.DateOfBirth != null
+ ? command.DateOfBirth.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue != null
+ ? command.DateOfIssue.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
employer.Edit(command.FName, command.LName, command.ContractingPartyId,
command.Gender, command.Nationalcode, command.IdNumber, command.Nationality, command.FatherName,
dateOfBirth, dateOfIssue, command.PlaceOfIssue, command.Phone, command.AgentPhone,
command.MclsUserName, command.MclsPassword, command.EserviceUserName, command.EservicePassword,
- command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword, command.EmployerNo);
+ command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword,
+ command.EmployerNo);
_EmployerRepository.SaveChanges();
return opration.Succcedded();
-
-
}
+
public OperationResult EditLegalForClient(EditEmployer command)
{
var opration = new OperationResult();
@@ -812,8 +884,6 @@ public class EmployerApplication : IEmployerApplication
{
try
{
-
-
char[] chArray = command.Nationalcode.ToCharArray();
int[] numArray = new int[chArray.Length];
var cunt = chArray.Length;
@@ -821,6 +891,7 @@ public class EmployerApplication : IEmployerApplication
{
numArray[i] = (int)char.GetNumericValue(chArray[i]);
}
+
int num2 = numArray[9];
switch (command.Nationalcode)
{
@@ -836,37 +907,30 @@ public class EmployerApplication : IEmployerApplication
case "9999999999":
-
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده صحیح نمی باشد");
-
-
}
- int num3 = ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) + (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) + (numArray[8] * 2);
+
+ int num3 =
+ ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) +
+ (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) +
+ (numArray[8] * 2);
int num4 = num3 - ((num3 / 11) * 11);
- if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) || ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
+ if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) ||
+ ((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
{
-
-
-
nationalCodValid = true;
-
-
}
else
{
-
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
}
-
}
catch (Exception)
{
-
nationalCodValid = false;
return opration.Failed("لطفا کد ملی 10 رقمی وارد کنید");
-
}
//if (_EmployerRepository.Exists(x => x.Nationalcode == command.Nationalcode && x.id != command.Id))
//{
@@ -875,21 +939,28 @@ public class EmployerApplication : IEmployerApplication
// return opration.Failed(" کد ملی وارد شده تکراری است");
//}
}
+
string initial = "1300/10/11";
- var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
- var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
+ var dateOfBirth = command.DateOfBirth != null
+ ? command.DateOfBirth.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue != null
+ ? command.DateOfIssue.ToGeorgianDateTime()
+ : initial.ToGeorgianDateTime();
legalEmployer.EditLegal(command.FName, command.LName, command.ContractingPartyId, command.Gender,
command.Nationalcode, command.IdNumber, command.Nationality, command.FatherName, dateOfBirth,
dateOfIssue, command.PlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName,
- command.Phone, command.AgentPhone, command.MclsUserName, command.MclsPassword, command.EserviceUserName, command.EservicePassword,
- command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword, command.EmployerNo);
+ command.Phone, command.AgentPhone, command.MclsUserName, command.MclsPassword, command.EserviceUserName,
+ command.EservicePassword,
+ command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword,
+ command.EmployerNo);
_EmployerRepository.SaveChanges();
return opration.Succcedded();
-
}
#region Mahan
+
public List GetEmployersHasWorkshop()
{
return _EmployerRepository.GetEmployersHasWorkshop();
@@ -899,19 +970,19 @@ public class EmployerApplication : IEmployerApplication
//{
// return await _EmployerRepository.GetSelectList(search);
//}
+
#endregion
#region NewByHeydari
-
public OperationResult DeleteEmployer(long id)
{
var opration = new OperationResult();
var ids = new List();
ids.Add(id);
- var workshops= _workshopRepository.GetWorkshopsByEmployerId(ids);
+ var workshops = _workshopRepository.GetWorkshopsByEmployerId(ids);
- if (workshops!=null && workshops.Count>0)
+ if (workshops != null && workshops.Count > 0)
{
return _EmployerRepository.DeActiveAll(id);
}
@@ -927,10 +998,12 @@ public class EmployerApplication : IEmployerApplication
{
return _EmployerRepository.GetEmployerWithFNameOrLName(searchText);
}
+
public List GetEmployerWithIdNumberOrRegisterId(string searchText)
{
return _EmployerRepository.GetEmployerWithIdNumberOrRegisterId(searchText);
}
+
public List GetEmployerWithNationalcodeOrNationalId(string searchText)
{
return _EmployerRepository.GetEmployerWithNationalcodeOrNationalId(searchText);
@@ -946,267 +1019,650 @@ public class EmployerApplication : IEmployerApplication
return _EmployerRepository.GetAllEmployers();
}
+ #endregion
+
+ #region Insurance
+
+ public (string employerName, bool isLegal) InsuranceEmployerByWorkshopId(long workshopId)
+ {
+ return _EmployerRepository.InsuranceEmployerByWorkshopId(workshopId);
+ }
+
+ #endregion
+
+ #region Api
+
+ public async Task> GetEmployerList(GetEmployerSearchModel searchModel)
+ {
+ return await _EmployerRepository.GetEmployerList(searchModel);
+ }
+
+ public async Task GetLegalEmployerDetail(long id)
+ {
+ var employer = await _EmployerRepository.GetLegalEmployerDetail(id);
+ if (employer == null)
+ {
+ throw new NotFoundException("کارفرمای مورد نطر یافت نشد");
+ }
+
+ return employer;
+ }
+
+ public async Task GetRealEmployerDetail(long id)
+ {
+ var employer = await _EmployerRepository.GetRealEmployerDetail(id);
+ if (employer == null)
+ {
+ throw new NotFoundException("کارفرمای مورد نطر یافت نشد");
+ }
+
+ return employer;
+ }
+
+ public async Task CreateReal(CreateRealEmployer command)
+ {
+ var opration = new OperationResult();
+ if (_EmployerRepository.Exists(x =>
+ (x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.NationalCode &&
+ x.Nationalcode != null))
+ return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
+
+ if (string.IsNullOrWhiteSpace(command.FName))
+ return opration.Failed("لطفا نام را وارد کنید");
+
+ if (!string.IsNullOrWhiteSpace(command.NationalCode))
+ {
+ if (command.NationalCode.NationalCodeValid() != "valid")
+ {
+ return opration.Failed("کدملی وارد شده نامعتبر است");
+ }
+
+ if (_EmployerRepository.Exists(x =>
+ x.Nationalcode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode)))
+ {
+ return opration.Failed("کد ملی وارد شده تکراری است");
+ }
+ }
+
+ string initial = "1300/10/11";
+ var dateOfBirth = command.DateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+
+ var gender = command.Gender switch
+ {
+ Gender.Male => "مرد",
+ Gender.Female => "زن",
+ Gender.None => null,
+ _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
+ };
+
+ var employerData = new Employer(command.FName, command.LName, command.ContractingPartyId, gender,
+ command.NationalCode, command.IdNumber, "ایرانی", command.FatherName, dateOfBirth,
+ dateOfIssue, command.PlaceOfIssue, "*", "*", "*", "حقیقی", command.PhoneNumber,
+ command.Telephone, "true", command.GovernmentSystemInfo.MclUsername,
+ command.GovernmentSystemInfo.MclPassword, command.GovernmentSystemInfo.EServiceUsername,
+ command.GovernmentSystemInfo.EServicePassword,
+ command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
+ command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
+
+ await _EmployerRepository.CreateAsync(employerData);
+ await _EmployerRepository.SaveChangesAsync();
+
+ return opration.Succcedded();
+ }
+
+ public async Task CreateLegal(CreateLegalEmployer command)
+ {
+ if (string.IsNullOrWhiteSpace(command.EmployerLName))
+ command.EmployerLName = "#";
+ var opration = new OperationResult();
+ if (_EmployerRepository.Exists(x =>
+ x.LName == command.CompanyName && x.NationalId == command.NationalId &&
+ x.EmployerLName == command.EmployerLName))
+ return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
+
+ if (_EmployerRepository.Exists(x =>
+ x.NationalId == command.NationalId && !string.IsNullOrWhiteSpace(command.NationalId) &&
+ x.NationalId != null))
+ {
+ return opration.Failed(" شناسه ملی وارد شده تکراری است");
+ }
+
+ if (_EmployerRepository.Exists(x => x.LName == command.CompanyName))
+ {
+ return opration.Failed("نام شرکت وارد شده تکراری است");
+ }
+
+ if (_EmployerRepository.Exists(x =>
+ x.RegisterId == command.RegisterId && !string.IsNullOrWhiteSpace(command.RegisterId) &&
+ x.RegisterId != null))
+ {
+ return opration.Failed(" شماره ثبت وارد شده تکراری است");
+ }
+
+ if (!string.IsNullOrEmpty(command.NationalId) && command.NationalId.Length != 11)
+ {
+ return opration.Failed(" شناسه ملی باید 11 رقم باشد");
+ }
+
+ if (!string.IsNullOrWhiteSpace(command.EmployerNationalCode))
+ {
+ if (command.EmployerNationalCode.NationalCodeValid() != "valid")
+ {
+ return opration.Failed("کد ملی وارد شده نا معتبر است");
+ }
+ }
+
+ string initial = "1300/10/11";
+ var dateOfBirth = command.EmployerDateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+ var dateOfIssue = command.EmployerDateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+
+ var gender = command.EmployerGender switch
+ {
+ Gender.Male => "مرد",
+ Gender.Female => "زن",
+ Gender.None => null,
+ _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
+ };
- #endregion
+ var legalEmployerData = new Employer(command.EmployerFName, command.CompanyName, command.ContractingPartyId,
+ gender,
+ command.EmployerNationalCode, command.EmployerIdNumber, "ایرانی", command.EmployerFatherName, dateOfBirth,
+ dateOfIssue, command.EmployerPlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName,
+ "حقوقی", command.PhoneNumber,
+ command.TelephoneNumber, "true", command.GovernmentSystemInfo.MclUsername,
+ command.GovernmentSystemInfo.MclPassword,
+ command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
+ command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
+ command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
- #region Insurance
+ await _EmployerRepository.CreateAsync(legalEmployerData);
+ await _EmployerRepository.SaveChangesAsync();
- public (string employerName, bool isLegal) InsuranceEmployerByWorkshopId(long workshopId)
- {
- return _EmployerRepository.InsuranceEmployerByWorkshopId(workshopId);
- }
+ return opration.Succcedded();
+ }
- #endregion
+ public async Task EditReal(EditRealEmployer command)
+ {
+ var opration = new OperationResult();
+ var employer = _EmployerRepository.Get(command.Id);
+ if (employer == null)
+ return opration.Failed("رکورد مورد نظر یافت نشد");
- #region Api
- public async Task> GetEmployerList(GetEmployerSearchModel searchModel)
- {
- return await _EmployerRepository.GetEmployerList(searchModel);
- }
- public async Task GetLegalEmployerDetail(long id)
- {
- var employer = await _EmployerRepository.GetLegalEmployerDetail(id);
- if (employer == null)
- {
- throw new NotFoundException("کارفرمای مورد نطر یافت نشد");
- }
- return employer;
- }
+ if (_EmployerRepository.Exists(x =>
+ (x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.NationalCode &&
+ x.id != command.Id))
+ return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
+ if (!string.IsNullOrWhiteSpace(command.NationalCode))
+ {
+ if (command.NationalCode.NationalCodeValid() != "valid")
+ {
+ return opration.Failed("کد ملی وارد شده نا معتبر است");
+ }
+ }
- public async Task GetRealEmployerDetail(long id)
- {
- var employer = await _EmployerRepository.GetRealEmployerDetail(id);
- if (employer == null)
- {
- throw new NotFoundException("کارفرمای مورد نطر یافت نشد");
- }
- return employer;
- }
-
- public async Task CreateReal(CreateRealEmployer command)
- {
- var opration = new OperationResult();
- if (_EmployerRepository.Exists(x =>
- (x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.NationalCode && x.Nationalcode != null))
- return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
-
- if (string.IsNullOrWhiteSpace(command.FName))
- return opration.Failed("لطفا نام را وارد کنید");
-
- if (!string.IsNullOrWhiteSpace(command.NationalCode))
- {
- if (command.NationalCode.NationalCodeValid() != "valid")
- {
- return opration.Failed("کدملی وارد شده نامعتبر است");
- }
- if (_EmployerRepository.Exists(x => x.Nationalcode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode)))
- {
- return opration.Failed("کد ملی وارد شده تکراری است");
- }
- }
- string initial = "1300/10/11";
- var dateOfBirth = command.DateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
- var dateOfIssue = command.DateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
-
- var gender = command.Gender switch
- {
- Gender.Male => "مرد",
- Gender.Female => "زن",
- Gender.None => null,
- _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
- };
-
- var employerData = new Employer(command.FName, command.LName, command.ContractingPartyId, gender,
- command.NationalCode, command.IdNumber, "ایرانی", command.FatherName, dateOfBirth,
- dateOfIssue, command.PlaceOfIssue, "*", "*", "*", "حقیقی", command.PhoneNumber,
- command.Telephone, "true", command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.MclPassword, command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
- command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword, command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
-
- await _EmployerRepository.CreateAsync(employerData);
- await _EmployerRepository.SaveChangesAsync();
-
- return opration.Succcedded();
- }
-
- public async Task CreateLegal(CreateLegalEmployer command)
- {
- if (string.IsNullOrWhiteSpace(command.EmployerLName))
- command.EmployerLName = "#";
- var opration = new OperationResult();
- if (_EmployerRepository.Exists(x =>
- x.LName == command.CompanyName && x.NationalId == command.NationalId && x.EmployerLName == command.EmployerLName))
- return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
-
- if (_EmployerRepository.Exists(x => x.NationalId == command.NationalId && !string.IsNullOrWhiteSpace(command.NationalId) && x.NationalId != null))
- {
- return opration.Failed(" شناسه ملی وارد شده تکراری است");
- }
- if (_EmployerRepository.Exists(x => x.LName == command.CompanyName))
- {
- return opration.Failed("نام شرکت وارد شده تکراری است");
- }
- if (_EmployerRepository.Exists(x => x.RegisterId == command.RegisterId && !string.IsNullOrWhiteSpace(command.RegisterId) && x.RegisterId != null))
- {
- return opration.Failed(" شماره ثبت وارد شده تکراری است");
- }
-
- if (!string.IsNullOrEmpty(command.NationalId) && command.NationalId.Length != 11)
- {
- return opration.Failed(" شناسه ملی باید 11 رقم باشد");
- }
-
- if (!string.IsNullOrWhiteSpace(command.EmployerNationalCode))
- {
- if (command.EmployerNationalCode.NationalCodeValid() != "valid")
- {
- return opration.Failed("کد ملی وارد شده نا معتبر است");
- }
- }
-
- string initial = "1300/10/11";
- var dateOfBirth = command.EmployerDateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
- var dateOfIssue = command.EmployerDateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
-
- var gender = command.EmployerGender switch
- {
- Gender.Male => "مرد",
- Gender.Female => "زن",
- Gender.None => null,
- _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
- };
+ if (_EmployerRepository.Exists(x =>
+ x.Nationalcode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) &&
+ x.id != command.Id))
+ {
+ return opration.Failed(" کد ملی وارد شده تکراری است");
+ }
- var legalEmployerData = new Employer(command.EmployerFName, command.CompanyName, command.ContractingPartyId, gender,
- command.EmployerNationalCode, command.EmployerIdNumber, "ایرانی", command.EmployerFatherName, dateOfBirth,
- dateOfIssue, command.EmployerPlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName, "حقوقی", command.PhoneNumber,
- command.TelephoneNumber, "true", command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.MclPassword,
- command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
- command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword, command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
+ string initial = "1300/10/11";
- await _EmployerRepository.CreateAsync(legalEmployerData);
- await _EmployerRepository.SaveChangesAsync();
+ var dateOfBirth = command.DateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
- return opration.Succcedded();
- }
+ var gender = command.Gender switch
+ {
+ Gender.Male => "مرد",
+ Gender.Female => "زن",
+ Gender.None => null,
+ _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
+ };
- public async Task EditReal(EditRealEmployer command)
- {
- var opration = new OperationResult();
- var employer = _EmployerRepository.Get(command.Id);
- if (employer == null)
- return opration.Failed("رکورد مورد نظر یافت نشد");
+ employer.Edit(command.FName, command.LName, command.ContractingPartyId,
+ gender, command.NationalCode, command.IdNumber, "ایرانی", command.FatherName,
+ dateOfBirth, dateOfIssue, command.PlaceOfIssue, command.PhoneNumber, command.Telephone,
+ command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.MclPassword,
+ command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
+ command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
+ command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword, null);
- if (_EmployerRepository.Exists(x =>
- (x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.NationalCode && x.id != command.Id))
- return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
- if (!string.IsNullOrWhiteSpace(command.NationalCode))
- {
- if (command.NationalCode.NationalCodeValid() != "valid")
- {
- return opration.Failed("کد ملی وارد شده نا معتبر است");
- }
- }
+ await _EmployerRepository.SaveChangesAsync();
+ return opration.Succcedded();
+ }
- if (_EmployerRepository.Exists(x => x.Nationalcode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.id != command.Id))
- {
+ public async Task EditLegal(EditLegalEmployer command)
+ {
+ var opration = new OperationResult();
+ var legalEmployer = _EmployerRepository.Get(command.Id);
+ if (legalEmployer == null)
+ return opration.Failed("رکورد مورد نظر یافت نشد");
- return opration.Failed(" کد ملی وارد شده تکراری است");
- }
+ if (_EmployerRepository.Exists(x =>
+ x.LName == command.CompanyName && x.NationalId == command.NationalId &&
+ !string.IsNullOrWhiteSpace(command.NationalId) && x.id != command.Id))
+ return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
+ if (!string.IsNullOrEmpty(command.NationalId) && command.NationalId.Length != 11)
+ {
+ return opration.Failed(" شناسه ملی باید 11 رقم باشد");
+ }
- string initial = "1300/10/11";
+ if (!string.IsNullOrWhiteSpace(command.EmployerNationalCode))
+ {
+ if (command.EmployerNationalCode.NationalCodeValid() != "valid")
+ {
+ return opration.Failed("کد ملی وارد شده نا معتبر است");
+ }
+ }
- var dateOfBirth = command.DateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
- var dateOfIssue = command.DateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+ var gender = command.EmployerGender switch
+ {
+ Gender.Male => "مرد",
+ Gender.Female => "زن",
+ Gender.None => null,
+ _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
+ };
- var gender = command.Gender switch
- {
- Gender.Male => "مرد",
- Gender.Female => "زن",
- Gender.None => null,
- _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
- };
+ string initial = "1300/10/11";
+ var dateOfBirth = command.EmployerDateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+ var dateOfIssue = command.EmployerDateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+ legalEmployer.EditLegal(command.EmployerFName, command.CompanyName, command.ContractingPartyId, gender,
+ command.EmployerNationalCode, command.EmployerIdNumber, "ایرانی", command.EmployerFatherName, dateOfBirth,
+ dateOfIssue, command.EmployerPlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName,
+ command.PhoneNumber, command.TelephoneNumber, command.GovernmentSystemInfo.MclUsername,
+ command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.EServiceUsername,
+ command.GovernmentSystemInfo.EServicePassword,
+ command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
+ command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword, null);
- employer.Edit(command.FName, command.LName, command.ContractingPartyId,
- gender, command.NationalCode, command.IdNumber, "ایرانی", command.FatherName,
- dateOfBirth, dateOfIssue, command.PlaceOfIssue, command.PhoneNumber, command.Telephone,
- command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.MclPassword, command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
- command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword, command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword, null);
+ await _EmployerRepository.SaveChangesAsync();
+ return opration.Succcedded();
+ }
- await _EmployerRepository.SaveChangesAsync();
- return opration.Succcedded();
- }
+ public async Task> GetSelectList(string search, long id)
+ {
+ return await _EmployerRepository.GetSelectList(search, id);
+ }
- public async Task EditLegal(EditLegalEmployer command)
- {
- var opration = new OperationResult();
- var legalEmployer = _EmployerRepository.Get(command.Id);
- if (legalEmployer == null)
- return opration.Failed("رکورد مورد نظر یافت نشد");
+ async Task> IEmployerApplication.Remove(long id)
+ {
+ var employer = _EmployerRepository.Get(id);
+ if (employer == null)
+ throw new NotFoundException("دیتای مورد نظر یافت نشد");
- if (_EmployerRepository.Exists(x =>
- x.LName == command.CompanyName && x.NationalId == command.NationalId && !string.IsNullOrWhiteSpace(command.NationalId) && x.id != command.Id))
- return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
+ var workshops = _workshopRepository.GetWorkshopsByEmployerId([id]);
+
+ if (workshops.Any())
+ {
+ return await _EmployerRepository.DeactivateWithSubordinates(id);
+ }
+
+ _EmployerRepository.Remove(id);
+
+ return new OperationResult().Succcedded("Deleted");
+ }
+
+ public async Task CreateWorkflowRegistration(CreateEmployerWorkflowRegistration command)
+ {
+ var operation = new OperationResult();
+ var tranasction = await _EmployerRepository.BeginTransactionAsync();
+ OperationResult createEmployerResult = command.LegalType switch
+ {
+ LegalType.Real => await CreateRealEmployerRegistration(command.RealEmployer, command.ContractingPartyId),
+ LegalType.Legal => await CreateLegalEmployerRegistration(command.LegalEmployer, command.ContractingPartyId),
+ _ => throw new ArgumentOutOfRangeException()
+ };
+ var employer = createEmployerResult.Data;
+
+ if (!createEmployerResult.IsSuccedded)
+ return operation.Failed(createEmployerResult.Message);
+
+ var workshopDetails =
+ await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(command.InstitutionWorkshopInitialId);
+ workshopDetails.AddEmployer(employer.id);
+
+ await _institutionContractRepository.SaveChangesAsync();
+ await tranasction.CommitAsync();
+ return operation.Succcedded();
+ }
+
+ public async Task EditWorkflowRegistration(EditEmployerWorkflowRegistration command)
+ {
+ var operation = new OperationResult();
+
+ // Get the existing employer
+ var employer = _EmployerRepository.Get(command.EmployerId);
+ if (employer == null)
+ return operation.Failed("کارفرمای مورد نظر یافت نشد");
+
+ OperationResult editEmployerResult = command.LegalType switch
+ {
+ LegalType.Real => await EditRealEmployerRegistration(command.RealEmployer, command.EmployerId),
+ LegalType.Legal => await EditLegalEmployerRegistration(command.LegalEmployer, command.EmployerId),
+ _ => throw new ArgumentOutOfRangeException()
+ };
+
+ if (!editEmployerResult.IsSuccedded)
+ return operation.Failed(editEmployerResult.Message);
+
+ await _institutionContractRepository.SaveChangesAsync();
+ return operation.Succcedded();
+ }
+
+ ///
+ /// حذف کارفرما از گردش کار ثبت نام
+ ///
+ /// شناسه کارفرما
+ /// شناسه جزئیات کارگاه موسسه
+ ///
+ public async Task 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);
+ if (workshopDetails == null)
+ return operation.Failed("جزئیات کارگاه موسسه یافت نشد");
+
+ // Find and remove the employer from workshop details
+ 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> AuthenticateEmployer(string nationalCode,
+ string dateOfBirth,
+ string mobile)
+ {
+ var op = new OperationResult();
+
+ 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)
+ throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
+
+ if (apiRespons.ResponseContext.Status.Code != 0)
+ return op.Failed($"{apiRespons.ResponseContext.Status.Message}");
+
+ var idNumber = apiRespons.IdentificationInformation.ShenasnamehNumber == "0"
+ ? apiRespons.IdentificationInformation.NationalId
+ : apiRespons.IdentificationInformation.ShenasnamehNumber;
+
+ var res = new AuthenticateUserViewModel()
+ {
+ DateOfBirth = dateOfBirth,
+ FatherName = apiRespons.BasicInformation.FatherName,
+ FName = apiRespons.BasicInformation.FirstName,
+ Gender = apiRespons.BasicInformation.GenderEnum,
+ IdNumber = apiRespons.IdentificationInformation.ShenasnamehNumber,
+ IdNumberSeri = apiRespons.IdentificationInformation.ShenasnameSeri,
+ IdNumberSerial = apiRespons.IdentificationInformation.ShenasnameSerial,
+ LName = apiRespons.BasicInformation.LastName,
+ NationalCode = nationalCode,
+ Phone = mobile,
+ };
+ return op.Succcedded(res);
+ }
+
+ private async Task> CreateLegalEmployerRegistration(
+ CreateLegalEmployerWorkflowRegistration command, long contractingPartyId)
+ {
+ if (string.IsNullOrWhiteSpace(command.CeoLName))
+ command.CeoLName = "#";
+ var opration = new OperationResult();
+ if (_EmployerRepository.Exists(x =>
+ x.LName == command.CompanyName && x.NationalId == command.NationalId &&
+ x.EmployerLName == command.CeoLName))
+ return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
+
+ if (_EmployerRepository.Exists(x =>
+ x.NationalId == command.NationalId && !string.IsNullOrWhiteSpace(command.NationalId) &&
+ x.NationalId != null))
+ {
+ return opration.Failed(" شناسه ملی وارد شده تکراری است");
+ }
+
+ if (_EmployerRepository.Exists(x => x.LName == command.CompanyName))
+ {
+ return opration.Failed("نام شرکت وارد شده تکراری است");
+ }
+
+ if (_EmployerRepository.Exists(x =>
+ x.RegisterId == command.RegisterId && !string.IsNullOrWhiteSpace(command.RegisterId) &&
+ x.RegisterId != null))
+ {
+ return opration.Failed(" شماره ثبت وارد شده تکراری است");
+ }
+
+ if (!string.IsNullOrEmpty(command.NationalId) && command.NationalId.Length != 11)
+ {
+ return opration.Failed(" شناسه ملی باید 11 رقم باشد");
+ }
+
+ if (!string.IsNullOrWhiteSpace(command.CeoNationalCode))
+ {
+ if (command.CeoNationalCode.NationalCodeValid() != "valid")
+ {
+ return opration.Failed("کد ملی وارد شده نا معتبر است");
+ }
+ }
+
+ string initial = "1300/10/11";
+ var dateOfBirth = command.CeoDateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+ var dateOfIssue = command.CeoDateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+
+ var gender = command.Gender switch
+ {
+ Gender.Male => "مرد",
+ Gender.Female => "زن",
+ Gender.None => null,
+ _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
+ };
- if (!string.IsNullOrEmpty(command.NationalId) && command.NationalId.Length != 11)
- {
- return opration.Failed(" شناسه ملی باید 11 رقم باشد");
- }
+ var legalEmployerData = new Employer(command.CeoFName, command.CompanyName, contractingPartyId,
+ gender,
+ command.CeoNationalCode, command.CeoIdNumber, "ایرانی", command.CeoFatherName, dateOfBirth,
+ dateOfIssue, command.CeoPlaceOfIssue, command.RegisterId, command.NationalId, command.CeoLName,
+ "حقوقی", command.PhoneNumber,
+ command.TelephoneNumber, "true", command.GovernmentSystemInfo.MclUsername,
+ command.GovernmentSystemInfo.MclPassword,
+ command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
+ command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
+ command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
- if (!string.IsNullOrWhiteSpace(command.EmployerNationalCode))
- {
- if (command.EmployerNationalCode.NationalCodeValid() != "valid")
- {
- return opration.Failed("کد ملی وارد شده نا معتبر است");
- }
- }
+ await _EmployerRepository.CreateAsync(legalEmployerData);
+ await _EmployerRepository.SaveChangesAsync();
- var gender = command.EmployerGender switch
- {
- Gender.Male => "مرد",
- Gender.Female => "زن",
- Gender.None => null,
- _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
- };
+ return opration.Succcedded(legalEmployerData);
+ }
- string initial = "1300/10/11";
- var dateOfBirth = command.EmployerDateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
- var dateOfIssue = command.EmployerDateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
- legalEmployer.EditLegal(command.EmployerFName, command.CompanyName, command.ContractingPartyId, gender,
- command.EmployerNationalCode, command.EmployerIdNumber, "ایرانی", command.EmployerFatherName, dateOfBirth,
- dateOfIssue, command.EmployerPlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName,
- command.PhoneNumber, command.TelephoneNumber, command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
- command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword, command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword, null);
+ private async Task> CreateRealEmployerRegistration(
+ CreateRealEmployerWorkflowRegistration command, long contractingPartyId)
+ {
+ var opration = new OperationResult();
+ if (_EmployerRepository.Exists(x =>
+ (x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.NationalCode &&
+ x.Nationalcode != null))
+ return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
- await _EmployerRepository.SaveChangesAsync();
- return opration.Succcedded();
- }
+ if (string.IsNullOrWhiteSpace(command.FName))
+ return opration.Failed("لطفا نام را وارد کنید");
- public async Task> GetSelectList(string search,long id)
- {
- return await _EmployerRepository.GetSelectList(search,id);
- }
+ if (!string.IsNullOrWhiteSpace(command.NationalCode))
+ {
+ if (command.NationalCode.NationalCodeValid() != "valid")
+ {
+ return opration.Failed("کدملی وارد شده نامعتبر است");
+ }
- async Task> IEmployerApplication.Remove(long id)
- {
- var employer = _EmployerRepository.Get(id);
- if (employer == null)
- throw new NotFoundException("دیتای مورد نظر یافت نشد");
+ if (_EmployerRepository.Exists(x =>
+ x.Nationalcode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode)))
+ {
+ return opration.Failed("کد ملی وارد شده تکراری است");
+ }
+ }
- var workshops = _workshopRepository.GetWorkshopsByEmployerId([id]);
+ string initial = "1300/10/11";
+ var dateOfBirth = command.DateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
- if (workshops.Any())
- {
- return await _EmployerRepository.DeactivateWithSubordinates(id);
- }
+ var gender = command.Gender switch
+ {
+ Gender.Male => "مرد",
+ Gender.Female => "زن",
+ Gender.None => null,
+ _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
+ };
- _EmployerRepository.Remove(id);
+ var employerData = new Employer(command.FName, command.LName, contractingPartyId, gender,
+ command.NationalCode, command.IdNumber, "ایرانی", command.FatherName, dateOfBirth,
+ dateOfIssue, command.PlaceOfIssue, "*", "*", "*", "حقیقی", command.PhoneNumber,
+ command.Telephone, "true", command.GovernmentSystemInfo.MclUsername,
+ command.GovernmentSystemInfo.MclPassword, command.GovernmentSystemInfo.EServiceUsername,
+ command.GovernmentSystemInfo.EServicePassword,
+ command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
+ command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
- return new OperationResult().Succcedded("Deleted");
+ await _EmployerRepository.CreateAsync(employerData);
+ await _EmployerRepository.SaveChangesAsync();
- }
- #endregion
+ return opration.Succcedded(employerData);
+ }
+
+ private async Task EditRealEmployerRegistration(
+ CreateRealEmployerWorkflowRegistration command, long employerId)
+ {
+ var operation = new OperationResult();
+ var employer = _EmployerRepository.Get(employerId);
+ if (employer == null)
+ return operation.Failed("رکورد مورد نظر یافت نشد");
+
+ if (_EmployerRepository.Exists(x =>
+ (x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.NationalCode &&
+ x.id != employerId))
+ return operation.Failed("امکان ثبت رکورد تکراری وجود ندارد");
+
+ if (!string.IsNullOrWhiteSpace(command.NationalCode))
+ {
+ if (command.NationalCode.NationalCodeValid() != "valid")
+ {
+ return operation.Failed("کد ملی وارد شده نا معتبر است");
+ }
+ }
+
+ if (_EmployerRepository.Exists(x =>
+ x.Nationalcode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) &&
+ x.id != employerId))
+ {
+ return operation.Failed(" کد ملی وارد شده تکراری است");
+ }
+
+ string initial = "1300/10/11";
+ var dateOfBirth = command.DateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+ var dateOfIssue = command.DateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+
+ var gender = command.Gender switch
+ {
+ Gender.Male => "مرد",
+ Gender.Female => "زن",
+ Gender.None => null,
+ _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
+ };
+
+ employer.Edit(command.FName, command.LName, employer.ContractingPartyId,
+ gender, command.NationalCode, command.IdNumber, "ایرانی", command.FatherName,
+ dateOfBirth, dateOfIssue, command.PlaceOfIssue, command.PhoneNumber, command.Telephone,
+ command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.MclPassword,
+ command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
+ command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
+ command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword, null);
+
+ await _EmployerRepository.SaveChangesAsync();
+ return operation.Succcedded();
+ }
+
+ private async Task EditLegalEmployerRegistration(
+ CreateLegalEmployerWorkflowRegistration command, long employerId)
+ {
+ var operation = new OperationResult();
+ var legalEmployer = _EmployerRepository.Get(employerId);
+ if (legalEmployer == null)
+ return operation.Failed("رکورد مورد نظر یافت نشد");
+
+ if (_EmployerRepository.Exists(x =>
+ x.LName == command.CompanyName && x.NationalId == command.NationalId &&
+ !string.IsNullOrWhiteSpace(command.NationalId) && x.id != employerId))
+ return operation.Failed("امکان ثبت رکورد تکراری وجود ندارد");
+
+ if (!string.IsNullOrEmpty(command.NationalId) && command.NationalId.Length != 11)
+ {
+ return operation.Failed(" شناسه ملی باید 11 رقم باشد");
+ }
+
+ if (!string.IsNullOrWhiteSpace(command.CeoNationalCode))
+ {
+ if (command.CeoNationalCode.NationalCodeValid() != "valid")
+ {
+ return operation.Failed("کد ملی وارد شده نا معتبر است");
+ }
+ }
+
+ var gender = command.Gender switch
+ {
+ Gender.Male => "مرد",
+ Gender.Female => "زن",
+ Gender.None => null,
+ _ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
+ };
+
+ string initial = "1300/10/11";
+ var dateOfBirth = command.CeoDateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+ var dateOfIssue = command.CeoDateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
+
+ legalEmployer.EditLegal(command.CeoFName, command.CompanyName, legalEmployer.ContractingPartyId, gender,
+ command.CeoNationalCode, command.CeoIdNumber, "ایرانی", command.CeoFatherName, dateOfBirth,
+ dateOfIssue, command.CeoPlaceOfIssue, command.RegisterId, command.NationalId, command.CeoLName,
+ command.PhoneNumber, command.TelephoneNumber, command.GovernmentSystemInfo.MclUsername,
+ command.GovernmentSystemInfo.MclPassword, command.GovernmentSystemInfo.EServiceUsername,
+ command.GovernmentSystemInfo.EServicePassword,
+ command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
+ command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword, null);
+
+ await _EmployerRepository.SaveChangesAsync();
+ return operation.Succcedded();
+ }
+ #endregion
}
\ No newline at end of file
diff --git a/CompanyManagment.Application/InstitutionContractApplication.cs b/CompanyManagment.Application/InstitutionContractApplication.cs
index 402e626f..816867c7 100644
--- a/CompanyManagment.Application/InstitutionContractApplication.cs
+++ b/CompanyManagment.Application/InstitutionContractApplication.cs
@@ -2,21 +2,35 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
+using System.Threading;
using System.Threading.Tasks;
using _0_Framework.Application;
+using _0_Framework.Application.Enums;
+using _0_Framework.Application.Sms;
+using _0_Framework.Application.UID;
+using _0_Framework.Exceptions;
+using AccountManagement.Application.Contracts.Account;
using Company.Domain.ContarctingPartyAgg;
using Company.Domain.EmployeeAgg;
using Company.Domain.empolyerAgg;
+using Company.Domain.FinancialStatmentAgg;
+using Company.Domain.FinancialTransactionAgg;
using Company.Domain.InstitutionContractAgg;
using Company.Domain.LeftWorkAgg;
using Company.Domain.RepresentativeAgg;
+using Company.Domain.TemporaryClientRegistrationAgg;
using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.FinancialStatment;
using CompanyManagment.App.Contracts.InstitutionContract;
+using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
+using CompanyManagment.App.Contracts.PersonalContractingParty;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.EFCore.Migrations;
+using Microsoft.AspNetCore.Mvc;
+using OfficeOpenXml.Packaging.Ionic.Zip;
using PersianTools.Core;
using ConnectedPersonnelViewModel = CompanyManagment.App.Contracts.Workshop.ConnectedPersonnelViewModel;
+using FinancialStatment = Company.Domain.FinancialStatmentAgg.FinancialStatment;
namespace CompanyManagment.Application;
@@ -30,13 +44,22 @@ public class InstitutionContractApplication : IInstitutionContractApplication
private readonly IWorkshopRepository _workshopRepository;
private readonly ILeftWorkRepository _leftWorkRepository;
private readonly IWorkshopApplication _workshopApplication;
+ private readonly IContractingPartyTempRepository _contractingPartyTempRepository;
+ private readonly IFinancialStatmentRepository _financialStatmentRepository;
+ private readonly IContactInfoApplication _contactInfoApplication;
+ private readonly IAccountApplication _accountApplication;
+ private readonly ISmsService _smsService;
+ private readonly IUidService _uidService;
public InstitutionContractApplication(IInstitutionContractRepository institutionContractRepository,
IPersonalContractingPartyRepository contractingPartyRepository,
IRepresentativeRepository representativeRepository, IEmployerRepository employerRepository,
IWorkshopRepository workshopRepository, ILeftWorkRepository leftWorkRepository,
- IFinancialStatmentApplication financialStatmentApplication, IWorkshopApplication workshopApplication)
+ IFinancialStatmentApplication financialStatmentApplication, IWorkshopApplication workshopApplication,
+ IContractingPartyTempRepository contractingPartyTempRepository,
+ IFinancialStatmentRepository financialStatmentRepository, IContactInfoApplication contactInfoApplication,
+ IAccountApplication accountApplication, ISmsService smsService, IUidService uidService)
{
_institutionContractRepository = institutionContractRepository;
_contractingPartyRepository = contractingPartyRepository;
@@ -46,6 +69,12 @@ public class InstitutionContractApplication : IInstitutionContractApplication
_leftWorkRepository = leftWorkRepository;
_financialStatmentApplication = financialStatmentApplication;
_workshopApplication = workshopApplication;
+ _contractingPartyTempRepository = contractingPartyTempRepository;
+ _financialStatmentRepository = financialStatmentRepository;
+ _contactInfoApplication = contactInfoApplication;
+ _accountApplication = accountApplication;
+ _smsService = smsService;
+ _uidService = uidService;
}
public OperationResult Create(CreateInstitutionContract command)
@@ -180,7 +209,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
command.ContractStartFa, contractEndGr, command.ContractEndFa, command.ContractAmount,
command.DailyCompenseation, command.Obligation,
command.TotalAmount, 0, command.WorkshopManualCount, command.EmployeeManualCount, command.Description,
- command.OfficialCompany, command.TypeOfContract, command.HasValueAddedTax, command.ValueAddedTax);
+ command.OfficialCompany, command.TypeOfContract, command.HasValueAddedTax, command.ValueAddedTax, []);
_institutionContractRepository.Create(createContract);
_institutionContractRepository.SaveChanges();
@@ -289,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.ValueAddedTax, []);
_institutionContractRepository.Create(createContract);
_institutionContractRepository.SaveChanges();
@@ -901,352 +930,562 @@ public class InstitutionContractApplication : IInstitutionContractApplication
public async Task CreateAsync(CreateInstitutionContractRequest command)
{
- string contractingPartyName = String.Empty;
- bool dateMessages = false;
- string dateMaessageResult = String.Empty;
var opration = new OperationResult();
- if (_institutionContractRepository.Exists(x =>
- x.ContractingPartyId == command.ContractingPartyId && x.RepresentativeId == command.RepresentativeId &&
- x.TypeOfContract == command.TypeOfContract))
- return opration.Failed(
- "برای این معرف و طرف حساب قبلا قرارداد ایجاد شده است، شما میتوانید از تمدید استفاده کنید");
-
- if (string.IsNullOrWhiteSpace(command.ContractDateFa))
- {
- dateMaessageResult = "تاریخ قراراداد اجباری است. ";
- dateMessages = true;
- }
-
- if (string.IsNullOrWhiteSpace(command.ContractStartFa))
- {
- dateMaessageResult += "تاریخ شروع قراراداد اجباری است. ";
- dateMessages = true;
- }
-
- if (string.IsNullOrWhiteSpace(command.ContractEndFa))
- {
- dateMaessageResult += "تاریخ پایان قراراداد اجباری است. ";
- dateMessages = true;
- }
-
- if (dateMessages)
- return opration.Failed(dateMaessageResult);
-
- if (command.RepresentativeId < 1 && command.ContractingPartyId > 1)
- {
- return opration.Failed("معرف را انتخاب کنید");
- }
- else if (command.ContractingPartyId < 1 && command.RepresentativeId > 1)
- {
- return opration.Failed("طرف حساب را انتخاب کنید");
- }
- else if (command.ContractingPartyId < 1 && command.RepresentativeId < 1)
- {
- return opration.Failed("معرف و طرف حساب را انتخاب کنید");
- }
-
var syear = command.ContractStartFa.Substring(0, 4);
var smonth = command.ContractStartFa.Substring(5, 2);
var sday = command.ContractStartFa.Substring(8, 2);
- var contractingParty = _contractingPartyRepository.GetDetails(command.ContractingPartyId);
- //شماره قرارداد
+
+ var transaction = await _contractingPartyRepository.BeginTransactionAsync();
+
+ if (command.ContractStartFa.TryToGeorgianDateTime(out var contractStartGr) == false)
+ return opration.Failed("تاریخ شروع قرارداد معتبر نیست");
+
+ contractStartGr.AddMonthsFa((int)command.Duration, out var contractEndGr);
+ contractEndGr = contractEndGr.ToFarsi().FindeEndOfMonth().ToGeorgianDateTime();
+
+ PersonalContractingParty existingContractingParty = null;
+ if (command.ContractingPartyLegalType == LegalType.Legal)
+ {
+ existingContractingParty =
+ await _contractingPartyRepository.GetByRegisterId(command.LegalParty.RegisterId);
+ if (_contractingPartyRepository.Exists(x =>
+ x.LName == command.LegalParty.CompanyName && x.RegisterId == command.LegalParty.RegisterId))
+ {
+ if (_institutionContractRepository.Exists(x => x.ContractStartGr < contractEndGr
+ && contractStartGr < x.ContractEndGr
+ && x.ContractingPartyId == existingContractingParty.id
+ && x.IsActiveString == "true"))
+ {
+ throw new BadRequestException("امکان ایجاد قرارداد تکراری وجود ندارد");
+ }
+ }
+ }
+ else if (command.ContractingPartyLegalType == LegalType.Real)
+ {
+ existingContractingParty =
+ await _contractingPartyRepository.GetByNationalCode(command.RealParty.NationalCode);
+ if (_contractingPartyRepository.Exists(x =>
+ x.LName == command.RealParty.LName && x.Nationalcode == command.RealParty.NationalCode))
+ {
+ if (_institutionContractRepository.Exists(x => x.ContractStartGr < contractEndGr
+ && contractStartGr < x.ContractEndGr
+ && x.ContractingPartyId == existingContractingParty.id
+ && x.IsActiveString == "true"))
+ {
+ throw new BadRequestException("امکان ایجاد قرارداد تکراری وجود ندارد");
+ }
+ }
+ }
+
+ PersonalContractingParty contractingParty;
+ if (existingContractingParty != null)
+ {
+ contractingParty = existingContractingParty;
+ }
+ else
+ {
+ OperationResult contractingPartyResult = command.ContractingPartyLegalType switch
+ {
+ LegalType.Legal => await CreateLegalContractingPartyEntity(command.LegalParty, command.RepresentativeId,
+ command.Address,
+ command.City, command.Province),
+ LegalType.Real => await CreateRealContractingPartyEntity(command.RealParty, command.RepresentativeId,
+ command.Address,
+ command.City, command.Province),
+ _ => throw new BadRequestException("نوع طرف قرارداد مشخص نشده است")
+ };
+
+ if (!contractingPartyResult.IsSuccedded)
+ return opration.Failed(contractingPartyResult.Message);
+
+ contractingParty = contractingPartyResult.Data;
+ }
+
+ if (_institutionContractRepository.Exists(x =>
+ x.ContractingPartyId == contractingParty.id && x.RepresentativeId == command.RepresentativeId &&
+ x.TypeOfContract == "JobRelation"))
+ return opration.Failed(
+ "برای این معرف و طرف حساب قبلا قرارداد ایجاد شده است، شما میتوانید از تمدید استفاده کنید");
+
var contractNo = $"{syear}{smonth}{sday}/{contractingParty.ArchiveCode}/0";
- ///////////////////////
- if (command.ContactInfos.Count == 0)
- return opration.Failed("ورود شماره تماس برای ارسال پیامک الزامیست");
- var accountContact = command.ContactInfos.Where(x =>
- x.SendSmsString == "true" && x.Position == "طرف قرارداد" && x.PhoneType == "شماره همراه" &&
- !string.IsNullOrWhiteSpace(x.PhoneNumber)).ToList();
- if (accountContact.Count == 0)
- return opration.Failed("ورود شماره همراه با سمت طرف قرارداد برای ساخت حساب کاربری الزامیست");
- var accountContactCount = command.ContactInfos
- .Where(x => x.PhoneType == "شماره همراه" && x.Position == "طرف قرارداد").ToList();
- if (accountContactCount.Count > 1)
- return opration.Failed("فقط یکی از شماره تلفن ها میتواند سمت طرف قرارداد داشته باشد");
+ var representative = _representativeRepository.Get(command.RepresentativeId);
+ if (representative == null)
+ return opration.Failed("معرف مورد نظر یافت نشد");
- contractingPartyName = contractingParty.LName;
- //نام معرف
- var representative = _representativeRepository.GetDetails(command.RepresentativeId).FullName;
-
- var contractStartGr = command.ContractStartFa.ToGeorgianDateTime();
- var contractEndGr = command.ContractEndFa.ToGeorgianDateTime();
-
- var contractDateGr = command.ContractDateFa.ToGeorgianDateTime();
-
- if (command.Address != null && command.State == null)
+ if (command.IsInstallment &&
+ !command.Workshops.Any(x => x.HasContractPlanInPerson || x.HasInsurancePlanInPerson))
{
- return opration.Failed("لطفا استان و شهر را انتخاب کنید");
+ return opration.Failed("برای قراردادهای اقساطی حداقل یک کارگاه باید دارای طرح حضوری باشد");
}
- if ((command.Address != null && command.State != null) && command.City == "شهرستان")
+
+ var today = DateTime.Today;
+
+ var contractDateGr = today;
+ var contractDateFa = contractDateGr.ToFarsi();
+
+
+ var hasValueAddedTax = command.TaxAmount > 0 ? "true" : "false";
+
+ var contractingPartyFullName = contractingParty.FName + " " + contractingParty.LName;
+
+ var workshopDetails = command.Workshops.Select(x =>
+ new InstitutionContractWorkshopInitial(x.WorkshopName, x.HasRollCallPlan, false, x.HasCustomizeCheckoutPlan,
+ x.HasContractPlan, x.HasContractPlanInPerson, x.HasInsurancePlan, x.HasInsurancePlanInPerson,
+ x.PersonnelCount, x.Price)).ToList();
+
+
+ var entity = new InstitutionContract(contractNo, command.RepresentativeId, representative.FullName,
+ contractingParty.id,
+ contractingPartyFullName, contractDateGr, contractDateFa, command.Province, command.City, command.Address,
+ contractStartGr,
+ contractStartGr.ToFarsi(), contractEndGr, contractEndGr.ToFarsi(), command.OneMonthAmount,
+ command.DailyCompensation,
+ command.Obligation, command.TotalAmount, 0,
+ command.Workshops.Count.ToString(),
+ command.Workshops.Sum(x => x.PersonnelCount).ToString(), command.Description,
+ "NotOfficial", "JobRelation", hasValueAddedTax,
+ command.TaxAmount, workshopDetails);
+
+
+ FinancialStatment financialStatement;
+ if (_financialStatmentRepository.Exists(x => x.ContractingPartyId == contractingParty.id))
{
- return opration.Failed("لطفا شهر را انتخاب کنید");
+ financialStatement = await _financialStatmentRepository.GetByContractingPartyId(contractingParty.id);
+ }
+ else
+ {
+ financialStatement = new FinancialStatment(contractingParty.id, contractingPartyFullName);
+ await _financialStatmentRepository.CreateAsync(financialStatement);
}
- if (command.Address == null && command.State != null)
+ if (command.IsInstallment)
{
- return opration.Failed("لطفا آدرس را وارد کنید");
+ var installments =
+ CalculateInstallment(command.TotalAmount, (int)command.Duration, command.ContractStartFa, true);
+
+ // دریافت مبلغ اولین قسط
+ //این کار برای این هست که اولین قسط باید با تاریخ امروز باشد و باید به وضعیت مالی بدهی ایجاد شود که یوزر اولین بدهی را وارد کند
+ var firstInstallmentAmount = installments.First().Amount;
+
+ // حذف اولین قسط
+ installments.RemoveAt(0);
+
+ // ایجاد قسط جدید با تاریخ امروز
+ var todayInstallment = new InstitutionContractInstallment(DateTime.Today, firstInstallmentAmount, "");
+
+ var financialTransaction = new FinancialTransaction(0, today, today.ToFarsi(),
+ "قسط اول سرویس", "debt", "بابت خدمات", firstInstallmentAmount, 0, 0);
+
+ financialStatement.AddFinancialTransaction(financialTransaction);
+
+ // اضافه کردن قسط جدید به ابتدای لیست
+ installments.Insert(0, todayInstallment);
+
+ entity.SetInstallments(installments);
+ }
+ else
+ {
+ var financialTransaction = new FinancialTransaction(0, today, today.ToFarsi(),
+ "پرداخت کل سرویس", "debt", "بابت خدمات", command.TotalAmount, 0, 0);
+ financialStatement.AddFinancialTransaction(financialTransaction);
}
- if (string.IsNullOrWhiteSpace(command.OfficialCompany))
- return opration.Failed("رسمی یا غیر رسمی بودن پرداخت را مشخص کنید");
- if (command.OfficialCompany == "Official" && string.IsNullOrWhiteSpace(command.HasValueAddedTax))
- return opration.Failed("وضعیت ارزش افزوده را مشخص کنید");
- if (string.IsNullOrWhiteSpace(command.TypeOfContract))
- return opration.Failed("عنوان قرارداد را انتخاب کنید");
- if (string.IsNullOrWhiteSpace(command.ContractAmountString))
- command.ContractAmountString = "0";
- if (string.IsNullOrWhiteSpace(command.DailyCompenseationString))
- command.DailyCompenseationString = "0";
- if (string.IsNullOrWhiteSpace(command.ObligationString))
- command.ObligationString = "0";
- if (string.IsNullOrWhiteSpace(command.TotalAmountString))
- command.TotalAmountString = "0";
-
- var valueAddedTax = string.IsNullOrWhiteSpace(command.ValueAddedTaxStr)
- ? 0
- : command.ValueAddedTaxStr.MoneyToDouble();
- var contractAmountStr = command.ContractAmountString.ToDoubleMoney();
- var contractAmount = Convert.ToDouble(contractAmountStr);
- var DailyCompenseationStr = command.DailyCompenseationString.ToDoubleMoney();
- var dailyCompenseation = Convert.ToDouble(DailyCompenseationStr);
- var ObligationStr = command.ObligationString.ToDoubleMoney();
- var obligation = Convert.ToDouble(ObligationStr);
- var TotalAmountStr = command.TotalAmountString.ToDoubleMoney();
- var totalAmount = Convert.ToDouble(TotalAmountStr);
- //var hasValueAddedTax = "false";
- //double valueAddedTax = 0;
- //if (command.HasValueAddedTax == "true")
- //{
- // hasValueAddedTax = "true";
- // valueAddedTax = command.ContractAmount * 0.1;
- // command.ContractAmount += valueAddedTax;
- //}
+ await _institutionContractRepository.CreateAsync(entity);
+ await _institutionContractRepository.SaveChangesAsync();
- var createContract = new InstitutionContract(contractNo, command.RepresentativeId, representative,
- command.ContractingPartyId,
- contractingPartyName, contractDateGr, command.ContractDateFa, command.State, command.City,
- command.Address, contractStartGr,
- command.ContractStartFa, contractEndGr, command.ContractEndFa, contractAmount,
- dailyCompenseation, obligation,
- totalAmount, 0, command.WorkshopManualCount, command.EmployeeManualCount, command.Description,
- command.OfficialCompany, command.TypeOfContract, command.HasValueAddedTax, valueAddedTax);
+ var mainContactInfo = new CreateContactInfo
+ {
+ InstitutionContractId = entity.id,
+ PhoneType = "شماره همراه",
+ Position = "طرف قرارداد",
+ PhoneNumber = contractingParty.Phone,
+ FnameLname = contractingPartyFullName,
+ SendSms = true
+ };
+ _contactInfoApplication.Create(mainContactInfo);
- _institutionContractRepository.Create(createContract);
- _institutionContractRepository.SaveChanges();
- return opration.Succcedded(createContract.id);
+ foreach (var contactInfo in command.ContactInfos)
+ {
+ if (contactInfo.PhoneNumber != null)
+ {
+ var contactinfo = new CreateContactInfo
+ {
+ InstitutionContractId = entity.id,
+ PhoneType = contactInfo.PhoneType,
+ Position = contactInfo.Position,
+ PhoneNumber = contactInfo.PhoneNumber,
+ FnameLname = contactInfo.FnameLname,
+ SendSms = contactInfo.SendSmsString == "true" ? true : false
+ };
+ _contactInfoApplication.Create(contactinfo);
+ }
+ }
+
+ var userPass = contractingParty.IsLegal == "حقیقی"
+ ? contractingParty.Nationalcode
+ : contractingParty.NationalId;
+ var createAcc = new RegisterAccount
+ {
+ Fullname = contractingParty.LName,
+ Username = userPass,
+ Password = userPass,
+ Mobile = contractingParty.Phone,
+ NationalCode = userPass
+ };
+ var res = _accountApplication.RegisterClient(createAcc);
+ if (res.IsSuccedded)
+ CreateContractingPartyAccount(contractingParty.id, res.SendId);
+
+ await _institutionContractRepository.SaveChangesAsync();
+
+ await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
+ entity.PublicId);
+
+
+ await transaction.CommitAsync();
+ return opration.Succcedded();
}
public async Task EditAsync(EditInstitutionContractRequest command)
{
- bool dateMessages = false;
- string dateMaessageResult = String.Empty;
- var opration = new OperationResult();
- var ContractEdit = _institutionContractRepository.Get(command.Id);
- if (ContractEdit == null)
- opration.Failed("رکورد مورد نظر وجود ندارد");
+ throw new NotImplementedException();
+ }
+
- var contractStartGr = command.ContractStartFa.ToGeorgianDateTime();
- var contractEndGr = command.ContractEndFa.ToGeorgianDateTime();
-
- var contractDateGr = command.ContractDateFa.ToGeorgianDateTime();
-
- if (_institutionContractRepository.Exists(x =>
- x.ContractingPartyId == ContractEdit.ContractingPartyId &&
- ((contractStartGr >= x.ContractStartGr && contractStartGr <= x.ContractEndGr) ||
- (contractEndGr >= x.ContractStartGr && contractEndGr <= x.ContractEndGr)) && x.id != command.Id &&
- x.TypeOfContract == command.TypeOfContract))
- return opration.Failed("در بازه تاریخ وارد شده قرارداد دیگری وجود دارد");
- //if (_institutionContractRepository.Exists(x =>
- // x.ContractingPartyId == ContractEdit.ContractingPartyId && (x.ContractStartGr <= contractDateGr || x.ContractDateGr <= contractDateGr) && x.id != command.Id))
- // return opration.Failed("تاریخ عقد قرارداد با قرارداد دیگری تداخل دارد");
- if (string.IsNullOrWhiteSpace(command.ContractDateFa))
- {
- dateMaessageResult = "تاریخ قراراداد اجباری است. ";
- dateMessages = true;
- }
-
- if (string.IsNullOrWhiteSpace(command.ContractStartFa))
- {
- dateMaessageResult += "تاریخ شروع قراراداد اجباری است. ";
- dateMessages = true;
- }
-
- if (string.IsNullOrWhiteSpace(command.ContractEndFa))
- {
- dateMaessageResult += "تاریخ پایان قراراداد اجباری است. ";
- dateMessages = true;
- }
-
- if (dateMessages)
- return opration.Failed(dateMaessageResult);
- if (command.Address != null && command.State == null)
- {
- return opration.Failed("لطفا استان و شهر را انتخاب کنید");
- }
-
- if ((command.Address != null && command.State != null) && command.City == "شهرستان")
- {
- return opration.Failed("لطفا شهر را انتخاب کنید");
- }
-
- if (command.Address == null && command.State != null)
- {
- return opration.Failed("لطفا آدرس را وارد کنید");
- }
-
- if (string.IsNullOrWhiteSpace(command.OfficialCompany))
- return opration.Failed("رسمی یا غیر رسمی بودن پرداخت را مشخص کنید");
- if (command.OfficialCompany == "Official" && string.IsNullOrWhiteSpace(command.HasValueAddedTax))
- return opration.Failed("وضعیت ارزش افزوده را مشخص کنید");
- if (string.IsNullOrWhiteSpace(command.TypeOfContract))
- return opration.Failed("عنوان قرارداد را انتخاب کنید");
-
- if (string.IsNullOrWhiteSpace(command.ContractAmountString))
- command.ContractAmountString = "0";
- if (string.IsNullOrWhiteSpace(command.DailyCompenseationString))
- command.DailyCompenseationString = "0";
- if (string.IsNullOrWhiteSpace(command.ObligationString))
- command.ObligationString = "0";
- if (string.IsNullOrWhiteSpace(command.TotalAmountString))
- command.TotalAmountString = "0";
-
- var valueAddedTax = command.ValueAddedTaxStr.MoneyToDouble();
- var contractAmountStr = command.ContractAmountString.ToDoubleMoney();
- var contractAmount = Convert.ToDouble(contractAmountStr);
- var DailyCompenseationStr = command.DailyCompenseationString.ToDoubleMoney();
- var dailyCompenseation = Convert.ToDouble(DailyCompenseationStr);
- var ObligationStr = command.ObligationString.ToDoubleMoney();
- var obligation = Convert.ToDouble(ObligationStr);
- var TotalAmountStr = command.TotalAmountString.ToDoubleMoney();
- var totalAmount = Convert.ToDouble(TotalAmountStr);
-
- ContractEdit.Edit(contractDateGr, command.ContractDateFa, command.State, command.City, command.Address,
- contractStartGr,
- command.ContractStartFa, contractEndGr, command.ContractEndFa, contractAmount,
- dailyCompenseation,
- obligation, totalAmount, command.WorkshopManualCount, command.EmployeeManualCount,
- command.Description, command.OfficialCompany, command.TypeOfContract, valueAddedTax,
- command.HasValueAddedTax);
- await _institutionContractRepository.SaveChangesAsync();
- return opration.Succcedded(command.Id);
+ public Task> RegistrationWorkflowMainList()
+ {
+ return _institutionContractRepository.RegistrationWorkflowMainList();
}
- public async Task ExtensionَAsync(CreateInstitutionContractRequest command)
+ public Task> RegistrationWorkflowItems(long institutionContractId)
{
- bool dateMessages = false;
- string dateMaessageResult = String.Empty;
- var opration = new OperationResult();
+ return _institutionContractRepository.RegistrationWorkflowItems(institutionContractId);
+ }
- command.ExtensionNo += 1;
- if (_institutionContractRepository.Exists(x =>
- x.ExtensionNo == command.ExtensionNo && x.ContractingPartyId == command.ContractingPartyId &&
- x.TypeOfContract == command.TypeOfContract))
- return opration.Failed("برای این قرارداد قبلا تمدید ایجاد شده است");
+ public async Task GetVerificationDetails(Guid id)
+ {
+ return await _institutionContractRepository.GetVerificationDetails(id);
+ }
- if (string.IsNullOrWhiteSpace(command.ContractDateFa))
+ public async Task> SendVerifyOtp(Guid id)
+ {
+ var institutionContract = await _institutionContractRepository.GetByPublicIdAsync(id);
+ if (institutionContract == null)
{
- dateMaessageResult = "تاریخ قراراداد اجباری است. ";
- dateMessages = true;
+ throw new NotFoundException("رکورد مورد نظر یافت نشد");
}
- if (string.IsNullOrWhiteSpace(command.ContractStartFa))
+ if (institutionContract.VerificationStatus == InstitutionContractVerificationStatus.Verified)
+ throw new BadRequestException("این قرارداد مالی قبلا تایید شده است");
+
+ if (institutionContract.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify &&
+ institutionContract.VerifyCodeCreation != DateTime.MinValue)
{
- dateMaessageResult += "تاریخ شروع قراراداد اجباری است. ";
- dateMessages = true;
+ if (!institutionContract.CanResendVerifyCode)
+ {
+ throw new BadRequestException("کد تایید قبلی هنوز منقضی نشده است",
+ new Dictionary
+ {
+ {
+ "expireTime", (int)institutionContract.ReSendTime.TotalSeconds -
+ (int)(DateTime.Now - institutionContract.VerifyCodeCreation).TotalSeconds
+ }
+ });
+ }
}
- if (string.IsNullOrWhiteSpace(command.ContractEndFa))
+ var contractingParty = _contractingPartyRepository.Get(institutionContract.ContractingPartyId);
+ if (contractingParty == null)
+ throw new NotFoundException("طرف قرارداد یافت نشد");
+
+ var code = new Random().Next(1000, 9999).ToString();
+ institutionContract.SetVerifyCode(code);
+
+ var transaction = await _institutionContractRepository.BeginTransactionAsync();
+ try
{
- dateMaessageResult += "تاریخ پایان قراراداد اجباری است. ";
- dateMessages = true;
+ await _institutionContractRepository.SaveChangesAsync();
+ _smsService.VerifySend(contractingParty.Phone, code);
+ }
+ catch (Exception e)
+ {
+ transaction.Rollback();
+ Console.WriteLine(e);
+ throw;
}
- if (dateMessages)
- return opration.Failed(dateMaessageResult);
-
- var firstContract =
- _institutionContractRepository.GetFirstContract(command.ContractingPartyId, command.TypeOfContract);
-
- var syear = firstContract.ContractStartFa.Substring(0, 4);
- var smonth = firstContract.ContractStartFa.Substring(5, 2);
- var sday = firstContract.ContractStartFa.Substring(8, 2);
- var contractingParty = _contractingPartyRepository.GetDetails(command.ContractingPartyId);
- //شماره قرارداد
- var contractNo = $"{syear}{smonth}{sday}/{contractingParty.ArchiveCode}/{command.ExtensionNo}";
-
-
- var contractStartGr = command.ContractStartFa.ToGeorgianDateTime();
- var contractEndGr = command.ContractEndFa.ToGeorgianDateTime();
-
- var contractDateGr = command.ContractDateFa.ToGeorgianDateTime();
- if (_institutionContractRepository.Exists(x =>
- ((contractStartGr >= x.ContractStartGr && contractStartGr <= x.ContractEndGr) ||
- (contractEndGr >= x.ContractStartGr && contractEndGr <= x.ContractEndGr)) &&
- x.TypeOfContract == command.TypeOfContract && x.ContractingPartyId == command.ContractingPartyId))
- return opration.Failed("تاریخ شروع و پایان وارد شده با قرارداد دیگری تداخل دارد");
- if (command.Address != null && command.State == null)
+ await transaction.CommitAsync();
+ var result = new OtpResultViewModel
{
- return opration.Failed("لطفا استان و شهر را انتخاب کنید");
+ ExpireTimeSec = (int)institutionContract.ExpireTime.TotalSeconds,
+ ReSendTimeSec = (int)institutionContract.ReSendTime.TotalSeconds
+ };
+ return new OperationResult().Succcedded(result);
+ }
+
+ public async Task VerifyOtp(Guid publicId, string code)
+ {
+ var op = new OperationResult();
+ var institutionContract = await _institutionContractRepository.GetByPublicIdAsync(publicId);
+ if (institutionContract == null)
+ {
+ throw new NotFoundException("رکورد مورد نظر یافت نشد");
}
- if ((command.Address != null && command.State != null) && command.City == "شهرستان")
+ if (institutionContract.VerificationStatus == InstitutionContractVerificationStatus.Verified)
+ throw new BadRequestException("این قرارداد مالی قبلا تایید شده است");
+
+ if (institutionContract.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify &&
+ institutionContract.VerifyCodeExpired)
+ throw new BadRequestException("کد تایید منقضی شده است");
+
+ var contractingParty = _contractingPartyRepository.Get(institutionContract.ContractingPartyId);
+ if (contractingParty == null)
+ throw new NotFoundException("طرف قرارداد یافت نشد");
+
+ if (institutionContract.VerifyCode != code)
+ return op.Failed("کد وارد شده صحیح نمی باشد");
+ institutionContract.SetPendingWorkflow();
+
+ await _institutionContractRepository.SaveChangesAsync();
+ return op.Succcedded();
+ }
+
+ public async Task GetWorkshopInitialDetails(long workshopDetailsId)
+ {
+ var details = await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(workshopDetailsId);
+ var services = details.Services;
+
+ var res = new InstitutionContractWorkshopDetailViewModel()
{
- return opration.Failed("لطفا شهر را انتخاب کنید");
+ ServicesViewModel = new WorkshopServicesViewModel()
+ {
+ Contract = services.Contract,
+ ContractInPerson = services.ContractInPerson,
+ CustomizeCheckout = services.CustomizeCheckout,
+ Insurance = services.Insurance,
+ InsuranceInPerson = services.InsuranceInPerson,
+ RollCall = services.RollCall,
+ RollCallInPerson = services.RollCallInPerson
+ }
+ };
+ return res;
+ }
+
+ public async Task GetExtensionInquiry(long previousContractId)
+ {
+ return await _institutionContractRepository.GetExtensionInquiry(previousContractId);
+ }
+
+ public async Task GetExtensionWorkshops(
+ InstitutionContractExtensionWorkshopsRequest request)
+ {
+ return await _institutionContractRepository.GetExtensionWorkshops(request);
+ }
+
+ public async Task GetExtensionInstitutionPlan(InstitutionContractExtensionPlanRequest request)
+ {
+ return await _institutionContractRepository.GetExtensionInstitutionPlan(request);
+ }
+
+ public async Task GetExtensionPaymentMethod(InstitutionContractExtensionPaymentRequest request)
+ {
+ return await _institutionContractRepository.GetExtensionPaymentMethod(request);
+ }
+
+ public async Task ExtensionComplete(InstitutionContractExtensionCompleteRequest request)
+ {
+ return await _institutionContractRepository.ExtensionComplete(request);
+ }
+
+
+ private async Task> CreateLegalContractingPartyEntity(
+ CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city,
+ string state)
+ {
+ var opration = new OperationResult();
+
+
+ if (representativeId < 1)
+ return opration.Failed("لطفا معرف را انتخاب کنید");
+
+ if (_contractingPartyRepository.Exists(x =>
+ x.LName == request.CompanyName && x.NationalId == request.NationalId))
+ return opration.Failed("نام شرکت وارد شده تکراری است");
+
+
+ if (_contractingPartyRepository.Exists(x =>
+ x.RegisterId == request.RegisterId && x.LName != request.CompanyName))
+ return opration.Failed("شماره ثبت وارد شده تکراری است");
+
+
+ if (_contractingPartyRepository.Exists(x =>
+ x.NationalId == request.NationalId && x.LName != request.CompanyName))
+ {
+ return opration.Failed("شناسه ملی وارد شده تکراری است");
}
- if (command.Address == null && command.State != null)
+ var archiveCode = _contractingPartyRepository.GetLastNewArchiveCode();
+
+
+ var representative = _representativeRepository.GetDetails(representativeId);
+ var legalContractingParty = new PersonalContractingParty("*", request.CompanyName,
+ "*", "*", request.RegisterId, request.NationalId,
+ "حقوقی",
+ request.PhoneNumber, request.PhoneNumber, address, representativeId, representative.FullName,
+ archiveCode, state, city, null, null,
+ request.FName, request.LName, request.Position);
+
+ if (request.IsAuth)
{
- return opration.Failed("لطفا آدرس را وارد کنید");
+ legalContractingParty.LegalAuthentication(request.FName,request.LName,request.FatherName,
+ request.IdNumber,null,null,request.BirthDateFa,request.Gender,request.PhoneNumber);
}
- if (string.IsNullOrWhiteSpace(command.OfficialCompany))
- return opration.Failed("رسمی یا غیر رسمی بودن پرداخت را مشخص کنید");
- if (command.OfficialCompany == "Official" && string.IsNullOrWhiteSpace(command.HasValueAddedTax))
- return opration.Failed("وضعیت ارزش افزوده را مشخص کنید");
- if (string.IsNullOrWhiteSpace(command.TypeOfContract))
- return opration.Failed("عنوان قرارداد را انتخاب کنید");
- if (string.IsNullOrWhiteSpace(command.ContractAmountString))
- command.ContractAmountString = "0";
- if (string.IsNullOrWhiteSpace(command.DailyCompenseationString))
- command.DailyCompenseationString = "0";
- if (string.IsNullOrWhiteSpace(command.ObligationString))
- command.ObligationString = "0";
- if (string.IsNullOrWhiteSpace(command.TotalAmountString))
- command.TotalAmountString = "0";
- var valueAddedTax = string.IsNullOrWhiteSpace(command.ValueAddedTaxStr)
- ? 0
- : command.ValueAddedTaxStr.MoneyToDouble();
- var contractAmountStr = command.ContractAmountString.ToDoubleMoney();
- var contractAmount = Convert.ToDouble(contractAmountStr);
- var DailyCompenseationStr = command.DailyCompenseationString.ToDoubleMoney();
- var dailyCompenseation = Convert.ToDouble(DailyCompenseationStr);
- var ObligationStr = command.ObligationString.ToDoubleMoney();
- var obligation = Convert.ToDouble(ObligationStr);
- var TotalAmountStr = command.TotalAmountString.ToDoubleMoney();
- var totalAmount = Convert.ToDouble(TotalAmountStr);
- var contractingPartyName = contractingParty.LName;
- var representative = _representativeRepository.GetDetails(command.RepresentativeId).FullName;
-
- var createContract = new InstitutionContract(contractNo, command.RepresentativeId, representative,
- command.ContractingPartyId,
- contractingPartyName, contractDateGr, command.ContractDateFa, command.State, command.City,
- command.Address, contractStartGr,
- command.ContractStartFa, contractEndGr, command.ContractEndFa, contractAmount,
- dailyCompenseation, obligation,
- totalAmount, command.ExtensionNo, command.WorkshopManualCount, command.EmployeeManualCount,
- command.Description, command.OfficialCompany, command.TypeOfContract, command.HasValueAddedTax,
- valueAddedTax);
+ await _contractingPartyRepository.CreateAsync(legalContractingParty);
+ await _contractingPartyRepository.SaveChangesAsync();
- _institutionContractRepository.Create(createContract);
- _institutionContractRepository.SaveChanges();
-
+ return opration.Succcedded(legalContractingParty);
+ }
-
- return opration.Succcedded(createContract.id);
+ private async Task> CreateRealContractingPartyEntity(
+ CreateInstitutionContractRealPartyRequest request, long representativeId, string address,
+ string city, string province)
+ {
+ var operation = new OperationResult();
+
+
+ if (representativeId < 1)
+ return operation.Failed("لطفا معرف را انتخاب کنید");
+
+ if (_contractingPartyRepository.Exists(x => x.Nationalcode == request.NationalCode))
+ {
+ return operation.Failed("کد ملی وارد شده تکراری است");
+ }
+
+ var archiveCode = _contractingPartyRepository.GetLastNewArchiveCode();
+
+ if (request.NationalCode.NationalCodeValid() != "valid")
+ {
+ return operation.Failed("کد ملی وارد شده نا معتبر است");
+ }
+
+ var representative = _representativeRepository.GetDetails(representativeId);
+
+ if (representative == null)
+ return operation.Failed("معرف مورد نظر یافت نشد");
+
+ var personalContractingParty = new PersonalContractingParty(request.FName, request.LName,
+ request.NationalCode, request.IdNumber, "*", "*",
+ "حقیقی",
+ request.PhoneNumber, request.PhoneNumber, address, representativeId, representative.FullName, archiveCode,
+ province, city, null, null, null, null);
+
+ if (request.IsAuth)
+ {
+ personalContractingParty.Authentication(request.FName, request.LName, request.FatherName,
+ request.IdNumber, null,null, request.BirthDateFa, request.Gender,request.PhoneNumber);
+ }
+
+ await _contractingPartyRepository.CreateAsync(personalContractingParty);
+ await _contractingPartyRepository.SaveChangesAsync();
+
+ return operation.Succcedded(personalContractingParty);
+ }
+
+ private List CalculateInstallment(double amount, int installmentCount,
+ string loanStartDate, bool getRounded)
+ {
+ int day = Convert.ToInt32(loanStartDate.Substring(8, 2));
+ int month = Convert.ToInt32(loanStartDate.Substring(5, 2));
+ int year = Convert.ToInt32(loanStartDate.Substring(0, 4));
+
+ var installments = new List();
+
+
+ bool endOfMonth = day == 31;
+
+
+ var dividedAmount = amount / installmentCount;
+
+ double moneyPerMonth = 0;
+
+ if (getRounded)
+ moneyPerMonth = Math.Floor(dividedAmount / 1000) * 1000;
+ else
+ moneyPerMonth = Math.Floor(dividedAmount);
+
+ double lastLoan = amount - (moneyPerMonth * (installmentCount - 1));
+
+ if (endOfMonth)
+ {
+ for (int i = 1; i < installmentCount; i++)
+ {
+ var installment =
+ new InstitutionContractInstallment(loanStartDate.ToGeorgianDateTime(), moneyPerMonth, "");
+
+ installments.Add(installment);
+
+ if (month == 12)
+ {
+ year++;
+ month = 1;
+ }
+ else
+ {
+ month++;
+ }
+
+ loanStartDate = $"{year:0000}/{month:00}/01".FindeEndOfMonth();
+ }
+
+ var lastInstallment = new InstitutionContractInstallment(loanStartDate.ToGeorgianDateTime(), lastLoan, "");
+
+ installments.Add(lastInstallment);
+ return installments;
+ }
+ else
+ {
+ for (int i = 1; i < installmentCount; i++)
+ {
+ var installment =
+ new InstitutionContractInstallment(loanStartDate.ToGeorgianDateTime(), moneyPerMonth, "");
+
+ installments.Add(installment);
+ var endDay = 0;
+
+ if (month == 12)
+ {
+ year++;
+ month = 1;
+ }
+ else
+ {
+ month++;
+ }
+
+ if (day == 30)
+ {
+ if (month == 12)
+ {
+ var lastYearDay =
+ Convert.ToInt32($"{year:0000}/{month:00}/1".FindeEndOfMonth().Substring(8, 2));
+ endDay = lastYearDay == 30 ? lastYearDay : 29;
+ }
+ }
+
+ loanStartDate =
+ endDay == 0 ? $"{year:0000}/{month:00}/{day:00}" : $"{year:0000}/{month:00}/{endDay:00}";
+ }
+
+ var lastInstallment = new InstitutionContractInstallment(loanStartDate.ToGeorgianDateTime(), lastLoan, "");
+ installments.Add(lastInstallment);
+ return installments;
+ }
}
}
@@ -1266,4 +1505,4 @@ public class WorkshopsAndEmployeeViewModel
public int ArchiveCode { get; set; }
}
-#endregion
\ No newline at end of file
+#endregion
diff --git a/CompanyManagment.Application/InsuranceJobApplication.cs b/CompanyManagment.Application/InsuranceJobApplication.cs
index 6bbbbadb..8bd08474 100644
--- a/CompanyManagment.Application/InsuranceJobApplication.cs
+++ b/CompanyManagment.Application/InsuranceJobApplication.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Threading.Tasks;
using _0_Framework.Application;
using Company.Domain.InsuranceJobItemAgg;
using Company.Domain.InsurancJobAgg;
@@ -155,4 +156,9 @@ public class InsuranceJobApplication: IInsuranceJobApplication
{
return _insuranceJobRepositpry.Remove(id);
}
+
+ public async Task> GetSelectList()
+ {
+ return await _insuranceJobRepositpry.GetSelectList();
+ }
}
\ No newline at end of file
diff --git a/CompanyManagment.Application/LawApplication.cs b/CompanyManagment.Application/LawApplication.cs
new file mode 100644
index 00000000..94267f82
--- /dev/null
+++ b/CompanyManagment.Application/LawApplication.cs
@@ -0,0 +1,256 @@
+using _0_Framework.Application;
+using Company.Domain.LawAgg;
+using CompanyManagment.App.Contracts.Law;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace CompanyManagment.Application;
+
+public class LawApplication : ILawApplication
+{
+ private readonly ILawRepository _lawRepository;
+
+ public LawApplication(ILawRepository lawRepository)
+ {
+ _lawRepository = lawRepository;
+ }
+
+ public OperationResult Create(CreateLaw command)
+ {
+ var operation = new OperationResult();
+ if (_lawRepository.Exists(x => x.Type == command.Type))
+ {
+ return operation.Failed("این قانون قبلا ثبت شده است");
+ }
+
+ var law = new Law(command.Title, command.Type, command.Notifications, command.HeadTitle);
+ if (command.Items == null || command.Items.Count == 0)
+ {
+ return operation.Failed("باید حداقل یک بند برای قانون باید ثبت شود");
+ }
+
+ var orderNumber = 1;
+ foreach (var item in command.Items)
+ {
+ law.AddItem(item.Header, item.Details, orderNumber);
+ orderNumber++;
+ }
+
+ _lawRepository.Create(law);
+ _lawRepository.SaveChanges();
+
+ return operation.Succcedded();
+ }
+
+ public OperationResult Edit(EditLaw command)
+ {
+ var operation = new OperationResult();
+ var law = _lawRepository.Get(command.Id);
+
+ if (law == null)
+ return operation.Failed(ApplicationMessages.RecordNotFound);
+
+ if (command.Items == null || command.Items.Count == 0)
+ {
+ return operation.Failed("باید حداقل یک بند برای قانون باید ثبت شود");
+ }
+ var orderNumber = 1;
+ var lawItems = command.Items.Select(x =>
+ {
+ var res = new LawItem(x.Header, x.Details, orderNumber);
+ orderNumber++;
+ return res;
+ }).ToList();
+
+ law.Edit(command.Title);
+
+ law.SetItem(lawItems);
+
+ _lawRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+
+ public OperationResult UpsertLaw(EditLaw command)
+ {
+ var operation = new OperationResult();
+
+ // Validate items
+ if (command.Items == null || command.Items.Count == 0)
+ {
+ return operation.Failed("باید حداقل یک بند برای قانون باید ثبت شود");
+ }
+
+ // Check if law exists by type
+ var existingLaw = _lawRepository.Get().FirstOrDefault(x => x.Type == command.Type);
+
+ if (existingLaw == null)
+ {
+ // If law doesn't exist, create a new one
+ var law = new Law(command.Title, command.Type,command.Notifications, command.HeadTitle);
+
+ var orderNumber = 1;
+ foreach (var item in command.Items)
+ {
+ law.AddItem(item.Header, item.Details, orderNumber);
+ orderNumber++;
+ }
+
+ _lawRepository.Create(law);
+ _lawRepository.SaveChanges();
+ }
+ else
+ {
+ // If law exists, update it
+ var orderNumber = 1;
+ var lawItems = command.Items.Select(x =>
+ {
+ var res = new LawItem(x.Header, x.Details, orderNumber);
+ orderNumber++;
+ return res;
+ }).ToList();
+
+ existingLaw.Edit(command.Title);
+ existingLaw.SetItem(lawItems);
+
+ _lawRepository.SaveChanges();
+ }
+
+ return operation.Succcedded();
+ }
+
+ public OperationResult Activate(long id)
+ {
+ var operation = new OperationResult();
+ var law = _lawRepository.Get(id);
+
+ if (law == null)
+ return operation.Failed(ApplicationMessages.RecordNotFound);
+
+ law.Activate();
+ _lawRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+
+ public OperationResult Deactivate(long id)
+ {
+ var operation = new OperationResult();
+ var law = _lawRepository.Get(id);
+
+ if (law == null)
+ return operation.Failed(ApplicationMessages.RecordNotFound);
+
+ law.Deactivate();
+ _lawRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+
+ public OperationResult ActivateByType(LawType type)
+ {
+ var operation = new OperationResult();
+ var law = _lawRepository.Get().FirstOrDefault(x => x.Type == type);
+
+ if (law == null)
+ {
+ // If law doesn't exist, create a new active one with default values
+ var newLaw = new Law(GetDefaultTitleForLawType(type), type, new List(), "");
+ newLaw.Activate();
+ _lawRepository.Create(newLaw);
+ _lawRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+
+ law.Activate();
+ _lawRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+
+ public OperationResult DeactivateByType(LawType type)
+ {
+ var operation = new OperationResult();
+ var law = _lawRepository.Get().FirstOrDefault(x => x.Type == type);
+
+ if (law == null)
+ return operation.Failed("قانون مورد نظر یافت نشد");
+
+ law.Deactivate();
+ _lawRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+
+ public EditLaw GetDetails(long id)
+ {
+ var law = _lawRepository.Get(id);
+ return new EditLaw
+ {
+ Id = law.id,
+ Title = law.Title,
+ Type = law.Type,
+ Items = law.Items.OrderBy(x => x.OrderNumber).Select(x => new LawItemViewModel
+ {
+ Header = x.Header,
+ Details = x.Details
+ }).ToList()
+ };
+ }
+
+ public async Task> GetList(LawSearchModel searchModel)
+ {
+ // Get filtered laws from database
+ return await _lawRepository.GetList(searchModel);
+
+
+ }
+
+ private string GetDefaultTitleForLawType(LawType lawType)
+ {
+ return lawType switch
+ {
+ LawType.Register => "قوانین ثبت نام",
+ _ => $"قوانین {lawType}"
+ };
+ }
+
+ public async Task GetLawWithItems(long id)
+ {
+ var law = await _lawRepository.GetWithItems(id);
+ if (law == null)
+ return null;
+
+ return new LawViewModel
+ {
+ Id = law.id,
+ Title = law.Title,
+ IsActive = law.IsActive,
+ CreatedAt = law.CreationDate,
+ Type = law.Type,
+ Items = law.Items.OrderBy(x=>x.OrderNumber).Select(x => new LawItemViewModel
+ {
+ Header = x.Header,
+ Details = x.Details,
+ }).ToList()
+ };
+ }
+
+ public async Task GetLawByType(LawType type)
+ {
+ var lawViewModel = await _lawRepository.GetByType(type);
+
+ // If no law exists for this type, return a default empty law
+ if (lawViewModel == null)
+ {
+ return new LawViewModel
+ {
+ Id = 0,
+ Title = GetDefaultTitleForLawType(type),
+ IsActive = false,
+ CreatedAt = DateTime.Now,
+ Type = type,
+ Items = new List()
+ };
+ }
+
+ return lawViewModel;
+ }
+}
\ No newline at end of file
diff --git a/CompanyManagment.Application/LoanApplication.cs b/CompanyManagment.Application/LoanApplication.cs
index 667a1681..3c9eb999 100644
--- a/CompanyManagment.Application/LoanApplication.cs
+++ b/CompanyManagment.Application/LoanApplication.cs
@@ -200,7 +200,8 @@ public class LoanApplication : ILoanApplication
DateGr = loanStartDate.ToGeorgianDateTime(),
Month = loanStartDate.Substring(5, 2),
Year = loanStartDate.Substring(0, 4),
- Day = loanStartDate.Substring(8, 2)
+ Day = loanStartDate.Substring(8, 2),
+ AmountDouble = moneyPerMonth
};
installments.Add(installment);
@@ -225,7 +226,8 @@ public class LoanApplication : ILoanApplication
DateGr = loanStartDate.ToGeorgianDateTime(),
Month = loanStartDate.Substring(5, 2),
Year = loanStartDate.Substring(0, 4),
- Day = loanStartDate.Substring(8, 2)
+ Day = loanStartDate.Substring(8, 2),
+ AmountDouble = lastLoan
};
installments.Add(lastInstallment);
@@ -243,7 +245,8 @@ public class LoanApplication : ILoanApplication
DateGr = loanStartDate.ToGeorgianDateTime(),
Month = loanStartDate.Substring(5, 2),
Year = loanStartDate.Substring(0, 4),
- Day = loanStartDate.Substring(8, 2)
+ Day = loanStartDate.Substring(8, 2),
+ AmountDouble = moneyPerMonth
};
installments.Add(installment);
@@ -278,7 +281,8 @@ public class LoanApplication : ILoanApplication
DateGr = loanStartDate.ToGeorgianDateTime(),
Month = loanStartDate.Substring(5, 2),
Year = loanStartDate.Substring(0, 4),
- Day = loanStartDate.Substring(8, 2)
+ Day = loanStartDate.Substring(8, 2),
+ AmountDouble = lastLoan
};
installments.Add(lastInstallment);
diff --git a/CompanyManagment.Application/PersonalContractingPartyApplication.cs b/CompanyManagment.Application/PersonalContractingPartyApplication.cs
index 3d4847f0..41db6b15 100644
--- a/CompanyManagment.Application/PersonalContractingPartyApplication.cs
+++ b/CompanyManagment.Application/PersonalContractingPartyApplication.cs
@@ -131,7 +131,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
command.Nationalcode, command.IdNumber, "*", "*",
"حقیقی",
command.Phone, command.AgentPhone, command.Address,command.RepresentativeId,representative.FullName,command.ArchiveCode,
- command.State,command.City,command.Zone,command.SureName);
+ command.State,command.City,command.Zone,command.SureName,null,null);
_personalContractingPartyRepository.Create(personalContractingParty);
@@ -203,7 +203,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
"*", "*", command.RegisterId, command.NationalId,
"حقوقی",
command.Phone, command.AgentPhone, command.Address,command.RepresentativeId, representative.FullName,command.ArchiveCode,
- command.State, command.City, command.Zone,command.SureName);
+ command.State, command.City, command.Zone,command.SureName,null,null);
_personalContractingPartyRepository.Create(legalContractingParty);
@@ -370,7 +370,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
public int GetLastArchiveCode()
{
- return _personalContractingPartyRepository.GetLastArchiveCode();
+ return _personalContractingPartyRepository.GetLastNewArchiveCode();
}
#region Mahan
public List SearchByName(string name)
@@ -554,7 +554,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
command.NationalCode, command.IdNumber, "*", "*",
"حقیقی",
command.PhoneNumber, command.AgentPhone, command.Address, command.RepresentativeId, representative.FullName, command.ArchiveCode,
- command.State, command.City, command.Zone, command.SureName);
+ command.State, command.City, command.Zone, command.SureName, null, null);
await _personalContractingPartyRepository.CreateAsync(personalContractingParty);
@@ -607,7 +607,7 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
"حقوقی",
command.PhoneNumber, command.AgentPhone, command.Address, command.RepresentativeId, representative.FullName,
command.ArchiveCode,
- command.State, command.City, command.Zone, command.SureName);
+ command.State, command.City, command.Zone, command.SureName,null,null);
await _personalContractingPartyRepository.CreateAsync(legalContractingParty);
diff --git a/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs b/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs
index a74e1df6..b376875f 100644
--- a/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs
+++ b/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs
@@ -1,16 +1,20 @@
-using System;
+ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Sms;
using _0_Framework.Application.UID;
+using _0_Framework.Exceptions;
using Company.Domain.ContarctingPartyAgg;
using Company.Domain.InstitutionPlanAgg;
using Company.Domain.TemporaryClientRegistrationAgg;
+using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.InstitutionPlan;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
+using CompanyManagment.EFCore.Repository;
using IPE.SmsIrClient.Models.Results;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using PersianTools.Core;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
@@ -28,7 +32,11 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
private readonly IInstitutionContractTempRepository _institutionContractTempRepository;
private readonly ISmsService _smsService;
- public TemporaryClientRegistrationApplication(IContractingPartyTempRepository contractingPartyTempRepository, IPersonalContractingPartyRepository personalContractingPartyRepository, IUidService uidService, IWorkshopTempRepository workshopTempRepository, IPlanPercentageRepository planPercentageRepository, IWorkshopServicesTempRepository workshopServicesTempRepository, IInstitutionContractTempRepository institutionContractTempRepository, ISmsService smsService)
+ public TemporaryClientRegistrationApplication(IContractingPartyTempRepository contractingPartyTempRepository,
+ IPersonalContractingPartyRepository personalContractingPartyRepository, IUidService uidService,
+ IWorkshopTempRepository workshopTempRepository, IPlanPercentageRepository planPercentageRepository,
+ IWorkshopServicesTempRepository workshopServicesTempRepository,
+ IInstitutionContractTempRepository institutionContractTempRepository, ISmsService smsService)
{
_contractingPartyTempRepository = contractingPartyTempRepository;
_personalContractingPartyRepository = personalContractingPartyRepository;
@@ -47,10 +55,11 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
///
///
///
- public async Task> CreateContractingPartyTemp(string nationalCode, string dateOfBirth, string mobile)
+ public async Task> CreateContractingPartyTemp(string nationalCode,
+ string dateOfBirth, string mobile)
{
var op = new OperationResult();
-
+ var result = new ContractingPartyTempViewModel();
#region Validations
if (string.IsNullOrWhiteSpace(nationalCode) || string.IsNullOrWhiteSpace(dateOfBirth) ||
@@ -67,12 +76,11 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
if (!mobile.IsMobileValid())
return op.Failed("شماره همراه نا معتبر است");
-
-
#endregion
- var getExistContractingParty = await _contractingPartyTempRepository.CheckExistOrAuthenticated(nationalCode, dateOfBirth);
+ var getExistContractingParty =
+ await _contractingPartyTempRepository.CheckExistOrAuthenticated(nationalCode, dateOfBirth);
//اگر طرف حساب قبلا در دیتابیس وجود داشت
if (getExistContractingParty)
@@ -87,70 +95,150 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var dateOfBirthGr = dateOfBirth.ToGeorgianDateTime();
+ var contractingParty =await _personalContractingPartyRepository.GetByNationalCode(nationalCode);
- //اگر طرف حساب موقت قبلا ایجاد شده دیتای آن را برمیگرداند
- if (getExistTemp != null)
+ if (contractingParty != null)
{
- var institutionContractTemp = await
- _institutionContractTempRepository.GetInstitutionContractTemp(0, getExistTemp.Id);
+ result.Id = contractingParty.id;
+ result.FName = contractingParty.FName;
+ result.LName = contractingParty.LName;
+ result.DateOfBirthFa = dateOfBirth;
+ result.FatherName = contractingParty.FatherName;
+ result.IdNumberSerial = contractingParty.IdNumberSerial;
+ result.IdNumber = contractingParty.IdNumber;
+ result.NationalCode = contractingParty.Nationalcode;
+
+ if (contractingParty.DateOfBirth != null &&contractingParty.DateOfBirth != dateOfBirthGr)
+ return op.Failed("تاریخ تولد مطابقت ندارد");
+
- if (institutionContractTemp != null)
+
+ var idNumberParty = contractingParty.IdNumber;
+ if (!contractingParty.IsAuthenticated)
{
+
+ //دریافت اطلاعات احراز هویت
+ var apiResponsParty = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
+
+ //چک کردن مطابقت شماره همراه و کد ملی
+ var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
+ if (isMachMobilAndNationalCode == null)
+ return op.Failed("خطا در سرویس احراز هویت");
+ if (!isMachMobilAndNationalCode.IsMatched)
+ return op.Failed("شماره همراه وارد شده با کد ملی مطابقت ندارد");
+
+ if (apiResponsParty == null)
+ throw new InternalServerException("خطا در سرویس احراز هویت");
+
+ if (apiResponsParty.ResponseContext.Status.Code ==14)
+ throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
+
+ if (apiResponsParty.ResponseContext.Status.Code != 0)
+ return op.Failed($"{apiResponsParty.ResponseContext.Status.Message}");
- if (institutionContractTemp.RegistrationStatus == "Completed")
- return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
+ idNumberParty = apiResponsParty.IdentificationInformation.ShenasnamehNumber == "0"
+ ? apiResponsParty.IdentificationInformation.NationalId
+ : apiResponsParty.IdentificationInformation.ShenasnamehNumber;
+
+ contractingParty.Authentication(apiResponsParty.BasicInformation.FirstName, apiResponsParty.BasicInformation.LastName,
+ apiResponsParty.BasicInformation.FatherName,idNumberParty,apiResponsParty.IdentificationInformation.ShenasnameSeri,
+ apiResponsParty.IdentificationInformation.ShenasnameSerial,dateOfBirth,apiResponsParty.BasicInformation.GenderEnum,
+ mobile);
+
+
+ await _contractingPartyTempRepository.SaveChangesAsync();
+
+
+ }
+ if (contractingParty.Phone != mobile)
+ return op.Failed("شما قبلا با شماره همراه دیگری احراز هویت شده اید");
+
+ result.Id = contractingParty.id;
+ result.FName = contractingParty.FName;
+ result.LName = contractingParty.LName;
+ result.DateOfBirthFa = dateOfBirth;
+ result.FatherName = contractingParty.FatherName;
+ result.IdNumberSerial = contractingParty.IdNumberSerial;
+ result.IdNumber = idNumberParty;
+ result.Address = contractingParty.Address;
+ result.Phone = contractingParty.Phone;
+ result.City = contractingParty.City;
+ result.State = contractingParty.State;
+ result.RepresentativeId = contractingParty.RepresentativeId;
+ result.NationalCode = contractingParty.Nationalcode;
+
+
+ return op.Succcedded(result);
+ }
+ else
+ {
+ //اگر طرف حساب موقت قبلا ایجاد شده دیتای آن را برمیگرداند
+ if (getExistTemp != null)
+ {
+ var institutionContractTemp = await
+ _institutionContractTempRepository.GetInstitutionContractTemp(0, getExistTemp.Id);
+
+ if (institutionContractTemp != null)
+ {
+ if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
+ return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
+ }
+
+
+
+ if (getExistTemp.DateOfBirth != dateOfBirthGr)
+ return op.Failed("تاریخ تولد مطابقت ندارد");
+ if (getExistTemp.Phone != mobile)
+ return op.Failed("شما قبلا با شماره همراه دیگری ثبت نام نموده اید");
+ return op.Succcedded(getExistTemp);
}
- if (getExistTemp.DateOfBirth != dateOfBirthGr)
- return op.Failed("تاریخ تولد مطابقت ندارد");
- if (getExistTemp.Phone != mobile)
- return op.Failed("شما قبلا با شماره همراه دیگری ثبت نام نموده اید");
- return op.Succcedded(getExistTemp);
+ //چک کردن مطابقت شماره همراه و کد ملی
+ var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
+ if (isMachMobilAndNationalCode == null)
+ return op.Failed("خطا در سرویس احراز هویت");
+ if (!isMachMobilAndNationalCode.IsMatched)
+ return op.Failed("شماره همراه وارد شده با کد ملی مطابقت ندارد");
- }
- //چک کردن مطابقت شماره همراه و کد ملی
- 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);
- //دریافت اطلاعات احراز هویت
- var apiRespons = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
+ if (apiRespons == null)
+ throw new InternalServerException("خطا در سرویس احراز هویت");
- if (apiRespons == null)
- return op.Failed("خطا در سرویس احراز هویت");
- if (apiRespons.ResponseContext.Status.Code != 0)
- return op.Failed($"{apiRespons.ResponseContext.Status.Message}");
+ if (apiRespons.ResponseContext.Status.Code == 14)
+ throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
- var idNumber = apiRespons.IdentificationInformation.ShenasnamehNumber == "0"
+ if (apiRespons.ResponseContext.Status.Code != 0)
+ return op.Failed($"{apiRespons.ResponseContext.Status.Message}");
+
+ var idNumber = apiRespons.IdentificationInformation.ShenasnamehNumber == "0"
? apiRespons.IdentificationInformation.NationalId
: apiRespons.IdentificationInformation.ShenasnamehNumber;
- //ایجاد طرف حساب موقت
- var createTemp = new ContractingPartyTemp(apiRespons.BasicInformation.FirstName,
- apiRespons.BasicInformation.LastName, nationalCode, idNumber, mobile,
- apiRespons.BasicInformation.FatherName, "", "", "",
- apiRespons.IdentificationInformation.ShenasnameSeri,
- apiRespons.IdentificationInformation.ShenasnameSerial, apiRespons.BasicInformation.GenderEnum,
- dateOfBirthGr);
- await _contractingPartyTempRepository.CreateAsync(createTemp);
- await _contractingPartyTempRepository.SaveChangesAsync();
+ //ایجاد طرف حساب موقت
+ var createTemp = new ContractingPartyTemp(apiRespons.BasicInformation.FirstName,
+ apiRespons.BasicInformation.LastName, nationalCode, idNumber, mobile,
+ apiRespons.BasicInformation.FatherName, "", "", "",
+ apiRespons.IdentificationInformation.ShenasnameSeri,
+ apiRespons.IdentificationInformation.ShenasnameSerial, apiRespons.BasicInformation.GenderEnum,
+ dateOfBirthGr);
+ await _contractingPartyTempRepository.CreateAsync(createTemp);
+ await _contractingPartyTempRepository.SaveChangesAsync();
- var result = new ContractingPartyTempViewModel();
- result.Id = createTemp.id;
- result.FName = createTemp.FName;
- result.LName = createTemp.LName;
- result.DateOfBirthFa = dateOfBirth;
- result.FatherName = createTemp.FatherName;
- result.IdNumberSerial = createTemp.IdNumberSerial;
- result.IdNumber = idNumber;
+ result.Id = createTemp.id;
+ result.FName = createTemp.FName;
+ result.LName = createTemp.LName;
+ result.DateOfBirthFa = dateOfBirth;
+ result.FatherName = createTemp.FatherName;
+ result.IdNumberSerial = createTemp.IdNumberSerial;
+ result.IdNumber = idNumber;
+ result.NationalCode = createTemp.NationalCode;
- return op.Succcedded(result);
+
+ return op.Succcedded(result);
+ }
}
-
-
-
}
///
@@ -161,7 +249,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
///
///
///
-
public async Task UpdateAddress(long id, string state, string city, string address)
{
var op = new OperationResult();
@@ -191,7 +278,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
///
///
///
- public async Task CreateOrUpdateWorkshopTemp(List command, long contractingPartyTempId)
+ public async Task CreateOrUpdateWorkshopTemp(List command,
+ long contractingPartyTempId)
{
var op = new OperationResult();
var updateWorkshopList = command.Where(x => x.Id > 0).ToList();
@@ -202,6 +290,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var oldWorkshops = await _workshopTempRepository.GetWorkshopTemp(contractingPartyTempId);
#region Update
+
if (updateWorkshopList.Count > 0)
{
var updateListIds = updateWorkshopList.Select(x => x.Id).ToList();
@@ -213,7 +302,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
foreach (var workshop in updateWorkshopList)
{
-
if (string.IsNullOrWhiteSpace(workshop.WorkshopName))
return op.Failed("نام مجموعه نمی تواند خالی باشد");
if (workshop.CountPerson == 0)
@@ -235,7 +323,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
if (plan.OnlineAndInPersonSumAmountDouble > 0)
{
//ویرایش مشخصات کارگاه
- existWorkshops.Edit(workshop.WorkshopName, workshop.CountPerson, plan.OnlineAndInPersonSumAmountDouble);
+ existWorkshops.Edit(workshop.WorkshopName, workshop.CountPerson,
+ plan.OnlineAndInPersonSumAmountDouble);
await _workshopTempRepository.SaveChangesAsync();
//حذف سرویس های قبلی
@@ -248,7 +337,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
//سرویس خدمات حضوری قرارداد
if (workshop.ContractAndCheckoutInPerson)
await _workshopServicesTempRepository.CreateAsync(
- new WorkshopServicesTemp("ContractAndCheckoutInPerson", workshop.CountPerson, workshop.Id));
+ new WorkshopServicesTemp("ContractAndCheckoutInPerson", workshop.CountPerson,
+ workshop.Id));
//سرویس بیمه
if (workshop.Insurance)
@@ -270,12 +360,10 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
await _workshopServicesTempRepository.SaveChangesAsync();
}
-
}
-
}
-
}
+
#endregion
#region Create
@@ -284,7 +372,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
{
foreach (var workshop in createNewWorkshopList)
{
-
if (string.IsNullOrWhiteSpace(workshop.WorkshopName))
return op.Failed("نام مجموعه نمی تواند خالی باشد");
if (workshop.CountPerson == 0)
@@ -302,23 +389,22 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var plan = _planPercentageRepository.GetInstitutionPlanForWorkshop(workshop);
if (plan.OnlineAndInPersonSumAmountDouble > 0)
{
-
-
var createNewWorkshopTemp = new WorkshopTemp(workshop.WorkshopName, workshop.CountPerson,
workshop.ContractingPartyTempId, plan.OnlineAndInPersonSumAmountDouble);
await _workshopTempRepository.CreateAsync(createNewWorkshopTemp);
await _workshopTempRepository.SaveChangesAsync();
-
//سرویس قرداد
if (workshop.ContractAndCheckout)
await _workshopServicesTempRepository.CreateAsync(
- new WorkshopServicesTemp("ContractAndCheckout", workshop.CountPerson, createNewWorkshopTemp.id));
+ new WorkshopServicesTemp("ContractAndCheckout", workshop.CountPerson,
+ createNewWorkshopTemp.id));
//سرویس خدمات حضوری قرارداد
if (workshop.ContractAndCheckoutInPerson)
await _workshopServicesTempRepository.CreateAsync(
- new WorkshopServicesTemp("ContractAndCheckoutInPerson", workshop.CountPerson, createNewWorkshopTemp.id));
+ new WorkshopServicesTemp("ContractAndCheckoutInPerson", workshop.CountPerson,
+ createNewWorkshopTemp.id));
//سرویس بیمه
if (workshop.Insurance)
@@ -327,7 +413,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
//سرویس خدمات حضوری بیمه
if (workshop.InsuranceInPerson)
await _workshopServicesTempRepository.CreateAsync(
- new WorkshopServicesTemp("InsuranceInPerson", workshop.CountPerson, createNewWorkshopTemp.id));
+ new WorkshopServicesTemp("InsuranceInPerson", workshop.CountPerson,
+ createNewWorkshopTemp.id));
//سرویس حضورغیاب
if (workshop.RollCall)
@@ -336,11 +423,11 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
//سرویس فیش غیر رسمی
if (workshop.CustomizeCheckout)
await _workshopServicesTempRepository.CreateAsync(
- new WorkshopServicesTemp("CustomizeCheckout", workshop.CountPerson, createNewWorkshopTemp.id));
+ new WorkshopServicesTemp("CustomizeCheckout", workshop.CountPerson,
+ createNewWorkshopTemp.id));
await _workshopServicesTempRepository.SaveChangesAsync();
}
-
}
}
@@ -367,174 +454,272 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
///
///
///
- public async Task GetTotalPaymentAndWorkshopList(long contractingPartyTempId, string periodModel = "12", string paymentModel = "OneTime", string contractStartType = "currentMonth")
+ public async Task GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
+ InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths,
+ string paymentModel = "OneTime", string contractStartType = "currentMonth")
{
+ throw new NotImplementedException();
+ // //دریافت کارگاه ها
+ // var workshops = await _workshopTempRepository.GetWorkshopTemp(contractingPartyTempId);
+ //
+ // double totalPayment1MonthDouble = 0;
+ //
+ // //بدست آوردن جمع کل برای یک ماه
+ // foreach (var workshop in workshops)
+ // {
+ // totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
+ // }
+ //
+ // if (totalPayment1MonthDouble == 0)
+ // return new ReviewAndPaymentViewModel();
+ //
+ // var result = new ReviewAndPaymentViewModel();
+ //
+ // int months = 0;
+ // months = (int)duration;
+ // //رند کردن مبالغ کارگاه ها
+ // var roundAmount = (((Convert.ToInt64(totalPayment1MonthDouble))) / 1000000) * 1000000;
+ // double roundAmount2 = roundAmount;
+ // //بدست آوردن جمع کل مبالغ کارگاه بر اساس مدت قراداد
+ // result.SumOfWorkshopsPaymentDouble = months * roundAmount2;
+ // result.SumOfWorkshopsPaymentPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney();
+ //
+ //
+ // result.Duration = duration;
+ // result.PaymentModel = paymentModel;
+ //
+ //
+ // var tenPercent = result.SumOfWorkshopsPaymentDouble * 10 / 100;
+ // //مالیات
+ // result.ValueAddedTaxDouble = tenPercent;
+ // result.ValueAddedTaxStr = tenPercent.ToMoney();
+ // //پرداخت یکجا
+ //
+ // #region OneTimePaymentResult
+ //
+ // double discountOneTimePeyment = result.SumOfWorkshopsPaymentDouble - tenPercent;
+ //
+ //
+ // //مبلغ بدون مالیات و با تخفیف
+ // result.OneTimeWithoutTaxPaymentDouble = discountOneTimePeyment;
+ // result.OneTimeWithoutTaxPaymentStr = discountOneTimePeyment.ToMoney();
+ //
+ // //مبلغ با مالیات
+ // result.OneTimeTotalPaymentDouble = discountOneTimePeyment + tenPercent;
+ // result.OneTimeTotalPaymentStr = result.OneTimeTotalPaymentDouble.ToMoney();
+ //
+ // #endregion
+ //
+ // //پرداخت ماهیانه
+ //
+ // #region MonthlyPaymentResult
+ //
+ // //مبلغ بدون مالیات
+ // result.MonthlyWithoutTaxPaymentDouble = result.SumOfWorkshopsPaymentDouble;
+ // result.MonthlyWithoutTaxPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney();
+ //
+ // // مبلغ با مالیات
+ // result.MonthlyTotalPaymentDouble = result.SumOfWorkshopsPaymentDouble + tenPercent;
+ // result.MonthlyTotalPaymentStr = result.MonthlyTotalPaymentDouble.ToMoney();
+ // var installmentList = new List();
+ //
+ // var startDate = (DateTime.Now).ToFarsi();
+ // result.ContractStartCurrentMonthFa = $"{startDate.Substring(0, 8)}01";
+ // result.ContractStartCurrentMonthGr = result.ContractStartCurrentMonthFa.ToGeorgianDateTime();
+ // startDate = result.ContractStartCurrentMonthFa;
+ //
+ // result.ContractStartNextMonthGr = ((startDate.FindeEndOfMonth()).ToGeorgianDateTime()).AddDays(1);
+ // result.ContractStartNextMonthFa = result.ContractStartNextMonthGr.ToFarsi();
+ //
+ // if (contractStartType == "nextMonth")
+ // startDate = result.ContractStartNextMonthFa;
+ //
+ //
+ // var findeEnd = Tools.FindEndOfContract(startDate, ((int)duration).ToString());
+ // var contractEndDate = findeEnd.endDateGr;
+ // result.ContractEndGr = contractEndDate;
+ // result.ContractEndFa = contractEndDate.ToFarsi();
+ //
+ // if (duration == InstitutionContractDuration.OneMonth)
+ // {
+ // installmentList.Add(new MonthlyInstallment()
+ // {
+ // InstallmentAmountStr = result.MonthlyTotalPaymentStr,
+ // InstallmentCounter = "سررسید پرداخت اول",
+ // InstalmentDate = (DateTime.Now).ToFarsi()
+ // });
+ // result.MonthlyInstallments = installmentList;
+ // }
+ // else
+ // {
+ // int instalmentCount = (int)duration;
+ // var instalmentAmount = result.MonthlyTotalPaymentDouble / instalmentCount;
+ // var findEndOfMonth = startDate.FindeEndOfMonth();
+ // for (int i = 1; i <= instalmentCount; i++)
+ // {
+ // if (i == 1)
+ // {
+ // startDate = (DateTime.Now).ToFarsi();
+ // }
+ // else if (i > 1)
+ // {
+ // var currentMonthStart = ((findEndOfMonth.ToGeorgianDateTime()).AddDays(1)).ToFarsi();
+ // startDate = currentMonthStart.FindeEndOfMonth();
+ // findEndOfMonth = startDate;
+ // }
+ //
+ // installmentList.Add(new MonthlyInstallment()
+ // {
+ // InstallmentAmountStr = instalmentAmount.ToMoney(),
+ // InstallmentCounter = i switch
+ // {
+ // 1 => "سررسید پرداخت اول",
+ // 2 => "سررسید پرداخت دوم",
+ // 3 => "سررسید پرداخت سوم",
+ // 4 => "سررسید پرداخت چهارم",
+ // 5 => "سررسید پرداخت پنجم",
+ // 6 => "سررسید پرداخت ششم",
+ // 7 => "سررسید پرداخت هفتم",
+ // 8 => "سررسید پرداخت هشتم",
+ // 9 => "سررسید پرداخت نهم",
+ // 10 => "سررسید پرداخت دهم",
+ // 11 => "سررسید پرداخت یازدهم",
+ // 12 => "سررسید پرداخت دوازدهم",
+ // _ => "سررسید پرداخت دوازدهم",
+ // },
+ // InstalmentDate = startDate
+ // });
+ // }
+ // }
+ //
+ // #endregion
+ //
+ // result.MonthlyInstallments = installmentList;
+ // result.ContractingPartTempId = contractingPartyTempId;
+ //
+ // return result;
+ }
+
+ public async Task GetTotalPaymentAndWorkshopList(double totalPaymentMonth,
+ InstitutionContractDuration duration, bool hasInPersonContract)
+ {
//دریافت کارگاه ها
- var workshops = await _workshopTempRepository.GetWorkshopTemp(contractingPartyTempId);
double totalPayment1MonthDouble = 0;
- //بدست آوردن جمع کل برای یک ماه
- foreach (var workshop in workshops)
- {
- totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
- }
+ // //بدست آوردن جمع کل برای یک ماه
+ // foreach (var workshop in workshops)
+ // {
+ // totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
+ // }
+ totalPayment1MonthDouble = totalPaymentMonth;
if (totalPayment1MonthDouble == 0)
return new ReviewAndPaymentViewModel();
var result = new ReviewAndPaymentViewModel();
- int months = 0;
- months = periodModel switch
- {
- "1" => 1,
- "3" => 3,
- "6" => 6,
- "12" => 12,
- _ => 12,
- };
+ var months = (int)duration;
//رند کردن مبالغ کارگاه ها
- var roundAmount = (((Convert.ToInt64(totalPayment1MonthDouble))) / 1000000) * 1000000;
- double roundAmount2 = roundAmount;
+
+ double roundAmount2 = totalPayment1MonthDouble;
//بدست آوردن جمع کل مبالغ کارگاه بر اساس مدت قراداد
- result.SumOfWorkshopsPaymentDouble = months * roundAmount2;
- result.SumOfWorkshopsPaymentPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney();
+ var sumOfWorkshopsPaymentDouble = months * roundAmount2;
+ result.SumOfWorkshopsPayment = roundAmount2.ToMoney();
+ var installmentstart = (DateTime.Now).ToFarsi();
+ result.ContractStartFa = installmentstart;
+ result.ContractStartGr = result.ContractStartFa.ToGeorgianDateTime();
- result.PeriodModel = periodModel;
- result.PaymentModel = paymentModel;
-
-
- var tenPercent = result.SumOfWorkshopsPaymentDouble * 10 / 100;
- //مالیات
- result.ValueAddedTaxDouble = tenPercent;
- result.ValueAddedTaxSt = tenPercent.ToMoney();
- //پرداخت یکجا
- #region OneTimePaymentResult
-
- double discountOneTimePeyment = result.SumOfWorkshopsPaymentDouble - tenPercent;
-
-
- //مبلغ بدون مالیات و با تخفیف
- result.OneTimeWithoutTaxPaymentDouble = discountOneTimePeyment;
- result.OneTimeWithoutTaxPaymentStr = discountOneTimePeyment.ToMoney();
-
- //مبلغ با مالیات
- result.OneTimeTotalPaymentDouble = discountOneTimePeyment + tenPercent;
- result.OneTimeTotalPaymentStr = result.OneTimeTotalPaymentDouble.ToMoney();
-
- #endregion
-
- //پرداخت ماهیانه
- #region MonthlyPaymentResult
-
- //مبلغ بدون مالیات
- result.MonthlyWithoutTaxPaymentDouble = result.SumOfWorkshopsPaymentDouble;
- result.MonthlyWithoutTaxPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney();
-
- // مبلغ با مالیات
- result.MonthlyTotalPaymentDouble = result.SumOfWorkshopsPaymentDouble + tenPercent;
- result.MonthlyTotalPaymentStr = result.MonthlyTotalPaymentDouble.ToMoney();
- var installmentList = new List();
-
- var startDate = (DateTime.Now).ToFarsi();
- result.ContractStartCurrentMonthFa = $"{startDate.Substring(0, 8)}01";
- result.ContractStartCurrentMonthGr = result.ContractStartCurrentMonthFa.ToGeorgianDateTime();
- startDate = result.ContractStartCurrentMonthFa;
-
- result.ContractStartNextMonthGr = ((startDate.FindeEndOfMonth()).ToGeorgianDateTime()).AddDays(1);
- result.ContractStartNextMonthFa = result.ContractStartNextMonthGr.ToFarsi();
-
- if (contractStartType == "nextMonth")
- startDate = result.ContractStartNextMonthFa;
-
-
-
- var findeEnd = Tools.FindEndOfContract(startDate, periodModel);
+ var findeEnd = Tools.FindEndOfContract(installmentstart, ((int)duration).ToString());
var contractEndDate = findeEnd.endDateGr;
result.ContractEndGr = contractEndDate;
result.ContractEndFa = contractEndDate.ToFarsi();
- if (periodModel == "1")
+ if (hasInPersonContract)
{
+ var tenPercent = sumOfWorkshopsPaymentDouble * 10 / 100;
+ //مالیات
+ //پرداخت یکجا
- installmentList.Add(new MonthlyInstallment()
- {
- InstallmentAmountStr = result.MonthlyTotalPaymentStr,
- InstallmentCounter = "سررسید پرداخت اول",
- InstalmentDate = (DateTime.Now).ToFarsi()
+ #region OneTimePaymentResult
+
+ double discountOneTimePeyment = sumOfWorkshopsPaymentDouble - tenPercent;
+
+
+ //مبلغ بدون مالیات و با تخفیف
+ result.OneTimeWithoutTaxPaymentStr = discountOneTimePeyment.ToMoney();
+ var oneTimeValueAddedTax = (discountOneTimePeyment * 10) / 100;
+ result.OneTimeValueAddedTaxStr = oneTimeValueAddedTax.ToMoney();
+
+ //مبلغ با مالیات
+ var oneTimePayment = discountOneTimePeyment + oneTimeValueAddedTax;
+ result.OneTimeTotalPaymentStr = oneTimePayment.ToMoney();
+ result.DiscountedAmountForOneMonth = roundAmount2.ToMoney();
+
+
+ #endregion
+
+
+ //پرداخت ماهیانه
+
+ #region MonthlyPaymentResult
+
+ //مبلغ بدون مالیات
+
+ result.MonthlyWithoutTaxPaymentStr = sumOfWorkshopsPaymentDouble.ToMoney();
+
+ // مبلغ با مالیات
+ result.MonthlyValueAddedTaxStr= tenPercent.ToMoney();
+ var monthlyTotalPaymentDouble = sumOfWorkshopsPaymentDouble + tenPercent;
+ result.MonthlyTotalPaymentStr = monthlyTotalPaymentDouble.ToMoney();
+ var installmentList = InstitutionContractRepository.InstitutionMonthlyInstallmentCaculation(duration, monthlyTotalPaymentDouble, installmentstart);
+
+ #endregion
- });
result.MonthlyInstallments = installmentList;
}
else
{
- int instalmentCount = Convert.ToInt32(periodModel);
- var instalmentAmount = result.MonthlyTotalPaymentDouble / instalmentCount;
- var findEndOfMonth = startDate.FindeEndOfMonth();
- for (int i = 1; i <= instalmentCount; i++)
+ var discount = duration switch
{
- if (i == 1)
- {
- startDate = (DateTime.Now).ToFarsi();
-
- }
- else if (i > 1)
- {
- var currentMonthStart = ((findEndOfMonth.ToGeorgianDateTime()).AddDays(1)).ToFarsi();
- startDate = currentMonthStart.FindeEndOfMonth();
- findEndOfMonth = startDate;
- }
-
- installmentList.Add(new MonthlyInstallment()
- {
- InstallmentAmountStr = instalmentAmount.ToMoney(),
- InstallmentCounter = i switch
- {
- 1 => "سررسید پرداخت اول",
- 2 => "سررسید پرداخت دوم",
- 3 => "سررسید پرداخت سوم",
- 4 => "سررسید پرداخت چهارم",
- 5 => "سررسید پرداخت پنجم",
- 6 => "سررسید پرداخت ششم",
- 7 => "سررسید پرداخت هفتم",
- 8 => "سررسید پرداخت هشتم",
- 9 => "سررسید پرداخت نهم",
- 10 => "سررسید پرداخت دهم",
- 11 => "سررسید پرداخت یازدهم",
- 12 => "سررسید پرداخت دوازدهم",
- _ => "سررسید پرداخت دوازدهم",
- },
- InstalmentDate = startDate
-
- });
- }
-
+ InstitutionContractDuration.OneMonth => 0,
+ InstitutionContractDuration.ThreeMonths => 5,
+ InstitutionContractDuration.SixMonths => 10,
+ InstitutionContractDuration.TwelveMonths => 15,
+ _ => throw new ArgumentOutOfRangeException(nameof(duration), duration, null)
+ };
+
+ var oneMonthDiscountAmount = (roundAmount2 * discount) / 100;
+ var totalDiscount = oneMonthDiscountAmount * months;
+ var discountedPayment = sumOfWorkshopsPaymentDouble - totalDiscount;
+ result.Discount = oneMonthDiscountAmount.ToMoney();
+ result.DiscountedAmountForOneMonth = (roundAmount2 - oneMonthDiscountAmount).ToMoney();
+ var taxDouble = (discountedPayment * 10)/100;
+ result.OneTimeValueAddedTaxStr =taxDouble.ToMoney();
+ result.OneTimeWithoutTaxPaymentStr = discountedPayment.ToMoney();
+ result.OneTimeTotalPaymentStr =( discountedPayment + taxDouble).ToMoney();
}
- #endregion
-
- result.MonthlyInstallments = installmentList;
- result.ContractingPartTempId = contractingPartyTempId;
-
+ result.DailyCompensation = ((roundAmount2 * 10) / 100).ToMoney();
+ result.Obligation = result.OneTimeWithoutTaxPaymentStr;
return result;
-
}
+
+
///
/// ایجاد یا ویرایش قرارداد موقت
///
///
///
- public async Task CreateOrUpdateInstitutionContractTemp(long contractingPartyTempId, string periodModel, string paymentModel, double totalPayment, double valueAddedTax, DateTime contractStart)
+ public async Task CreateOrUpdateInstitutionContractTemp(long contractingPartyTempId,
+ string periodModel, string paymentModel, double totalPayment, double valueAddedTax, DateTime contractStart)
{
-
var op = new OperationResult();
-
var institutionContractTemp = await
_institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
var contractStartDate = contractStart;
@@ -545,7 +730,10 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
{
var periodModelInt = Convert.ToInt32(periodModel);
- var create = new InstitutionContractTemp(contractingPartyTempId, paymentModel, periodModel, totalPayment, contractStartDate, contractEndDate, "official", valueAddedTax, "", "BeforeSendVerifyCode", 0, null, null);
+ var create = new InstitutionContractTemp(contractingPartyTempId, paymentModel, periodModel, totalPayment,
+ contractStartDate, contractEndDate, "official", valueAddedTax, "",
+ InstitutionContractTempStatus.BeforeSendVerifyCode, 0, null,
+ null);
_institutionContractTempRepository.Create(create);
_institutionContractTempRepository.SaveChanges();
@@ -560,11 +748,13 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
if (institutionContractTemp.VerifyCodeEndTime != null)
{
var spaning = (DateTime.Now - institutionContractTemp.VerifyCodeEndTime.Value);
- if (institutionContractTemp.RegistrationStatus == "VerifyCodeSent" && spaning > new TimeSpan(0, 0, 0) && spaning < new TimeSpan(0, 1, 0))
+ if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.VerifyCodeSent &&
+ spaning > new TimeSpan(0, 0, 0) &&
+ spaning < new TimeSpan(0, 1, 0))
return op.Failed("شما به تازگی پیامک دریافت نموده اید دو دقیقه صبر کنید و دوباره تلاش کنید");
}
- if (institutionContractTemp.RegistrationStatus == "Completed")
+ if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
@@ -572,17 +762,17 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var contractstart = DateTime.Now;
var contractEnd = DateTime.Now.AddMonths(periodModelInt);
var update = _institutionContractTempRepository.Get(institutionContractTemp.Id);
- update.Edit(contractingPartyTempId, paymentModel, periodModel, totalPayment, contractStartDate, contractEndDate, "official", valueAddedTax, "", "BeforeSendVerifyCode", 0, null, null);
+ update.Edit(contractingPartyTempId, paymentModel, periodModel, totalPayment, contractStartDate,
+ contractEndDate, "official", valueAddedTax, "", InstitutionContractTempStatus.BeforeSendVerifyCode, 0,
+ null, null);
_institutionContractTempRepository.SaveChanges();
-
+
//temporary
var res = await PayOffCompleted(contractingPartyTempId);
if (!res.IsSuccedded)
return op.Failed(res.Message);
return op.Succcedded();
}
-
-
}
@@ -594,27 +784,25 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
///
public async Task ReceivedCodeFromServer(long contractingPartyTempId)
{
-
var op = new OperationResult();
var institutionContractTemp = await
- _institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
+ _institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
if (institutionContractTemp == null)
return op.Failed("خطا");
var update = _institutionContractTempRepository.Get(institutionContractTemp.Id);
-
-
- if (institutionContractTemp.RegistrationStatus == "BeforeSendVerifyCode")
+ if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.BeforeSendVerifyCode)
{
//ساخت کد شش رقمی
Random generator = new Random();
String code = generator.Next(1, 1000000).ToString("D6");
//ارسال اس ام اس
- var getContractingPaty = _contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
+ var getContractingPaty =
+ _contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
var sendResult = await _smsService.SendVerifyCodeToClient(getContractingPaty.Phone, code);
if (!sendResult.IsSuccedded)
@@ -626,18 +814,16 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
//تغییر وضعیت به ارسال شده
if (update != null)
{
- update.Update(code, "VerifyCodeSent", sendResult.MessageId, DateTime.Now, DateTime.Now.AddMinutes(2));
+ update.Update(code, InstitutionContractTempStatus.VerifyCodeSent, sendResult.MessageId, DateTime.Now,
+ DateTime.Now.AddMinutes(2));
_institutionContractTempRepository.SaveChanges();
return op.Succcedded(1, "کد برای شما پیامک شد");
}
-
-
}
- if (institutionContractTemp.RegistrationStatus == "VerifyCodeSent")
+ if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.VerifyCodeSent)
{
-
if (DateTime.Now < institutionContractTemp.VerifyCodeEndTime.Value)
return op.Failed("کد دریافت شده را وارد کنید");
var spaning = (DateTime.Now - institutionContractTemp.VerifyCodeEndTime.Value);
@@ -650,14 +836,14 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
Random generator = new Random();
String code = generator.Next(1, 1000000).ToString("D6");
//ارسال اس ام اس
- var getContractingPaty = _contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
+ var getContractingPaty =
+ _contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
var sendResult = await _smsService.SendVerifyCodeToClient(getContractingPaty.Phone, code);
if (!sendResult.IsSuccedded)
return op.Failed($"{sendResult.Message}");
-
//ذخیره کد در دیتا بیس
//ذخیره تاریخ ارسال و مهلت پایان
//ذخیره آیدی پیامک
@@ -665,21 +851,19 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
if (update != null)
{
- update.Update(code, "VerifyCodeSent", sendResult.MessageId, DateTime.Now, DateTime.Now.AddMinutes(2));
+ update.Update(code, InstitutionContractTempStatus.VerifyCodeSent, sendResult.MessageId,
+ DateTime.Now,
+ DateTime.Now.AddMinutes(2));
_institutionContractTempRepository.SaveChanges();
return op.Succcedded(1, "کد برای شما پیامک شد");
}
-
-
-
}
-
}
//if (institutionContractTemp.RegistrationStatus == "ReceivedCodeFromClient")
// return op.Succcedded(2, "انتقال به بخش پرداخت");
- if (institutionContractTemp.RegistrationStatus == "Completed")
+ if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
return op.Failed("خظا");
}
@@ -694,32 +878,27 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
public async Task CheckVerifyCodeIsTrue(long contractingPartyTempId, string verifyCode)
{
var op = new OperationResult();
- var institutionContractTemp = await
- _institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
- if (institutionContractTemp == null)
+ var contractingPartyTemp = _contractingPartyTempRepository.Get( contractingPartyTempId);
+ if (contractingPartyTemp == null)
return op.Failed("خظا");
- if (institutionContractTemp.RegistrationStatus != "VerifyCodeSent")
- return op.Failed("خطا");
- if (institutionContractTemp.VerifyCodeEndTime < DateTime.Now)
+ if (contractingPartyTemp.Status != ContractingPartyTempStatus.InComplete)
+ return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
+
+ if (contractingPartyTemp.VerifyCodeSentDateTime.AddMinutes(2) < DateTime.Now)
return op.Failed("کد شما منقضی شده است");
- if (institutionContractTemp.SendVerifyCodeTime < DateTime.Now && institutionContractTemp.VerifyCodeEndTime >= DateTime.Now)
+ if (contractingPartyTemp.VerifyCodeSentDateTime < DateTime.Now &&
+ contractingPartyTemp.VerifyCodeSentDateTime >= DateTime.Now)
{
- if (institutionContractTemp.VerifyCode == verifyCode)
+ if (contractingPartyTemp.VerifyCode == verifyCode)
{
-
-
+ contractingPartyTemp.SetCompleted();
+ await _contractingPartyTempRepository.SaveChangesAsync();
return op.Succcedded();
}
- else
- {
- return op.Failed("کد وارد شده صحیح نیست");
- }
-
}
-
-
+
return op.Failed("کد وارد شده صحیح نیست");
}
@@ -736,24 +915,25 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var temp = _contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
if (_personalContractingPartyRepository.Exists(x =>
- x.Nationalcode == temp.NationalCode))
+ x.Nationalcode == temp.NationalCode))
return op.Failed("امکان ثبت رکورد تکراری وجود ندارد");
- var lastArchiveCode = _personalContractingPartyRepository.GetLastArchiveCode();
+ var lastArchiveCode = _personalContractingPartyRepository.GetLastNewArchiveCode();
var personalContractingParty = new PersonalContractingParty(temp.FName, temp.LName,
temp.NationalCode, temp.IdNumber, "*", "*",
"حقیقی",
temp.Phone, null, temp.Address, 1, "-", lastArchiveCode,
- temp.State, temp.City, null, null);
+ temp.State, temp.City, null, null, null, null);
_personalContractingPartyRepository.Create(personalContractingParty);
_personalContractingPartyRepository.SaveChanges();
- personalContractingParty.RegisterComplete(temp.FatherName, temp.IdNumberSeri, temp.IdNumberSerial, temp.DateOfBirth, temp.Gender);
+ personalContractingParty.RegisterComplete(temp.FatherName, temp.IdNumberSeri, temp.IdNumberSerial,
+ temp.DateOfBirth, temp.Gender);
_personalContractingPartyRepository.SaveChanges();
var institutionContractTemp = await
_institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
var update = _institutionContractTempRepository.Get(institutionContractTemp.Id);
- update.ChangeRegistrationStatus("Completed");
+ update.ChangeRegistrationStatus(InstitutionContractTempStatus.PendingToCompletion);
_institutionContractTempRepository.SaveChanges();
@@ -761,10 +941,24 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
}
- public async Task> RegistrationWorkflowMainList()
+ public async Task SendAgreementLink(long contractingPartyTempId)
{
+ var op = new OperationResult();
+ var contractingPartyTemp = _contractingPartyTempRepository.Get(contractingPartyTempId);
+ if (contractingPartyTemp == null)
+ throw new NotFoundException("طرف حساب یافت نشد");
- return await _institutionContractTempRepository.GetAllCompletedRegistration();
+ if (contractingPartyTemp.Status == ContractingPartyTempStatus.Completed)
+ throw new BadRequestException("شما قبلا ثبت نام خود را تکمیل نموده اید");
+
+ Random generator = new Random();
+ string verifyCode = generator.Next(1, 1000000).ToString("D6");
+ contractingPartyTemp.SetVerifyCode(verifyCode);
+ await _contractingPartyTempRepository.SaveChangesAsync();
+
+ await _smsService.SendVerifyCodeToClient(contractingPartyTemp.Phone, verifyCode);
+
+
+ return op.Succcedded();
}
-
}
\ No newline at end of file
diff --git a/CompanyManagment.Application/WorkshopAppliction.cs b/CompanyManagment.Application/WorkshopAppliction.cs
index 1d306823..ee4405d7 100644
--- a/CompanyManagment.Application/WorkshopAppliction.cs
+++ b/CompanyManagment.Application/WorkshopAppliction.cs
@@ -19,6 +19,7 @@ using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.Workshop.DTOs;
using CompanyManagment.App.Contracts.WorkshopPlan;
using CompanyManagment.EFCore.Migrations;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration.UserSecrets;
using Microsoft.Identity.Client;
@@ -39,7 +40,12 @@ public class WorkshopAppliction : IWorkshopApplication
private readonly IRollCallServiceApplication _rollCallServiceApplication;
private readonly IPasswordHasher _passwordHasher;
- public WorkshopAppliction(IWorkshopRepository workshopRepository, ILeftWorkRepository leftWorkRepository, ILeftWorkInsuranceRepository leftWorkInsuranceRepository, IWorkshopPlanApplication workshopPlanApplication, IEmployeeApplication employeeApplication, IEmployeeChildrenApplication employeeChildrenApplication, IInstitutionContractRepository institutionContractRepository, IPersonalContractingPartyRepository personalContractingPartyRepository, IRollCallServiceApplication rollCallServiceApplication, IPasswordHasher passwordHasher)
+ public WorkshopAppliction(IWorkshopRepository workshopRepository, ILeftWorkRepository leftWorkRepository,
+ ILeftWorkInsuranceRepository leftWorkInsuranceRepository, IWorkshopPlanApplication workshopPlanApplication,
+ IEmployeeApplication employeeApplication, IEmployeeChildrenApplication employeeChildrenApplication,
+ IInstitutionContractRepository institutionContractRepository,
+ IPersonalContractingPartyRepository personalContractingPartyRepository,
+ IRollCallServiceApplication rollCallServiceApplication, IPasswordHasher passwordHasher)
{
_workshopRepository = workshopRepository;
_leftWorkRepository = leftWorkRepository;
@@ -58,7 +64,7 @@ public class WorkshopAppliction : IWorkshopApplication
bool createPlanValidations = false;
var accountIds = new List();
var operation = new OperationResult();
- if (command.EmployerIdList==null)
+ if (command.EmployerIdList == null)
return operation.Failed("لطفا کارفرما را انتخاب نمایید");
var employer = command.EmployerIdList.ToList();
if (command.AccountIdsList != null)
@@ -66,45 +72,49 @@ public class WorkshopAppliction : IWorkshopApplication
accountIds = command.AccountIdsList.ToList();
}
- if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" && string.IsNullOrEmpty(command.InsuranceCode))
+ if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" &&
+ string.IsNullOrEmpty(command.InsuranceCode))
return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode))
return operation.Failed("موارد اجباری را پر کنید");
- //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
- // return operation.Failed("نام کارگاه تکراری است");
+ //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
+ // return operation.Failed("نام کارگاه تکراری است");
- if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" && (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
- return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
+ if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" &&
+ (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
+ return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
- if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
- command.CutContractEndOfYear = IsActive.None;
- if (!command.CreateContract)
- {
- command.SignContract = false;
- command.CreateCheckout = false;
- command.SignCheckout = false;
- }
+ if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
+ command.CutContractEndOfYear = IsActive.None;
+ if (!command.CreateContract)
+ {
+ command.SignContract = false;
+ command.CreateCheckout = false;
+ command.SignCheckout = false;
+ }
- if (!command.CreateCheckout)
- {
- command.SignCheckout = false;
- }
+ if (!command.CreateCheckout)
+ {
+ command.SignCheckout = false;
+ }
- if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode))
+ if (_workshopRepository.Exists(x =>
+ !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode))
return operation.Failed("کد بیمه کارگاه تکراری است");
if (!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.State))
return operation.Failed("لطفا استان و شهر را انتخاب کنید");
- if ((!string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.State)) && command.City == "شهرستان")
+ if ((!string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.State)) &&
+ command.City == "شهرستان")
return operation.Failed("لطفا شهر را انتخاب کنید");
if (string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.State))
return operation.Failed("لطفا آدرس را وارد کنید");
-
+
if (command.FixedSalary)
{
if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
@@ -115,12 +125,14 @@ public class WorkshopAppliction : IWorkshopApplication
if (command.IsClassified)
{
- if (string.IsNullOrWhiteSpace(command.CreatePlan.ExecutionDateFa) || command.CreatePlan.ExecutionDateFa.Length < 10)
+ if (string.IsNullOrWhiteSpace(command.CreatePlan.ExecutionDateFa) ||
+ command.CreatePlan.ExecutionDateFa.Length < 10)
return operation.Failed("تاریخ اجرای طرح را بصورت صحیح وارد کنید");
- if(string.IsNullOrWhiteSpace(command.CreatePlan.IncludingDateFa) || command.CreatePlan.IncludingDateFa.Length <10)
+ if (string.IsNullOrWhiteSpace(command.CreatePlan.IncludingDateFa) ||
+ command.CreatePlan.IncludingDateFa.Length < 10)
return operation.Failed("تاریخ شمول طرح را بصورت صحیح وارد کنید");
var groupCounter = 0;
- // var planEmployeeCounter = command.CreatePlan.EditWorkshopPlanEmployeeList == null ? 0 : command.CreatePlan.EditWorkshopPlanEmployeeList.Count;
+ // var planEmployeeCounter = command.CreatePlan.EditWorkshopPlanEmployeeList == null ? 0 : command.CreatePlan.EditWorkshopPlanEmployeeList.Count;
for (int i = 0; i <= command.CreatePlan.EditGroupPlanlist.Count - 1; i++)
{
if (!string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].AnnualSalaryStr)
@@ -129,14 +141,12 @@ public class WorkshopAppliction : IWorkshopApplication
&& command.CreatePlan.EditGroupPlanlist[i].JobIdList.Count > 0)
{
groupCounter += 1;
-
}
}
if (groupCounter >= 1)
{
createPlanValidations = true;
-
}
else
{
@@ -144,31 +154,37 @@ public class WorkshopAppliction : IWorkshopApplication
return operation.Failed("وارد کردن اطلاعات تمامی گروه ها الزامی است");
}
}
+
//if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend))
// return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
var account = new AccountViewModel();
var institutionContract = new InstitutionContract();
-
+
if (command.HasRollCallFreeVip == "true")
{
- institutionContract = _institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
+ institutionContract =
+ _institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
if (institutionContract == null)
return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
- account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract.ContractingPartyId);
- if(account == null || account.ClientAreaPermission != "true")
+ account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract
+ .ContractingPartyId);
+ if (account == null || account.ClientAreaPermission != "true")
return operation.Failed("بدلیل نداشتن حساب کاربری کلاینت نمیتوانید سرویس حضور غیاب را فعال کنید");
-
}
- var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode,
+
+ var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode,
command.TypeOfOwnership,
command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City,
command.Address,
- command.TypeOfInsuranceSend, command.TypeOfContract,command.ContractTerm,command.AgreementNumber
- ,command.FixedSalary, command.Population,command.InsuranceJobId,command.ZoneName,command.AddBonusesPay,
- command.AddYearsPay,command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,command.ComputeOptions,
- command.BonusesOptions,command.YearsOptions,command.HasRollCallFreeVip,command.WorkshopHolidayWorking,
- command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract, command.SignContract,
- command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear,command.RotatingShiftCompute, command.IsStaticCheckout);
+ command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
+ , command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName, command.AddBonusesPay,
+ command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide, command.IsClassified,
+ command.ComputeOptions,
+ command.BonusesOptions, command.YearsOptions, command.HasRollCallFreeVip, command.WorkshopHolidayWorking,
+ command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract,
+ command.SignContract,
+ command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear, command.RotatingShiftCompute,
+ command.IsStaticCheckout, institutionContract.ContractingPartyId);
_workshopRepository.Create(workshop);
_workshopRepository.SaveChanges();
@@ -184,20 +200,17 @@ public class WorkshopAppliction : IWorkshopApplication
MaxPersonValid = 500,
Duration = "12",
HasCustomizeCheckoutService = command.HasCustomizeCheckoutService
-
- };
+ };
_rollCallServiceApplication.Create(commandSave);
-
-
-
}
+
//مشاغل مقطوع
if (createPlanValidations)
{
command.CreatePlan.WorkshopId = workshop.id;
var creatPlan = _workshopPlanApplication.CreateWorkshopPlan(command.CreatePlan);
}
-
+
foreach (var e in employer)
{
@@ -208,9 +221,7 @@ public class WorkshopAppliction : IWorkshopApplication
var op = _workshopRepository.CreateAccountLeftWorkAndWorkshopAccounts(accountIds, workshop.id);
-
return operation.Succcedded();
-
}
public OperationResult Edit(EditWorkshop command)
@@ -228,44 +239,48 @@ public class WorkshopAppliction : IWorkshopApplication
{
accountIds = command.AccountIdsList.ToList();
}
+
if (workshop == null)
operation.Failed("رکورد مورد نظر وجود ندارد");
if (command.EmployerIdList == null)
return operation.Failed("لطفا کارفرما را انتخاب نمایید");
var employer = command.EmployerIdList.ToList();
- //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
- // return operation.Failed(" نام کارگاه تکراری است ");
+ //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
+ // return operation.Failed(" نام کارگاه تکراری است ");
- if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" && (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
- return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
+ if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" &&
+ (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
+ return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
- if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
- command.CutContractEndOfYear = IsActive.None;
- if (!command.CreateContract)
- {
- command.SignContract = false;
- command.CreateCheckout = false;
- command.SignCheckout = false;
- }
+ if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
+ command.CutContractEndOfYear = IsActive.None;
+ if (!command.CreateContract)
+ {
+ command.SignContract = false;
+ command.CreateCheckout = false;
+ command.SignCheckout = false;
+ }
- if (!command.CreateCheckout)
- {
- command.SignCheckout = false;
- }
+ if (!command.CreateCheckout)
+ {
+ command.SignCheckout = false;
+ }
- if (command.TypeOfInsuranceSend != null && string.IsNullOrEmpty(command.InsuranceCode))
+ if (command.TypeOfInsuranceSend != null && string.IsNullOrEmpty(command.InsuranceCode))
return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
- if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode && x.id != command.Id))
+ if (_workshopRepository.Exists(x =>
+ !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode &&
+ x.id != command.Id))
return operation.Failed("کد بیمه کارگاه تکراری است");
if (command.Address != null && command.State == null)
return operation.Failed("لطفا استان و شهر را انتخاب کنید");
if ((command.Address != null && command.State != null) && command.City == "شهرستان")
return operation.Failed("لطفا شهر را انتخاب کنید");
-
- if (command.Address == null && command.State != null)
+
+ if (command.Address == null && command.State != null)
return operation.Failed("لطفا آدرس را وارد کنید");
if (command.ComputeOptions == "0")
@@ -280,17 +295,19 @@ public class WorkshopAppliction : IWorkshopApplication
if (string.IsNullOrWhiteSpace(command.Population))
return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
}
+
var account = new AccountViewModel();
var institutionContract = new InstitutionContract();
if (command.HasRollCallFreeVip == "true")
{
-
- institutionContract = _institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
+ institutionContract =
+ _institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
if (institutionContract == null)
return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
- account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract.ContractingPartyId);
+ account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract
+ .ContractingPartyId);
if ((account == null || account.ClientAreaPermission != "true") && command.Id != 11)
return operation.Failed("بدلیل نداشتن حساب کاربری کلاینت نمیتوانید سرویس حضور غیاب را فعال کنید");
var searchService = _rollCallServiceApplication.GetAllServiceByWorkshopId(command.Id);
@@ -309,7 +326,7 @@ public class WorkshopAppliction : IWorkshopApplication
{
var hasService = searchService.FirstOrDefault(x =>
x.IsActiveString == "true" && x.StartService <= DateTime.Now &&
- x.EndService >= DateTime.Now );
+ x.EndService >= DateTime.Now);
if (hasService == null)
{
_rollCallServiceApplication.Create(commandSave);
@@ -321,22 +338,18 @@ public class WorkshopAppliction : IWorkshopApplication
hasService.HasCustomizeCheckoutService != "true")
{
_rollCallServiceApplication.AddCustomizeCheckoutServiceVip(hasService.Id);
- }else if (command.HasCustomizeCheckoutService == "false" &&
- hasService.HasCustomizeCheckoutService == "true")
+ }
+ else if (command.HasCustomizeCheckoutService == "false" &&
+ hasService.HasCustomizeCheckoutService == "true")
{
_rollCallServiceApplication.StopVipService(hasService.Id);
}
-
}
-
}
else
{
_rollCallServiceApplication.Create(commandSave);
}
-
-
-
}
else
{
@@ -352,16 +365,18 @@ public class WorkshopAppliction : IWorkshopApplication
}
}
}
-
- workshop.Edit(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, command.TypeOfOwnership,
+
+ workshop.Edit(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, command.TypeOfOwnership,
command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City,
command.Address,
- command.TypeOfInsuranceSend, command.TypeOfContract,command.ContractTerm, command.AgreementNumber
+ command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
, command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName,
- command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide,command.IsClassified,
- command.ComputeOptions,command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip,
- command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime,command.InsuranceCheckoutFamilyAllowance,
- command.CreateContract, command.SignContract, command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear,command.RotatingShiftCompute, command.IsStaticCheckout);
+ command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide,
+ command.IsClassified,
+ command.ComputeOptions, command.BonusesOptions, command.YearsOptions, command.HasRollCallFreeVip,
+ command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance,
+ command.CreateContract, command.SignContract, command.CreateCheckout, command.SignCheckout,
+ command.CutContractEndOfYear, command.RotatingShiftCompute, command.IsStaticCheckout);
_workshopRepository.SaveChanges();
_workshopRepository.RemoveOldRelation(command.Id);
@@ -369,18 +384,18 @@ public class WorkshopAppliction : IWorkshopApplication
{
_workshopRepository.EmployerWorkshop(workshop.id, e);
}
+
var op = _workshopRepository.EditAccountLeftWorkAndWorkshopAccounts(accountIds, workshop.id);
foreach (var item in leftWork)
{
var editLeft = _leftWorkRepository.Get(item.Id);
-
+
editLeft.EditBonuses(command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay);
_leftWorkRepository.SaveChanges();
-
}
+
transaction.Complete();
return operation.Succcedded();
-
}
public string GetWorkshopFullname(long id)
@@ -396,8 +411,7 @@ public class WorkshopAppliction : IWorkshopApplication
{
workshop.CreatePlan = _workshopPlanApplication.GetWorkshopPlanByWorkshopId(id);
}
-
-
+
return workshop;
}
@@ -411,6 +425,7 @@ public class WorkshopAppliction : IWorkshopApplication
{
return _workshopRepository.GetWorkshopAll();
}
+
public List GetWorkshopAccount()
{
return _workshopRepository.GetWorkshopAccount();
@@ -436,13 +451,17 @@ public class WorkshopAppliction : IWorkshopApplication
InsurancePerson = x.InsurancePerson,
ContractLeft = x.ContractLeft,
InsurancetLeft = x.InsurancetLeft,
- Black = ((x.ContractPerson && x.InsurancePerson && x.InsurancetLeft && x.ContractLeft) || (x.ContractPerson && !x.InsurancePerson && x.ContractLeft) || (x.InsurancePerson && !x.ContractPerson && x.InsurancetLeft)) ? true : false
+ Black = ((x.ContractPerson && x.InsurancePerson && x.InsurancetLeft && x.ContractLeft) ||
+ (x.ContractPerson && !x.InsurancePerson && x.ContractLeft) ||
+ (x.InsurancePerson && !x.ContractPerson && x.InsurancetLeft))
+ ? true
+ : false
}).ToList();
return res;
-
}
#region Vafa
+
public List GetPersonnelInfo(PersonnelInfoSearchModel searchModel)
{
var res = _workshopRepository.GetPersonnelInfo(searchModel.WorkshopId);
@@ -464,7 +483,11 @@ public class WorkshopAppliction : IWorkshopApplication
InsurancePerson = x.InsurancePerson,
ContractLeft = x.ContractLeft,
InsuranceLeft = x.InsuranceLeft,
- Black = ((x.ContractPerson && x.InsurancePerson && x.InsuranceLeft && x.ContractLeft) || (x.ContractPerson && !x.InsurancePerson && x.ContractLeft) || (x.InsurancePerson && !x.ContractPerson && x.InsuranceLeft)) ? true : false,
+ Black = ((x.ContractPerson && x.InsurancePerson && x.InsuranceLeft && x.ContractLeft) ||
+ (x.ContractPerson && !x.InsurancePerson && x.ContractLeft) ||
+ (x.InsurancePerson && !x.ContractPerson && x.InsuranceLeft))
+ ? true
+ : false,
LastStartContractWork = x.LastStartContractWork,
LastLeftContractWork = x.LastLeftContractWork,
LastStartInsuranceWork = x.LastStartInsuranceWork,
@@ -514,7 +537,7 @@ public class WorkshopAppliction : IWorkshopApplication
var workshop = _workshopRepository.Get(id);
if (workshop == null)
return opration.Failed("رکورد مورد نظر یافت نشد");
-
+
var checkLeftWork = _leftWorkRepository.searchByWorkshopId(id);
var checkInsurancLeftWork = _leftWorkInsuranceRepository.searchByWorkshopId(id);
if (checkLeftWork.Count > 0 || checkInsurancLeftWork.Count > 0)
@@ -525,14 +548,11 @@ public class WorkshopAppliction : IWorkshopApplication
{
workshop.DeActive(workshop.ArchiveCode);
_workshopRepository.SaveChanges();
- return opration.Succcedded(id,"عملیت با موفقیت انجام شد");
+ return opration.Succcedded(id, "عملیت با موفقیت انجام شد");
}
-
+
//var s = workshop.ArchiveCode;
-
-
-
}
public WorkshopViewModel GetWorkshopInfo(long id)
@@ -555,10 +575,8 @@ public class WorkshopAppliction : IWorkshopApplication
#region client
-
public OperationResult Remove(long id)
{
-
var opration = new OperationResult();
bool result = _workshopRepository.Remove(id);
@@ -569,14 +587,15 @@ public class WorkshopAppliction : IWorkshopApplication
}
else
return opration.Failed("حذف با خطا مواجه نشد");
- return opration;
+ return opration;
}
public List GetWorkshopByTextSearchForClient(string textSearch)
{
return _workshopRepository.GetWorkshopByTextSearchForClient(textSearch);
}
+
public List SearchForClient(WorkshopSearchModel searchModel)
{
return _workshopRepository.SearchForClient(searchModel);
@@ -584,12 +603,12 @@ public class WorkshopAppliction : IWorkshopApplication
public OperationResult CreateForClient(CreateWorkshop command)
{
- throw new NotImplementedException();
+ throw new NotImplementedException();
}
public OperationResult EditForClient(EditWorkshop command)
{
- throw new NotImplementedException();
+ throw new NotImplementedException();
}
//public OperationResult CreateForClient(CreateWorkshop command)
//{
@@ -650,7 +669,6 @@ public class WorkshopAppliction : IWorkshopApplication
// _workshopRepository.SaveChanges();
-
// foreach (var e in employer)
// {
// _workshopRepository.EmployerWorkshop(workshop.id, e);
@@ -660,7 +678,6 @@ public class WorkshopAppliction : IWorkshopApplication
// _workshopRepository.CreateWorkshopAccounts(accountIds, workshop.id);
-
// return operation.Succcedded();
@@ -749,6 +766,7 @@ public class WorkshopAppliction : IWorkshopApplication
{
return _workshopRepository.GetWorkshopAccountByAcountID(acountID);
}
+
public bool CheckAccountWorkshop(long workshopId)
{
return _workshopRepository.CheckAccountWorkshop(workshopId);
@@ -762,17 +780,13 @@ public class WorkshopAppliction : IWorkshopApplication
#endregion
-
-
-
-
#region NewByHeydari
public List GetWorkshopByTextSearch(string searchText)
{
return _workshopRepository.GetWorkshopByTextSearch(searchText);
-
}
+
public List SearchForMain(WorkshopSearchModel searchModel)
{
return _workshopRepository.SearchForMain(searchModel);
@@ -789,7 +803,8 @@ public class WorkshopAppliction : IWorkshopApplication
//var workshopObj = _workshopRepository.Get(id);
//workshopObj.DeActive(workshopObj.ArchiveCode);
//_workshopRepository.SaveChanges();
- return _workshopRepository.DeActiveAll(id); ;
+ return _workshopRepository.DeActiveAll(id);
+ ;
}
else
{
@@ -804,6 +819,7 @@ public class WorkshopAppliction : IWorkshopApplication
return opration;
}
+
public OperationResult ActiveAll(long id)
{
return _workshopRepository.ActiveAll(id);
@@ -814,7 +830,6 @@ public class WorkshopAppliction : IWorkshopApplication
return _workshopRepository.PrintWorkshopList(searchModel);
}
-
public AccountViewModel GetClientAccountByWorkshopId(long workshopId)
{
@@ -823,7 +838,6 @@ public class WorkshopAppliction : IWorkshopApplication
}
-
//public List GetConnectedPersonnelsForMain(long workshopId)
//{
// return _workshopRepository.GetConnectedPersonnelsForMain(workshopId);
@@ -833,9 +847,9 @@ public class WorkshopAppliction : IWorkshopApplication
#region Pooya
+
public List GetPersonnelInfoRemastered(PersonnelInfoSearchModel searchModel)
{
-
var res = _workshopRepository.GetPersonnelInfoRemastered(searchModel.WorkshopId);
res = res.Select(x => new PersonnelInfoViewModel
{
@@ -886,23 +900,24 @@ public class WorkshopAppliction : IWorkshopApplication
res = res.Where(x => x.MaritalStatus == searchModel.MaritalStatus).ToList();
return res;
}
+
#endregion
#region Insurance
public List GetWorkshopSelectListInsuransce()
- {
- return _workshopRepository.GetWorkshopSelectListInsuransce();
- }
+ {
+ return _workshopRepository.GetWorkshopSelectListInsuransce();
+ }
#endregion
#region Mahan
+
public async Task> GetWorkshopsForEmployeeStartWork(long accountId)
{
return await _workshopRepository.GetWorkshopsForEmployeeStartWork(accountId);
-
}
public async Task GetWorkshopsForEmployeeStartWorkCount(long accountId)
@@ -925,8 +940,189 @@ public class WorkshopAppliction : IWorkshopApplication
return await _workshopRepository.GetSelectList(search, id);
}
+ public async Task> CreateWorkshopWorkflowRegistration(
+ CreateWorkshopWorkflowRegistration command)
+ {
+ bool createPlanValidations = false;
+ var operation = new OperationResult();
+ var transaction = await _workshopRepository.BeginTransactionAsync();
+ var contractWorkshopInitial =
+ await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(command.InstitutionContractWorkshopInitialId);
+ if (contractWorkshopInitial == null)
+ return operation.Failed("جزئیات قرارداد موسسه یافت نشد");
+
+ var employerIds = contractWorkshopInitial.Employers.Select(x => x.EmployerId).ToList();
+
+ if (employerIds.Count == 0)
+ return operation.Failed("لطفا کارفرما را انتخاب نمایید");
+
+
+ if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" &&
+ string.IsNullOrEmpty(command.InsuranceCode))
+ return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
+
+
+ if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode))
+ return operation.Failed("موارد اجباری را پر کنید");
+
+ //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
+ // return operation.Failed("نام کارگاه تکراری است");
+
+ if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" &&
+ (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
+ return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
+
+ if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
+ command.CutContractEndOfYear = IsActive.None;
+ if (!command.CreateContract)
+ {
+ command.SignContract = false;
+ command.CreateCheckout = false;
+ command.SignCheckout = false;
+ }
+
+ if (!command.CreateCheckout)
+ {
+ command.SignCheckout = false;
+ }
+
+
+ if (_workshopRepository.Exists(x =>
+ !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode))
+ return operation.Failed("کد بیمه کارگاه تکراری است");
+
+ if (!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.Province))
+ return operation.Failed("لطفا استان و شهر را انتخاب کنید");
+ if ((!string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.Province)) &&
+ command.City == "شهرستان")
+ return operation.Failed("لطفا شهر را انتخاب کنید");
+ if (string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.Province))
+ return operation.Failed("لطفا آدرس را وارد کنید");
+
+
+ if (command.FixedSalary)
+ {
+ if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
+ return operation.Failed("لطفا صنف را انتخاب کنید");
+ if (string.IsNullOrWhiteSpace(command.Population))
+ return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
+ }
+
+ // if (command.IsClassified)
+ // {
+ // if (string.IsNullOrWhiteSpace(command.CreatePlan.ExecutionDateFa) ||
+ // command.CreatePlan.ExecutionDateFa.Length < 10)
+ // return operation.Failed("تاریخ اجرای طرح را بصورت صحیح وارد کنید");
+ // if (string.IsNullOrWhiteSpace(command.CreatePlan.IncludingDateFa) ||
+ // command.CreatePlan.IncludingDateFa.Length < 10)
+ // return operation.Failed("تاریخ شمول طرح را بصورت صحیح وارد کنید");
+ // var groupCounter = 0;
+ // // var planEmployeeCounter = command.CreatePlan.EditWorkshopPlanEmployeeList == null ? 0 : command.CreatePlan.EditWorkshopPlanEmployeeList.Count;
+ // for (int i = 0; i <= command.CreatePlan.EditGroupPlanlist.Count - 1; i++)
+ // {
+ // if (!string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].AnnualSalaryStr)
+ // && !string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].BaseSalaryStr)
+ // && !string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].JobSalaryStr)
+ // && command.CreatePlan.EditGroupPlanlist[i].JobIdList.Count > 0)
+ // {
+ // groupCounter += 1;
+ //
+ // }
+ // }
+ //
+ // if (groupCounter >= 1)
+ // {
+ // createPlanValidations = true;
+ //
+ // }
+ // else
+ // {
+ // createPlanValidations = false;
+ // return operation.Failed("وارد کردن اطلاعات تمامی گروه ها الزامی است");
+ // }
+ // }
+
+ //if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend))
+ // return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
+ var account = new AccountViewModel();
+
+ var institutionContract =
+ await _institutionContractRepository.GetIncludeWorkshopDetailsAsync(contractWorkshopInitial
+ .InstitutionContractId);
+ if (institutionContract == null)
+ {
+ return operation.Failed("قرارداد مالی موسسه یافت نشد");
+ }
+
+ if (command.HasRollCallFreeVip == "true")
+ {
+ // if (institutionContract == null)
+ // return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
+
+ account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract
+ .ContractingPartyId);
+ if (account == null || account.ClientAreaPermission != "true")
+ return operation.Failed("بدلیل نداشتن حساب کاربری کلاینت نمیتوانید سرویس حضور غیاب را فعال کنید");
+ }
+
+ var workshop = new Workshop(command.WorkshopName, command.SureName, command.InsuranceCode,
+ command.TypeOfOwnership,
+ command.ArchiveCode, command.AgentName, command.AgentPhone, command.Province, command.City,
+ command.Address,
+ command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
+ , command.FixedSalary, command.Population, command.InsuranceJobId, null, true,
+ true, true, command.TotalPaymentHide, false,
+ command.ComputeOptions,
+ command.BonusesOptions, command.YearsOptions, command.HasRollCallFreeVip, command.WorkingInHoliday,
+ command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract,
+ command.SignContract,
+ command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear, command.RotatingShiftCompute,
+ command.IsStaticCheckout, institutionContract.ContractingPartyId);
+ await _workshopRepository.CreateAsync(workshop);
+ await _workshopRepository.SaveChangesAsync();
+
+ if (command.HasRollCallFreeVip == "true")
+ {
+ var commandSave = new CreateRollCallService()
+ {
+ AccountId = account.Id,
+ WorkshopId = workshop.id,
+ ServiceType = "vip",
+ EndService = institutionContract.ContractEndGr,
+ Amount = 1000,
+ MaxPersonValid = 500,
+ Duration = "12",
+ HasCustomizeCheckoutService = command.HasCustomizeCheckoutService
+ };
+ _rollCallServiceApplication.Create(commandSave);
+ }
+
+ contractWorkshopInitial.SetWorkshopId(workshop.id);
+ await _workshopRepository.SaveChangesAsync();
+
+ foreach (var e in employerIds)
+ {
+ _workshopRepository.EmployerWorkshop(workshop.id, e);
+ }
+
+ var accountIds = StaticWorkshopAccounts.StaticAccountIds.ToList();
+ accountIds.Add(command.SeniorContractAccountId);
+ accountIds.Add(command.JuniorContractAccountId);
+ accountIds.Add(command.SeniorInsuranceAccountId);
+ accountIds.Add(command.JuniorInsuranceAccountId);
+
+ var op = _workshopRepository
+ .CreateAccountLeftWorkAndWorkshopAccounts(accountIds.Distinct().ToList(),
+ workshop.id);
+
+ _institutionContractRepository.UpdateStatusIfNeeded(institutionContract.id);
+
+ if (!op.IsSuccedded)
+ return op;
+
+ await transaction.CommitAsync();
+ return operation.Succcedded();
+ }
+
#endregion
-
-
-
}
\ No newline at end of file
diff --git a/CompanyManagment.EFCore/CompanyContext.cs b/CompanyManagment.EFCore/CompanyContext.cs
index 330885b7..ba0d7a01 100644
--- a/CompanyManagment.EFCore/CompanyContext.cs
+++ b/CompanyManagment.EFCore/CompanyContext.cs
@@ -65,6 +65,7 @@ using Company.Domain.InsuranceYearlySalaryAgg;
using Company.Domain.InsurancJobAgg;
using Company.Domain.InsurancWorkshopInfoAgg;
using Company.Domain.JobAgg;
+using Company.Domain.LawAgg;
using Company.Domain.LeaveAgg;
using Company.Domain.LeftWorkAgg;
using Company.Domain.LeftWorkInsuranceAgg;
@@ -118,6 +119,7 @@ using Company.Domain.YearlysSalaryTitleAgg;
using CompanyManagment.EFCore.Mapping;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
+using Company.Domain.AuthorizedPersonAgg;
using Evidence = Company.Domain.Evidence.Evidence;
using Zone = Company.Domain.ZoneAgg.Zone;
@@ -133,9 +135,7 @@ public class CompanyContext : DbContext
public DbSet EntityModules { get; set; }
public DbSet EntityModuleTextManagers { get; set; }
public DbSet EntityBills { get; set; }
-
public DbSet EntityContacts { get; set; }
-
//---------Files------------------------------
public DbSet Boards { get; set; }
public DbSet BoardTypes { get; set; }
@@ -152,7 +152,6 @@ public class CompanyContext : DbContext
public DbSet FileTitles { get; set; }
public DbSet FileTimings { get; set; }
public DbSet FileStates { get; set; }
-
public DbSet FileAlerts { get; set; }
//-------Task Manager----------------------------
//public DbSet Tasks { get; set; }
@@ -191,10 +190,17 @@ public class CompanyContext : DbContext
public DbSet PaymentTransactions { get; set; }
public DbSet ContractingPartyBankAccounts { get; set; }
+
+ public DbSet Laws { get; set; }
+
public DbSet PaymentInstruments { get; set; }
public DbSet PaymentInstrumentGroups { get; set; }
+ public DbSet AuthorizedPersons { get; set; }
+
+ public DbSet InstitutionContractContactInfoTemps { get; set; }
+
#endregion
#region Pooya
@@ -261,13 +267,16 @@ public class CompanyContext : DbContext
public DbSet DateSalaries { get; set; }
public DbSet DateSalaryItems { get; set; }
-
+
public DbSet Percentages { get; set; }
public DbSet