Compare commits
70 Commits
Feature/pr
...
Feature/in
| Author | SHA1 | Date | |
|---|---|---|---|
| c488f61a09 | |||
| a986212834 | |||
| 649242fc76 | |||
| ad4b0be033 | |||
| 733f39db9f | |||
| 94237434c5 | |||
| 2da8bc8a20 | |||
| 8b217f6cd0 | |||
|
|
74bd802a3d | ||
| b58481a36f | |||
|
|
3fd17299f9 | ||
|
|
fc315cc908 | ||
|
|
abe07e1c4b | ||
|
|
6046f55ece | ||
| d80a36ec35 | |||
|
|
7b648b135e | ||
|
|
5998bd212f | ||
|
|
d77bffabdd | ||
| 4f0e5a34a4 | |||
| 5faa2062b9 | |||
| 30b4f52896 | |||
| 134466547e | |||
| a191968c15 | |||
| d740c36dc6 | |||
|
|
f00fde4084 | ||
|
|
e8b3700cdf | ||
| 0ca35e3295 | |||
| 1a91743916 | |||
|
|
dd68473150 | ||
|
|
72e3859d2c | ||
| 46d193b45e | |||
| 1bfe41418b | |||
| 6a446d5972 | |||
|
|
acec101c4c | ||
|
|
7d92321d1c | ||
|
|
19f78a230c | ||
| 0e91e6f287 | |||
| 9df56ee19b | |||
| 8750604d96 | |||
| f27ce460fd | |||
|
|
934019c6c6 | ||
|
|
82bf10c2d5 | ||
|
|
19a72ac78d | ||
|
|
9cb42b7cef | ||
| 12fab5a9a5 | |||
| 20dd8f64f4 | |||
| b827493306 | |||
| 04c65eae93 | |||
| b4526a4338 | |||
| 2d879ce80a | |||
| 56e79d2099 | |||
| 93891f3837 | |||
|
|
5bdfbc572b | ||
| 4385a65cbc | |||
| 722f8dae7c | |||
|
|
07113353c4 | ||
| 8c6336b9bd | |||
| 20e3d454cf | |||
| 2bf31db6b2 | |||
| 7a4a6de84f | |||
| 4f16d7680c | |||
|
|
7a10d5ce59 | ||
|
|
3d88feeee7 | ||
|
|
f408624463 | ||
|
|
8296292e49 | ||
| be8deef167 | |||
| 84fb29c8c8 | |||
| 0969e8a5fd | |||
| 92e2282381 | |||
|
|
3b71b7d707 |
2
.github/workflows/dotnet-developPublish.yml
vendored
2
.github/workflows/dotnet-developPublish.yml
vendored
@@ -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="Administrator",password="R2rNpdnetP3j>q5b18",authType="Basic" `
|
||||
-dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName="Administrator",password="R",authType="Basic" `
|
||||
-allowUntrusted `
|
||||
-enableRule:AppOffline
|
||||
|
||||
|
||||
@@ -39,4 +39,15 @@ public static class StaticWorkshopAccounts
|
||||
/// که کاربر همچنان به کارگاه دسترسی دارد
|
||||
/// </summary>
|
||||
public static DateTime ContinuesWorkingDate = new DateTime(2150, 1, 1);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// لیستی آی دی نقش هایی که مسئول بیمه کارگاه هستند
|
||||
/// 7 : بیمه ارشد
|
||||
/// 8 : بیمه ساده
|
||||
/// </summary>
|
||||
public static List<long> InsuranceAccountsRoleIds = [7, 8];
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public class ExcelGenerator
|
||||
{
|
||||
public ExcelGenerator()
|
||||
{
|
||||
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
OfficeOpenXml.ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||
}
|
||||
public static byte[] GenerateExcel<T>(List<T> obj, string date = "") where T : class
|
||||
{
|
||||
|
||||
@@ -24,9 +24,13 @@ public class CustomExceptionHandler : IExceptionHandler
|
||||
|
||||
public async ValueTask<bool> TryHandleAsync(HttpContext context, Exception exception, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogError(
|
||||
"Error Message: {exceptionMessage}, Time of occurrence {time}",
|
||||
exception.Message, DateTime.UtcNow);
|
||||
_logger.LogError(exception,
|
||||
"Error Message: {exceptionMessage}, Type: {exceptionType}, Time: {time}, Path: {path}, TraceId: {traceId}",
|
||||
exception.Message,
|
||||
exception.GetType().FullName,
|
||||
DateTime.UtcNow,
|
||||
context.Request.Path,
|
||||
context.TraceIdentifier);
|
||||
|
||||
(string Detail, string Title, int StatusCode, Dictionary<string, object>? Extra) details = exception switch
|
||||
{
|
||||
|
||||
@@ -155,6 +155,8 @@ public class AccountApplication : IAccountApplication
|
||||
|
||||
if (command.IsProgramManagerUser)
|
||||
{
|
||||
if (command.UserRoles == null)
|
||||
return operation.Failed("حداقل یک نقش برای کاربر مدیریت پروژه لازم است");
|
||||
var pmUserRoles = command.UserRoles.Where(x => x > 0).ToList();
|
||||
var createPm = await _pmUserCommandService.Create(new CreatePmUserDto(command.Fullname, command.Username, account.Password, command.Mobile,
|
||||
null, account.id, pmUserRoles));
|
||||
@@ -252,6 +254,8 @@ public class AccountApplication : IAccountApplication
|
||||
//);
|
||||
var userResult =await _pmUserQueryService.GetPmUserDataByAccountId(account.id);
|
||||
|
||||
if (command.UserRoles == null)
|
||||
return operation.Failed("حداقل یک نقش برای کاربر مدیریت پروژه لازم است");
|
||||
var pmUserRoles = command.UserRoles.Where(x => x > 0).ToList();
|
||||
|
||||
//اگر کاربر در پروگرام منیجر قبلا ایجاد شده
|
||||
@@ -396,6 +400,23 @@ public class AccountApplication : IAccountApplication
|
||||
.Permissions
|
||||
.Select(x => x.Code)
|
||||
.ToList();
|
||||
//PmPermission
|
||||
var PmUserData = _pmUserQueryService.GetPmUserDataByAccountId(account.id).GetAwaiter().GetResult();
|
||||
if (PmUserData.AccountId > 0 && PmUserData.IsActive)
|
||||
{
|
||||
|
||||
var pmUserPermissions =
|
||||
PmUserData.RoleListDto != null
|
||||
? PmUserData.RoleListDto
|
||||
.SelectMany(x => x.Permissions)
|
||||
.Where(p => p != 99)
|
||||
.Distinct()
|
||||
.ToList()
|
||||
: new List<int>();
|
||||
permissions.AddRange(pmUserPermissions);
|
||||
}
|
||||
|
||||
|
||||
int? positionValue;
|
||||
if (account.PositionId != null)
|
||||
{
|
||||
@@ -405,7 +426,7 @@ public class AccountApplication : IAccountApplication
|
||||
{
|
||||
positionValue = null;
|
||||
}
|
||||
var pmUserId = _pmUserQueryService.GetCurrentPmUserIdFromAccountId(account.id).GetAwaiter().GetResult();
|
||||
var pmUserId = PmUserData.AccountId > 0 ? PmUserData.AccountId : null;
|
||||
var authViewModel = new AuthViewModel(account.id, account.RoleId, account.Fullname
|
||||
, account.Username, account.Mobile, account.ProfilePhoto,
|
||||
permissions, account.RoleName, account.AdminAreaPermission,
|
||||
|
||||
@@ -17,4 +17,9 @@
|
||||
<ProjectReference Include="..\..\WorkFlow\Infrastructure\WorkFlow.Infrastructure.Config\WorkFlow.Infrastructure.Config.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
using Hangfire;
|
||||
@@ -13,18 +14,22 @@ public class JobSchedulerRegistrator
|
||||
private readonly IInstitutionContractRepository _institutionContractRepository;
|
||||
private static DateTime? _lastRunCreateTransaction;
|
||||
private static DateTime? _lastRunSendMonthlySms;
|
||||
private readonly ISmsService _smsService;
|
||||
private readonly ILogger<JobSchedulerRegistrator> _logger;
|
||||
|
||||
|
||||
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository)
|
||||
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository, ISmsService smsService, ILogger<JobSchedulerRegistrator> logger)
|
||||
{
|
||||
_smsReminder = smsReminder;
|
||||
_backgroundJobClient = backgroundJobClient;
|
||||
_institutionContractRepository = institutionContractRepository;
|
||||
_smsService = smsService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Register()
|
||||
{
|
||||
|
||||
_logger.LogInformation("hangfire Started");
|
||||
RecurringJob.AddOrUpdate(
|
||||
"InstitutionContract.CreateFinancialTransaction",
|
||||
() => CreateFinancialTransaction(),
|
||||
@@ -91,8 +96,8 @@ public class JobSchedulerRegistrator
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//_smsService.Alarm("09114221321", "خطا-ایجاد سند مالی");
|
||||
|
||||
await _smsService.Alarm("09114221321", "خطا-ایجاد سند مالی");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
using GozareshgirProgramManager.Application.Interfaces;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
|
||||
public class NullBoardNotificationPublisher:IBoardNotificationPublisher
|
||||
{
|
||||
public Task SendProjectStatusChanged(long userId, TaskSectionStatus oldStatus, TaskSectionStatus newStatus, Guid sectionId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using BackgroundInstitutionContract.Task.Jobs;
|
||||
using CompanyManagment.App.Contracts.Hubs;
|
||||
using CompanyManagment.EFCore.Services;
|
||||
using GozareshgirProgramManager.Application._Bootstrapper;
|
||||
using GozareshgirProgramManager.Application.Interfaces;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Commands.CreateUser;
|
||||
using GozareshgirProgramManager.Infrastructure;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Seed;
|
||||
@@ -16,9 +17,37 @@ using Microsoft.AspNetCore.Identity;
|
||||
using MongoDB.Driver;
|
||||
using PersonalContractingParty.Config;
|
||||
using Query.Bootstrapper;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using Shared.Contracts.PmUser.Queries;
|
||||
using WorkFlow.Infrastructure.Config;
|
||||
|
||||
var logDirectory = @"C:\Logs\Hangfire\BackgroundInstitutionContract\";
|
||||
|
||||
if (!Directory.Exists(logDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(logDirectory);
|
||||
}
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
//NO EF Core log
|
||||
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
|
||||
|
||||
//NO DbCommand log
|
||||
.MinimumLevel.Override("Microsoft.EntityFrameworkCore.Database.Command", LogEventLevel.Warning)
|
||||
|
||||
//NO Microsoft Public log
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
||||
|
||||
.WriteTo.File(
|
||||
path: Path.Combine(logDirectory, "institution-contract-log-.txt"),
|
||||
rollingInterval: RollingInterval.Day,
|
||||
retainedFileCountLimit: 30,
|
||||
shared: true,
|
||||
outputTemplate:
|
||||
"{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] {Message}{NewLine}{Exception}"
|
||||
).CreateLogger();
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var hangfireConnectionString = builder.Configuration.GetConnectionString("HangfireDb");
|
||||
builder.Services.AddHangfire(x => x.UseSqlServerStorage(hangfireConnectionString));
|
||||
@@ -31,7 +60,7 @@ builder.Services.AddTransient<ISmsService, SmsService>();
|
||||
builder.Services.AddTransient<IUidService, UidService>();
|
||||
builder.Services.AddTransient<IFileUploader, FileUploader>();
|
||||
builder.Services.Configure<AppSettingConfiguration>(builder.Configuration);
|
||||
|
||||
builder.Services.AddScoped<IBoardNotificationPublisher, NullBoardNotificationPublisher>();
|
||||
#region MongoDb
|
||||
|
||||
var mongoConnectionSection = builder.Configuration.GetSection("MongoDb");
|
||||
@@ -58,7 +87,13 @@ builder.Services.AddHttpClient();
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
builder.Services.AddSignalR();
|
||||
|
||||
|
||||
builder.Host.UseSerilog();
|
||||
Log.Information("SERILOG STARTED SUCCESSFULLY");
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapHub<SendSmsHub>("/sendSmsHub");
|
||||
|
||||
app.MapHangfireDashboard();
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
//mahan Docker
|
||||
//"MesbahDb": "Data Source=localhost,5069;Initial Catalog=mesbah_db;User ID=sa;Password=YourPassword123;TrustServerCertificate=True;",
|
||||
//"HangfireDb": "Data Source=.;Initial Catalog=hangfire_db;Integrated Security=True;TrustServerCertificate=true;",
|
||||
"HangfireDb": "Data Source=185.208.175.186;Initial Catalog=hangfire_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;"
|
||||
"HangfireDb": "Data Source=.;Initial Catalog=hangfire_db;Integrated Security=True;TrustServerCertificate=true;",
|
||||
//"HangfireDb": "Data Source=185.208.175.186;Initial Catalog=hangfire_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;"
|
||||
},
|
||||
|
||||
"GoogleRecaptchaV3": {
|
||||
|
||||
@@ -76,6 +76,7 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
||||
#region Api
|
||||
Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText,long id);
|
||||
Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel);
|
||||
Task<List<GetClientEmployeeListViewModel>> GetClientEmployeeList(GetClientEmployeeListSearchModel searchModel, long workshopId);
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
void UpdateStatusIfNeeded(long institutionContractId);
|
||||
Task<GetInstitutionVerificationDetailsViewModel> GetVerificationDetails(Guid id);
|
||||
Task<InstitutionContract> GetByPublicIdAsync(Guid id);
|
||||
InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request);
|
||||
InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request,string contractStart = null);
|
||||
InstitutionContractDiscountResponse ResetDiscountCreate(InstitutionContractResetDiscountForCreateRequest request);
|
||||
|
||||
|
||||
@@ -159,4 +159,5 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
#endregion
|
||||
|
||||
Task<long> GetIdByInstallmentId(long installmentId);
|
||||
Task<InstitutionContract> GetPreviousContract(long currentInstitutionContractId);
|
||||
}
|
||||
@@ -98,6 +98,11 @@ public class InstitutionContract : EntityBase
|
||||
// مبلغ قرارداد
|
||||
public double ContractAmount { get; private set; }
|
||||
|
||||
public double ContractAmountWithTax => !IsOldContract ? ContractAmount + ContractAmountTax
|
||||
: ContractAmount;
|
||||
|
||||
public double ContractAmountTax => ContractAmount*0.10;
|
||||
|
||||
//خسارت روزانه
|
||||
public double DailyCompenseation { get; private set; }
|
||||
|
||||
@@ -159,6 +164,10 @@ public class InstitutionContract : EntityBase
|
||||
|
||||
public List<InstitutionContractAmendment> Amendments { get; private set; }
|
||||
|
||||
public InstitutionContractSigningType? SigningType { get; private set; }
|
||||
|
||||
public bool IsOldContract => LawId== 0;
|
||||
|
||||
public InstitutionContract()
|
||||
{
|
||||
ContactInfoList = [];
|
||||
@@ -262,6 +271,10 @@ public class InstitutionContract : EntityBase
|
||||
{
|
||||
WorkshopGroup = null;
|
||||
}
|
||||
public void SetSigningType(InstitutionContractSigningType signingType)
|
||||
{
|
||||
SigningType = signingType;
|
||||
}
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendment : EntityBase
|
||||
|
||||
@@ -10,13 +10,15 @@ public class InstitutionContractWorkshopCurrent:InstitutionContractWorkshopBase
|
||||
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,
|
||||
int personnelCount, double price,long institutionContractWorkshopGroupId,
|
||||
InstitutionContractWorkshopGroup workshopGroup,long workshopId,long initialWorkshopId) : base(workshopName, hasRollCallPlan,
|
||||
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan,
|
||||
hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
|
||||
{
|
||||
InstitutionContractWorkshopGroupId = institutionContractWorkshopGroupId;
|
||||
WorkshopGroup = workshopGroup;
|
||||
WorkshopId = workshopId;
|
||||
InitialWorkshopId = initialWorkshopId;
|
||||
}
|
||||
public long InstitutionContractWorkshopGroupId { get; private set; }
|
||||
public InstitutionContractWorkshopGroup WorkshopGroup { get; private set; }
|
||||
|
||||
@@ -37,4 +37,10 @@ public class InstitutionContractWorkshopGroup : EntityBase
|
||||
CurrentWorkshops = updatedDetails.ToList();
|
||||
LastModifiedDate = DateTime.Now;
|
||||
}
|
||||
|
||||
public void AddCurrentWorkshop(InstitutionContractWorkshopCurrent currentWorkshop)
|
||||
{
|
||||
CurrentWorkshops.Add(currentWorkshop);
|
||||
LastModifiedDate = DateTime.Now;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase
|
||||
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);
|
||||
Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId,id);
|
||||
WorkshopCurrent.SetEmployers(Employers.Select(x=>x.EmployerId).ToList());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using _0_Framework.Domain;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.Domain.InstitutionPlanAgg;
|
||||
|
||||
@@ -26,4 +28,18 @@ public interface IPlanPercentageRepository : IRepository<long, PlanPercentage>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
InstitutionPlanViewModel GetInstitutionPlanForWorkshop(WorkshopTempViewModel command);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت دیتای مودال ایجاد
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<CreateServiceAmountDto> GetCreateModalData();
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست مبالغ سرویس ها
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
Task<PagedResult<InstitutionPlanListDto>> GetList(
|
||||
InstitutionPlanSearchModel searchModel);
|
||||
}
|
||||
@@ -73,6 +73,7 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
|
||||
Task<InsuranceListConfirmOperation> GetInsuranceOperationDetails(long id);
|
||||
|
||||
Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel);
|
||||
Task<PagedResult<InsuranceClientListViewModel>> GetInsuranceClientList(InsuranceClientSearchModel searchModel);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -316,7 +316,10 @@ public class Workshop : EntityBase
|
||||
IsStaticCheckout = isStaticCheckout;
|
||||
}
|
||||
|
||||
|
||||
public void AddContractingPartyId(long contractingPartyId)
|
||||
{
|
||||
ContractingPartyId = contractingPartyId;
|
||||
}
|
||||
public void Active(string archiveCode)
|
||||
{
|
||||
this.IsActive = true;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class CustomizeWorkshopGroupSettingExcelGenerator
|
||||
{
|
||||
public static byte[] Generate(List<CustomizeWorkshopGroupExcelViewModel> groups)
|
||||
{
|
||||
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||
using (var package = new ExcelPackage())
|
||||
{
|
||||
var worksheet = package.Workbook.Worksheets.Add("GroupsAndEmployees");
|
||||
|
||||
@@ -24,7 +24,7 @@ public class CaseManagementExcelGenerator
|
||||
};
|
||||
public static byte[] GenerateCheckoutTempExcelInfo(List<FileExcelViewModel> data)
|
||||
{
|
||||
OfficeOpenXml.ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
OfficeOpenXml.ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||
using var package = new ExcelPackage();
|
||||
CreateSheet(data, package,"همه");
|
||||
CreateSheet(data.Where(x=>x.Status ==2).ToList(), package,"فعال");
|
||||
|
||||
@@ -46,7 +46,7 @@ public class CustomizeCheckoutExcelGenerator
|
||||
};
|
||||
public static byte[] GenerateCheckoutTempExcelInfo(List<CustomizeCheckoutTempExcelViewModel> data, List<string> selectedParameters)
|
||||
{
|
||||
OfficeOpenXml.ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||
using var package = new ExcelPackage();
|
||||
var worksheet = package.Workbook.Worksheets.Add("Sheet1");
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ public class EmployeeBankInfoExcelGenerator
|
||||
{
|
||||
public static byte[] Generate(List<EmployeeBankInfoExcelViewModel> list)
|
||||
{
|
||||
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||
using var package = new ExcelPackage();
|
||||
var worksheet = package.Workbook.Worksheets.Add("EmployeeBankInfo");
|
||||
|
||||
@@ -166,7 +166,7 @@ public class EmployeeBankInfoExcelGenerator
|
||||
|
||||
public static byte[] Generate2(List<EmployeeBankInfoExcelViewModel> list)
|
||||
{
|
||||
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||
using var package = new ExcelPackage();
|
||||
foreach (var employee in list)
|
||||
{
|
||||
@@ -220,4 +220,4 @@ public class EmployeeBankInfoExcelGenerator
|
||||
cell.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
|
||||
cell.Style.Fill.PatternType = ExcelFillStyle.Solid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class InstitutionContractExcelGenerator
|
||||
|
||||
public static byte[] GenerateExcel(List<InstitutionContractViewModel> institutionContractViewModels)
|
||||
{
|
||||
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||
using var package = new ExcelPackage();
|
||||
var allWorksheet = package.Workbook.Worksheets.Add("همه");
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ public class RollCallExcelGenerator : ExcelGenerator
|
||||
{
|
||||
public static byte[] CaseHistoryExcelForEmployee(CaseHistoryRollCallExcelForEmployeeViewModel data)
|
||||
{
|
||||
OfficeOpenXml.ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
OfficeOpenXml.ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||
using var package = new OfficeOpenXml.ExcelPackage();
|
||||
var worksheet = package.Workbook.Worksheets.Add("Sheet1");
|
||||
var rollCalls = data.RollCalls;
|
||||
@@ -181,7 +181,7 @@ public class RollCallExcelGenerator : ExcelGenerator
|
||||
|
||||
public static byte[] CaseHistoryExcelForOneDay(CaseHistoryRollCallForOneDayViewModel data)
|
||||
{
|
||||
OfficeOpenXml.ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
OfficeOpenXml.ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||
using var package = new OfficeOpenXml.ExcelPackage();
|
||||
var worksheet = package.Workbook.Worksheets.Add("Sheet1");
|
||||
var rollCalls = data.RollCalls;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class SalaryAidImportExcel
|
||||
ValidData = []
|
||||
};
|
||||
|
||||
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||
|
||||
if (file == null || file.Length == 0)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ public class WorkshopRollCallExcelExporter
|
||||
{
|
||||
public static byte[] Export(List<WorkshopRollCallExcelViewModel> workshops)
|
||||
{
|
||||
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
|
||||
using (var package = new ExcelPackage())
|
||||
{
|
||||
var ws = package.Workbook.Worksheets.Add("Workshops");
|
||||
|
||||
@@ -60,7 +60,7 @@ public interface IEmployeeApplication
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<EmployeeByNationalCodeInWorkshopViewModel>>
|
||||
ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(string nationalCode,
|
||||
string birthDate, long workshopId);
|
||||
string birthDate,bool authorizedCanceled, long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// پرسنل هایی که در کارگاهی از سمت ادمین شروع به کار کرده اند
|
||||
@@ -94,7 +94,42 @@ public interface IEmployeeApplication
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel);
|
||||
|
||||
/// <summary>
|
||||
/// لیست کل پرسنل کلاینت
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<GetClientEmployeeListViewModel>> GetClientEmployeeList(GetClientEmployeeListSearchModel searchModel, long workshopId);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public class GetClientEmployeeListSearchModel
|
||||
{
|
||||
}
|
||||
|
||||
public class GetClientEmployeeListViewModel
|
||||
{
|
||||
public string FullName { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public long PersonnelCode { get; set; }
|
||||
public string MaritalStatus { get; set; }
|
||||
public string NationalCode { get; set; }
|
||||
public string IdNumber { get; set; }
|
||||
public string DateOfBirthFa { get; set; }
|
||||
public string FatherName { get; set; }
|
||||
public int ChildrenCount { get; set; }
|
||||
public string LastStartInsuranceWork { get; set; }
|
||||
public string LastLeftInsuranceWork { get; set; }
|
||||
public string LastStartContractWork { get; set; }
|
||||
public string LastLeftContractWork { get; set; }
|
||||
public bool HasContractLeftWork { get; set; }
|
||||
public bool HasInsuranceLeftWork { get; set; }
|
||||
public bool LeftWorkCompletely { get; set; }
|
||||
public bool PendingStartWork { get; set; }
|
||||
public bool PendingLeftWork { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public enum InstitutionContractSigningType
|
||||
{
|
||||
/// <summary>
|
||||
/// قدیمی
|
||||
/// </summary>
|
||||
Legacy = 0,
|
||||
/// <summary>
|
||||
/// الکترونیکی با کد یکبار مصرف
|
||||
/// </summary>
|
||||
OtpBased = 1,
|
||||
/// <summary>
|
||||
/// به صورت فیزیکی
|
||||
/// </summary>
|
||||
Physical = 2
|
||||
}
|
||||
@@ -91,6 +91,11 @@ public class GetInstitutionContractListItemsViewModel
|
||||
public bool IsInPersonContract { get; set; }
|
||||
|
||||
public bool IsOldContract { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ قسط
|
||||
/// </summary>
|
||||
public double InstallmentAmount { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractListWorkshop
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.WorkshopPlan;
|
||||
@@ -260,154 +259,13 @@ public interface IInstitutionContractApplication
|
||||
/// <returns></returns>
|
||||
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
|
||||
|
||||
Task<OperationResult> SetPendingWorkflow(long entityId);
|
||||
Task<OperationResult> SetPendingWorkflow(long entityId,InstitutionContractSigningType signingType);
|
||||
Task<long> GetIdByInstallmentId(long installmentId);
|
||||
|
||||
}
|
||||
|
||||
public class InstitutionContractDiscountResponse
|
||||
{
|
||||
public InstitutionContractDiscountOneTimeViewModel OneTime { get; set; }
|
||||
public InstitutionContractDiscountMonthlyViewModel Monthly { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractDiscountMonthlyViewModel:InstitutionContractDiscountOneTimeViewModel
|
||||
{
|
||||
public List<MonthlyInstallment> Installments { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractDiscountOneTimeViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// مجموع مبالغ
|
||||
/// تایید قرارداد مالی به صورت دستی
|
||||
/// </summary>
|
||||
public string TotalAmount { get; set; }
|
||||
/// <summary>
|
||||
/// ارزش افزوده
|
||||
/// </summary>
|
||||
public string Tax { get; set; }
|
||||
/// <summary>
|
||||
/// مبلغ قابل پرداخت
|
||||
/// </summary>
|
||||
public string PaymentAmount { get; set; }
|
||||
|
||||
public string DiscountedAmount { get; set; }
|
||||
|
||||
public int DiscountPercetage { get; set; }
|
||||
/// <param name="institutionContractId"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> VerifyInstitutionContractManually(long institutionContractId);
|
||||
|
||||
public string Obligation { get; set; }
|
||||
|
||||
public string OneMonthAmount { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractResetDiscountForCreateRequest
|
||||
{
|
||||
public int DiscountPercentage { get; set; }
|
||||
public double TotalAmount { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
public InstitutionContractDuration Duration { get; set; }
|
||||
public double OneMonthAmount { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractSetDiscountForExtensionRequest
|
||||
{
|
||||
public Guid TempId { get; set; }
|
||||
public int DiscountPercentage { get; set; }
|
||||
public double TotalAmount { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
}
|
||||
public class InstitutionContractResetDiscountForExtensionRequest
|
||||
{
|
||||
public Guid TempId { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class InstitutionContractSetDiscountRequest
|
||||
{
|
||||
public int DiscountPercentage { get; set; }
|
||||
public double TotalAmount { get; set; }
|
||||
public InstitutionContractDuration Duration { get; set; }
|
||||
public double OneMonthAmount { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractPrintViewModel
|
||||
{
|
||||
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<GetInstitutionVerificationDetailsWorkshopsViewModel> Workshops { get; set; }
|
||||
public string TotalPrice { get; set; }
|
||||
public string TaxPrice { get; set; }
|
||||
public string PaymentPrice { get; set; }
|
||||
public string VerifyCode { get; set; }
|
||||
public string VerifyDate { get; set; }
|
||||
public string VerifyTime { get; set; }
|
||||
public string VerifierFullName { get; set; }
|
||||
public string VerifierPhoneNumber { get; set; }
|
||||
public LawViewModel LawViewModel { get; set; }
|
||||
public string Obligation { get; set; }
|
||||
}
|
||||
|
||||
public class InsertAmendmentTempWorkshopResponse
|
||||
{
|
||||
public Guid WorkshopTempId { get; set; }
|
||||
public string Amount { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentWorkshopsResponse
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public List<InstitutionContractAmendmentTempWorkshopViewModel> Workshops { get; set; }
|
||||
|
||||
public Guid TempId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class InstitutionContractSelectListViewModel : SelectListViewModel;
|
||||
|
||||
public class InstitutionContractExtensionInquiryResponse
|
||||
{
|
||||
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 InstitutionContractExtensionPaymentMonthly:InstitutionContractExtensionPaymentOneTime
|
||||
{
|
||||
public List<MonthlyInstallment> Installments { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractExtensionPaymentOneTime
|
||||
{
|
||||
/// <summary>
|
||||
/// مجموع مبالغ
|
||||
/// </summary>
|
||||
public string TotalAmount { get; set; }
|
||||
/// <summary>
|
||||
/// ارزش افزوده
|
||||
/// </summary>
|
||||
public string Tax { get; set; }
|
||||
/// <summary>
|
||||
/// مبلغ قابل پرداخت
|
||||
/// </summary>
|
||||
public string PaymentAmount { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InsertAmendmentTempWorkshopResponse
|
||||
{
|
||||
public Guid WorkshopTempId { get; set; }
|
||||
public string Amount { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractAmendmentWorkshopsResponse
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public List<InstitutionContractAmendmentTempWorkshopViewModel> Workshops { get; set; }
|
||||
|
||||
public Guid TempId { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractDiscountResponse
|
||||
{
|
||||
public InstitutionContractDiscountOneTimeViewModel OneTime { get; set; }
|
||||
public InstitutionContractDiscountMonthlyViewModel Monthly { get; set; }
|
||||
}
|
||||
public class InstitutionContractDiscountMonthlyViewModel:InstitutionContractDiscountOneTimeViewModel
|
||||
{
|
||||
public List<MonthlyInstallment> Installments { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractDiscountOneTimeViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// مجموع مبالغ
|
||||
/// </summary>
|
||||
public string TotalAmount { get; set; }
|
||||
/// <summary>
|
||||
/// ارزش افزوده
|
||||
/// </summary>
|
||||
public string Tax { get; set; }
|
||||
/// <summary>
|
||||
/// مبلغ قابل پرداخت
|
||||
/// </summary>
|
||||
public string PaymentAmount { get; set; }
|
||||
|
||||
public string DiscountedAmount { get; set; }
|
||||
|
||||
public int DiscountPercetage { get; set; }
|
||||
|
||||
public string Obligation { get; set; }
|
||||
|
||||
public string OneMonthAmount { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractExtensionInquiryResponse
|
||||
{
|
||||
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; }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractExtensionPaymentMonthly:InstitutionContractExtensionPaymentOneTime
|
||||
{
|
||||
public List<MonthlyInstallment> Installments { get; set; }
|
||||
}
|
||||
public class InstitutionContractExtensionPaymentOneTime
|
||||
{
|
||||
/// <summary>
|
||||
/// مجموع مبالغ
|
||||
/// </summary>
|
||||
public string TotalAmount { get; set; }
|
||||
/// <summary>
|
||||
/// ارزش افزوده
|
||||
/// </summary>
|
||||
public string Tax { get; set; }
|
||||
/// <summary>
|
||||
/// مبلغ قابل پرداخت
|
||||
/// </summary>
|
||||
public string PaymentAmount { get; set; }
|
||||
}
|
||||
@@ -18,6 +18,16 @@ public class InstitutionContractPaymentOneTimeViewModel
|
||||
/// </summary>
|
||||
public string PaymentAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مجموع مبالغ بدون تخفیف
|
||||
/// </summary>
|
||||
public string TotalAmountWithoutDiscount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ یک ماه بدون تخفیف
|
||||
/// </summary>
|
||||
public string OneMonthPaymentWithoutDiscount { get; set; }
|
||||
|
||||
public string DiscountedAmount { get; set; }
|
||||
public int DiscountPercetage { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractPrintViewModel
|
||||
{
|
||||
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<GetInstitutionVerificationDetailsWorkshopsViewModel> Workshops { get; set; }
|
||||
public string TotalPrice { get; set; }
|
||||
public string TaxPrice { get; set; }
|
||||
public string PaymentPrice { get; set; }
|
||||
public string OneMonthPrice { get; set; }
|
||||
public string VerifyCode { get; set; }
|
||||
public string VerifyDate { get; set; }
|
||||
public string VerifyTime { get; set; }
|
||||
public string VerifierFullName { get; set; }
|
||||
public string VerifierPhoneNumber { get; set; }
|
||||
public LawViewModel LawViewModel { get; set; }
|
||||
public string Obligation { get; set; }
|
||||
public string OneMonthWithoutTax { get; set; }
|
||||
public string OneMonthTax { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractResetDiscountForCreateRequest
|
||||
{
|
||||
public int DiscountPercentage { get; set; }
|
||||
public double TotalAmount { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
public InstitutionContractDuration Duration { get; set; }
|
||||
public double OneMonthAmount { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractResetDiscountForExtensionRequest
|
||||
{
|
||||
public Guid TempId { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractSelectListViewModel : SelectListViewModel;
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractSetDiscountForExtensionRequest
|
||||
{
|
||||
public Guid TempId { get; set; }
|
||||
public int DiscountPercentage { get; set; }
|
||||
public double TotalAmount { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractSetDiscountRequest
|
||||
{
|
||||
public int DiscountPercentage { get; set; }
|
||||
public double TotalAmount { get; set; }
|
||||
public InstitutionContractDuration Duration { get; set; }
|
||||
public double OneMonthAmount { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
}
|
||||
@@ -76,5 +76,7 @@ public class InstitutionContractViewModel
|
||||
public bool IsInstallment { get; set; }
|
||||
public InstitutionContractVerificationStatus VerificationStatus { get; set; }
|
||||
|
||||
public InstitutionContractSigningType? SigningType { get; set; }
|
||||
|
||||
public List<InstitutionContractInstallmentViewModel> InstallmentList { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
public class CreateServiceAmountDto
|
||||
{
|
||||
/// <summary>
|
||||
/// آی دی
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string ContractAndCheckoutPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string InsurancePercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string RollCallPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string CustomizeCheckoutPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string ContractAndCheckoutInPersonPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string InsuranceInPersonPercentStr { get; set; }
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
@@ -34,4 +35,27 @@ public interface IInstitutionPlanApplication
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
InstitutionPlanViewModel GetInstitutionPlanForWorkshop(WorkshopTempViewModel command);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت دیتای درصد سرویس برای مودال ایجاد
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<CreateServiceAmountDto> GetCreateModalData();
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد درصد سرویس
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> CreateInstitutionPlanPercentage(CreateServiceAmountDto command);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست مبالغ سرویس ها
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
Task<PagedResult<InstitutionPlanListDto>> GetList(
|
||||
InstitutionPlanSearchModel searchModel);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
public class InstitutionPlanListDto
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ قرارداد و تصفیه
|
||||
/// </summary>
|
||||
public string ContractAndCheckout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ بیمه
|
||||
/// </summary>
|
||||
public string Insurance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ حضورغباب
|
||||
/// </summary>
|
||||
public string RollCall { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ فیش غیر رسمی
|
||||
/// </summary>
|
||||
public string CustomizeCheckout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ خدمات حضوری قرداد و تصفیه
|
||||
/// </summary>
|
||||
public string ContractAndCheckoutInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ خدمات حضوری بیمه
|
||||
/// </summary>
|
||||
public string InsuranceInPerson { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
#region Total
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات حضوری
|
||||
/// </summary>
|
||||
public string InPersonSumAmountStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات آنلاین
|
||||
/// </summary>
|
||||
public string OnlineOnlySumAmountStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات حضوری و آنلاین
|
||||
/// </summary>
|
||||
public string OnlineAndInPersonSumAmountStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات حضوری و آنلاین
|
||||
/// double
|
||||
/// </summary>
|
||||
public double OnlineAndInPersonSumAmountDouble { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات حضوری
|
||||
/// double
|
||||
/// </summary>
|
||||
public double InPersonSumAmountDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات آنلاین
|
||||
/// double
|
||||
/// </summary>
|
||||
public double OnlineOnlySumAmountDouble { get; set; }
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
public class InstitutionPlanSearchModel : PaginationRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// تعداد پرسنل برای جستجو
|
||||
/// </summary>
|
||||
public int CountPerson { get; set; }
|
||||
}
|
||||
@@ -90,8 +90,27 @@ public interface IInsuranceListApplication
|
||||
Task<InsuranceListConfirmOperation> GetInsuranceOperationDetails(long id);
|
||||
|
||||
Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel);
|
||||
Task<PagedResult<InsuranceClientListViewModel>> GetInsuranceClientList(InsuranceClientSearchModel searchModel);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel);
|
||||
}
|
||||
|
||||
public class InsuranceClientSearchModel:PaginationRequest
|
||||
{
|
||||
public int Year { get; set; }
|
||||
public int Month { get; set; }
|
||||
public string Sorting { get; set; }
|
||||
}
|
||||
public class InsuranceClientListViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Year { get; set; }
|
||||
public string Month { get; set; }
|
||||
public long WorkShopId { get; set; }
|
||||
public int YearInt { get; set; }
|
||||
public string MonthName { get; set; }
|
||||
public int MonthInt { get; set; }
|
||||
}
|
||||
@@ -124,7 +124,7 @@ namespace CompanyManagment.App.Contracts.RollCall
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult RecalculateValues(long workshopId, List<ReCalculateRollCallValues> command);
|
||||
Task<OperationResult> RecalculateValues(long workshopId, List<ReCalculateRollCallValues> command);
|
||||
}
|
||||
public class ReCalculateRollCallValues
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ using Microsoft.EntityFrameworkCore.Query;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg;
|
||||
using Company.Domain.RollCallAgg;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
|
||||
|
||||
@@ -38,7 +39,8 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
IRollCallApplication rollCallAppllication,
|
||||
ICheckoutRepository checkoutRepository,
|
||||
ICustomizeCheckoutRepository customizeCheckoutRepository,
|
||||
ICustomizeCheckoutTempRepository customizeCheckoutTempRepository)
|
||||
ICustomizeCheckoutTempRepository customizeCheckoutTempRepository,
|
||||
IRollCallRepository rollCallRepository)
|
||||
: ICustomizeWorkshopSettingsApplication
|
||||
{
|
||||
private readonly ICustomizeWorkshopSettingsRepository _customizeWorkshopSettingsRepository = customizeWorkshopSettingsRepository;
|
||||
@@ -53,6 +55,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
private readonly ICheckoutRepository _checkoutRepository = checkoutRepository;
|
||||
private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository = customizeCheckoutRepository;
|
||||
private readonly ICustomizeCheckoutTempRepository _customizeCheckoutTempRepository = customizeCheckoutTempRepository;
|
||||
private readonly IRollCallRepository _rollCallRepository = rollCallRepository;
|
||||
|
||||
#region RollCallShifts
|
||||
|
||||
@@ -822,14 +825,19 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
|
||||
var notSelectedEmployeeSettings = employeeSettings.Where(x => !selectedEmployeesIds.Contains(x.EmployeeId));
|
||||
|
||||
var weeklyOffDays = command.OffDayOfWeeks?.Select(x => new WeeklyOffDay(x)).ToList() ?? [];
|
||||
using var transaction = new TransactionScope();
|
||||
var weeklyOffDays = command.OffDayOfWeeks?
|
||||
.Select(x => new WeeklyOffDay(x)).ToList() ?? [];
|
||||
|
||||
using var rollCallTransaction = _rollCallRepository.BeginTransactionAsync()
|
||||
.GetAwaiter().GetResult();
|
||||
|
||||
entity.EditSimpleAndOverwriteOnEmployee(command.Name, selectedEmployeesIds, groupSettingsShifts, command.WorkshopShiftStatus,
|
||||
command.IrregularShift, breakTime, isChanged, command.HolidayWork, rotatingShift, weeklyOffDays);
|
||||
if (reCalculateCommand.Count > 0)
|
||||
{
|
||||
var result = _rollCallApplication.RecalculateValues(workshopSettings.WorkshopId, reCalculateCommand);
|
||||
var result = _rollCallApplication
|
||||
.RecalculateValues(workshopSettings.WorkshopId, reCalculateCommand)
|
||||
.GetAwaiter().GetResult();
|
||||
|
||||
if (result.IsSuccedded == false)
|
||||
{
|
||||
@@ -844,7 +852,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
|
||||
_customizeWorkshopGroupSettingsRepository.SaveChanges();
|
||||
|
||||
transaction.Complete();
|
||||
rollCallTransaction.Commit();
|
||||
return op.Succcedded();
|
||||
}
|
||||
public OperationResult EditSimpleRollCallEmployeeSetting(EditCustomizeEmployeeSettings command,
|
||||
@@ -1043,7 +1051,9 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
_customizeWorkshopGroupSettingsRepository.SaveChanges();
|
||||
if (reCalculateCommand.Count > 0)
|
||||
{
|
||||
var result = _rollCallApplication.RecalculateValues(command.WorkshopId, reCalculateCommand);
|
||||
var result = _rollCallApplication
|
||||
.RecalculateValues(command.WorkshopId, reCalculateCommand)
|
||||
.GetAwaiter().GetResult();
|
||||
|
||||
if (result.IsSuccedded == false)
|
||||
{
|
||||
|
||||
@@ -1263,7 +1263,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
System.IO.File.WriteAllBytes(filePath, bytes);
|
||||
}
|
||||
public async Task<OperationResult<EmployeeByNationalCodeInWorkshopViewModel>>
|
||||
ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(string nationalCode, string birthDate, long workshopId)
|
||||
ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(string nationalCode, string birthDate,bool authorizedCanceled, long workshopId)
|
||||
{
|
||||
var op = new OperationResult<EmployeeByNationalCodeInWorkshopViewModel>();
|
||||
|
||||
@@ -1279,65 +1279,25 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
var employee = _EmployeeRepository.GetByNationalCodeIgnoreQueryFilter(nationalCode);
|
||||
|
||||
if (employee == null)
|
||||
if (employee == null && !authorizedCanceled)
|
||||
{
|
||||
var personalInfo = await _uidService.GetPersonalInfo(nationalCode, birthDate);
|
||||
|
||||
if (personalInfo.ResponseContext.Status.Code == 14)
|
||||
if (personalInfo != null)
|
||||
{
|
||||
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeByNationalCodeInWorkshopViewModel() { AuthorizedCanceled = true });
|
||||
}
|
||||
if (personalInfo.ResponseContext.Status.Code != 0)
|
||||
{
|
||||
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
|
||||
}
|
||||
if (personalInfo.ResponseContext.Status.Code == 14)
|
||||
{
|
||||
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeByNationalCodeInWorkshopViewModel() { AuthorizedCanceled = true });
|
||||
}
|
||||
if (personalInfo.ResponseContext.Status.Code != 0)
|
||||
{
|
||||
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
|
||||
}
|
||||
|
||||
var basicInfo = personalInfo.BasicInformation;
|
||||
var identityInfo = personalInfo.IdentificationInformation;
|
||||
DateTime apiBirthDate = identityInfo.BirthDate.ToGeorgianDateTime();
|
||||
var basicInfo = personalInfo.BasicInformation;
|
||||
var identityInfo = personalInfo.IdentificationInformation;
|
||||
DateTime apiBirthDate = identityInfo.BirthDate.ToGeorgianDateTime();
|
||||
|
||||
var dateOfIssue = new DateTime(1922, 1, 1);
|
||||
|
||||
var gender = basicInfo.GenderEnum switch
|
||||
{
|
||||
Gender.Female => "زن",
|
||||
Gender.Male => "مرد",
|
||||
_ => throw new AggregateException()
|
||||
};
|
||||
|
||||
var idNumber = identityInfo.ShenasnamehNumber == "0" ? identityInfo.NationalId : identityInfo.ShenasnamehNumber;
|
||||
|
||||
var newEmployee = new Employee(basicInfo.FirstName, basicInfo.LastName, basicInfo.FatherName, apiBirthDate,
|
||||
dateOfIssue, null, identityInfo.NationalId, idNumber, gender, "ایرانی", identityInfo.ShenasnameSerial, identityInfo.ShenasnameSeri);
|
||||
newEmployee.Authorized();
|
||||
await _EmployeeRepository.CreateAsync(newEmployee);
|
||||
await _EmployeeRepository.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded(new EmployeeByNationalCodeInWorkshopViewModel()
|
||||
{
|
||||
EmployeeId = newEmployee.id,
|
||||
EmployeeFName = newEmployee.FName,
|
||||
Gender = newEmployee.Gender,
|
||||
Nationality = newEmployee.Nationality,
|
||||
EmployeeLName = newEmployee.LName
|
||||
});
|
||||
}
|
||||
|
||||
if (_leftWorkTempRepository.ExistsIgnoreQueryFilter(x =>
|
||||
x.EmployeeId == employee.id && x.WorkshopId == workshopId && x.LeftWorkType == LeftWorkTempType.StartWork))
|
||||
{
|
||||
return op.Failed("این پرسنل در کارگاه شما قبلا افزوده شده است و در انتظار تایید میباشد");
|
||||
}
|
||||
|
||||
if (employee.IsAuthorized == false)
|
||||
{
|
||||
var personalInfoResponse = await _uidService.GetPersonalInfo(nationalCode, birthDate);
|
||||
|
||||
if (personalInfoResponse.ResponseContext.Status.Code == 0)
|
||||
{
|
||||
var basicInfo = personalInfoResponse.BasicInformation;
|
||||
var identityInfo = personalInfoResponse.IdentificationInformation;
|
||||
var apiBirthDate = identityInfo.BirthDate.ToGeorgianDateTime();
|
||||
var dateOfIssue = new DateTime(1922, 1, 1);
|
||||
|
||||
var gender = basicInfo.GenderEnum switch
|
||||
{
|
||||
@@ -1348,31 +1308,90 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
var idNumber = identityInfo.ShenasnamehNumber == "0" ? identityInfo.NationalId : identityInfo.ShenasnamehNumber;
|
||||
|
||||
|
||||
employee.Edit(basicInfo.FirstName, basicInfo.LastName, basicInfo.FatherName, apiBirthDate,
|
||||
employee.DateOfIssue, employee.PlaceOfIssue, identityInfo.NationalId, idNumber,
|
||||
gender, "ایرانی", employee.Phone, employee.Address, employee.State, employee.City,
|
||||
employee.MaritalStatus, employee.MilitaryService, employee.LevelOfEducation,
|
||||
employee.FieldOfStudy, employee.BankCardNumber, employee.BankBranch, employee.InsuranceCode, employee.InsuranceHistoryByYear,
|
||||
employee.InsuranceHistoryByMonth, employee.NumberOfChildren,
|
||||
employee.OfficePhone, employee.MclsUserName, employee.MclsPassword,
|
||||
employee.EserviceUserName, employee.EservicePassword, employee.TaxOfficeUserName,
|
||||
employee.TaxOfficepassword, employee.SanaUserName, employee.SanaPassword);
|
||||
|
||||
employee.Authorized();
|
||||
|
||||
var newEmployee = new Employee(basicInfo.FirstName, basicInfo.LastName, basicInfo.FatherName, apiBirthDate,
|
||||
dateOfIssue, null, identityInfo.NationalId, idNumber, gender, "ایرانی", identityInfo.ShenasnameSerial, identityInfo.ShenasnameSeri);
|
||||
newEmployee.Authorized();
|
||||
await _EmployeeRepository.CreateAsync(newEmployee);
|
||||
await _EmployeeRepository.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded(new EmployeeByNationalCodeInWorkshopViewModel()
|
||||
{
|
||||
EmployeeId = newEmployee.id,
|
||||
EmployeeFName = newEmployee.FName,
|
||||
Gender = newEmployee.Gender,
|
||||
Nationality = newEmployee.Nationality,
|
||||
EmployeeLName = newEmployee.LName
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeByNationalCodeInWorkshopViewModel() { AuthorizedCanceled = true });
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (employee == null && authorizedCanceled)
|
||||
{
|
||||
return op.Succcedded(new EmployeeByNationalCodeInWorkshopViewModel());
|
||||
}
|
||||
|
||||
if (_leftWorkTempRepository.ExistsIgnoreQueryFilter(x =>
|
||||
x.EmployeeId == employee.id && x.WorkshopId == workshopId && x.LeftWorkType == LeftWorkTempType.StartWork))
|
||||
{
|
||||
return op.Failed("این پرسنل در کارگاه شما قبلا افزوده شده است و در انتظار تایید میباشد");
|
||||
}
|
||||
|
||||
var personalInfoResponse = await _uidService.GetPersonalInfo(nationalCode, birthDate);
|
||||
if (personalInfoResponse != null)
|
||||
{
|
||||
if (employee.IsAuthorized == false)
|
||||
{
|
||||
|
||||
|
||||
if (personalInfoResponse.ResponseContext.Status.Code == 0)
|
||||
{
|
||||
var basicInfo = personalInfoResponse.BasicInformation;
|
||||
var identityInfo = personalInfoResponse.IdentificationInformation;
|
||||
var apiBirthDate = identityInfo.BirthDate.ToGeorgianDateTime();
|
||||
|
||||
var gender = basicInfo.GenderEnum switch
|
||||
{
|
||||
Gender.Female => "زن",
|
||||
Gender.Male => "مرد",
|
||||
_ => throw new AggregateException()
|
||||
};
|
||||
|
||||
var idNumber = identityInfo.ShenasnamehNumber == "0" ? identityInfo.NationalId : identityInfo.ShenasnamehNumber;
|
||||
|
||||
|
||||
employee.Edit(basicInfo.FirstName, basicInfo.LastName, basicInfo.FatherName, apiBirthDate,
|
||||
employee.DateOfIssue, employee.PlaceOfIssue, identityInfo.NationalId, idNumber,
|
||||
gender, "ایرانی", employee.Phone, employee.Address, employee.State, employee.City,
|
||||
employee.MaritalStatus, employee.MilitaryService, employee.LevelOfEducation,
|
||||
employee.FieldOfStudy, employee.BankCardNumber, employee.BankBranch, employee.InsuranceCode, employee.InsuranceHistoryByYear,
|
||||
employee.InsuranceHistoryByMonth, employee.NumberOfChildren,
|
||||
employee.OfficePhone, employee.MclsUserName, employee.MclsPassword,
|
||||
employee.EserviceUserName, employee.EservicePassword, employee.TaxOfficeUserName,
|
||||
employee.TaxOfficepassword, employee.SanaUserName, employee.SanaPassword);
|
||||
|
||||
employee.Authorized();
|
||||
|
||||
await _EmployeeRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return op.Failed("کد ملی با تاریخ تولد وارد شده مطابقت ندارد");
|
||||
}
|
||||
}
|
||||
else if (employee.DateOfBirth.ToFarsi() != birthDate || employee.NationalCode != nationalCode)
|
||||
{
|
||||
return op.Failed("کد ملی با تاریخ تولد وارد شده مطابقت ندارد");
|
||||
}
|
||||
}
|
||||
else if (employee.DateOfBirth.ToFarsi() != birthDate || employee.NationalCode != nationalCode)
|
||||
{
|
||||
return op.Failed("کد ملی با تاریخ تولد وارد شده مطابقت ندارد");
|
||||
}
|
||||
|
||||
|
||||
var leftWorkViewModel = _leftWorkRepository.GetLastLeftWorkByEmployeeIdAndWorkshopId(workshopId, employee.id);
|
||||
if (leftWorkViewModel == null)
|
||||
@@ -1710,5 +1729,10 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
return await _EmployeeRepository.GetList(searchModel);
|
||||
}
|
||||
|
||||
public async Task<List<GetClientEmployeeListViewModel>> GetClientEmployeeList(GetClientEmployeeListSearchModel searchModel, long workshopId)
|
||||
{
|
||||
return await _EmployeeRepository.GetClientEmployeeList(searchModel, workshopId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -22,6 +22,7 @@ using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using Company.Domain.RepresentativeAgg;
|
||||
using Company.Domain.RollCallServiceAgg;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.FinancialInvoice;
|
||||
@@ -59,6 +60,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
private readonly IFinancialInvoiceRepository _financialInvoiceRepository;
|
||||
private readonly IPaymentGateway _paymentGateway;
|
||||
private readonly IPaymentTransactionRepository _paymentTransactionRepository;
|
||||
private readonly IRollCallServiceRepository _rollCallServiceRepository;
|
||||
|
||||
|
||||
public InstitutionContractApplication(IInstitutionContractRepository institutionContractRepository,
|
||||
@@ -70,7 +72,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
IFinancialStatmentRepository financialStatmentRepository, IContactInfoApplication contactInfoApplication,
|
||||
IAccountApplication accountApplication, ISmsService smsService, IUidService uidService,
|
||||
IFinancialInvoiceRepository financialInvoiceRepository, IHttpClientFactory httpClientFactory,
|
||||
IPaymentTransactionRepository paymentTransactionRepository)
|
||||
IPaymentTransactionRepository paymentTransactionRepository, IRollCallServiceRepository rollCallServiceRepository)
|
||||
{
|
||||
_institutionContractRepository = institutionContractRepository;
|
||||
_contractingPartyRepository = contractingPartyRepository;
|
||||
@@ -88,6 +90,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
_uidService = uidService;
|
||||
_financialInvoiceRepository = financialInvoiceRepository;
|
||||
_paymentTransactionRepository = paymentTransactionRepository;
|
||||
_rollCallServiceRepository = rollCallServiceRepository;
|
||||
_paymentGateway = new SepehrPaymentGateway(httpClientFactory);
|
||||
}
|
||||
|
||||
@@ -1537,7 +1540,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> SetPendingWorkflow(long entityId)
|
||||
public async Task<OperationResult> SetPendingWorkflow(long entityId,InstitutionContractSigningType signingType)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var institutionContract = await _institutionContractRepository.GetIncludeWorkshopDetailsAsync(entityId);
|
||||
@@ -1551,15 +1554,64 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return op.Failed("وضعیت قرارداد مالی برای این عملیات مناسب نمی باشد");
|
||||
}
|
||||
|
||||
var initialCreatedWorkshops = institutionContract.WorkshopGroup.InitialWorkshops
|
||||
.Where(x => x.WorkshopCreated && x.WorkshopId is > 0).ToList();
|
||||
|
||||
var currentWorkshops = institutionContract.WorkshopGroup.CurrentWorkshops.ToList();
|
||||
var accountId = _contractingPartyRepository
|
||||
.GetAccountByPersonalContractingParty(institutionContract.ContractingPartyId).Id;
|
||||
foreach (var createdWorkshop in initialCreatedWorkshops)
|
||||
{
|
||||
if (currentWorkshops.Any(x => x.WorkshopId == createdWorkshop.WorkshopId))
|
||||
{
|
||||
//rollcall serviecs
|
||||
if (createdWorkshop.Services.RollCall)
|
||||
{
|
||||
var ActiveService = _rollCallServiceRepository.GetActiveServiceByWorkshopId(createdWorkshop.WorkshopId!.Value);
|
||||
var startTime = institutionContract.ContractStartGr;
|
||||
var endTime = institutionContract.ContractEndGr;
|
||||
if (ActiveService != null)
|
||||
{
|
||||
if (ActiveService.EndService> startTime)
|
||||
{
|
||||
startTime = ActiveService.EndService;
|
||||
}
|
||||
|
||||
}
|
||||
var rollCallService = new RollCallService("BasedOnIC",
|
||||
startTime, endTime, createdWorkshop.WorkshopId.Value,accountId,createdWorkshop.PersonnelCount,
|
||||
0,"12");
|
||||
await _rollCallServiceRepository.CreateAsync(rollCallService);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var currentWorkshop = new InstitutionContractWorkshopCurrent(createdWorkshop.WorkshopName,
|
||||
createdWorkshop.Services.RollCall, createdWorkshop.Services.RollCallInPerson,
|
||||
createdWorkshop.Services.CustomizeCheckout, createdWorkshop.Services.Contract,
|
||||
createdWorkshop.Services.ContractInPerson, createdWorkshop.Services.Insurance,
|
||||
createdWorkshop.Services.InsuranceInPerson,createdWorkshop.PersonnelCount, createdWorkshop.Price,
|
||||
createdWorkshop.InstitutionContractWorkshopGroupId,createdWorkshop.WorkshopGroup,
|
||||
createdWorkshop.WorkshopId!.Value, createdWorkshop.id);
|
||||
institutionContract.WorkshopGroup.AddCurrentWorkshop(currentWorkshop);
|
||||
}
|
||||
}
|
||||
|
||||
if (institutionContract.WorkshopGroup.InitialWorkshops.All(x => x.WorkshopCreated && x.WorkshopId is > 0))
|
||||
{
|
||||
|
||||
institutionContract.Verified();
|
||||
}
|
||||
else
|
||||
{
|
||||
institutionContract.SetPendingWorkflow();
|
||||
}
|
||||
|
||||
|
||||
institutionContract.SetSigningType(signingType);
|
||||
var previousInstitutionContract = await _institutionContractRepository
|
||||
.GetPreviousContract(institutionContract.id);
|
||||
previousInstitutionContract?.DeActive();
|
||||
ReActiveAllAfterCreateNew(institutionContract.ContractingPartyId);
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
return op.Succcedded();
|
||||
}
|
||||
@@ -1569,6 +1621,42 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return await _institutionContractRepository.GetIdByInstallmentId(installmentId);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> VerifyInstitutionContractManually(long institutionContractId)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
var institutionContract =await _institutionContractRepository
|
||||
.GetIncludeWorkshopDetailsAsync(institutionContractId);
|
||||
|
||||
if (institutionContract == null)
|
||||
return op.Failed("قرارداد مالی یافت نشد");
|
||||
|
||||
if (institutionContract.VerificationStatus == InstitutionContractVerificationStatus.Verified)
|
||||
return op.Failed("قرارداد مالی قبلا تایید شده است");
|
||||
|
||||
var transaction = await _institutionContractRepository.BeginTransactionAsync();
|
||||
await SetPendingWorkflow(institutionContractId,InstitutionContractSigningType.Physical);
|
||||
|
||||
var financialStatement = await _financialStatmentRepository
|
||||
.GetByContractingPartyId(institutionContract.ContractingPartyId);
|
||||
|
||||
DateTime today = DateTime.Today;
|
||||
var description = institutionContract.IsInstallment
|
||||
? "قسط اول سرویس"
|
||||
: "پرداخت کل سرویس";
|
||||
var debtorAmount = institutionContract.IsInstallment
|
||||
? institutionContract.Installments.First().Amount
|
||||
: institutionContract.TotalAmount;
|
||||
|
||||
var financialTransaction = new FinancialTransaction(0, today, today.ToFarsi(),
|
||||
description, "debt", "بابت خدمات", debtorAmount, 0, 0);
|
||||
financialStatement.AddFinancialTransaction(financialTransaction);
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
await transaction.CommitAsync();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
|
||||
CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city,
|
||||
string state)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
@@ -84,4 +85,73 @@ public class InstitutionPlanApplication : IInstitutionPlanApplication
|
||||
{
|
||||
return _planPercentageRepository.GetInstitutionPlanForWorkshop(command);
|
||||
}
|
||||
|
||||
|
||||
#region ForApi
|
||||
|
||||
public async Task<CreateServiceAmountDto> GetCreateModalData()
|
||||
{
|
||||
return await _planPercentageRepository.GetCreateModalData();
|
||||
}
|
||||
|
||||
|
||||
public async Task<OperationResult> CreateInstitutionPlanPercentage(CreateServiceAmountDto command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (string.IsNullOrWhiteSpace(command.ContractAndCheckoutInPersonPercentStr) || command.ContractAndCheckoutInPersonPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.ContractAndCheckoutPercentStr) || (command.ContractAndCheckoutPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.CustomizeCheckoutPercentStr) || command.CustomizeCheckoutPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.InsuranceInPersonPercentStr) || command.InsuranceInPersonPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.InsurancePercentStr) || command.InsurancePercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.RollCallPercentStr) || command.RollCallPercentStr == "0"))
|
||||
return op.Failed("هیچ یک از فیلدها نمیتوانند صفر باشند");
|
||||
|
||||
int contractAndCheckoutInPersonPercent = 0;
|
||||
int contractAndCheckoutPercent = 0;
|
||||
int customizeCheckoutPercent = 0;
|
||||
int insuranceInPersonPercent = 0;
|
||||
int insurancePercent = 0;
|
||||
int rollCallPercent = 0;
|
||||
|
||||
try
|
||||
{
|
||||
contractAndCheckoutInPersonPercent = Convert.ToInt32(command.ContractAndCheckoutInPersonPercentStr);
|
||||
contractAndCheckoutPercent = Convert.ToInt32(command.ContractAndCheckoutPercentStr);
|
||||
customizeCheckoutPercent = Convert.ToInt32(command.CustomizeCheckoutPercentStr);
|
||||
insuranceInPersonPercent = Convert.ToInt32(command.InsuranceInPersonPercentStr);
|
||||
insurancePercent = Convert.ToInt32(command.InsurancePercentStr);
|
||||
rollCallPercent = Convert.ToInt32(command.RollCallPercentStr);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return op.Failed("لطفا عدد معتبر وارد کنید");
|
||||
|
||||
}
|
||||
|
||||
var firstPlan =await _planPercentageRepository.GetCreateModalData();
|
||||
if (firstPlan != null)
|
||||
{
|
||||
var planPercentage = _planPercentageRepository.Get(firstPlan.Id);
|
||||
planPercentage.Edit(contractAndCheckoutPercent, insurancePercent, rollCallPercent, customizeCheckoutPercent, contractAndCheckoutInPersonPercent, insuranceInPersonPercent);
|
||||
_planPercentageRepository.SaveChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
var create = new PlanPercentage(contractAndCheckoutPercent, insurancePercent, rollCallPercent,
|
||||
customizeCheckoutPercent, contractAndCheckoutInPersonPercent, insuranceInPersonPercent);
|
||||
await _planPercentageRepository.CreateAsync(create);
|
||||
await _planPercentageRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<PagedResult<InstitutionPlanListDto>> GetList(InstitutionPlanSearchModel searchModel)
|
||||
{
|
||||
return await _planPercentageRepository.GetList(searchModel);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -2371,6 +2371,11 @@ public class InsuranceListApplication : IInsuranceListApplication
|
||||
return _insuranceListRepositpry.GetTabCounts(searchModel);
|
||||
}
|
||||
|
||||
public async Task<PagedResult<InsuranceClientListViewModel>> GetInsuranceClientList(InsuranceClientSearchModel searchModel)
|
||||
{
|
||||
return await _insuranceListRepositpry.GetInsuranceClientList(searchModel);
|
||||
}
|
||||
|
||||
public async Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel)
|
||||
{
|
||||
return await _insuranceListRepositpry.GetNotCreatedWorkshop(searchModel);
|
||||
|
||||
@@ -788,7 +788,7 @@ public class RollCallApplication : IRollCallApplication
|
||||
return _rollCallRepository.CheckRepeat(employeeId, workshopId);
|
||||
}
|
||||
|
||||
public OperationResult RecalculateValues(long workshopId, List<ReCalculateRollCallValues> commands)
|
||||
public async Task<OperationResult> RecalculateValues(long workshopId, List<ReCalculateRollCallValues> commands)
|
||||
{
|
||||
var operationResult = new OperationResult();
|
||||
try
|
||||
@@ -812,24 +812,43 @@ public class RollCallApplication : IRollCallApplication
|
||||
|
||||
var oldestDate = commands.MinBy(x => x.FromDate).FromDate.ToGeorgianDateTime();
|
||||
|
||||
var allRollCalls = _rollCallRepository
|
||||
var allRollCalls = await _rollCallRepository
|
||||
.GetRollCallsUntilNowWithWorkshopIdEmployeeIds(workshopId, commands.Select(x => x.EmployeeId).ToList(),
|
||||
oldestDate).GetAwaiter().GetResult();
|
||||
oldestDate);
|
||||
|
||||
var rollCalls =
|
||||
commands.SelectMany(command =>
|
||||
allRollCalls.Where(x =>
|
||||
x.EmployeeId == command.EmployeeId &&
|
||||
x.ShiftDate >= command.FromDate.ToGeorgianDateTime()
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
foreach (var command in commands)
|
||||
foreach (var rollCall in rollCalls)
|
||||
{
|
||||
var rollCalls = allRollCalls
|
||||
.Where(x => x.EmployeeId == command.EmployeeId && x.ShiftDate >= command.FromDate.ToGeorgianDateTime()).ToList();
|
||||
rollCall.ClearTimeDiff();
|
||||
|
||||
foreach (var rollCall in rollCalls)
|
||||
{
|
||||
rollCall.ClearTimeDiff();
|
||||
_rollCallRepository.SaveChanges();
|
||||
rollCall.SetEndDateTime(rollCall.EndDate!.Value, _rollCallDomainService);
|
||||
}
|
||||
await _rollCallRepository.SaveChangesAsync();
|
||||
|
||||
rollCall.SetEndDateTime(
|
||||
rollCall.EndDate!.Value,
|
||||
_rollCallDomainService
|
||||
);
|
||||
}
|
||||
_rollCallRepository.SaveChanges();
|
||||
|
||||
// foreach (var command in commands)
|
||||
// {
|
||||
// var rollCalls = allRollCalls
|
||||
// .Where(x => x.EmployeeId == command.EmployeeId && x.ShiftDate >= command.FromDate.ToGeorgianDateTime()).ToList();
|
||||
//
|
||||
// foreach (var rollCall in rollCalls)
|
||||
// {
|
||||
// rollCall.ClearTimeDiff();
|
||||
// await _rollCallRepository.SaveChangesAsync();
|
||||
// rollCall.SetEndDateTime(rollCall.EndDate!.Value, _rollCallDomainService);
|
||||
// }
|
||||
// }
|
||||
await _rollCallRepository.SaveChangesAsync();
|
||||
|
||||
return operationResult.Succcedded();
|
||||
}
|
||||
|
||||
@@ -1092,7 +1092,9 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
Amount = 1000,
|
||||
MaxPersonValid = 500,
|
||||
Duration = "12",
|
||||
HasCustomizeCheckoutService = command.HasCustomizeCheckoutService
|
||||
HasCustomizeCheckoutService = command.HasCustomizeCheckoutService,
|
||||
StartService = institutionContract.ContractStartGr,
|
||||
|
||||
};
|
||||
_rollCallServiceApplication.Create(commandSave);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,10 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
|
||||
builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20);
|
||||
|
||||
builder.Property(x => x.VerificationStatus).HasConversion<string>().HasMaxLength(122);
|
||||
|
||||
builder.Property(x=>x.SigningType).HasConversion<string>()
|
||||
.HasMaxLength(25)
|
||||
.IsRequired(false);
|
||||
|
||||
builder.HasMany(x => x.Installments)
|
||||
.WithOne(x => x.InstitutionContract)
|
||||
@@ -45,5 +49,10 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
|
||||
|
||||
builder.HasMany(x => x.Amendments).WithOne(x => x.InstitutionContract)
|
||||
.HasForeignKey(x => x.InstitutionContractId);
|
||||
|
||||
|
||||
builder.Ignore(x => x.ContractAmountWithTax);
|
||||
builder.Ignore(x => x.ContractAmountTax);
|
||||
builder.Ignore(x => x.ContractAmountTax);
|
||||
}
|
||||
}
|
||||
11521
CompanyManagment.EFCore/Migrations/20251220143403_addsigningTypeforinstitutioncontract.Designer.cs
generated
Normal file
11521
CompanyManagment.EFCore/Migrations/20251220143403_addsigningTypeforinstitutioncontract.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addsigningTypeforinstitutioncontract : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "SigningType",
|
||||
table: "InstitutionContracts",
|
||||
type: "nvarchar(25)",
|
||||
maxLength: 25,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SigningType",
|
||||
table: "InstitutionContracts");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3462,6 +3462,10 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(1)
|
||||
.HasColumnType("nvarchar(1)");
|
||||
|
||||
b.Property<string>("SigningType")
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
@@ -1062,5 +1062,116 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
public Task<List<GetClientEmployeeListViewModel>> GetClientEmployeeList(GetClientEmployeeListSearchModel searchModel, long workshopId)
|
||||
{
|
||||
// var leftDate = Tools.GetUndefinedDateTime();
|
||||
//
|
||||
// var personnelCodes = _context.PersonnelCodeSet.Include(x => x.Employee)
|
||||
// .ThenInclude(x => x.EmployeeChildrenList).IgnoreQueryFilters().Where(x => x.WorkshopId == workshopId).ToList();
|
||||
//
|
||||
// var contractLeftWork =
|
||||
// _context.LeftWorkList.Where(x => x.WorkshopId == workshopId)
|
||||
// .GroupBy(x => x.EmployeeId).Select(x => x.OrderByDescending(y => y.LeftWork).First()).ToList();
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// var insuranceLeftWork = _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId).Select(x => new
|
||||
// {
|
||||
// EmployeeId = x.EmployeeId,
|
||||
// FullName = x.EmployeeFullName,
|
||||
// PersonnelCode = 0,
|
||||
// InsurancePerson = true,
|
||||
// InsuranceLeft = x.LeftWorkDate != null,
|
||||
// StartWork = x.StartWorkDate,
|
||||
// LeftWork = x.LeftWorkDate ?? leftDate,
|
||||
// LastStartInsuranceWork = x.StartWorkDate.ToFarsi(),
|
||||
// LastLeftInsuranceWork = x.LeftWorkDate != null ? x.LeftWorkDate.ToFarsi() : "-",
|
||||
// LastStartContractWork = "-",
|
||||
// LastLeftContractWork = "-"
|
||||
// }).GroupBy(x => x.EmployeeId)
|
||||
// .Select(x => x.OrderByDescending(y => y.LeftWork).First()).ToList();
|
||||
//
|
||||
// var leftWorkTemp = _context.LeftWorkTemps.Where(x => x.WorkshopId == workshopId).Select(x => new
|
||||
// {
|
||||
// WorkshopId = x.WorkshopId,
|
||||
// EmployeeId = x.EmployeeId,
|
||||
// PersonnelCode = 0,
|
||||
// ContractPerson = true,
|
||||
// ContractLeft = x.LeftWork != leftDate,
|
||||
// StartWork = x.StartWork,
|
||||
// LeftWork = x.LeftWork,
|
||||
// LastStartContractWork = x.StartWork.ToFarsi(),
|
||||
// LastLeftContractWork = x.LeftWork != leftDate ? x.LeftWork.ToFarsi() : "-",
|
||||
// LastStartInsuranceWork = "-",
|
||||
// LastLeftInsuranceWork = "-",
|
||||
// LefWorkTemp = x.LeftWorkType == LeftWorkTempType.LeftWork,
|
||||
// CreatedByClient = x.LeftWorkType == LeftWorkTempType.StartWork
|
||||
// }).ToList();
|
||||
//
|
||||
//
|
||||
// var employeeClientTemp = _context.EmployeeClientTemps.Where(x => x.WorkshopId == workshopId).Select(x => new
|
||||
// {
|
||||
// WorkshopId = x.WorkshopId,
|
||||
// EmployeeId = x.EmployeeId,
|
||||
// PersonnelCode = 0,
|
||||
// CreatedByClient = true,
|
||||
// ContractPerson = true
|
||||
// }).ToList();
|
||||
//
|
||||
// var resultTemp = employeeClientTemp.Concat(leftWorkTemp).ToList().GroupBy(x => x.EmployeeId);
|
||||
//
|
||||
//
|
||||
//
|
||||
// var result = contractLeftWork.Concat(insuranceLeftWork).GroupBy(x => x.EmployeeId).ToList();
|
||||
//
|
||||
// result = result.Concat(resultTemp).GroupBy(x => x.First().EmployeeId).Select(x => x.First()).ToList();
|
||||
//
|
||||
// var employeeClientTempList = employeeClientTemp.ToList();
|
||||
// var startWorkTempsForWorkshop = leftWorkTemp.Where(x => x.CreatedByClient).ToList();
|
||||
// var leftWorkTempsForWorkshop = leftWorkTemp.Where(x => x.LefWorkTemp).ToList();
|
||||
//
|
||||
// return result.Select(x =>
|
||||
// {
|
||||
// var insurance = x.FirstOrDefault(y => y.InsurancePerson);
|
||||
// var contract = x.FirstOrDefault(y => y.ContractPerson);
|
||||
// var personnelCode = personnelCodes.FirstOrDefault(y => y.EmployeeId == x.Key);
|
||||
// var employee = personnelCode.Employee;
|
||||
// var employeeClient = employeeClientTempList.FirstOrDefault(t => t.EmployeeId == x.First().EmployeeId);
|
||||
// var startWorkTemp = startWorkTempsForWorkshop.FirstOrDefault(s => s.EmployeeId == x.First().EmployeeId);
|
||||
// var leftWorkTemp = leftWorkTempsForWorkshop.FirstOrDefault(s => s.EmployeeId == x.First().EmployeeId);
|
||||
//
|
||||
//
|
||||
// return new GetClientEmployeeListViewModel()
|
||||
// {
|
||||
// EmployeeId = x.Key,
|
||||
// FullName = employee.FullName,
|
||||
// PersonnelCode = personnelCode?.PersonnelCode ?? 0,
|
||||
// HasContractLeftWork = insurance != null,
|
||||
// HasInsuranceLeftWork = contract != null,
|
||||
//
|
||||
// LeftWorkCompletely = (insurance?.InsuranceLeft ?? false) && (contract?.ContractLeft ?? false),
|
||||
//
|
||||
// LastStartInsuranceWork = insurance != null ? insurance.LastStartInsuranceWork : "-",
|
||||
// LastLeftInsuranceWork = insurance != null ? insurance.LastLeftInsuranceWork : "-",
|
||||
// LastStartContractWork = contract != null ? contract.LastStartContractWork : "-",
|
||||
// LastLeftContractWork = contract != null ? contract.LastLeftContractWork : "-",
|
||||
//
|
||||
// NationalCode = employee.NationalCode,
|
||||
// IdNumber = employee.IdNumber,
|
||||
// MaritalStatus = employee.MaritalStatus,
|
||||
// DateOfBirthFa = employee.DateOfBirth.ToFarsi(),
|
||||
// FatherName = employee.FatherName,
|
||||
// ChildrenCount = employee.EmployeeChildrenList.Count,
|
||||
//
|
||||
// PendingStartWork = employeeClient != null || startWorkTemp != null,
|
||||
// PendingLeftWork = leftWorkTemp != null,
|
||||
//
|
||||
//
|
||||
// };
|
||||
// }).OrderByDescending(x => x.StartWork).ToList();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -722,34 +722,33 @@ public class EmployerRepository : RepositoryBase<long, Employer>, IEmployerRepos
|
||||
public OperationResult ActiveAll(long id)
|
||||
{
|
||||
OperationResult result = new OperationResult();
|
||||
using (var transaction = _context.Database.BeginTransaction())
|
||||
try
|
||||
{
|
||||
try
|
||||
var employer = _context.Employers.FirstOrDefault(x => x.id == id);
|
||||
if (employer == null)
|
||||
{
|
||||
var employer = _context.Employers.FirstOrDefault(x => x.id == id);
|
||||
employer.Active();
|
||||
|
||||
var workshopIds = _context.WorkshopEmployers.Where(x => x.EmployerId == id).Select(x => x.WorkshopId)
|
||||
.ToList();
|
||||
var workshops = _context.Workshops.Where(x => workshopIds.Contains(x.id)).ToList();
|
||||
workshops.ForEach(x => x.Active(x.ArchiveCode));
|
||||
|
||||
var contracts = _context.Contracts.Where(x => workshopIds.Contains(x.WorkshopIds)).ToList();
|
||||
contracts.ForEach(x => x.Active());
|
||||
|
||||
var contractIds = contracts.Select(x => x.id).ToList();
|
||||
var checkouts = _context.CheckoutSet.Where(x => contractIds.Contains(x.ContractId)).ToList();
|
||||
checkouts.ForEach(x => x.Active());
|
||||
|
||||
_context.SaveChanges();
|
||||
transaction.Commit();
|
||||
result.Succcedded();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result.Failed("فعال کردن کارفرما با خطا مواجه شد");
|
||||
transaction.Rollback();
|
||||
return result.Failed("کارفرما یافت نشد");
|
||||
}
|
||||
employer.Active();
|
||||
|
||||
var workshopIds = _context.WorkshopEmployers.Where(x => x.EmployerId == id).Select(x => x.WorkshopId)
|
||||
.ToList();
|
||||
var workshops = _context.Workshops.Where(x => workshopIds.Contains(x.id)).ToList();
|
||||
workshops.ForEach(x => x.Active(x.ArchiveCode));
|
||||
|
||||
var contracts = _context.Contracts.Where(x => workshopIds.Contains(x.WorkshopIds)).ToList();
|
||||
contracts.ForEach(x => x.Active());
|
||||
|
||||
var contractIds = contracts.Select(x => x.id).ToList();
|
||||
var checkouts = _context.CheckoutSet.Where(x => contractIds.Contains(x.ContractId)).ToList();
|
||||
checkouts.ForEach(x => x.Active());
|
||||
|
||||
_context.SaveChanges();
|
||||
result.Succcedded();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result.Failed("فعال کردن کارفرما با خطا مواجه شد");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -4,9 +4,7 @@ using _0_Framework.Application.Sms;
|
||||
using _0_Framework.Exceptions;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.ContractingPartyAccountAgg;
|
||||
using Company.Domain.empolyerAgg;
|
||||
using Company.Domain.FinancialInvoiceAgg;
|
||||
using Company.Domain.FinancialStatmentAgg;
|
||||
using Company.Domain.FinancialTransactionAgg;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
@@ -17,7 +15,6 @@ using Company.Domain.InstitutionPlanAgg;
|
||||
using Company.Domain.SmsResultAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.FinancialInvoice;
|
||||
using CompanyManagment.App.Contracts.FinancialStatment;
|
||||
using CompanyManagment.App.Contracts.FinancilTransaction;
|
||||
using CompanyManagment.App.Contracts.Hubs;
|
||||
@@ -26,30 +23,18 @@ using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.WorkshopPlan;
|
||||
using CompanyManagment.EFCore.Migrations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MongoDB.Driver;
|
||||
using OfficeOpenXml.Packaging.Ionic.Zip;
|
||||
using PersianTools.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using ContractingPartyAccount = Company.Domain.ContractingPartyAccountAgg.ContractingPartyAccount;
|
||||
using FinancialStatment = Company.Domain.FinancialStatmentAgg.FinancialStatment;
|
||||
using String = System.String;
|
||||
@@ -70,6 +55,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
private readonly IFinancialTransactionRepository _financialTransactionRepository;
|
||||
private readonly IFinancialStatmentRepository _financialStatmentRepository;
|
||||
private readonly IHubContext<SendSmsHub> _hubContext;
|
||||
private readonly ILogger<InstitutionContractRepository> _logger;
|
||||
|
||||
private readonly InstitutionContratVerificationParty _firstParty = new()
|
||||
{
|
||||
@@ -85,7 +71,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
IWorkshopRepository workshopRepository, IMongoDatabase database,
|
||||
IPlanPercentageRepository planPercentageRepository, ISmsService smsService,
|
||||
ISmsResultRepository smsResultRepository, IFinancialTransactionRepository financialTransactionRepository,
|
||||
IFinancialStatmentRepository financialStatmentRepository, IHubContext<SendSmsHub> hubContext) : base(context)
|
||||
IFinancialStatmentRepository financialStatmentRepository, IHubContext<SendSmsHub> hubContext, ILogger<InstitutionContractRepository> logger) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
_employerRepository = employerRepository;
|
||||
@@ -96,6 +82,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
_financialTransactionRepository = financialTransactionRepository;
|
||||
_financialStatmentRepository = financialStatmentRepository;
|
||||
_hubContext = hubContext;
|
||||
_logger = logger;
|
||||
_institutionExtensionTemp =
|
||||
database.GetCollection<InstitutionContractExtensionTemp>("InstitutionContractExtensionTemp");
|
||||
_institutionAmendmentTemp =
|
||||
@@ -1111,26 +1098,41 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
public async Task<PagedResult<GetInstitutionContractListItemsViewModel>> GetList(
|
||||
InstitutionContractListSearchModel searchModel)
|
||||
{
|
||||
var query = _context.InstitutionContractSet
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x => x.InitialWorkshops)
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x => x.CurrentWorkshops)
|
||||
.Include(x => x.ContactInfoList).AsNoTracking();
|
||||
|
||||
var now = DateTime.Today;
|
||||
var nowFa = now.ToFarsi();
|
||||
var endFa = nowFa.FindeEndOfMonth();
|
||||
var endThisMontGr = endFa.ToGeorgianDateTime();
|
||||
|
||||
var joinedQuery = query.Join(_context.PersonalContractingParties
|
||||
var contractsWithExtension = await _context.InstitutionContractSet
|
||||
.Where(x => x.IsActiveString == "true")
|
||||
.Select(x => new { x.ContractingPartyId, x.ExtensionNo })
|
||||
.ToListAsync();
|
||||
|
||||
// var contractsWithExtensionLookup = contractsWithExtension
|
||||
// .GroupBy(x => x.ContractingPartyId)
|
||||
// .ToDictionary(
|
||||
// g => g.Key,
|
||||
// g => g.Max(x => x.ExtensionNo)
|
||||
// );
|
||||
|
||||
var rawQuery = _context.InstitutionContractSet
|
||||
.Include(x=>x.Installments)
|
||||
.AsNoTracking()
|
||||
.Join(_context.PersonalContractingParties
|
||||
.AsNoTracking()
|
||||
.Include(x => x.Employers)
|
||||
.ThenInclude(x => x.WorkshopEmployers)
|
||||
.ThenInclude(x => x.Workshop),
|
||||
contract => contract.ContractingPartyId,
|
||||
contractingParty => contractingParty.id,
|
||||
(contract, contractingParty) => new { contract, contractingParty })
|
||||
.Select(x => new
|
||||
(contract, contractingParty) => new { contract, contractingParty });
|
||||
|
||||
// var pendingForRenewalContracts = _context.InstitutionContractSet.AsNoTracking()
|
||||
// .Where(c => c.IsActiveString == "true" &&
|
||||
// c.ContractEndGr >= now &&
|
||||
// c.ContractEndGr <= endThisMontGr);
|
||||
|
||||
var joinedQuery = rawQuery.Select(x => new
|
||||
{
|
||||
x.contract,
|
||||
x.contractingParty,
|
||||
@@ -1151,7 +1153,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
: x.contract.ContractAmount == 0
|
||||
? (int)InstitutionContractListStatus.Free
|
||||
: !x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop)).Any()
|
||||
.SelectMany(e => e.WorkshopEmployers
|
||||
.Select(we => we.Workshop)).Any()
|
||||
? (int)InstitutionContractListStatus.WithoutWorkshop
|
||||
: (int)InstitutionContractListStatus.Active
|
||||
});
|
||||
@@ -1314,6 +1317,15 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
var list = await orderedQuery.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync();
|
||||
var contractingPartyIds = list.Select(x => x.contractingParty.id).ToList();
|
||||
var contractIds = list.Select(x => x.contract.id).ToList();
|
||||
|
||||
// بارگذاری WorkshopGroups فقط برای قراردادهای صفحه فعلی
|
||||
var workshopGroups = await _context.InstitutionContractWorkshopGroups
|
||||
.AsNoTracking()
|
||||
.Include(x=>x.InitialWorkshops )
|
||||
.Include(x => x.CurrentWorkshops)
|
||||
.Where(x => contractIds.Contains(x.InstitutionContractId))
|
||||
.ToDictionaryAsync(x => x.InstitutionContractId, x => x);
|
||||
|
||||
var financialStatements = _context.FinancialStatments.Include(x => x.FinancialTransactionList)
|
||||
.Where(x => contractingPartyIds.Contains(x.ContractingPartyId)).ToList();
|
||||
@@ -1337,13 +1349,19 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
var archiveCode = minArchiveCode == 10000000 ? 0 : minArchiveCode;
|
||||
var status = Enum.Parse<InstitutionContractListStatus>(x.StatusPriority.ToString());
|
||||
List<InstitutionContractWorkshopBase> currentStateWorkshops = x.contract.WorkshopGroup?.CurrentWorkshops
|
||||
|
||||
// دریافت WorkshopGroup از dictionary بارگذاری شده
|
||||
workshopGroups.TryGetValue(x.contract.id, out var workshopGroup);
|
||||
|
||||
List<InstitutionContractWorkshopBase> currentStateWorkshops = workshopGroup?.CurrentWorkshops
|
||||
.Cast<InstitutionContractWorkshopBase>().ToList();
|
||||
|
||||
var statement = financialStatements.FirstOrDefault(f => f.ContractingPartyId == x.contractingParty.id);
|
||||
|
||||
currentStateWorkshops?.AddRange(
|
||||
x.contract.WorkshopGroup?.InitialWorkshops.Where(w => !w.WorkshopCreated) ?? []);
|
||||
if (currentStateWorkshops != null && workshopGroup != null)
|
||||
{
|
||||
currentStateWorkshops.AddRange(workshopGroup.InitialWorkshops.Where(w => !w.WorkshopCreated));
|
||||
}
|
||||
|
||||
var workshopDetails = currentStateWorkshops?.Select(w =>
|
||||
{
|
||||
@@ -1373,9 +1391,28 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var employeesCount = _context.LeftWorkList
|
||||
.Where(l => workshops.Select(w => w.id).Contains(l.WorkshopId))
|
||||
.Count(l => l.StartWorkDate <= DateTime.Now && l.LeftWorkDate >= DateTime.Now);
|
||||
|
||||
|
||||
var contractAmount = x.contract.SigningType is not InstitutionContractSigningType.Legacy
|
||||
&& !x.contract.IsInstallment?
|
||||
x.contract.TotalAmount:0;
|
||||
|
||||
var installmentAmount = 0d;
|
||||
try
|
||||
{
|
||||
installmentAmount =x.contract.SigningType == InstitutionContractSigningType.Legacy
|
||||
?x.contract.ContractAmount : x.contract.IsInstallment ? x.contract.Installments.First().Amount :0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
|
||||
return new GetInstitutionContractListItemsViewModel()
|
||||
{
|
||||
ContractAmount = x.contract.ContractAmount,
|
||||
ContractAmount = contractAmount,
|
||||
InstallmentAmount = installmentAmount,
|
||||
Balance = statement?.FinancialTransactionList.Sum(ft => ft.Deptor - ft.Creditor) ?? 0,
|
||||
WorkshopsCount = workshops.Count(),
|
||||
ContractStartFa = x.contract.ContractStartGr.ToFarsi(),
|
||||
@@ -1393,11 +1430,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
IsExpired = x.contract.ContractEndGr <= endThisMontGr,
|
||||
ContractingPartyId = x.contractingParty.id,
|
||||
Workshops = workshopDetails,
|
||||
IsInPersonContract = x.contract.WorkshopGroup?.CurrentWorkshops
|
||||
IsInPersonContract = workshopGroup?.CurrentWorkshops
|
||||
.Any(y => y.Services.ContractInPerson) ?? true,
|
||||
IsOldContract = x.contract.WorkshopGroup?.CurrentWorkshops == null
|
||||
|| x.contract.WorkshopGroup.CurrentWorkshops.Count == 0
|
||||
|| x.contract.WorkshopGroup.CurrentWorkshops.Any(y => y.Price == 0)
|
||||
IsOldContract = x.contract.SigningType == InstitutionContractSigningType.Legacy
|
||||
};
|
||||
}).ToList()
|
||||
};
|
||||
@@ -1772,6 +1807,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.ThenInclude(x => x.InitialWorkshops)
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x => x.CurrentWorkshops)
|
||||
.Include(x=>x.Installments)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractId);
|
||||
}
|
||||
|
||||
@@ -1913,7 +1949,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.FirstOrDefaultAsync(x => x.PublicId == id);
|
||||
}
|
||||
|
||||
public InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request)
|
||||
public InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request,string contractStart=null)
|
||||
{
|
||||
var baseAmount = request.TotalAmount;
|
||||
var discountAmount = (baseAmount * request.DiscountPercentage) / 100;
|
||||
@@ -2172,6 +2208,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(institutionContractWorkshopGroup => institutionContractWorkshopGroup.CurrentWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == extenstionTemp.PreviousId);
|
||||
|
||||
var employerWorkshopIds = _context.Employers.Where(x=>x.ContractingPartyId == prevInstitutionContracts.ContractingPartyId).Include(x=>x.WorkshopEmployers)
|
||||
.SelectMany(x=>x.WorkshopEmployers).Select(x=>x.WorkshopId).Distinct().ToList();
|
||||
|
||||
if (prevInstitutionContracts == null)
|
||||
{
|
||||
throw new BadRequestException("قرارداد مالی قبلی یافت نشد");
|
||||
@@ -2184,7 +2224,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
);
|
||||
|
||||
var workshopIds = prevInstitutionContracts.WorkshopGroup.CurrentWorkshops.Select(x => x.WorkshopId.Value);
|
||||
var workshops = await _context.Workshops.Where(x => workshopIds.Contains(x.id)).ToListAsync();
|
||||
|
||||
var workshopsNotInInstitution = employerWorkshopIds.Where(x=> !workshopIds.Contains(x)).ToList();
|
||||
|
||||
var workshops = await _context.Workshops.Where(x => workshopIds.Contains(x.id) || employerWorkshopIds.Contains(x.id))
|
||||
.ToListAsync();
|
||||
|
||||
var workshopDetails = prevInstitutionContracts.WorkshopGroup.CurrentWorkshops
|
||||
.Select(x =>
|
||||
{
|
||||
@@ -2226,6 +2271,32 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
RollCallInPerson = service.RollCallInPerson
|
||||
};
|
||||
}).ToList();
|
||||
var notIncludeWorskhopsLeftWork =await _context.LeftWorkList
|
||||
.Where(x => workshopsNotInInstitution.Contains(x.WorkshopId) && x.StartWorkDate <= DateTime.Now &&
|
||||
x.LeftWorkDate >= DateTime.Now)
|
||||
.GroupBy(x => x.WorkshopId).ToListAsync();
|
||||
var notIncludeWorskhopsInContract = workshopsNotInInstitution.Select(x =>
|
||||
{
|
||||
var workshop = workshops.FirstOrDefault(w => w.id == x);
|
||||
var leftWorks = notIncludeWorskhopsLeftWork.FirstOrDefault(l=>l.Key ==x);
|
||||
return new WorkshopTempViewModel()
|
||||
{
|
||||
WorkshopName = workshop?.WorkshopName ?? "فاقد کارگاه",
|
||||
WorkshopServicesAmount = 0,
|
||||
WorkshopServicesAmountStr = "0",
|
||||
WorkshopId = x,
|
||||
Id = 0,
|
||||
ContractAndCheckout = false,
|
||||
ContractAndCheckoutInPerson = false,
|
||||
CustomizeCheckout = false,
|
||||
CountPerson = leftWorks?.Count()??0,
|
||||
Insurance = false,
|
||||
InsuranceInPerson = false,
|
||||
RollCall = false,
|
||||
RollCallInPerson = false,
|
||||
};
|
||||
}).ToList();
|
||||
workshopDetails = workshopDetails.Concat(notIncludeWorskhopsInContract).ToList();
|
||||
var res = new InstitutionContractExtensionWorkshopsResponse()
|
||||
{
|
||||
TotalAmount = workshopDetails.Sum(x => x.WorkshopServicesAmount).ToMoney(),
|
||||
@@ -2340,6 +2411,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
{
|
||||
if (request.DiscountPercentage <= 0)
|
||||
throw new BadRequestException("مقدار تخفیف نمیتواند برابر یا کمتر از صفر باشد");
|
||||
if (request.DiscountPercentage>=100)
|
||||
{
|
||||
throw new BadRequestException("مقدار تخفیف نمیتواند برابر یا بیشتر از صد باشد");
|
||||
}
|
||||
var institutionTemp = await _institutionExtensionTemp.Find(x => x.Id == request.TempId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (institutionTemp == null)
|
||||
@@ -2357,7 +2432,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (institutionTemp.OneTimePayment.DiscountPercetage > 0)
|
||||
throw new BadRequestException("تخفیف قبلا برای این قرارداد اعمال شده است");
|
||||
}
|
||||
|
||||
|
||||
var selectedPlan = institutionTemp.Duration switch
|
||||
{
|
||||
InstitutionContractDuration.OneMonth => institutionTemp.OneMonth,
|
||||
@@ -2374,12 +2449,18 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
IsInstallment = request.IsInstallment,
|
||||
OneMonthAmount = selectedPlan.OneMonthPaymentDiscounted.MoneyToDouble()
|
||||
};
|
||||
var res = CalculateDiscount(calculateRequest);
|
||||
var res = CalculateDiscount(calculateRequest,selectedPlan.ContractStart);
|
||||
|
||||
//این به این دلیل هست که متد caclulate discount یکی از مقادیر رو پر میکنه و ما نیاز داریم هر دو مقدار رو داشته باشیم
|
||||
if (request.IsInstallment)
|
||||
{
|
||||
var onetime = institutionTemp.OneTimePayment;
|
||||
onetime.TotalAmountWithoutDiscount = onetime.TotalAmount;
|
||||
|
||||
onetime.OneMonthPaymentWithoutDiscount = selectedPlan.OneMonthPaymentDiscounted;
|
||||
institutionTemp.OneTimePayment.TotalAmountWithoutDiscount = onetime.TotalAmount;
|
||||
institutionTemp.OneTimePayment.OneMonthPaymentWithoutDiscount = selectedPlan.OneMonthPaymentDiscounted;
|
||||
|
||||
res.OneTime = new()
|
||||
{
|
||||
PaymentAmount = onetime.PaymentAmount,
|
||||
@@ -2388,6 +2469,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
DiscountedAmount = onetime.DiscountedAmount,
|
||||
DiscountPercetage = onetime.DiscountPercetage,
|
||||
};
|
||||
|
||||
|
||||
|
||||
institutionTemp.MonthlyPayment = new()
|
||||
{
|
||||
Installments = res.Monthly.Installments,
|
||||
@@ -2396,8 +2480,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
TotalAmount = res.Monthly.TotalAmount,
|
||||
DiscountedAmount = res.Monthly.DiscountedAmount,
|
||||
DiscountPercetage = res.Monthly.DiscountPercetage,
|
||||
TotalAmountWithoutDiscount = institutionTemp.MonthlyPayment.TotalAmount,
|
||||
OneMonthPaymentWithoutDiscount = selectedPlan.OneMonthPaymentDiscounted,
|
||||
};
|
||||
|
||||
|
||||
selectedPlan.TotalPayment = res.Monthly.TotalAmount;
|
||||
selectedPlan.Obligation = res.Monthly.Obligation;
|
||||
selectedPlan.OneMonthPaymentDiscounted = res.Monthly.OneMonthAmount;
|
||||
@@ -2406,6 +2492,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
else
|
||||
{
|
||||
var monthly = institutionTemp.MonthlyPayment;
|
||||
|
||||
institutionTemp.MonthlyPayment.TotalAmountWithoutDiscount = monthly.TotalAmount;
|
||||
|
||||
res.Monthly = new()
|
||||
{
|
||||
PaymentAmount = monthly.PaymentAmount,
|
||||
@@ -2415,6 +2504,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
DiscountPercetage = monthly.DiscountPercetage,
|
||||
Installments = monthly.Installments,
|
||||
};
|
||||
|
||||
|
||||
institutionTemp.OneTimePayment = new()
|
||||
{
|
||||
PaymentAmount = res.OneTime.PaymentAmount,
|
||||
@@ -2422,6 +2513,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
TotalAmount = res.OneTime.TotalAmount,
|
||||
DiscountedAmount = res.OneTime.DiscountedAmount,
|
||||
DiscountPercetage = res.OneTime.DiscountPercetage,
|
||||
TotalAmountWithoutDiscount = institutionTemp.OneTimePayment.TotalAmount,
|
||||
OneMonthPaymentWithoutDiscount = selectedPlan.OneMonthPaymentDiscounted,
|
||||
};
|
||||
selectedPlan.TotalPayment = res.OneTime.TotalAmount;
|
||||
selectedPlan.Obligation = res.OneTime.Obligation;
|
||||
@@ -2480,12 +2573,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (request.IsInstallment)
|
||||
{
|
||||
var prevMonthlyPayment = institutionTemp.MonthlyPayment;
|
||||
var resetTotalAmount = prevMonthlyPayment.TotalAmount.MoneyToDouble() /
|
||||
(1 - (prevMonthlyPayment.DiscountPercetage / 100.0));
|
||||
var resetTotalAmount = prevMonthlyPayment.TotalAmountWithoutDiscount.MoneyToDouble();
|
||||
var resetTax = (resetTotalAmount * 0.10);
|
||||
var paymentAmount = (resetTotalAmount + resetTax);
|
||||
var newOneMonthAmount = selectedPlan.OneMonthPaymentDiscounted.MoneyToDouble() /
|
||||
(1 - (prevMonthlyPayment.DiscountPercetage / 100));
|
||||
var newOneMonthAmount = prevMonthlyPayment.OneMonthPaymentWithoutDiscount.MoneyToDouble();
|
||||
monthlyPayment = new InstitutionContractDiscountMonthlyViewModel()
|
||||
{
|
||||
DiscountPercetage = 0,
|
||||
@@ -2494,7 +2585,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Tax = resetTax.ToMoney(),
|
||||
TotalAmount = resetTotalAmount.ToMoney(),
|
||||
Installments = InstitutionMonthlyInstallmentCaculation((int)institutionTemp.Duration.Value,
|
||||
paymentAmount, DateTime.Now.ToFarsi()),
|
||||
paymentAmount,selectedPlan.ContractStart),
|
||||
OneMonthAmount = newOneMonthAmount.ToMoney(),
|
||||
Obligation = resetTotalAmount.ToMoney()
|
||||
};
|
||||
@@ -2536,11 +2627,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
else
|
||||
{
|
||||
var prevOneTimePayment = institutionTemp.OneTimePayment;
|
||||
var resetTotalAmount = prevOneTimePayment.TotalAmount.MoneyToDouble() /
|
||||
(1 - (prevOneTimePayment.DiscountPercetage / 100.0));
|
||||
var resetTotalAmount = prevOneTimePayment.TotalAmountWithoutDiscount.MoneyToDouble();
|
||||
var resetTax = (resetTotalAmount * 0.10);
|
||||
var newOneMonthAmount = selectedPlan.OneMonthPaymentDiscounted.MoneyToDouble() /
|
||||
(1 - (prevOneTimePayment.DiscountPercetage / 100));
|
||||
var newOneMonthAmount = prevOneTimePayment.OneMonthPaymentWithoutDiscount.MoneyToDouble();
|
||||
|
||||
oneTimePayment = new InstitutionContractDiscountOneTimeViewModel()
|
||||
{
|
||||
@@ -2559,8 +2648,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
TotalAmount = oneTimePayment.TotalAmount,
|
||||
DiscountedAmount = oneTimePayment.DiscountedAmount,
|
||||
DiscountPercetage = oneTimePayment.DiscountPercetage,
|
||||
TotalAmountWithoutDiscount = institutionTemp.OneTimePayment.TotalAmount,
|
||||
OneMonthPaymentWithoutDiscount = institutionTemp.OneTimePayment.OneMonthPaymentWithoutDiscount
|
||||
};
|
||||
selectedPlan.TotalPayment = oneTimePayment.TotalAmount;
|
||||
selectedPlan.TotalPayment = institutionTemp.HasContractInPerson?
|
||||
(oneTimePayment.TotalAmount.MoneyToDouble()/(0.9)).ToMoney()
|
||||
:oneTimePayment.TotalAmount;
|
||||
selectedPlan.Obligation = oneTimePayment.Obligation;
|
||||
selectedPlan.OneMonthPaymentDiscounted = oneTimePayment.OneMonthAmount;
|
||||
selectedPlan.DailyCompenseation = (oneTimePayment.OneMonthAmount.MoneyToDouble() * 0.10).ToMoney();
|
||||
@@ -2816,7 +2909,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
_context.InstitutionContractContactInfos.Add(contactinfo);
|
||||
}
|
||||
}
|
||||
|
||||
await SaveChangesAsync();
|
||||
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
@@ -2827,6 +2919,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
await transaction.CommitAsync();
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -3216,6 +3309,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
PaymentPrice = institution.TotalAmount.ToMoney(),
|
||||
TotalPrice = (institution.TotalAmount - institution.ValueAddedTax).ToMoney(),
|
||||
TaxPrice = institution.ValueAddedTax.ToMoney(),
|
||||
OneMonthPrice = institution.ContractAmountWithTax.ToMoney(),
|
||||
OneMonthWithoutTax = institution.ContractAmount.ToMoney(),
|
||||
OneMonthTax = institution.ContractAmountTax.ToMoney(),
|
||||
VerifierFullName = institution.VerifierFullName,
|
||||
VerifierPhoneNumber = institution.VerifierPhoneNumber,
|
||||
VerifyCode = institution.VerifyCode,
|
||||
@@ -3469,7 +3565,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (checkAnyToExecute)
|
||||
{
|
||||
//اجرای تسک
|
||||
|
||||
_logger.LogInformation("اجرای تسک پیامک های یاد آور SendReminderSmsForBackgroundTask" + persianNow + " - " + hour + ":" + minute);
|
||||
//دریافت لیست بدهکاران
|
||||
var smsListData = await GetSmsListData(now, TypeOfSmsSetting.InstitutionContractDebtReminder);
|
||||
string typeOfSms = "یادآور بدهی ماهانه";
|
||||
@@ -4244,6 +4340,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
{
|
||||
string name = item.PartyName.Length > 18 ? item.PartyName.Substring(0, 18) : item.PartyName;
|
||||
string errMess = $"{name}-خطا";
|
||||
_logger.LogError(errMess);
|
||||
await _smsService.Alarm("09114221321", errMess);
|
||||
}
|
||||
|
||||
@@ -4357,7 +4454,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (checkAnyToExecute)
|
||||
{
|
||||
//اجرای تسک
|
||||
|
||||
_logger.LogInformation("اجرای تسک ارسال یاد آور تایید قراداد مالی SendInstitutionContractConfirmSms" + persianNow + " - " + hour + ":" + minute);
|
||||
//دریافت لیست قراداد های تایید نشده
|
||||
var fromAmonthAgo = now.AddDays(-30);
|
||||
var pendingContracts = await _context.InstitutionContractSet
|
||||
@@ -4377,8 +4474,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
string typeOfSms = "یادآور تایید قرارداد مالی";
|
||||
foreach (var item in pendingContracts)
|
||||
{
|
||||
|
||||
var sendResult = await _smsService.SendInstitutionCreationVerificationLink(item.Number, item.FullName,
|
||||
item.InstitutionId, item.ContractingPartyId, item.InstitutionContractId, typeOfSms);
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
Console.WriteLine("executed at : " + persianNow + " - " + hour + ":" + minute);
|
||||
@@ -4430,12 +4529,13 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
TypeOfContract = x.TypeOfContract,
|
||||
IsInstallment = x.IsInstallment,
|
||||
VerificationStatus = x.VerificationStatus,
|
||||
SigningType = x.SigningType,
|
||||
InstallmentList = x.Installments
|
||||
.Select(ins => new InstitutionContractInstallmentViewModel
|
||||
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
|
||||
.OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(),
|
||||
}).Where(x =>
|
||||
x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0)
|
||||
x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
|
||||
.ToListAsync();
|
||||
|
||||
#endregion
|
||||
@@ -4453,13 +4553,13 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
|
||||
#region GetDectivedContractOnCurrentMonth
|
||||
|
||||
|
||||
if (futureContracts.Any())
|
||||
{
|
||||
List<long> futureContractIds = futureContracts.Select(x => x.ContractingPartyId).ToList();
|
||||
List<InstitutionContractViewModel> deatcivedContract = await _context.InstitutionContractSet
|
||||
.Where(x => x.IsActiveString == "false" && futureContractIds.Contains(x.ContractingPartyId) &&
|
||||
x.ContractEndGr.Date == endOfCurrentMonth.Date && x.ContractAmount > 0)
|
||||
x.ContractEndGr.Date == endOfCurrentMonth.Date && x.ContractAmount > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
|
||||
.Select(x => new InstitutionContractViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
@@ -4474,6 +4574,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
TypeOfContract = x.TypeOfContract,
|
||||
IsInstallment = x.IsInstallment,
|
||||
VerificationStatus = x.VerificationStatus,
|
||||
SigningType = x.SigningType,
|
||||
InstallmentList = x.Installments
|
||||
.Select(ins => new InstitutionContractInstallmentViewModel
|
||||
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
|
||||
@@ -4484,6 +4585,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
institutionContracts.AddRange(deatcivedContract);
|
||||
}
|
||||
|
||||
// قرارداد هایی که پطور یکجا پرداخت شده اند
|
||||
var paidInFull = institutionContracts.Where(x =>
|
||||
x.SigningType != InstitutionContractSigningType.Legacy && x.IsInstallment == false && x.SigningType != null).ToList();
|
||||
|
||||
//حذف قراداد هایی که یکجا پرداخت شده اند از لیست ایجاد سند ماهانه
|
||||
institutionContracts = institutionContracts.Except(paidInFull).ToList();
|
||||
|
||||
#region RollCallServicCompute
|
||||
|
||||
@@ -4531,8 +4638,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
if (!alreadyCreated)
|
||||
{
|
||||
if (item.IsInstallment &&
|
||||
item.VerificationStatus == InstitutionContractVerificationStatus.Verified)
|
||||
if (item.IsInstallment)
|
||||
{
|
||||
var instalment = item.InstallmentList
|
||||
.FirstOrDefault(x =>
|
||||
@@ -4566,8 +4672,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
await _financialStatmentRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
if (item.IsInstallment &&
|
||||
item.VerificationStatus == InstitutionContractVerificationStatus.Verified)
|
||||
if (item.IsInstallment)
|
||||
{
|
||||
var instalment = item.InstallmentList
|
||||
.FirstOrDefault(x =>
|
||||
@@ -4594,12 +4699,17 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
|
||||
#region RollCallServicCompute
|
||||
|
||||
if (item.VerificationStatus != InstitutionContractVerificationStatus.Verified &&
|
||||
!item.IsInstallment && item.ContractingPartyId != 30520 && item.ContractingPartyId != 30739)
|
||||
//ایجاد سند مالی حضورغیاب
|
||||
//قرارداد هایی که جدید نیستند و اقساط ندارند
|
||||
//کارگاه های استثناء : کباب مهدی 30520 و نمونه پروتئین 30739
|
||||
if (item.SigningType != InstitutionContractSigningType.OtpBased && item.SigningType != InstitutionContractSigningType.Physical
|
||||
&& !item.IsInstallment && item.ContractingPartyId != 30520 && item.ContractingPartyId != 30739)
|
||||
{
|
||||
try
|
||||
{
|
||||
//TODO
|
||||
//@refactor Need
|
||||
|
||||
var employers = await _context.Employers
|
||||
.Where(x => x.ContractingPartyId == item.ContractingPartyId)
|
||||
.Select(x => x.id).ToListAsync();
|
||||
@@ -4774,6 +4884,20 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.Select(x => x.id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<InstitutionContract> GetPreviousContract(long currentInstitutionContractId)
|
||||
{
|
||||
var institutionContract =await _context.InstitutionContractSet
|
||||
.FirstOrDefaultAsync(x=>x.id ==currentInstitutionContractId);
|
||||
if (institutionContract == null)
|
||||
return null;
|
||||
var previousContract = await _context.InstitutionContractSet
|
||||
.Where(x => x.ContractingPartyId == institutionContract.ContractingPartyId)
|
||||
.Where(x => x.ContractStartGr < institutionContract.ContractStartGr)
|
||||
.OrderByDescending(x => x.ContractEndGr)
|
||||
.FirstOrDefaultAsync();
|
||||
return previousContract;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
@@ -1777,19 +1777,67 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel)
|
||||
public async Task<PagedResult<InsuranceClientListViewModel>> GetInsuranceClientList(InsuranceClientSearchModel searchModel)
|
||||
{
|
||||
var workshopId = _authHelper.GetWorkshopId();
|
||||
var query = _context.InsuranceListSet
|
||||
.Select(x => new InsuranceClientListViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
WorkShopId = x.WorkshopId,
|
||||
Year = x.Year,
|
||||
YearInt = Convert.ToInt32(x.Year),
|
||||
Month = x.Month,
|
||||
MonthName = x.Month.ToFarsiMonthByNumber(),
|
||||
MonthInt = Convert.ToInt32(x.Month),
|
||||
}).Where(x => x.WorkShopId == workshopId);
|
||||
|
||||
|
||||
if (searchModel.Year>0)
|
||||
{
|
||||
query = query.Where(x => x.YearInt == searchModel.Year);
|
||||
}
|
||||
if (searchModel.Month > 0)
|
||||
{
|
||||
query = query.Where(x => x.MonthInt == searchModel.Month);
|
||||
}
|
||||
|
||||
var res = new PagedResult<InsuranceClientListViewModel>
|
||||
{
|
||||
TotalCount = query.Count()
|
||||
};
|
||||
query = searchModel.Sorting switch
|
||||
{
|
||||
"CreationDate-Max" => query.OrderByDescending(x => x.Id),
|
||||
"CreationDate-Min" => query.OrderBy(x => x.Id),
|
||||
"Month-Max" => query.OrderByDescending(x => x.MonthInt),
|
||||
"Month-Min" => query.OrderBy(x => x.MonthInt),
|
||||
"Year-Max" => query.OrderByDescending(x => x.YearInt),
|
||||
"Year-Min" => query.OrderBy(x => x.YearInt),
|
||||
_ => query.OrderByDescending(x => x.Id),
|
||||
};
|
||||
res.List =await query.ApplyPagination(searchModel.PageIndex,searchModel.PageSize).ToListAsync();
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel)
|
||||
{
|
||||
if (string.IsNullOrEmpty(searchModel.Month) || string.IsNullOrEmpty(searchModel.Year))
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
var workshopsHasInsuranceAccount = await _accountContext
|
||||
.AccountLeftWorks
|
||||
.Where(x => StaticWorkshopAccounts.InsuranceAccountsRoleIds.Contains(x.RoleId) && x.IsActive)
|
||||
.Select(x => x.WorkshopId).Distinct().ToListAsync();
|
||||
var acountId = _authHelper.CurrentAccountId();
|
||||
var accountWorkshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountId)
|
||||
var accountWorkshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountId && workshopsHasInsuranceAccount.Contains(x.WorkshopId))
|
||||
.Select(x => x.WorkshopId);
|
||||
var firstDayOfMonth = $"{searchModel.Year}/{searchModel.Month}/01".ToGeorgianDateTime();
|
||||
var insuranceWorkshops = _context.Workshops
|
||||
.Where(x => x.InsuranceCode != null && x.InsuranceCode.Length >= 10 && accountWorkshopIds.Contains(x.id) &&
|
||||
.Where(x => accountWorkshopIds.Contains(x.id) &&
|
||||
x.IsActiveString == "true");
|
||||
|
||||
|
||||
@@ -1812,7 +1860,7 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
WorkShopId = result.id,
|
||||
WorkShopCode = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.InsuranceCode
|
||||
: result.InsuranceCode,
|
||||
: string.IsNullOrWhiteSpace(result.InsuranceCode) ? "کد کارگاهی ندارد" : result.InsuranceCode,
|
||||
WorkShopName = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.WorkshopName
|
||||
: result.WorkshopFullName,
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
@@ -44,6 +46,7 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
|
||||
public List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron)
|
||||
{
|
||||
var planPercentage = _context.PlanPercentages.FirstOrDefault();
|
||||
@@ -303,4 +306,109 @@ public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IP
|
||||
|
||||
return new InstitutionPlanViewModel();
|
||||
}
|
||||
|
||||
|
||||
#region ForApi
|
||||
|
||||
public async Task<CreateServiceAmountDto> GetCreateModalData()
|
||||
{
|
||||
return await _context.PlanPercentages.Select(x => new CreateServiceAmountDto()
|
||||
{
|
||||
Id = x.id,
|
||||
ContractAndCheckoutInPersonPercentStr = $"{x.ContractAndCheckoutInPersonPercent}",
|
||||
CustomizeCheckoutPercentStr = $"{x.CustomizeCheckoutPercent}",
|
||||
ContractAndCheckoutPercentStr = $"{x.ContractAndCheckoutPercent}",
|
||||
InsuranceInPersonPercentStr = $"{x.InsuranceInPersonPercent}",
|
||||
InsurancePercentStr = $"{x.InsurancePercent}",
|
||||
RollCallPercentStr = $"{x.RollCallPercent}",
|
||||
}).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
|
||||
public async Task<PagedResult<InstitutionPlanListDto>> GetList(
|
||||
InstitutionPlanSearchModel searchModel)
|
||||
{
|
||||
var planPercentage = await _context.PlanPercentages.FirstOrDefaultAsync();
|
||||
if (planPercentage == null)
|
||||
return new PagedResult<InstitutionPlanListDto>();
|
||||
var dailyWageYearlySalery = await _context.YearlySalaries.Include(i => i.YearlySalaryItemsList).FirstOrDefaultAsync(x =>
|
||||
x.StartDate.Date <= DateTime.Now.Date && x.EndDate >= DateTime.Now.Date);
|
||||
if (dailyWageYearlySalery == null)
|
||||
return new PagedResult<InstitutionPlanListDto>();
|
||||
|
||||
var dailyWage = dailyWageYearlySalery.YearlySalaryItemsList.Where(x => x.ItemName == "مزد روزانه")
|
||||
.Select(x => x.ItemValue).FirstOrDefault();
|
||||
|
||||
var plans = _context.InstitutionPlans.AsQueryable();
|
||||
if (searchModel.CountPerson > 0)
|
||||
plans = plans.Where(x => x.CountPerson == searchModel.CountPerson);
|
||||
|
||||
var count = await plans.CountAsync();
|
||||
|
||||
var planQueryFilter =await plans.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync();
|
||||
var planResult = planQueryFilter.Select(plan =>
|
||||
new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckoutDouble =
|
||||
((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
InsuranceDouble = (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
RollCallDouble = (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
CustomizeCheckoutDouble = (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) *
|
||||
plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
ContractAndCheckoutInPersonDouble =
|
||||
(((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
InsuranceInPersonDouble = (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) *
|
||||
plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
}).ToList();
|
||||
|
||||
var finalResult = planResult.Select(plan => new InstitutionPlanListDto()
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckout = plan.ContractAndCheckoutDouble.ToMoney(),
|
||||
|
||||
Insurance = plan.InsuranceDouble.ToMoney(),
|
||||
|
||||
RollCall = plan.RollCallDouble.ToMoney(),
|
||||
|
||||
CustomizeCheckout = plan.CustomizeCheckoutDouble.ToMoney(),
|
||||
|
||||
ContractAndCheckoutInPerson = plan.ContractAndCheckoutInPersonDouble.ToMoney(),
|
||||
|
||||
InsuranceInPerson = plan.InsuranceInPersonDouble.ToMoney(),
|
||||
|
||||
InPersonSumAmountStr =
|
||||
(plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble +
|
||||
plan.InsuranceInPersonDouble).ToMoney(),
|
||||
|
||||
OnlineAndInPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble +
|
||||
plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble +
|
||||
plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
OnlineOnlySumAmountStr =
|
||||
(plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.RollCallDouble +
|
||||
plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
}).ToList();
|
||||
|
||||
return new PagedResult<InstitutionPlanListDto>()
|
||||
{
|
||||
TotalCount = count,
|
||||
List = finalResult
|
||||
};
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1994,8 +1994,9 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
case "شنبه":
|
||||
w1 = 7;
|
||||
w2 = 14;
|
||||
w3 = 28;
|
||||
w4 = 31;
|
||||
w3 = 21;
|
||||
w4 = 28;
|
||||
w5 = 31;
|
||||
break;
|
||||
case "یکشنبه":
|
||||
w1 = 6;
|
||||
@@ -2361,6 +2362,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using Company.Domain.SmsResultAgg;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
@@ -10,6 +6,11 @@ using IPE.SmsIrClient;
|
||||
using IPE.SmsIrClient.Models.Requests;
|
||||
using IPE.SmsIrClient.Models.Results;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SmsResult = Company.Domain.SmsResultAgg.SmsResult;
|
||||
|
||||
|
||||
@@ -17,521 +18,531 @@ namespace CompanyManagment.EFCore.Services;
|
||||
|
||||
public class SmsService : ISmsService
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ISmsResultRepository _smsResultRepository;
|
||||
private readonly bool _isDevEnvironment;
|
||||
private readonly List<string> _testNumbers;
|
||||
public SmsIr SmsIr { get; set; }
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ISmsResultRepository _smsResultRepository;
|
||||
private readonly bool _isDevEnvironment;
|
||||
private readonly List<string> _testNumbers;
|
||||
private readonly ILogger<SmsService> _logger;
|
||||
public SmsIr SmsIr { get; set; }
|
||||
|
||||
|
||||
public SmsService(IConfiguration configuration, ISmsResultRepository smsResultRepository)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_smsResultRepository = smsResultRepository;
|
||||
SmsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
public SmsService(IConfiguration configuration, ISmsResultRepository smsResultRepository, ILogger<SmsService> logger)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_smsResultRepository = smsResultRepository;
|
||||
_logger = logger;
|
||||
SmsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
// خواندن تنظیمات SMS از appsettings
|
||||
var smsSettings = _configuration.GetSection("SmsSettings");
|
||||
_isDevEnvironment = smsSettings.GetValue<bool>("IsTestMode");
|
||||
_testNumbers = smsSettings.GetSection("TestNumbers").Get<List<string>>() ?? new List<string>();
|
||||
}
|
||||
// خواندن تنظیمات SMS از appsettings
|
||||
var smsSettings = _configuration.GetSection("SmsSettings");
|
||||
_isDevEnvironment = smsSettings.GetValue<bool>("IsTestMode");
|
||||
_testNumbers = smsSettings.GetSection("TestNumbers").Get<List<string>>() ?? new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// متد مرکزی برای ارسال پیامک که محیط dev را چک میکند
|
||||
/// </summary>
|
||||
private async Task<SmsIrResult<VerifySendResult>> VerifySendSmsAsync(string number, int templateId, VerifySendParameter[] parameters)
|
||||
{
|
||||
// اگر محیط dev است و شمارههای تست وجود دارد، به شمارههای تست ارسال میشود
|
||||
if (_isDevEnvironment && _testNumbers is { Count: > 0 })
|
||||
{
|
||||
// ارسال به همه شمارههای تست
|
||||
SmsIrResult<VerifySendResult> lastResult = null;
|
||||
foreach (var testNumber in _testNumbers)
|
||||
{
|
||||
lastResult = await SmsIr.VerifySendAsync(testNumber, templateId, parameters);
|
||||
}
|
||||
return lastResult; // برگرداندن نتیجه آخرین ارسال
|
||||
}
|
||||
else
|
||||
{
|
||||
// ارسال به شماره واقعی
|
||||
return await SmsIr.VerifySendAsync(number, templateId, parameters);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// متد مرکزی برای ارسال پیامک که محیط dev را چک میکند
|
||||
/// </summary>
|
||||
private async Task<SmsIrResult<VerifySendResult>> VerifySendSmsAsync(string number, int templateId, VerifySendParameter[] parameters)
|
||||
{
|
||||
// اگر محیط dev است و شمارههای تست وجود دارد، به شمارههای تست ارسال میشود
|
||||
if (_isDevEnvironment && _testNumbers is { Count: > 0 })
|
||||
{
|
||||
// ارسال به همه شمارههای تست
|
||||
SmsIrResult<VerifySendResult> lastResult = null;
|
||||
foreach (var testNumber in _testNumbers)
|
||||
{
|
||||
lastResult = await SmsIr.VerifySendAsync(testNumber, templateId, parameters);
|
||||
}
|
||||
return lastResult; // برگرداندن نتیجه آخرین ارسال
|
||||
}
|
||||
else
|
||||
{
|
||||
// ارسال به شماره واقعی
|
||||
return await SmsIr.VerifySendAsync(number, templateId, parameters);
|
||||
}
|
||||
}
|
||||
|
||||
public void Send(string number, string message)
|
||||
{
|
||||
//var token = GetToken();
|
||||
//var lines = new SmsLine().GetSmsLines(token);
|
||||
//if (lines == null) return;
|
||||
public void Send(string number, string message)
|
||||
{
|
||||
//var token = GetToken();
|
||||
//var lines = new SmsLine().GetSmsLines(token);
|
||||
//if (lines == null) return;
|
||||
|
||||
//var line = lines.SMSLines.Last().LineNumber.ToString();
|
||||
//var data = new MessageSendObject
|
||||
//{
|
||||
// Messages = new List<string>
|
||||
// {message}.ToArray(),
|
||||
// MobileNumbers = new List<string> {number}.ToArray(),
|
||||
// LineNumber = line,
|
||||
// SendDateTime = DateTime.Now,
|
||||
// CanContinueInCaseOfError = true
|
||||
//};
|
||||
//var messageSendResponseObject =
|
||||
// new MessageSend().Send(token, data);
|
||||
//var line = lines.SMSLines.Last().LineNumber.ToString();
|
||||
//var data = new MessageSendObject
|
||||
//{
|
||||
// Messages = new List<string>
|
||||
// {message}.ToArray(),
|
||||
// MobileNumbers = new List<string> {number}.ToArray(),
|
||||
// LineNumber = line,
|
||||
// SendDateTime = DateTime.Now,
|
||||
// CanContinueInCaseOfError = true
|
||||
//};
|
||||
//var messageSendResponseObject =
|
||||
// new MessageSend().Send(token, data);
|
||||
|
||||
//if (messageSendResponseObject.IsSuccessful) return;
|
||||
//if (messageSendResponseObject.IsSuccessful) return;
|
||||
|
||||
//line = lines.SMSLines.First().LineNumber.ToString();
|
||||
//data.LineNumber = line;
|
||||
//new MessageSend().Send(token, data);
|
||||
}
|
||||
public bool VerifySend(string number, string message)
|
||||
{
|
||||
var verificationSendResult = VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", message) });
|
||||
Thread.Sleep(2000);
|
||||
if (verificationSendResult.IsCompletedSuccessfully)
|
||||
{
|
||||
//line = lines.SMSLines.First().LineNumber.ToString();
|
||||
//data.LineNumber = line;
|
||||
//new MessageSend().Send(token, data);
|
||||
}
|
||||
public bool VerifySend(string number, string message)
|
||||
{
|
||||
var verificationSendResult = VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", message) });
|
||||
Thread.Sleep(2000);
|
||||
if (verificationSendResult.IsCompletedSuccessfully)
|
||||
{
|
||||
|
||||
var resStartStatus = verificationSendResult.Result;
|
||||
var b = resStartStatus.Status;
|
||||
var resResult = verificationSendResult.Status;
|
||||
var a = verificationSendResult.IsCompleted;
|
||||
var reseExceptiont = verificationSendResult.Exception;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
var resStartStatus = verificationSendResult.Result;
|
||||
var b = resStartStatus.Status;
|
||||
var resResult = verificationSendResult.Status;
|
||||
var a = verificationSendResult.IsCompleted;
|
||||
var reseExceptiont = verificationSendResult.Exception;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var resStartStatus = verificationSendResult.Status;
|
||||
var resResult = verificationSendResult.Status;
|
||||
var reseExceptiont = verificationSendResult.Exception;
|
||||
var resStartStatus = verificationSendResult.Status;
|
||||
var resResult = verificationSendResult.Status;
|
||||
var reseExceptiont = verificationSendResult.Exception;
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public bool LoginSend(string number, string message)
|
||||
{
|
||||
var verificationSendResult = VerifySendSmsAsync(number, 635330, new VerifySendParameter[] { new VerifySendParameter("LOGINCODE", message) });
|
||||
Thread.Sleep(2000);
|
||||
if (verificationSendResult.IsCompletedSuccessfully)
|
||||
{
|
||||
public bool LoginSend(string number, string message)
|
||||
{
|
||||
var verificationSendResult = VerifySendSmsAsync(number, 635330, new VerifySendParameter[] { new VerifySendParameter("LOGINCODE", message) });
|
||||
Thread.Sleep(2000);
|
||||
if (verificationSendResult.IsCompletedSuccessfully)
|
||||
{
|
||||
|
||||
var resStartStatus = verificationSendResult.Result;
|
||||
var b = resStartStatus.Status;
|
||||
var resResult = verificationSendResult.Status;
|
||||
var a = verificationSendResult.IsCompleted;
|
||||
var reseExceptiont = verificationSendResult.Exception;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
var resStartStatus = verificationSendResult.Result;
|
||||
var b = resStartStatus.Status;
|
||||
var resResult = verificationSendResult.Status;
|
||||
var a = verificationSendResult.IsCompleted;
|
||||
var reseExceptiont = verificationSendResult.Exception;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var resStartStatus = verificationSendResult.Status;
|
||||
var resResult = verificationSendResult.Status;
|
||||
var reseExceptiont = verificationSendResult.Exception;
|
||||
var resStartStatus = verificationSendResult.Status;
|
||||
var resResult = verificationSendResult.Status;
|
||||
var reseExceptiont = verificationSendResult.Exception;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code)
|
||||
{
|
||||
var result = new SentSmsViewModel();
|
||||
var sendResult = await VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
|
||||
Thread.Sleep(2000);
|
||||
public async Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code)
|
||||
{
|
||||
var result = new SentSmsViewModel();
|
||||
var sendResult = await VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
|
||||
Thread.Sleep(2000);
|
||||
|
||||
if (sendResult.Message == "موفق")
|
||||
{
|
||||
var status = sendResult.Status;
|
||||
var message = sendResult.Message;
|
||||
var messaeId = sendResult.Data.MessageId;
|
||||
return result.Succedded(status, message, messaeId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var status = sendResult.Status;
|
||||
var message = sendResult.Message;
|
||||
var messaeId = sendResult.Data.MessageId;
|
||||
return result.Failed(status, message, messaeId);
|
||||
}
|
||||
}
|
||||
if (sendResult.Message == "موفق")
|
||||
{
|
||||
var status = sendResult.Status;
|
||||
var message = sendResult.Message;
|
||||
var messaeId = sendResult.Data.MessageId;
|
||||
return result.Succedded(status, message, messaeId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var status = sendResult.Status;
|
||||
var message = sendResult.Message;
|
||||
var messaeId = sendResult.Data.MessageId;
|
||||
return result.Failed(status, message, messaeId);
|
||||
}
|
||||
}
|
||||
|
||||
public bool SendAccountsInfo(string number, string fullName, string userName)
|
||||
{
|
||||
public bool SendAccountsInfo(string number, string fullName, string userName)
|
||||
{
|
||||
|
||||
var checkLength = fullName.Length;
|
||||
if (checkLength > 25)
|
||||
fullName = fullName.Substring(0, 24);
|
||||
var checkLength = fullName.Length;
|
||||
if (checkLength > 25)
|
||||
fullName = fullName.Substring(0, 24);
|
||||
|
||||
var sendResult = VerifySendSmsAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
|
||||
var sendResult = VerifySendSmsAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
|
||||
|
||||
|
||||
Console.WriteLine(userName + " - " + sendResult.Result.Status);
|
||||
if (sendResult.IsCompletedSuccessfully)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Console.WriteLine(userName + " - " + sendResult.Result.Status);
|
||||
if (sendResult.IsCompletedSuccessfully)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ApiResultViewModel> GetByMessageId(int messId)
|
||||
{
|
||||
public async Task<ApiResultViewModel> GetByMessageId(int messId)
|
||||
{
|
||||
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var response = await smsIr.GetReportAsync(messId);
|
||||
MessageReportResult messages = response.Data;
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var response = await smsIr.GetReportAsync(messId);
|
||||
MessageReportResult messages = response.Data;
|
||||
|
||||
var appendData = new ApiResultViewModel()
|
||||
{
|
||||
MessageId = messages.MessageId,
|
||||
LineNumber = messages.LineNumber,
|
||||
Mobile = messages.Mobile,
|
||||
MessageText = messages.MessageText,
|
||||
SendUnixTime = UnixTimeStampToDateTime(messages.SendDateTime),
|
||||
DeliveryState = DeliveryStatus(messages.DeliveryState),
|
||||
DeliveryUnixTime = UnixTimeStampToDateTime(messages.DeliveryDateTime),
|
||||
DeliveryColor = DeliveryColorStatus(messages.DeliveryState),
|
||||
};
|
||||
return appendData;
|
||||
}
|
||||
public async Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate)
|
||||
{
|
||||
var st = new DateTime(2024, 6, 2);
|
||||
var ed = new DateTime(2024, 7, 1);
|
||||
if (!string.IsNullOrWhiteSpace(startDate) && startDate.Length == 10)
|
||||
{
|
||||
st = startDate.ToGeorgianDateTime();
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(endDate) && endDate.Length == 10)
|
||||
{
|
||||
ed = endDate.ToGeorgianDateTime();
|
||||
}
|
||||
var res = new List<ApiResultViewModel>();
|
||||
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
Int32 unixTimestamp2 = (int)ed.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
// int? fromDateUnixTime = null; // unix time - for instance: 1700598600
|
||||
//int? toDateUnixTime = null; // unix time - for instance: 1703190600
|
||||
int pageNumber = 2;
|
||||
int pageSize = 100; // max: 100
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var response = await smsIr.GetArchivedReportAsync(pageNumber, pageSize, unixTimestamp, unixTimestamp2);
|
||||
var appendData = new ApiResultViewModel()
|
||||
{
|
||||
MessageId = messages.MessageId,
|
||||
LineNumber = messages.LineNumber,
|
||||
Mobile = messages.Mobile,
|
||||
MessageText = messages.MessageText,
|
||||
SendUnixTime = UnixTimeStampToDateTime(messages.SendDateTime),
|
||||
DeliveryState = DeliveryStatus(messages.DeliveryState),
|
||||
DeliveryUnixTime = UnixTimeStampToDateTime(messages.DeliveryDateTime),
|
||||
DeliveryColor = DeliveryColorStatus(messages.DeliveryState),
|
||||
};
|
||||
return appendData;
|
||||
}
|
||||
public async Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate)
|
||||
{
|
||||
var st = new DateTime(2024, 6, 2);
|
||||
var ed = new DateTime(2024, 7, 1);
|
||||
if (!string.IsNullOrWhiteSpace(startDate) && startDate.Length == 10)
|
||||
{
|
||||
st = startDate.ToGeorgianDateTime();
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(endDate) && endDate.Length == 10)
|
||||
{
|
||||
ed = endDate.ToGeorgianDateTime();
|
||||
}
|
||||
var res = new List<ApiResultViewModel>();
|
||||
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
Int32 unixTimestamp2 = (int)ed.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
// int? fromDateUnixTime = null; // unix time - for instance: 1700598600
|
||||
//int? toDateUnixTime = null; // unix time - for instance: 1703190600
|
||||
int pageNumber = 2;
|
||||
int pageSize = 100; // max: 100
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var response = await smsIr.GetArchivedReportAsync(pageNumber, pageSize, unixTimestamp, unixTimestamp2);
|
||||
|
||||
MessageReportResult[] messages = response.Data;
|
||||
foreach (var message in messages)
|
||||
{
|
||||
var appendData = new ApiResultViewModel()
|
||||
{
|
||||
MessageId = message.MessageId,
|
||||
LineNumber = message.LineNumber,
|
||||
Mobile = message.Mobile,
|
||||
MessageText = message.MessageText,
|
||||
SendUnixTime = UnixTimeStampToDateTime(message.SendDateTime),
|
||||
DeliveryState = DeliveryStatus(message.DeliveryState),
|
||||
DeliveryUnixTime = UnixTimeStampToDateTime(message.DeliveryDateTime),
|
||||
DeliveryColor = DeliveryColorStatus(message.DeliveryState),
|
||||
};
|
||||
res.Add(appendData);
|
||||
}
|
||||
MessageReportResult[] messages = response.Data;
|
||||
foreach (var message in messages)
|
||||
{
|
||||
var appendData = new ApiResultViewModel()
|
||||
{
|
||||
MessageId = message.MessageId,
|
||||
LineNumber = message.LineNumber,
|
||||
Mobile = message.Mobile,
|
||||
MessageText = message.MessageText,
|
||||
SendUnixTime = UnixTimeStampToDateTime(message.SendDateTime),
|
||||
DeliveryState = DeliveryStatus(message.DeliveryState),
|
||||
DeliveryUnixTime = UnixTimeStampToDateTime(message.DeliveryDateTime),
|
||||
DeliveryColor = DeliveryColorStatus(message.DeliveryState),
|
||||
};
|
||||
res.Add(appendData);
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public string DeliveryStatus(byte? dv)
|
||||
{
|
||||
string mess = "";
|
||||
switch (dv)
|
||||
{
|
||||
case 1:
|
||||
mess = "رسیده به گوشی";
|
||||
break;
|
||||
case 2:
|
||||
mess = "نرسیده به گوشی";
|
||||
break;
|
||||
case 3:
|
||||
mess = "پردازش در مخابرات";
|
||||
break;
|
||||
case 4:
|
||||
mess = "نرسیده به مخابرات";
|
||||
break;
|
||||
case 5:
|
||||
mess = "سیده به مخابرات";
|
||||
break;
|
||||
case 6:
|
||||
mess = "خطا";
|
||||
break;
|
||||
case 7:
|
||||
mess = "لیست سیاه";
|
||||
break;
|
||||
default:
|
||||
mess = "";
|
||||
break;
|
||||
public string DeliveryStatus(byte? dv)
|
||||
{
|
||||
string mess = "";
|
||||
switch (dv)
|
||||
{
|
||||
case 1:
|
||||
mess = "رسیده به گوشی";
|
||||
break;
|
||||
case 2:
|
||||
mess = "نرسیده به گوشی";
|
||||
break;
|
||||
case 3:
|
||||
mess = "پردازش در مخابرات";
|
||||
break;
|
||||
case 4:
|
||||
mess = "نرسیده به مخابرات";
|
||||
break;
|
||||
case 5:
|
||||
mess = "سیده به مخابرات";
|
||||
break;
|
||||
case 6:
|
||||
mess = "خطا";
|
||||
break;
|
||||
case 7:
|
||||
mess = "لیست سیاه";
|
||||
break;
|
||||
default:
|
||||
mess = "";
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return mess;
|
||||
}
|
||||
public string DeliveryColorStatus(byte? dv)
|
||||
{
|
||||
string mess = "";
|
||||
switch (dv)
|
||||
{
|
||||
case 1:
|
||||
mess = "successSend";
|
||||
break;
|
||||
case 2:
|
||||
mess = "errSend";
|
||||
break;
|
||||
case 3:
|
||||
mess = "pSend";
|
||||
break;
|
||||
case 4:
|
||||
mess = "noSend";
|
||||
break;
|
||||
case 5:
|
||||
mess = "itcSend";
|
||||
break;
|
||||
case 6:
|
||||
mess = "redSend";
|
||||
break;
|
||||
case 7:
|
||||
mess = "blockSend";
|
||||
break;
|
||||
default:
|
||||
mess = "";
|
||||
break;
|
||||
return mess;
|
||||
}
|
||||
public string DeliveryColorStatus(byte? dv)
|
||||
{
|
||||
string mess = "";
|
||||
switch (dv)
|
||||
{
|
||||
case 1:
|
||||
mess = "successSend";
|
||||
break;
|
||||
case 2:
|
||||
mess = "errSend";
|
||||
break;
|
||||
case 3:
|
||||
mess = "pSend";
|
||||
break;
|
||||
case 4:
|
||||
mess = "noSend";
|
||||
break;
|
||||
case 5:
|
||||
mess = "itcSend";
|
||||
break;
|
||||
case 6:
|
||||
mess = "redSend";
|
||||
break;
|
||||
case 7:
|
||||
mess = "blockSend";
|
||||
break;
|
||||
default:
|
||||
mess = "";
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return mess;
|
||||
}
|
||||
public string UnixTimeStampToDateTime(int? unixTimeStamp)
|
||||
{
|
||||
if (unixTimeStamp != null)
|
||||
{
|
||||
// Unix timestamp is seconds past epoch
|
||||
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
dateTime = dateTime.AddSeconds(Convert.ToDouble(unixTimeStamp)).ToLocalTime();
|
||||
var time = dateTime.ToFarsiFull();
|
||||
return time;
|
||||
}
|
||||
return mess;
|
||||
}
|
||||
public string UnixTimeStampToDateTime(int? unixTimeStamp)
|
||||
{
|
||||
if (unixTimeStamp != null)
|
||||
{
|
||||
// Unix timestamp is seconds past epoch
|
||||
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
dateTime = dateTime.AddSeconds(Convert.ToDouble(unixTimeStamp)).ToLocalTime();
|
||||
var time = dateTime.ToFarsiFull();
|
||||
return time;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
private string GetToken()
|
||||
{
|
||||
return "";
|
||||
//var smsSecrets = _configuration.GetSection("SmsSecrets");
|
||||
//var tokenService = new Token();
|
||||
//return tokenService.GetToken("x-api-key", "Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
private string GetToken()
|
||||
{
|
||||
return "";
|
||||
//var smsSecrets = _configuration.GetSection("SmsSecrets");
|
||||
//var tokenService = new Token();
|
||||
//return tokenService.GetToken("x-api-key", "Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
}
|
||||
|
||||
#region Mahan
|
||||
#region Mahan
|
||||
|
||||
public async Task<double> GetCreditAmount()
|
||||
{
|
||||
try
|
||||
{
|
||||
var credit = await SmsIr.GetCreditAsync();
|
||||
return (double)credit.Data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
public async Task<double> GetCreditAmount()
|
||||
{
|
||||
try
|
||||
{
|
||||
var credit = await SmsIr.GetCreditAsync();
|
||||
return (double)credit.Data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId, string typeOfSms)
|
||||
{
|
||||
public async Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId, string typeOfSms)
|
||||
{
|
||||
typeOfSms = string.IsNullOrWhiteSpace(typeOfSms) ? "لینک تاییدیه ایجاد قرارداد مالی" : typeOfSms;
|
||||
|
||||
|
||||
|
||||
|
||||
var full = fullName;
|
||||
var fullName1 = fullName;
|
||||
if (fullName.Length >= 25)
|
||||
{
|
||||
fullName1 = fullName.Substring(0, 25);
|
||||
}
|
||||
var fullName2 = "";
|
||||
if (full.Length > 25)
|
||||
{
|
||||
fullName2 = full.Substring(25);
|
||||
if (fullName2.Length>25)
|
||||
{
|
||||
fullName2 = fullName2.Substring(0, 25);
|
||||
}
|
||||
}
|
||||
var guidStr = institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
var secondPart = guidStr.Substring(15);
|
||||
var verificationSendResult = await VerifySendSmsAsync(number, 527519, new VerifySendParameter[]
|
||||
{
|
||||
new("FULLNAME1", fullName1),
|
||||
new("FULLNAME2", fullName2),
|
||||
new("CODE1",firstPart),
|
||||
new("CODE2",secondPart)
|
||||
});
|
||||
|
||||
var fullName1 = fullName;
|
||||
if (fullName.Length >= 25)
|
||||
{
|
||||
fullName1 = fullName.Substring(0, 25);
|
||||
}
|
||||
var fullName2 = "";
|
||||
if (full.Length > 25)
|
||||
{
|
||||
fullName2 = full.Substring(25);
|
||||
if (fullName2.Length > 25)
|
||||
{
|
||||
fullName2 = fullName2.Substring(0, 25);
|
||||
}
|
||||
}
|
||||
var guidStr = institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
var secondPart = guidStr.Substring(15);
|
||||
var verificationSendResult = await VerifySendSmsAsync(number, 527519, new VerifySendParameter[]
|
||||
{
|
||||
new("FULLNAME1", fullName1),
|
||||
new("FULLNAME2", fullName2),
|
||||
new("CODE1",firstPart),
|
||||
new("CODE2",secondPart)
|
||||
});
|
||||
|
||||
if (verificationSendResult.Status == 1)
|
||||
{
|
||||
_logger.LogInformation("ارسال لینک قراداد مالی موفق بود");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogError("خطا در ارسال لینک قراداد مالی");
|
||||
}
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, typeOfSms,
|
||||
fullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
fullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
_logger.LogInformation("ذخیره در دیتابیس موفق بود");
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
public async Task<bool> SendInstitutionAmendmentVerificationLink(string number, string fullName, Guid institutionId,
|
||||
long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var guidStr = institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
var secondPart = guidStr.Substring(15);
|
||||
var verificationSendResult = await VerifySendSmsAsync(number, 527519, new VerifySendParameter[]
|
||||
{
|
||||
new("FULLNAME", fullName),
|
||||
new("CODE1",firstPart),
|
||||
new("CODE2",secondPart)
|
||||
});
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه ارتقا قرارداد مالی",
|
||||
fullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
public async Task<bool> SendInstitutionAmendmentVerificationLink(string number, string fullName, Guid institutionId,
|
||||
long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var guidStr = institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
var secondPart = guidStr.Substring(15);
|
||||
var verificationSendResult = await VerifySendSmsAsync(number, 527519, new VerifySendParameter[]
|
||||
{
|
||||
new("FULLNAME", fullName),
|
||||
new("CODE1",firstPart),
|
||||
new("CODE2",secondPart)
|
||||
});
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه ارتقا قرارداد مالی",
|
||||
fullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var verificationSendResult = await VerifySendSmsAsync(number, 965348, new VerifySendParameter[]
|
||||
{
|
||||
new("VERIFYCODE", code)
|
||||
});
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var verificationSendResult = await VerifySendSmsAsync(number, 965348, new VerifySendParameter[]
|
||||
{
|
||||
new("VERIFYCODE", code)
|
||||
});
|
||||
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "کد تاییدیه قرارداد مالی",
|
||||
contractingPartyFullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "کد تاییدیه قرارداد مالی",
|
||||
contractingPartyFullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
public _0_Framework.Application.Sms.SmsResult TaskReminderSms(string number, string taskCount)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public _0_Framework.Application.Sms.SmsResult TaskReminderSms(string number, string taskCount)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
#region InstitutionContractSMS
|
||||
#region InstitutionContractSMS
|
||||
|
||||
public async Task<(byte status, string message, int messaeId, bool isSucceded)> MonthlyBillNew(string number, int tamplateId, string fullname, string amount, string code1,
|
||||
string code2)
|
||||
{
|
||||
public async Task<(byte status, string message, int messaeId, bool isSucceded)> MonthlyBillNew(string number, int tamplateId, string fullname, string amount, string code1,
|
||||
string code2)
|
||||
{
|
||||
|
||||
var smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var result = new ValueTuple<byte, string, int, bool>();
|
||||
var sendResult = await smsIr.VerifySendAsync(number, tamplateId,
|
||||
new VerifySendParameter[]
|
||||
{ new("FULLNAME", fullname), new("AMOUNT", amount), new("CODE1", code1), new("CODE2", code2) });
|
||||
Thread.Sleep(500);
|
||||
var smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var result = new ValueTuple<byte, string, int, bool>();
|
||||
var sendResult = await smsIr.VerifySendAsync(number, tamplateId,
|
||||
new VerifySendParameter[]
|
||||
{ new("FULLNAME", fullname), new("AMOUNT", amount), new("CODE1", code1), new("CODE2", code2) });
|
||||
Thread.Sleep(500);
|
||||
|
||||
|
||||
if (sendResult.Message == "موفق")
|
||||
{
|
||||
if (sendResult.Message == "موفق")
|
||||
{
|
||||
_logger.LogInformation("ارسال پیامک یادآور موفق بود");
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, true);
|
||||
return result;
|
||||
}
|
||||
_logger.LogError("خطا در ارسال یاد آور");
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, false);
|
||||
return result;
|
||||
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, true);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, false);
|
||||
return result;
|
||||
public async Task<(byte status, string message, int messaeId, bool isSucceded)> MonthlyBill(string number, int tamplateId, string fullname, string amount, string id,
|
||||
string aprove)
|
||||
{
|
||||
|
||||
}
|
||||
var smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var result = new ValueTuple<byte, string, int, bool>();
|
||||
var sendResult = await smsIr.VerifySendAsync(number, tamplateId,
|
||||
new VerifySendParameter[]
|
||||
{ new("FULLNAME", fullname), new("AMOUNT", amount), new("ID", id), new("APROVE", aprove) });
|
||||
Thread.Sleep(500);
|
||||
|
||||
public async Task<(byte status, string message, int messaeId, bool isSucceded)> MonthlyBill(string number, int tamplateId, string fullname, string amount, string id,
|
||||
string aprove)
|
||||
{
|
||||
|
||||
if (sendResult.Message == "موفق")
|
||||
{
|
||||
_logger.LogInformation("ارسال پیامک یادآور موفق بود");
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, true);
|
||||
return result;
|
||||
}
|
||||
_logger.LogError("خطا در ارسال یاد آور");
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, false);
|
||||
return result;
|
||||
}
|
||||
|
||||
var smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var result = new ValueTuple<byte, string, int, bool>();
|
||||
var sendResult = await smsIr.VerifySendAsync(number, tamplateId,
|
||||
new VerifySendParameter[]
|
||||
{ new("FULLNAME", fullname), new("AMOUNT", amount), new("ID", id), new("APROVE", aprove) });
|
||||
Thread.Sleep(500);
|
||||
public async Task<(byte status, string message, int messaeId, bool isSucceded)> BlockMessage(string number, string fullname, string amount, string accountType, string id,
|
||||
string aprove)
|
||||
{
|
||||
var tamplateId = 117946;
|
||||
var result = new ValueTuple<byte, string, int, bool>();
|
||||
var smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
var sendResult = await smsIr.VerifySendAsync(number, tamplateId,
|
||||
new VerifySendParameter[]
|
||||
{
|
||||
new("FULLNAME", fullname), new("AMOUNT", amount), new("ACCOUNTTYPE", accountType), new("ID", id),
|
||||
new("APROVE", aprove)
|
||||
});
|
||||
Thread.Sleep(500);
|
||||
|
||||
|
||||
if (sendResult.Message == "موفق")
|
||||
{
|
||||
if (sendResult.Message == "موفق")
|
||||
{
|
||||
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, true);
|
||||
return result;
|
||||
}
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, true);
|
||||
return result;
|
||||
}
|
||||
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, false);
|
||||
return result;
|
||||
}
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, false);
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<(byte status, string message, int messaeId, bool isSucceded)> BlockMessage(string number, string fullname, string amount, string accountType, string id,
|
||||
string aprove)
|
||||
{
|
||||
var tamplateId = 117946;
|
||||
var result = new ValueTuple<byte, string, int, bool>();
|
||||
var smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
var sendResult = await smsIr.VerifySendAsync(number, tamplateId,
|
||||
new VerifySendParameter[]
|
||||
{
|
||||
new("FULLNAME", fullname), new("AMOUNT", amount), new("ACCOUNTTYPE", accountType), new("ID", id),
|
||||
new("APROVE", aprove)
|
||||
});
|
||||
Thread.Sleep(500);
|
||||
#endregion
|
||||
|
||||
|
||||
if (sendResult.Message == "موفق")
|
||||
{
|
||||
#region AlarmMessage
|
||||
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, true);
|
||||
return result;
|
||||
}
|
||||
public async Task<bool> Alarm(string number, string message)
|
||||
{
|
||||
var smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, false);
|
||||
return result;
|
||||
}
|
||||
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
|
||||
|
||||
#endregion
|
||||
var verificationSendResult =
|
||||
smsIr.VerifySendAsync(number, 662874, new VerifySendParameter[] { new("ALARM", message) });
|
||||
Thread.Sleep(1000);
|
||||
var status = verificationSendResult.Result.Status;
|
||||
var mess = verificationSendResult.Result.Message;
|
||||
var messaeId = verificationSendResult.Result.Data.MessageId;
|
||||
if (verificationSendResult.IsCompletedSuccessfully) return true;
|
||||
|
||||
var resStartStatus = verificationSendResult.Result;
|
||||
var resResult = verificationSendResult.Status;
|
||||
var reseExceptiont = verificationSendResult.Exception;
|
||||
|
||||
#region AlarmMessage
|
||||
return false;
|
||||
}
|
||||
|
||||
public async Task<bool> Alarm(string number, string message)
|
||||
{
|
||||
var smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
|
||||
|
||||
var verificationSendResult =
|
||||
smsIr.VerifySendAsync(number, 662874, new VerifySendParameter[] { new("ALARM", message) });
|
||||
Thread.Sleep(1000);
|
||||
var status = verificationSendResult.Result.Status;
|
||||
var mess = verificationSendResult.Result.Message;
|
||||
var messaeId = verificationSendResult.Result.Data.MessageId;
|
||||
if (verificationSendResult.IsCompletedSuccessfully) return true;
|
||||
|
||||
var resStartStatus = verificationSendResult.Result;
|
||||
var resResult = verificationSendResult.Status;
|
||||
var reseExceptiont = verificationSendResult.Exception;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.AutoStopOverTimeTaskSections;
|
||||
|
||||
public record AutoStopOverTimeTaskSectionsCommand : IBaseCommand;
|
||||
|
||||
public class AutoStopOverTimeTaskSectionsCommandHandler : IBaseCommandHandler<AutoStopOverTimeTaskSectionsCommand>
|
||||
{
|
||||
private readonly ITaskSectionRepository _taskSectionRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public AutoStopOverTimeTaskSectionsCommandHandler(ITaskSectionRepository taskSectionRepository,
|
||||
IUnitOfWork unitOfWork)
|
||||
{
|
||||
_taskSectionRepository = taskSectionRepository;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(AutoStopOverTimeTaskSectionsCommand request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
// دریافت تمام تسکهای در حال انجام
|
||||
var taskSections = await _taskSectionRepository.GetActiveSectionsIncludeAllAsync(cancellationToken);
|
||||
|
||||
|
||||
foreach (var taskSection in taskSections)
|
||||
{
|
||||
// استفاده از متد Domain برای بررسی و متوقف کردن خودکار
|
||||
taskSection.AutoStopIfOverTime();
|
||||
}
|
||||
|
||||
// ذخیره تغییرات در دیتابیس
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return OperationResult.Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return OperationResult.Failure($"خطا در ناتمام کردن تسکهای overtime: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,6 @@ public class CreateProjectCommandValidator:AbstractValidator<CreateProjectComman
|
||||
public CreateProjectCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.Name)
|
||||
.MaximumLength(15)
|
||||
.WithMessage("نام نمیتواند بیشتر از 15 کاراکتر باشد")
|
||||
.NotEmpty()
|
||||
.NotNull()
|
||||
.WithMessage("نام نمیتواند خالی باشد");
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Globalization;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
@@ -7,21 +8,22 @@ namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.Project
|
||||
|
||||
public record ProjectBoardDetailQuery(Guid SectionId) : IBaseQuery<ProjectBoardDetailResponse>;
|
||||
|
||||
public record ProjectBoardDetailResponse(List<ProjectBoardDetailUserResponse> Users, string TotalTime);
|
||||
public record ProjectBoardDetailResponse(List<ProjectBoardDetailUserResponse> Users, string TotalTimeMinute,string RemainingTimeMinute );
|
||||
|
||||
public record ProjectBoardDetailUserResponse
|
||||
{
|
||||
public List<ProjectBoardDetailUserHistoryResponse> Histories { get; set; } = new();
|
||||
public string UserFullName { get; set; }
|
||||
public long UserId { get; set; }
|
||||
public List<ProjectBoardDetailUserHistoryResponse> Histories { get; init; }
|
||||
public string UserFullName { get; init; }
|
||||
public string SpentTimeMinute { get; init; }
|
||||
public long UserId { get; init; }
|
||||
}
|
||||
|
||||
public class ProjectBoardDetailUserHistoryResponse
|
||||
public record ProjectBoardDetailUserHistoryResponse
|
||||
{
|
||||
public string Date { get; set; }
|
||||
public string startTime { get; set; }
|
||||
public string EndTime { get; set; }
|
||||
public string TotalTime { get; set; }
|
||||
public string Date { get; init; }
|
||||
public string startTime { get; init; }
|
||||
public string EndTime { get; init; }
|
||||
public string TotalTimeMinute { get; init; }
|
||||
}
|
||||
|
||||
public class ProjectBoardDetailQueryHandler : IBaseQueryHandler<ProjectBoardDetailQuery, ProjectBoardDetailResponse>
|
||||
@@ -38,6 +40,7 @@ public class ProjectBoardDetailQueryHandler : IBaseQueryHandler<ProjectBoardDeta
|
||||
{
|
||||
var section = await _programManagerDbContext.TaskSections
|
||||
.Include(x => x.Activities)
|
||||
.Include(x=>x.AdditionalTimes)
|
||||
.FirstOrDefaultAsync(x => x.Id == request.SectionId, cancellationToken: cancellationToken);
|
||||
|
||||
if (section == null)
|
||||
@@ -49,26 +52,33 @@ public class ProjectBoardDetailQueryHandler : IBaseQueryHandler<ProjectBoardDeta
|
||||
.Where(x => userIds.Contains(x.Id))
|
||||
.ToDictionaryAsync(x => x.Id, x => x.FullName, cancellationToken);
|
||||
|
||||
var totalTimeSpan = section.Activities
|
||||
var totalActivityTimeSpan = section.Activities
|
||||
.Select(x => x.GetTimeSpent())
|
||||
.Aggregate(TimeSpan.Zero, (sum, next) => sum.Add(next));
|
||||
|
||||
var finalTime = section.FinalEstimatedHours;
|
||||
|
||||
var remainingTimeSpan = finalTime >= totalActivityTimeSpan
|
||||
? TimeSpan.FromTicks(finalTime.Ticks - totalActivityTimeSpan.Ticks)
|
||||
: TimeSpan.Zero;
|
||||
var users = section.Activities.GroupBy(x => x.UserId).Select(x =>
|
||||
{
|
||||
return new ProjectBoardDetailUserResponse()
|
||||
{
|
||||
UserId = x.Key,
|
||||
UserFullName = usersDict[x.Key],
|
||||
SpentTimeMinute = ((int)TimeSpan.FromTicks(x.Sum(h=>h.GetTimeSpent().Ticks)).TotalMinutes).ToString(CultureInfo.InvariantCulture),
|
||||
Histories = x.Select(h => new ProjectBoardDetailUserHistoryResponse()
|
||||
{
|
||||
Date = h.StartDate.ToFarsi(),
|
||||
startTime = h.StartDate.ToString("HH:mm"),
|
||||
EndTime = h.EndDate?.ToString("HH:mm") ?? "-",
|
||||
TotalTime = h.GetTimeSpent().ToString(@"hh\:mm")
|
||||
TotalTimeMinute = h.GetTimeSpent().TotalMinutes.ToString("F0",CultureInfo.InvariantCulture)
|
||||
}).ToList()
|
||||
};
|
||||
}).ToList();
|
||||
var response = new ProjectBoardDetailResponse(users, $"{totalTimeSpan.TotalHours}:{totalTimeSpan.Minutes:D2}");
|
||||
var response = new ProjectBoardDetailResponse(users, $"{(int)finalTime.TotalMinutes}",
|
||||
$"{(int)remainingTimeSpan.TotalMinutes:D2}");
|
||||
return OperationResult<ProjectBoardDetailResponse>.Success(response);
|
||||
}
|
||||
}
|
||||
@@ -231,11 +231,11 @@ public static class ProgramManagerPermissionCode
|
||||
#endregion
|
||||
|
||||
|
||||
public static List<int> GetAllCodes()
|
||||
public static Dictionary<string, object> GetAllCodes()
|
||||
{
|
||||
var result = new List<int>();
|
||||
var result = new Dictionary<string, object>();
|
||||
|
||||
void Collect(Type type)
|
||||
void Collect(Type type, Dictionary<string, object> dict)
|
||||
{
|
||||
// Collect const int fields directly declared on this type
|
||||
var fields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly);
|
||||
@@ -246,7 +246,7 @@ public static class ProgramManagerPermissionCode
|
||||
var raw = f.GetRawConstantValue();
|
||||
if (raw is int value)
|
||||
{
|
||||
result.Add(value);
|
||||
dict[f.Name] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,11 +255,16 @@ public static class ProgramManagerPermissionCode
|
||||
var nestedTypes = type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic);
|
||||
foreach (var nt in nestedTypes)
|
||||
{
|
||||
Collect(nt);
|
||||
var nestedDict = new Dictionary<string, object>();
|
||||
Collect(nt, nestedDict);
|
||||
if (nestedDict.Count > 0)
|
||||
{
|
||||
dict[nt.Name] = nestedDict;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Collect(typeof(ProgramManagerPermissionCode));
|
||||
Collect(typeof(ProgramManagerPermissionCode), result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -217,4 +217,39 @@ public class TaskSection : EntityBase<Guid>
|
||||
var finalEstimate = FinalEstimatedHours;
|
||||
return totalSpent < finalEstimate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// اگر زمان کار شده بیش از تایم تعیین شده باشد، تسک را متوقف میکند
|
||||
/// و EndDate را به طوری تنظیم میکند که کل زمان برابر با FinalEstimatedHours شود
|
||||
/// </summary>
|
||||
public void AutoStopIfOverTime()
|
||||
{
|
||||
if (Status != TaskSectionStatus.InProgress)
|
||||
return;
|
||||
|
||||
var activeActivity = _activities.FirstOrDefault(a => a.IsActive);
|
||||
if (activeActivity == null)
|
||||
return;
|
||||
|
||||
// محاسبه کل زمان صرف شده تا کنون (بدون فعالیت فعال)
|
||||
var totalTimeSpentExcludingActive = _activities.Where(a => !a.IsActive).Sum(a => a.GetTimeSpent().Ticks);
|
||||
var totalTimeSpentTimeSpan = TimeSpan.FromTicks(totalTimeSpentExcludingActive);
|
||||
var finalEstimate = FinalEstimatedHours;
|
||||
|
||||
// اگر زمان صرف شده (بدون فعالیت فعال) + فعالیت فعال > تایم تعیین شده
|
||||
var activeTimeSpent = activeActivity.GetTimeSpent();
|
||||
if (totalTimeSpentTimeSpan + activeTimeSpent > finalEstimate)
|
||||
{
|
||||
// محاسبه مدت زمانی که این فعالیت باید برای رسیدن به FinalEstimatedHours داشته باشد
|
||||
var remainingTime = finalEstimate - totalTimeSpentTimeSpan;
|
||||
|
||||
// EndDate = StartDate + remainingTime
|
||||
var adjustedEndDate = activeActivity.StartDate.Add(remainingTime);
|
||||
|
||||
// متوقف کردن فعالیت با EndDate دقیق شده
|
||||
activeActivity.StopWorkWithSpecificTime(adjustedEndDate, "متوقف خودکار - بیش از تایم تعیین شده");
|
||||
|
||||
UpdateStatus(TaskSectionStatus.Incomplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,22 @@ public class TaskSectionActivity : EntityBase<Guid>
|
||||
IsActive = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// متوقف کردن فعالیت با مشخص کردن EndDate دقیق
|
||||
/// </summary>
|
||||
public void StopWorkWithSpecificTime(DateTime endDate, string? endNotes = null)
|
||||
{
|
||||
if (!IsActive)
|
||||
throw new InvalidOperationException("این فعالیت قبلاً متوقف شده است.");
|
||||
|
||||
if (endDate < StartDate)
|
||||
throw new InvalidOperationException("تاریخ پایان نمیتواند قبل از تاریخ شروع باشد.");
|
||||
|
||||
EndDate = endDate;
|
||||
EndNotes = endNotes;
|
||||
IsActive = false;
|
||||
}
|
||||
|
||||
public TimeSpan GetTimeSpent()
|
||||
{
|
||||
if (IsActive)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
|
||||
@@ -11,4 +12,5 @@ public interface ITaskSectionRepository: IRepository<Guid,TaskSection>
|
||||
Task<TaskSection?> GetByIdWithFullDataAsync(Guid id, CancellationToken cancellationToken = default);
|
||||
|
||||
Task<List<TaskSection>> GetAssignedToUserAsync(long userId);
|
||||
Task<List<TaskSection>> GetActiveSectionsIncludeAllAsync(CancellationToken cancellationToken);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
|
||||
b.HasIndex("SkillId");
|
||||
|
||||
b.ToTable("PhaseSections");
|
||||
b.ToTable("PhaseSections", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", b =>
|
||||
@@ -238,7 +238,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
|
||||
b.HasIndex("SkillId");
|
||||
|
||||
b.ToTable("ProjectSections");
|
||||
b.ToTable("ProjectSections", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b =>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
@@ -35,4 +36,13 @@ public class TaskSectionRepository:RepositoryBase<Guid,TaskSection>,ITaskSection
|
||||
.Where(x => x.CurrentAssignedUserId == userId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public Task<List<TaskSection>> GetActiveSectionsIncludeAllAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return _context.TaskSections
|
||||
.Where(x => x.Status == TaskSectionStatus.InProgress)
|
||||
.Include(x => x.Activities)
|
||||
.Include(x => x.AdditionalTimes)
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Commands.AssignProject;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Commands.AutoStopOverTimeTaskSections;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Commands.ChangeStatusSection;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Commands.CreateProject;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Commands.DeleteProject;
|
||||
@@ -98,11 +99,14 @@ public class ProjectController : ProgramManagerBaseController
|
||||
[HttpGet("board")]
|
||||
public async Task<ActionResult<OperationResult<List<ProjectBoardListResponse>>>> GetProjectBoard([FromQuery] ProjectBoardListQuery query)
|
||||
{
|
||||
// اجرای Command برای متوقف کردن تسکهای overtime قبل از نمایش
|
||||
await _mediator.Send(new AutoStopOverTimeTaskSectionsCommand());
|
||||
|
||||
var res = await _mediator.Send(query);
|
||||
return res;
|
||||
}
|
||||
[HttpGet("board/{id:guid}")]
|
||||
public async Task<ActionResult<OperationResult<ProjectBoardDetailResponse>>> Test(Guid id)
|
||||
[HttpGet("board/details")]
|
||||
public async Task<ActionResult<OperationResult<ProjectBoardDetailResponse>>> GetProjectBoardDetails(Guid id)
|
||||
{
|
||||
var query = new ProjectBoardDetailQuery(id);
|
||||
var res = await _mediator.Send(query);
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
using _0_Framework.Application;
|
||||
using AccountManagement.Application.Contracts.Ticket;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers;
|
||||
|
||||
public class ServiceAmountsManagement : AdminBaseController
|
||||
{
|
||||
private readonly IInstitutionPlanApplication _institutionPlanApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
|
||||
public ServiceAmountsManagement(IInstitutionPlanApplication institutionPlanApplication, IAuthHelper authHelper)
|
||||
{
|
||||
_institutionPlanApplication = institutionPlanApplication;
|
||||
_authHelper = authHelper;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت دیتای مودال ایجاد
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetCreateModalData")]
|
||||
public async Task<ActionResult<CreateServiceAmountDto>> GetCreateModalData()
|
||||
{
|
||||
if(!_authHelper.HasPermission(315))
|
||||
return Forbid();
|
||||
var data = await _institutionPlanApplication.GetCreateModalData();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ذخیره درصدها
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("CreateServicePercentage")]
|
||||
public async Task<ActionResult<OperationResult>> CreateServicePercentage([FromBody] CreateServiceAmountDto command)
|
||||
{
|
||||
|
||||
if (!_authHelper.HasPermission(315))
|
||||
return Forbid();
|
||||
|
||||
var result = await _institutionPlanApplication.CreateInstitutionPlanPercentage(command);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست مبالغ سرویس ها
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetList")]
|
||||
public async Task<ActionResult<PagedResult<InstitutionPlanListDto>>> GetList(InstitutionPlanSearchModel searchModel)
|
||||
{
|
||||
return await _institutionPlanApplication.GetList(searchModel);
|
||||
}
|
||||
}
|
||||
@@ -807,6 +807,13 @@ public class institutionContractController : AdminBaseController
|
||||
var res =await _institutionContractApplication.PrintOneAsync(id);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpPost("mannual-verify/{id}")]
|
||||
public async Task<ActionResult<OperationResult>> VerifyInstitutionContractManually(long id)
|
||||
{
|
||||
var res= await _institutionContractApplication.VerifyInstitutionContractManually(id);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
<div class="col-md-6">
|
||||
<div class="row"></div>
|
||||
<div class="form-group" style="margin: 29px 7px 0px;">
|
||||
<span> فعالیت کاربر در پروگرام منیجر </span>
|
||||
<span> فعالیت کاربر در مدیریت پروژه </span>
|
||||
<span> </span>
|
||||
<label class="switch">
|
||||
<input id="checkAll" asp-for="IsProgramManagerUser" type="checkbox"/>
|
||||
@@ -143,7 +143,7 @@
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label asp-for="UserRoles" > نقش در پروگرام منیجر </label>
|
||||
<label asp-for="UserRoles" > انتخاب نقش در مدیریت پروژه </label>
|
||||
<select disabled="disabled" class="form-control select-city" multiple="multiple" asp-for="UserRoles" asp-items="Model.RoleList">
|
||||
<option value="0"></option>
|
||||
</select>
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
<div class="col-md-6">
|
||||
<div class="row"></div>
|
||||
<div class="form-group" style="margin: 29px 7px 0px;">
|
||||
<span> فعالیت کاربر در پروگرام منیجر </span>
|
||||
<span> فعالیت کاربر درمدیریت پروژه </span>
|
||||
<span> </span>
|
||||
<label class="switch">
|
||||
<input id="editcheckAll" asp-for="IsProgramManagerUser" type="checkbox"/>
|
||||
@@ -148,7 +148,7 @@
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
|
||||
<label asp-for="UserRoles"> نقش در پروگرام منیجر </label>
|
||||
<label asp-for="UserRoles"> انتخاب نقش در مدیریت پروژه </label>
|
||||
@if (Model.IsProgramManagerUser)
|
||||
{
|
||||
<select class="form-control select-city editSelect" multiple="multiple" asp-for="UserRoles" asp-items="Model.RoleList">
|
||||
|
||||
@@ -43,6 +43,9 @@
|
||||
case TypeOfSmsSetting.Warning:
|
||||
<h5 class="modal-title">ایجاد پیامک هشدار قضائی</h5>
|
||||
break;
|
||||
case TypeOfSmsSetting.InstitutionContractConfirm:
|
||||
<h5 class="modal-title">ایجاد پیامک یادآور تایید قراداد</h5>
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
case TypeOfSmsSetting.Warning:
|
||||
<h5 class="modal-title">ویرایش پیامک هشدار قضائی</h5>
|
||||
break;
|
||||
case TypeOfSmsSetting.InstitutionContractConfirm:
|
||||
<h5 class="modal-title">ویرایش پیامک یادآور تایید قراداد</h5>
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="بستن">
|
||||
@@ -100,8 +104,8 @@
|
||||
success: function (response) {
|
||||
if(response.isSuccess){
|
||||
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
|
||||
$('.close').click();
|
||||
|
||||
|
||||
$('.close').click();
|
||||
setTimeout(function () {
|
||||
if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.InstitutionContractDebtReminder'){
|
||||
$('#institutionContractDebtReminderTab').click();
|
||||
@@ -114,14 +118,16 @@
|
||||
}else if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.Warning'){
|
||||
$('#warningTab').click();
|
||||
|
||||
}else if(typeOfSmsSetting == '@TypeOfSmsSetting.InstitutionContractConfirm'){
|
||||
}else if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.InstitutionContractConfirm'){
|
||||
|
||||
$('#institutionContractConfirmTab').click();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}, 500);
|
||||
}, 700);
|
||||
|
||||
}else{
|
||||
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
|
||||
}
|
||||
|
||||
@@ -2642,8 +2642,9 @@ public class AutoExtensionModel : PageModel
|
||||
case "شنبه":
|
||||
w1 = 7;
|
||||
w2 = 14;
|
||||
w3 = 28;
|
||||
w4 = 31;
|
||||
w3 = 21;
|
||||
w4 = 28;
|
||||
w5 = 31;
|
||||
break;
|
||||
case "یکشنبه":
|
||||
w1 = 6;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
@page
|
||||
|
||||
|
||||
<h4>Deploy Log</h4>
|
||||
|
||||
<pre style="
|
||||
background:#111;
|
||||
color:#0f0;
|
||||
padding:15px;
|
||||
max-height:600px;
|
||||
overflow:auto;
|
||||
font-size:13px;
|
||||
border-radius:6px;">
|
||||
|
||||
</pre>
|
||||
@@ -2,6 +2,14 @@
|
||||
@model ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel
|
||||
@{
|
||||
ViewData["Title"] = "File Upload";
|
||||
<style>
|
||||
.lineDiv {
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background-image: linear-gradient(to right, #ffffff, #e5e5e5, #cbcbcb, #b2b2b2, #9a9a9a, #9a9a9a, #9a9a9a, #9a9a9a, #b2b2b2, #cbcbcb, #e5e5e5, #ffffff);
|
||||
margin: 10px;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
<h1>Upload APK File</h1>
|
||||
@@ -60,16 +68,85 @@
|
||||
</form>
|
||||
|
||||
|
||||
<form style="margin:50px" asp-page-handler="PaymentGateWay" id="11" method="post">
|
||||
<form style="margin:30px" asp-page-handler="PaymentGateWay" id="11" method="post">
|
||||
|
||||
<button type="submit">درگاه پرداخت تستی </button>
|
||||
</form>
|
||||
<div class="lineDiv"></div>
|
||||
<div class="row m-t-20">
|
||||
<div class="col-md-4 visible-md visible-lg"></div>
|
||||
<div class="col-6 col-md-2">
|
||||
<form asp-page-handler="UploadFrontEnd" id="12" method="post">
|
||||
<button type="submit"
|
||||
class="btn btn-danger"
|
||||
onclick="return confirm('آیا از انتشار نسخه جدید فرانت مطمئن هستید؟');">
|
||||
🚀 Deploy Next UI
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<button type="button" class="btn btn-outline-secondary"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#logModal">
|
||||
مشاهده لاگ Deploy
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-md-4 visible-md visible-lg"></div>
|
||||
</div>
|
||||
<div class="lineDiv"></div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="modal fade" id="logModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-xl modal-dialog-scrollable">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Deploy Log</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<pre id="logContent"
|
||||
style="background: #111;
|
||||
color: #0f0;
|
||||
padding: 15px;
|
||||
font-size: 13px;
|
||||
text-align: left;
|
||||
direction: ltr;">
|
||||
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form style="margin:20px" asp-page-handler="ContractingPartyToWorkshop" id="13" method="post">
|
||||
|
||||
<button class="btn btn-outline-secondary" type="submit"> افزودن آی دی طرف حساب به کارگاه </button>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
@if (ViewData["message"] != null)
|
||||
{
|
||||
<p>@ViewData["message"]</p>
|
||||
}
|
||||
<script>
|
||||
document.getElementById('logModal')
|
||||
.addEventListener('show.bs.modal', function () {
|
||||
|
||||
fetch('?handler=Log')
|
||||
.then(r => r.text())
|
||||
.then(t => {
|
||||
document.getElementById('logContent').textContent = t;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@* <script>
|
||||
|
||||
|
||||
@@ -1,36 +1,40 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Application.FaceEmbedding;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using AccountManagement.Domain.AccountLeftWorkAgg;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using Company.Domain.AndroidApkVersionAgg;
|
||||
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using Company.Domain.RewardAgg;
|
||||
using Company.Domain.RollCallAgg.DomainService;
|
||||
using CompanyManagement.Infrastructure.Excel.WorkshopsRollCall;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.EFCore;
|
||||
using Hangfire;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography.Xml;
|
||||
using System.Text.Json.Serialization;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Parbad;
|
||||
using Parbad.AspNetCore;
|
||||
using Parbad.Gateway.Sepehr;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Application.FaceEmbedding;
|
||||
using CompanyManagement.Infrastructure.Excel.WorkshopsRollCall;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography.Xml;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using static ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel2;
|
||||
|
||||
namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
@@ -47,6 +51,8 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly IOnlinePayment _onlinePayment;
|
||||
private readonly IFaceEmbeddingService _faceEmbeddingService;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IInstitutionContractApplication _institutionContractApplication;
|
||||
|
||||
|
||||
[BindProperty] public IFormFile File { get; set; }
|
||||
@@ -61,13 +67,19 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
[Display(Name = "کد ورژن")]
|
||||
public string VersionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// لاگ آپلود فرانت
|
||||
/// </summary>
|
||||
public string LogContent { get; set; }
|
||||
|
||||
[BindProperty] public ApkType SelectedApkType { get; set; }
|
||||
[BindProperty] public bool IsForce { get; set; }
|
||||
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService,
|
||||
CompanyContext context, AccountContext accountContext, IHttpClientFactory httpClientFactory,
|
||||
IOptions<AppSettingConfiguration> appSetting,
|
||||
ITemporaryClientRegistrationApplication clientRegistrationApplication, IOnlinePayment onlinePayment, IFaceEmbeddingService faceEmbeddingService)
|
||||
ITemporaryClientRegistrationApplication clientRegistrationApplication, IOnlinePayment onlinePayment,
|
||||
IFaceEmbeddingService faceEmbeddingService, IAuthHelper authHelper, IInstitutionContractApplication institutionContractApplication)
|
||||
{
|
||||
_application = application;
|
||||
_rollCallDomainService = rollCallDomainService;
|
||||
@@ -77,6 +89,8 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
_clientRegistrationApplication = clientRegistrationApplication;
|
||||
_onlinePayment = onlinePayment;
|
||||
_faceEmbeddingService = faceEmbeddingService;
|
||||
_authHelper = authHelper;
|
||||
_institutionContractApplication = institutionContractApplication;
|
||||
_paymentGateway = new SepehrPaymentGateway(httpClientFactory);
|
||||
}
|
||||
|
||||
@@ -140,11 +154,63 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
public async Task<IActionResult> OnPostShiftDateNew()
|
||||
{
|
||||
//await UpdateInstitutionContract();
|
||||
await UpdateFaceEmbeddingNames();
|
||||
//await UpdateFaceEmbeddingNames();
|
||||
//await SetInstitutionContractSigningType();
|
||||
await ReActivateInstitution();
|
||||
ViewData["message"] = "تومام یک";
|
||||
return Page();
|
||||
}
|
||||
|
||||
private async System.Threading.Tasks.Task ReActivateInstitution()
|
||||
{
|
||||
var blueInstitutionContracts = await _context.InstitutionContractSet.Where(x =>
|
||||
x.IsActiveString == "blue").ToListAsync();
|
||||
|
||||
|
||||
var blueContracts = new List<InstitutionContract>();
|
||||
|
||||
foreach (var blueContract in blueInstitutionContracts)
|
||||
{
|
||||
var verifiedContracts = await _context.InstitutionContractSet
|
||||
.Where(x => x.ContractingPartyId == blueContract.ContractingPartyId
|
||||
&& x.VerificationStatus == InstitutionContractVerificationStatus.Verified
|
||||
&& x.ContractStartGr > blueContract.ContractEndGr)
|
||||
.ToListAsync();
|
||||
|
||||
if (verifiedContracts.Any())
|
||||
{
|
||||
blueContracts.Add(blueContract);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var institutionContract in blueContracts)
|
||||
{
|
||||
institutionContract.DeActive();
|
||||
_institutionContractApplication.ReActiveAllAfterCreateNew(institutionContract.ContractingPartyId);
|
||||
}
|
||||
}
|
||||
|
||||
private async System.Threading.Tasks.Task SetInstitutionContractSigningType()
|
||||
{
|
||||
var query = _context.InstitutionContractSet
|
||||
.Where(x => x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify);
|
||||
|
||||
|
||||
var otpSigned = query.Where(x => x.VerifierFullName != null && x.LawId != 0).ToList();
|
||||
foreach (var institutionContract in otpSigned)
|
||||
{
|
||||
institutionContract.SetSigningType(InstitutionContractSigningType.OtpBased);
|
||||
}
|
||||
|
||||
var lagacySigned = query.Where(x => x.VerifierFullName == null && x.LawId == 0).ToList();
|
||||
foreach (var institutionContract in lagacySigned)
|
||||
{
|
||||
institutionContract.SetSigningType(InstitutionContractSigningType.Legacy);
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostShiftDateNew2()
|
||||
{
|
||||
//var startRollCall = new DateTime(2025, 3, 21);
|
||||
@@ -293,6 +359,122 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
return Page();
|
||||
}
|
||||
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 120)]
|
||||
public async Task<IActionResult> OnPostUploadFrontEnd(CancellationToken cancellationToken)
|
||||
{
|
||||
var validAccountId = _authHelper.CurrentAccountId();
|
||||
if (validAccountId == 2 || validAccountId == 322)
|
||||
{
|
||||
//var batPath = @"C:\next-ui\deploy-next-ui.bat";
|
||||
|
||||
//var psi = new ProcessStartInfo
|
||||
//{
|
||||
// FileName = batPath,
|
||||
// UseShellExecute = true, // خیلی مهم
|
||||
// Verb = "runas", // اجرای Administrator
|
||||
// CreateNoWindow = true,
|
||||
// WindowStyle = ProcessWindowStyle.Hidden
|
||||
//};
|
||||
|
||||
//Process.Start(psi);
|
||||
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "cmd.exe",
|
||||
Arguments = "/c schtasks /run /tn \"DeployNextUI\"",
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
Process.Start(psi);
|
||||
|
||||
//var psi = new ProcessStartInfo
|
||||
//{
|
||||
// FileName = @"C:\next-ui\deploy-next-ui.bat",
|
||||
// UseShellExecute = false,
|
||||
// CreateNoWindow = false
|
||||
//};
|
||||
|
||||
//Process.Start(psi);
|
||||
|
||||
|
||||
TempData["Message"] = "فرآیند Deploy شروع شد. لاگ را بررسی کنید.";
|
||||
return RedirectToPage();
|
||||
}
|
||||
|
||||
return Forbid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// افزودن آی دی طرف حساب به کارگاه
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 120)]
|
||||
public async Task<IActionResult> OnPostContractingPartyToWorkshop()
|
||||
{
|
||||
var workshops = await _context.Workshops.Where(x => x.ContractingPartyId == 0).ToListAsync();
|
||||
|
||||
var worskhopEmployeer = await _context.WorkshopEmployers.Include(x => x.Employer).ToListAsync();
|
||||
|
||||
var contractingParties = await _context.PersonalContractingParties.ToListAsync();
|
||||
|
||||
foreach (var workshop in workshops)
|
||||
{
|
||||
var employers = worskhopEmployeer.Where(x => x.WorkshopId == workshop.id);
|
||||
var contractingPartyIdList = new List<long>();
|
||||
foreach (var employer in employers)
|
||||
{
|
||||
if (contractingParties.Any(x => x.id == employer.Employer.ContractingPartyId))
|
||||
{
|
||||
contractingPartyIdList.Add(employer.Employer.ContractingPartyId);
|
||||
}
|
||||
}
|
||||
|
||||
if (contractingPartyIdList.Count > 0)
|
||||
{
|
||||
if (contractingPartyIdList.Count == 1)
|
||||
{
|
||||
workshop.AddContractingPartyId(contractingPartyIdList[0]);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
var idDistinct = contractingPartyIdList.Distinct().ToList();
|
||||
if (idDistinct.Count == 1)
|
||||
{
|
||||
workshop.AddContractingPartyId(contractingPartyIdList[0]);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ViewData["message"] = "آی دی های طرف حساب اضافه شد";
|
||||
return Page();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لاگ آپلود فرانت
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnGetLog()
|
||||
{
|
||||
var validAccountId = _authHelper.CurrentAccountId();
|
||||
if (validAccountId == 2 || validAccountId == 322)
|
||||
{
|
||||
var logPath = @"C:\next-ui\log.txt";
|
||||
if (!System.IO.File.Exists(logPath))
|
||||
return Content("Log file not found.");
|
||||
|
||||
var content = System.IO.File.ReadAllText(logPath, Encoding.UTF8);
|
||||
return Content(content);
|
||||
}
|
||||
|
||||
return Content("شما مجاز به دیدن لاگ نیستید");
|
||||
}
|
||||
|
||||
|
||||
public async System.Threading.Tasks.Task OnGetCallback(string? transid, string? cardnumber,
|
||||
string? tracking_number, string status)
|
||||
{
|
||||
@@ -840,8 +1022,8 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
contract => contract.ContractingPartyId,
|
||||
contractingParty => contractingParty.id,
|
||||
(contract, contractingParty) => new { contract, contractingParty });
|
||||
|
||||
|
||||
|
||||
|
||||
var remoteContractsQuery = query
|
||||
.Where(x => x.contractingParty.Employers
|
||||
.Any(e => e.WorkshopEmployers
|
||||
@@ -902,7 +1084,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
x.PersonnelCount,
|
||||
x.Price, x.InstitutionContractWorkshopGroupId,
|
||||
group,
|
||||
x.WorkshopId.Value);
|
||||
x.WorkshopId.Value, x.id);
|
||||
entity.SetEmployers(x.Employers.Select(e => e.EmployerId).ToList());
|
||||
|
||||
return entity;
|
||||
|
||||
25
ServiceHost/Areas/Client/Controllers/EmployeeController.cs
Normal file
25
ServiceHost/Areas/Client/Controllers/EmployeeController.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public class EmployeeController:ClientBaseController
|
||||
{
|
||||
private readonly IEmployeeApplication _employeeApplication;
|
||||
private readonly long _workshopId;
|
||||
|
||||
public EmployeeController(IEmployeeApplication employeeApplication,IAuthHelper authHelper)
|
||||
{
|
||||
_employeeApplication = employeeApplication;
|
||||
_workshopId = authHelper.GetWorkshopId();
|
||||
}
|
||||
|
||||
[HttpGet("select-list")]
|
||||
public async Task<ActionResult<List<EmployeeSelectListViewModel>>> GetEmployeeSelectList()
|
||||
{
|
||||
var result = await _employeeApplication.WorkedEmployeesInWorkshopSelectList(_workshopId);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
22
ServiceHost/Areas/Client/Controllers/InsuranceController.cs
Normal file
22
ServiceHost/Areas/Client/Controllers/InsuranceController.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.InsuranceList;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public class InsuranceController:ClientBaseController
|
||||
{
|
||||
private readonly IInsuranceListApplication _insuranceListApplication;
|
||||
|
||||
public InsuranceController(IInsuranceListApplication insuranceListApplication)
|
||||
{
|
||||
_insuranceListApplication = insuranceListApplication;
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<PagedResult<InsuranceClientListViewModel>>> GetInsurances(InsuranceClientSearchModel searchModel)
|
||||
{
|
||||
var insurances =await _insuranceListApplication.GetInsuranceClientList(searchModel);
|
||||
return Ok(insurances);
|
||||
}
|
||||
}
|
||||
@@ -157,9 +157,10 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetEmployeeDetailsWithNationalCode(string nationalCode,string birthDate)
|
||||
public async Task<IActionResult> OnGetEmployeeDetailsWithNationalCode(string nationalCode,string birthDate, bool authorizedCanceled)
|
||||
{
|
||||
var result = await _employeeApplication.ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(nationalCode, birthDate, _workshopId);
|
||||
|
||||
var result = await _employeeApplication.ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(nationalCode, birthDate, authorizedCanceled, _workshopId);
|
||||
return new JsonResult(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="AuthorizedCanceled" class="col-12 p-2 disable">
|
||||
<div id="AuthorizedCanceled" class="col-12 p-2 disable">
|
||||
<input id="authorizedCheckboxInput" type="checkbox"/>
|
||||
<label>ثبت مشخصات پرسنل بدون احراز هویت</label>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -39,7 +39,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.InsuranceList
|
||||
public string WorkshopName;
|
||||
public List<string> YearlyList;
|
||||
public string Year;
|
||||
public string Month;
|
||||
public string Month;
|
||||
public string Sorting;
|
||||
public int PageIndex;
|
||||
public string TypeOfInsurance;
|
||||
@@ -163,6 +163,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.InsuranceList
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OldClientByHeydari
|
||||
|
||||
//public IActionResult OnGetSearch(InsuranceListSearchModel searchModel)
|
||||
|
||||
@@ -777,9 +777,9 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetEmployeeDetailsWithNationalCode(string nationalCode, string birthDate)
|
||||
public async Task<IActionResult> OnGetEmployeeDetailsWithNationalCode(string nationalCode, string birthDate, bool? authorizedCanceled = null)
|
||||
{
|
||||
var result = await _employeeApplication.ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(nationalCode, birthDate, _workshopId);
|
||||
var result = await _employeeApplication.ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(nationalCode, birthDate,false, _workshopId);
|
||||
return new JsonResult(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -293,9 +293,9 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnPostReCalculateValues(List<ReCalculateRollCallValues> command)
|
||||
public async Task<IActionResult> OnPostReCalculateValues(List<ReCalculateRollCallValues> command)
|
||||
{
|
||||
var result = _rollCallApplication.RecalculateValues(_workshopId, command);
|
||||
var result =await _rollCallApplication.RecalculateValues(_workshopId, command);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
|
||||
@@ -546,11 +546,11 @@ namespace ServiceHost.Areas.Client.Pages
|
||||
return new JsonResult(jobViewModels);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetEmployeeDetailsWithNationalCode(string nationalCode, string birthDate)
|
||||
public async Task<IActionResult> OnGetEmployeeDetailsWithNationalCode(string nationalCode, string birthDate, bool? authorizedCanceled = null)
|
||||
{
|
||||
var workshopSlug = User.FindFirst("WorkshopSlug")?.Value;
|
||||
long workshopIDecrypt = _passwordHasher.SlugDecrypt(workshopSlug);
|
||||
var result = await _employeeApplication.ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(nationalCode, birthDate, workshopIDecrypt);
|
||||
var result = await _employeeApplication.ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(nationalCode, birthDate,false, workshopIDecrypt);
|
||||
return new JsonResult(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ using System.Security.Cryptography;
|
||||
using System.Threading;
|
||||
using CompanyManagment.App.Contracts.FinancialInvoice;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using GozareshgirProgramManager.Application._Common.Constants;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
|
||||
namespace ServiceHost.Controllers;
|
||||
|
||||
@@ -65,9 +67,15 @@ public class GeneralController : GeneralBaseController
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet("pm-permissions")]
|
||||
public IActionResult GetPMPermissions()
|
||||
{
|
||||
var permissions = ProgramManagerPermissionCode.GetAllCodes();
|
||||
return new JsonResult(permissions);
|
||||
}
|
||||
|
||||
[HttpGet("/api/callback"), HttpPost("/api/callback")]
|
||||
public async Task<IActionResult> Verify(SepehrGatewayPayResponse payResponse)
|
||||
public async Task<IActionResult> Verify([FromForm]SepehrGatewayPayResponse payResponse)
|
||||
{
|
||||
if (!long.TryParse(payResponse.invoiceid, out var paymentTransactionId))
|
||||
{
|
||||
@@ -125,7 +133,12 @@ public class GeneralController : GeneralBaseController
|
||||
DigitalReceipt = payResponse.digitalreceipt
|
||||
};
|
||||
|
||||
|
||||
var verifyRes = await _paymentGateway.Verify(verifyCommand, CancellationToken.None);
|
||||
#if DEBUG
|
||||
verifyRes.IsSuccess = true;
|
||||
#endif
|
||||
|
||||
_financialInvoiceApplication.SetPaid(financialInvoiceId, DateTime.Now);
|
||||
|
||||
if (verifyRes.IsSuccess)
|
||||
@@ -150,14 +163,18 @@ public class GeneralController : GeneralBaseController
|
||||
payResponse.cardnumber, payResponse.issuerbank, payResponse.rrn.ToString(),
|
||||
payResponse.digitalreceipt);
|
||||
|
||||
if (financialInvoice.Items?.Any(x => x.Type is FinancialInvoiceItemType.BuyInstitutionContract or FinancialInvoiceItemType.BuyInstitutionContractInstallment) ?? false)
|
||||
if (financialInvoice.Items?.Any(x =>
|
||||
x.Type is FinancialInvoiceItemType.BuyInstitutionContract
|
||||
or FinancialInvoiceItemType.BuyInstitutionContractInstallment) ?? false)
|
||||
{
|
||||
var financialItems = financialInvoice.Items
|
||||
.Where(x => x.Type == FinancialInvoiceItemType.BuyInstitutionContract);
|
||||
foreach (var editFinancialInvoiceItem in financialItems)
|
||||
{
|
||||
await _institutionContractApplication.SetPendingWorkflow(editFinancialInvoiceItem.EntityId);
|
||||
await _institutionContractApplication.SetPendingWorkflow(editFinancialInvoiceItem.EntityId,
|
||||
InstitutionContractSigningType.OtpBased);
|
||||
}
|
||||
|
||||
var financialInstallmentItems = financialInvoice.Items
|
||||
.Where(x => x.Type == FinancialInvoiceItemType.BuyInstitutionContractInstallment);
|
||||
|
||||
@@ -166,7 +183,8 @@ public class GeneralController : GeneralBaseController
|
||||
var institutionContractId =
|
||||
await _institutionContractApplication.GetIdByInstallmentId(
|
||||
editFinancialInvoiceItem.EntityId);
|
||||
await _institutionContractApplication.SetPendingWorkflow(institutionContractId);
|
||||
await _institutionContractApplication.SetPendingWorkflow(institutionContractId,
|
||||
InstitutionContractSigningType.OtpBased);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,8 @@ public class ParameterBindingConvention : IApplicationModelConvention
|
||||
{
|
||||
if (selector.AttributeRouteModel?.Template != null)
|
||||
{
|
||||
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase))
|
||||
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase) ||
|
||||
selector.AttributeRouteModel.Template.Contains($"{{{parameterName}:", StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +81,8 @@ public class ParameterBindingConvention : IApplicationModelConvention
|
||||
{
|
||||
if (selector.AttributeRouteModel?.Template != null)
|
||||
{
|
||||
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase))
|
||||
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase) ||
|
||||
selector.AttributeRouteModel.Template.Contains($"{{{parameterName}:", StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
38
ServiceHost/Filters/OperationResultFilter.cs
Normal file
38
ServiceHost/Filters/OperationResultFilter.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
namespace ServiceHost.Filters;
|
||||
|
||||
public class OperationResultFilter : ActionFilterAttribute
|
||||
{
|
||||
public override void OnActionExecuted(ActionExecutedContext context)
|
||||
{
|
||||
// بررسی کنید که درخواست برای مسیر /api/programmanager/ است
|
||||
var path = context.HttpContext.Request.Path.Value ?? string.Empty;
|
||||
if (!path.StartsWith("/api/programmanager/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return; // اگر مسیر مطابقت ندارد، فیلتر را اعمال نکنید
|
||||
}
|
||||
|
||||
if (context.Result is ObjectResult objectResult)
|
||||
{
|
||||
if (objectResult.Value is OperationResult operationResult && !operationResult.IsSuccess)
|
||||
{
|
||||
int statusCode = GetStatusCode(operationResult.ErrorType);
|
||||
objectResult.StatusCode = statusCode;
|
||||
context.HttpContext.Response.StatusCode = statusCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetStatusCode(ErrorType errorType) => errorType switch
|
||||
{
|
||||
ErrorType.NotFound => StatusCodes.Status404NotFound,
|
||||
ErrorType.Unauthorized => StatusCodes.Status401Unauthorized,
|
||||
ErrorType.Validation => StatusCodes.Status400BadRequest,
|
||||
ErrorType.BadRequest => StatusCodes.Status400BadRequest,
|
||||
ErrorType.InternalServerError => StatusCodes.Status500InternalServerError,
|
||||
_ => StatusCodes.Status400BadRequest
|
||||
};
|
||||
}
|
||||
@@ -35,6 +35,7 @@ using Microsoft.OpenApi;
|
||||
using ServiceHost.Hubs.ProgramManager;
|
||||
using ServiceHost.Notifications.ProgramManager;
|
||||
using ServiceHost.Conventions;
|
||||
using ServiceHost.Filters;
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@@ -178,6 +179,7 @@ builder.Services.AddAuthorization(options =>
|
||||
builder.Services.AddControllers(options =>
|
||||
{
|
||||
options.Conventions.Add(new ParameterBindingConvention());
|
||||
options.Filters.Add(new OperationResultFilter());
|
||||
})
|
||||
.AddJsonOptions(options =>
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user