Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-11-19 11:10:33 +03:30
67 changed files with 38979 additions and 234 deletions

View File

@@ -0,0 +1,22 @@
namespace _0_Framework.Application.Enums;
/// <summary>
/// وضعیت تایید قرادا مالی
/// </summary>
public enum InstitutionContractVerificationStatus
{
/// <summary>
/// در انتظار تایید
/// </summary>
PendingForVerify = 0,
/// <summary>
/// در انتظار کارپوشه
/// </summary>
PendingWorkflow = 1,
/// <summary>
/// تایید شده
/// </summary>
Verified = 2
}

View File

@@ -0,0 +1,36 @@
namespace _0_Framework.Application.Enums;
public enum TypeOfSmsSetting
{
/// <summary>
/// پیامک
/// یادآور بدهی ماهیانه قرارداد مالی
/// </summary>
InstitutionContractDebtReminder,
/// <summary>
/// پیامک
/// صورت حساب ماهانه قرارداد مالی
/// </summary>
MonthlyInstitutionContract,
/// <summary>
/// پیامک
/// اعلام مسدودی طرف حساب
/// </summary>
BlockContractingParty,
/// <summary>
/// پیامک
/// هشدار اول
/// </summary>
Warning,
/// <summary>
///پیامک اقدام قضائی
/// </summary>
LegalAction,
}

View File

@@ -32,6 +32,60 @@ public interface ISmsService
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
long contractingPartyId, long institutionContractId);
SmsResult TaskReminderSms(string number, string taskCount);
#endregion
#region InstitutionContractSMS
/// <summary>
/// پیامک اهانه جدید
/// </summary>
/// <param name="number"></param>
/// <param name="tamplateId"></param>
/// <param name="fullname"></param>
/// <param name="amount"></param>
/// <param name="code1"></param>
/// <param name="code2"></param>
/// <returns></returns>
Task<(byte status, string message, int messaeId, bool isSucceded)> MonthlyBillNew(string number, int tamplateId, string fullname, string amount, string code1,
string code2);
/// <summary>
/// پیامک ماهانه قدیم
/// </summary>
/// <param name="number"></param>
/// <param name="tamplateId"></param>
/// <param name="fullname"></param>
/// <param name="amount"></param>
/// <param name="id"></param>
/// <param name="aprove"></param>
/// <returns></returns>
Task<(byte status, string message, int messaeId, bool isSucceded)> MonthlyBill(string number, int tamplateId, string fullname, string amount, string id, string aprove);
/// <summary>
/// پیامک مسدودی طرف حساب
/// </summary>
/// <param name="number"></param>
/// <param name="fullname"></param>
/// <param name="amount"></param>
/// <param name="accountType"></param>
/// <param name="id"></param>
/// <param name="aprove"></param>
/// <returns></returns>
Task<(byte status, string message, int messaeId, bool isSucceded)> BlockMessage(string number, string fullname, string amount, string accountType, string id, string aprove);
#endregion
#region AlarmMessage
/// <summary>
/// ارسال پیامک های خطا یا اعمال ارسال
/// </summary>
/// <param name="number"></param>
/// <param name="message"></param>
/// <returns></returns>
Task<bool> Alarm(string number, string message);
#endregion
}

View File

@@ -0,0 +1,32 @@
namespace _0_Framework.Application.Sms;
public class SmsResult
{
public SmsResult()
{
IsSuccedded = false;
}
public bool IsSuccedded { get; set; }
public string Message { get; set; }
public byte StatusCode { get; set; }
public int MessageId { get; set; }
public SmsResult Succedded(byte statusCode, string message, int messageId)
{
IsSuccedded = true;
Message = message;
StatusCode = statusCode;
MessageId = messageId;
return this;
}
public SmsResult Failed(byte statusCode, string message, int messageId)
{
IsSuccedded = false;
Message = message;
StatusCode = statusCode;
MessageId = messageId;
return this;
}
}

View File

@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>BackgroundInstitutionContract.Task</AssemblyName>
<RootNamespace>BackgroundInstitutionContract.Task</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\0_Framework\0_Framework.csproj" />
<ProjectReference Include="..\..\AccountManagement.Configuration\AccountManagement.Configuration.csproj" />
<ProjectReference Include="..\..\PersonalContractingParty.Config\PersonalContractingParty.Config.csproj" />
<ProjectReference Include="..\..\Query.Bootstrapper\Query.Bootstrapper.csproj" />
<ProjectReference Include="..\..\WorkFlow\Infrastructure\WorkFlow.Infrastructure.Config\WorkFlow.Infrastructure.Config.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,32 @@
using _0_Framework.Application;
namespace BackgroundInstitutionContract.Task
{
public class FileUploader : IFileUploader
{
private readonly IWebHostEnvironment _webHostEnvironment;
public FileUploader(IWebHostEnvironment webHostEnvironment)
{
_webHostEnvironment = webHostEnvironment;
}
public string Upload(IFormFile file, string path)
{
if (file == null) return "";
var directoryPath = $"{_webHostEnvironment.WebRootPath}\\ProductPictures\\{path}";
if (!Directory.Exists(directoryPath))
Directory.CreateDirectory(directoryPath);
var fileName = $"{DateTime.Now.ToFileName()}-{file.FileName}";
var filePath = $"{directoryPath}\\{fileName}";
var output = System.IO.File.Create(filePath);
file.CopyTo(output);
return $"{path}/{fileName}";
}
}
}

View File

@@ -0,0 +1,149 @@
using _0_Framework.Application;
using Company.Domain.ContarctingPartyAgg;
using Company.Domain.InstitutionContractAgg;
using Hangfire;
namespace BackgroundInstitutionContract.Task.Jobs;
public class JobSchedulerRegistrator
{
private readonly IBackgroundJobClient _backgroundJobClient;
private readonly SmsReminder _smsReminder;
private readonly IInstitutionContractRepository _institutionContractRepository;
private static DateTime? _lastRunCreateTransaction;
private static DateTime? _lastRunSendMonthlySms;
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository)
{
_smsReminder = smsReminder;
_backgroundJobClient = backgroundJobClient;
_institutionContractRepository = institutionContractRepository;
}
public void Register()
{
//RecurringJob.AddOrUpdate(
// "InstitutionContract.CreateFinancialTransaction",
// () => CreateFinancialTransaction(),
// "*/30 * * * *" // هر 30 دقیقه یکبار چک کن
//);
//RecurringJob.AddOrUpdate(
// "InstitutionContract.SendMonthlySms",
// () => SendMonthlySms(),
// "*/20 * * * *" // هر 30 دقیقه یکبار چک کن
//);
//RecurringJob.AddOrUpdate(
// "InstitutionContract.SendReminderSms",
// () => SendReminderSms(),
// "*/1 * * * *" // هر 1 دقیقه یکبار چک کن
//);
RecurringJob.AddOrUpdate(
"InstitutionContract.SendBlockSms",
() => SendBlockSms(),
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
);
}
/// <summary>
/// ایجاد سند بدهی ماهیانه برای قراداد مالی
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 1200)]
public async System.Threading.Tasks.Task CreateFinancialTransaction()
{
var now =DateTime.Now;
var endOfMonth = now.ToFarsi().FindeEndOfMonth();
var endOfMonthGr = endOfMonth.ToGeorgianDateTime();
if (now.Date == endOfMonthGr.Date && now.Hour >= 2 && now.Hour < 4 &&
now.Date != _lastRunCreateTransaction?.Date)
{
var month = endOfMonth.Substring(5, 2);
var year = endOfMonth.Substring(0, 4);
var monthName = month.ToFarsiMonthByNumber();
var description = $"{monthName} {year}";
var endnew = ($"{endOfMonth.Substring(0, 8)}01").FindeEndOfMonth();
var endNewGr = endnew.ToGeorgianDateTime();
var endNewFa = endNewGr.ToFarsi();
try
{
await _institutionContractRepository.CreateTransactionForInstitutionContracts(endNewGr, endNewFa, description);
_lastRunCreateTransaction = now;
Console.WriteLine("CreateTransAction executed");
}
catch (Exception e)
{
//_smsService.Alarm("09114221321", "خطا-ایجاد سند مالی");
}
}
}
/// <summary>
/// ارسال پیامک صورت حساب ماهانه
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 1000)]
public async System.Threading.Tasks.Task SendMonthlySms()
{
//var now = new DateTime(2025,11,21, 10,30,0);
var now = DateTime.Now;
var endOfMonth = now.ToFarsi().FindeEndOfMonth();
var endOfMonthGr = endOfMonth.ToGeorgianDateTime();
if (now.Date == endOfMonthGr.Date && now.Hour >= 10 && now.Hour < 11 &&
now.Date != _lastRunSendMonthlySms?.Date)
{
try
{
await _institutionContractRepository.SendMonthlySms(now);
_lastRunSendMonthlySms = now;
Console.WriteLine("Send Monthly sms executed");
}
catch (Exception e)
{
//_smsService.Alarm("09114221321", "خطا-ایجاد سند مالی");
}
}
}
/// <summary>
/// ارسال پیامک یاد آور بدهی
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 1200)]
public async System.Threading.Tasks.Task SendReminderSms()
{
await _institutionContractRepository.SendReminderSmsForBackgroundTask();
}
/// <summary>
/// ارسال پیامک مسدودی
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 100)]
public async System.Threading.Tasks.Task SendBlockSms()
{
await _institutionContractRepository.SendBlockSmsForBackgroundTask();
}
}

View File

@@ -0,0 +1,116 @@
using _0_Framework.Application.Sms;
using AccountManagement.Application.Contracts.Account;
using AccountMangement.Infrastructure.EFCore;
using Company.Domain.SmsResultAgg;
using Microsoft.EntityFrameworkCore;
using SmsResult = Company.Domain.SmsResultAgg.SmsResult;
namespace BackgroundInstitutionContract.Task.Jobs;
public class SmsReminder
{
private readonly AccountContext _accountContext;
private readonly ISmsService _smsService;
private readonly ISmsResultRepository _smsResultRepository;
public SmsReminder(ISmsService smsService, AccountContext accountContext, ISmsResultRepository smsResultRepository)
{
_smsService = smsService;
_accountContext = accountContext;
_smsResultRepository = smsResultRepository;
}
public void Execute()
{
//var accounts = _accountContext.Accounts.Where(x => x.PositionId > 0 && x.IsActiveString == "true").Select(x => new AccountViewModel() { Id = x.id, Mobile = x.Mobile, Fullname = x.Fullname }).ToList();
//Thread.Sleep(300);
//var accounts = new List<AccountViewModel>() { new AccountViewModel() { Mobile = "09114221321", Id = 2 } };
var accounts= _accountContext.Accounts.Where(x => x.Username.ToLower()=="mahan").Select(x => new AccountViewModel() { Id = x.id, Mobile = x.Mobile, Fullname = x.Fullname }).ToList();
var smsVM = accounts.Select(x => new AccountSmsTaskViewModel()
{
Mobile = x.Mobile,
AccountId = x.Id,
FullName = x.Fullname,
TaskCount = GetLateTasksCount(x.Id)
}).Where(x => x.TaskCount > 0 && !string.IsNullOrEmpty(x.Mobile) && x.Mobile.Length == 11).ToList();
Thread.Sleep(300);
foreach (var viewmodel in smsVM)
{
var smsResult = _smsService.TaskReminderSms(viewmodel.Mobile, $"{viewmodel.TaskCount}");
Thread.Sleep(1000);
var createSmsResult = new SmsResult(smsResult.MessageId, smsResult.Message, "یادآور وظایف",
viewmodel.FullName, viewmodel.Mobile, viewmodel.AccountId, viewmodel.AccountId);
_smsResultRepository.Create(createSmsResult);
_smsResultRepository.SaveChanges();
Thread.Sleep(1000);
}
}
private int GetLateTasksCount(long accountId)
{
var positionValue = _accountContext.Accounts
.Where(x => x.id == accountId)
.Include(p => p.Position)
.Select(x => x.Position.PositionValue)
.FirstOrDefault();
if (positionValue == 0)
return 0;
DateTime now = DateTime.Now;
int overdueTasksCount;
if (positionValue == 1)
{
overdueTasksCount = _accountContext.Assigns.Include(x => x.Task).Where(x => x.AssignedId == accountId &&
x.AssignerId == accountId && x.Task.Assigns.Count == 1 &&
!x.IsCancel && !x.IsCanceledRequest &&
!x.IsDone && !x.TimeRequest && !x.IsDoneRequest && x.EndTaskDate.Date <= DateTime.Now.Date && x.Task.IsActiveString == "true")
.GroupBy(x => x.TaskId).Select(x => x.First()).Count();
//overdueTasksCount = _accountContext.Tasks.Include(x =>
// x.Assigns).Count(x => !x.Assigns.Any(a => a.IsCancel) && !x.Assigns.Any(a => a.IsCanceledRequest) &&
// !x.Assigns.Any(a => a.IsDone) && !x.Assigns.Any(a => a.IsDoneRequest) &&
// !x.Assigns.Any(a => a.TimeRequest)
// && x.Assigns.Any(a => a.AssignedId == accountId && a.AssignerId == accountId) &&
// (x.Assigns.First(a => a.AssignedId == accountId && a.AssignerId == accountId)
// .EndTaskDate.Date <= DateTime.Now.Date) && x.Assigns.Count == 1);
}
else
{
overdueTasksCount = _accountContext.Assigns
.Include(x => x.Task)
.Where(x => x.AssignedId == accountId &&
!x.IsCancel && !x.IsCanceledRequest &&
!x.IsDone && !x.TimeRequest && !x.IsDoneRequest && x.EndTaskDate.Date <= DateTime.Now.Date && x.Task.IsActiveString == "true")
.GroupBy(x => x.TaskId).Select(x => x.First()).Count();
}
//overdueTasksCount = _accountContext.Tasks.Include(x =>
// x.Assigns).Count(x => !x.Assigns.Any(a => a.IsCancel) && !x.Assigns.Any(a => a.IsCanceledRequest) &&
// !x.Assigns.Any(a => a.IsDone) && !x.Assigns.Any(a => a.IsDoneRequest) &&
// !x.Assigns.Any(a => a.TimeRequest)
// && x.Assigns.Any(a => a.AssignedId == accountId) &&
// (x.Assigns.First(a => a.AssignedId == accountId).EndTaskDate.Date <= DateTime.Now.Date));
var overdueRequestsCount = _accountContext.Assigns.Include(x => x.Task)
.Where(x => (x.IsCanceledRequest
|| x.IsDoneRequest || x.TimeRequest) && !x.IsCancel && !x.IsDone &&
x.Task.IsActiveString == "true" &&
x.Task.SenderId == accountId).GroupBy(x => x.TaskId).Select(x => x.First()).Count();
return overdueTasksCount + overdueRequestsCount;
}
}
public class AccountSmsTaskViewModel
{
public int TaskCount { get; set; }
public long AccountId { get; set; }
public string Mobile { get; set; }
public string FullName { get; set; }
}

View File

@@ -0,0 +1,25 @@
using BackgroundInstitutionContract.Task.Jobs;
namespace BackgroundInstitutionContract.Task;
public class JobsBootstrapper
{
public static void Configure(IServiceCollection services)
{
var currentNamespace = typeof(JobSchedulerRegistrator).Namespace; // همون namespace کلاس
var assembly = typeof(JobSchedulerRegistrator).Assembly;
var jobTypes = assembly.GetTypes()
.Where(t =>
t is { IsClass: true, IsAbstract: false, Namespace: not null } &&
t.Namespace.StartsWith(currentNamespace, StringComparison.Ordinal))
.ToList();
foreach (var jobType in jobTypes)
{
services.AddTransient(jobType);
}
}
}

View File

@@ -0,0 +1,59 @@
using _0_Framework.Application;
using _0_Framework.Application.Sms;
using _0_Framework.Application.UID;
using _0_Framework.InfraStructure.Mongo;
using AccountManagement.Configuration;
using BackgroundInstitutionContract.Task;
using BackgroundInstitutionContract.Task.Jobs;
using CompanyManagment.EFCore.Services;
using Hangfire;
using Microsoft.AspNetCore.Identity;
using MongoDB.Driver;
using PersonalContractingParty.Config;
using Query.Bootstrapper;
using WorkFlow.Infrastructure.Config;
var builder = WebApplication.CreateBuilder(args);
var hangfireConnectionString = builder.Configuration.GetConnectionString("HangfireDb");
builder.Services.AddHangfire(x => x.UseSqlServerStorage(hangfireConnectionString));
builder.Services.AddHangfireServer();
var connectionString = builder.Configuration.GetConnectionString("MesbahDb");
var connectionStringTestDb = builder.Configuration.GetConnectionString("TestDb");
builder.Services.AddSingleton<IPasswordHasher, PasswordHasher>();
builder.Services.AddTransient<IAuthHelper, AuthHelper>();
builder.Services.AddTransient<ISmsService, SmsService>();
builder.Services.AddTransient<IUidService, UidService>();
builder.Services.AddTransient<IFileUploader, FileUploader>();
builder.Services.Configure<AppSettingConfiguration>(builder.Configuration);
#region MongoDb
var mongoConnectionSection = builder.Configuration.GetSection("MongoDb");
var mongoDbSettings = mongoConnectionSection.Get<MongoDbConfig>();
var mongoClient = new MongoClient(mongoDbSettings.ConnectionString);
var mongoDatabase = mongoClient.GetDatabase(mongoDbSettings.DatabaseName);
builder.Services.AddSingleton<IMongoDatabase>(mongoDatabase);
#endregion
PersonalBootstrapper.Configure(builder.Services, connectionString);
TestDbBootStrapper.Configure(builder.Services, connectionStringTestDb);
AccountManagementBootstrapper.Configure(builder.Services, connectionString);
WorkFlowBootstrapper.Configure(builder.Services, connectionString);
QueryBootstrapper.Configure(builder.Services);
JobsBootstrapper.Configure(builder.Services);
builder.Services.AddHttpClient();
builder.Services.AddHttpContextAccessor();
var app = builder.Build();
app.MapHangfireDashboard();
app.MapGet("/", () => "Hello World!");
using (var scope = app.Services.CreateScope())
{
var jobScheduler = scope.ServiceProvider.GetRequiredService<JobSchedulerRegistrator>();
jobScheduler.Register();
}
app.Run();

View File

@@ -0,0 +1,38 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56492",
"sslPort": 44378
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5216",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7223;http://localhost:5217",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,46 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"ConnectionStrings": {
//تست
//"MesbahDb": "Data Source=DESKTOP-NUE119G\\MSNEW;Initial Catalog=Mesbah_db;Integrated Security=True"
//server
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;",
//local
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
//dad-mehr
//"MesbahDb": "Data Source=.;Initial Catalog=teamWork;Integrated Security=True;TrustServerCertificate=true;",
"TestDb": "Data Source=.;Initial Catalog=TestDb;Integrated Security=True;TrustServerCertificate=true;",
//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;"
},
"GoogleRecaptchaV3": {
"SiteKey": "6Lfhp_AnAAAAAB79WkrMoHd1k8ir4m8VvfjE7FTH",
"SecretKey": "6Lfhp_AnAAAAANjDDY6DPrbbUQS7k6ZCRmrVP5Lb"
},
"SmsSecrets": {
"ApiKey": "Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa",
"SecretKey": "dadmehr"
},
"Domain": ".gozareshgir.ir",
"MongoDb": {
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "Gozareshgir"
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\0_Framework\0_Framework.csproj" />
<ProjectReference Include="..\..\AccountManagement.Configuration\AccountManagement.Configuration.csproj" />
<ProjectReference Include="..\..\PersonalContractingParty.Config\PersonalContractingParty.Config.csproj" />
<ProjectReference Include="..\..\Query.Bootstrapper\Query.Bootstrapper.csproj" />
<ProjectReference Include="..\..\WorkFlow\Infrastructure\WorkFlow.Infrastructure.Config\WorkFlow.Infrastructure.Config.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,32 @@
using _0_Framework.Application;
namespace BackgroundJobs.Task
{
public class FileUploader : IFileUploader
{
private readonly IWebHostEnvironment _webHostEnvironment;
public FileUploader(IWebHostEnvironment webHostEnvironment)
{
_webHostEnvironment = webHostEnvironment;
}
public string Upload(IFormFile file, string path)
{
if (file == null) return "";
var directoryPath = $"{_webHostEnvironment.WebRootPath}\\ProductPictures\\{path}";
if (!Directory.Exists(directoryPath))
Directory.CreateDirectory(directoryPath);
var fileName = $"{DateTime.Now.ToFileName()}-{file.FileName}";
var filePath = $"{directoryPath}\\{fileName}";
var output = System.IO.File.Create(filePath);
file.CopyTo(output);
return $"{path}/{fileName}";
}
}
}

View File

@@ -0,0 +1,62 @@
using Hangfire;
namespace BackgroundJobs.Task.Jobs;
public class JobSchedulerRegistrator
{
private readonly IBackgroundJobClient _backgroundJobClient;
private readonly SmsReminder _smsReminder;
private static DateTime? _lastRunDateMorning;
private static DateTime? _lastRunDateEvening;
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient)
{
_smsReminder = smsReminder;
_backgroundJobClient = backgroundJobClient;
}
public void Register()
{
RecurringJob.AddOrUpdate(
"Task.SmsReminderChecker",
() => SmsReminderCheckAndSchedule(),
"*/5 * * * *" // هر 5 دقیقه یکبار چک کن
);
}
public void SmsReminderCheckAndSchedule()
{
var now = DateTime.Now;
var startMorning = new TimeSpan(9, 0, 0);
var endMorning = new TimeSpan(9, 40, 0);
var startEvening = new TimeSpan(15, 30, 0);
var endEvening = new TimeSpan(15, 40, 0);
// صبح
if (now.DayOfWeek != DayOfWeek.Friday &&
now.TimeOfDay >= startMorning &&
now.TimeOfDay < endMorning)
{
if (_lastRunDateMorning?.Date != now.Date)
{
_backgroundJobClient.Enqueue(() => _smsReminder.Execute());
_lastRunDateMorning = now;
}
}
// عصر - پنجشنبه و جمعه تعطیل است
if (now.DayOfWeek != DayOfWeek.Friday &&
now.DayOfWeek != DayOfWeek.Thursday &&
now.TimeOfDay >= startEvening &&
now.TimeOfDay < endEvening)
{
if (_lastRunDateEvening?.Date != now.Date)
{
_backgroundJobClient.Enqueue(() => _smsReminder.Execute());
_lastRunDateEvening = now;
}
}
}
}

View File

@@ -0,0 +1,116 @@
using _0_Framework.Application.Sms;
using AccountManagement.Application.Contracts.Account;
using AccountMangement.Infrastructure.EFCore;
using Company.Domain.SmsResultAgg;
using Microsoft.EntityFrameworkCore;
using SmsResult = Company.Domain.SmsResultAgg.SmsResult;
namespace BackgroundJobs.Task.Jobs;
public class SmsReminder
{
private readonly AccountContext _accountContext;
private readonly ISmsService _smsService;
private readonly ISmsResultRepository _smsResultRepository;
public SmsReminder(ISmsService smsService, AccountContext accountContext, ISmsResultRepository smsResultRepository)
{
_smsService = smsService;
_accountContext = accountContext;
_smsResultRepository = smsResultRepository;
}
public void Execute()
{
//var accounts = _accountContext.Accounts.Where(x => x.PositionId > 0 && x.IsActiveString == "true").Select(x => new AccountViewModel() { Id = x.id, Mobile = x.Mobile, Fullname = x.Fullname }).ToList();
//Thread.Sleep(300);
//var accounts = new List<AccountViewModel>() { new AccountViewModel() { Mobile = "09114221321", Id = 2 } };
var accounts= _accountContext.Accounts.Where(x => x.Username.ToLower()=="mahan").Select(x => new AccountViewModel() { Id = x.id, Mobile = x.Mobile, Fullname = x.Fullname }).ToList();
var smsVM = accounts.Select(x => new AccountSmsTaskViewModel()
{
Mobile = x.Mobile,
AccountId = x.Id,
FullName = x.Fullname,
TaskCount = GetLateTasksCount(x.Id)
}).Where(x => x.TaskCount > 0 && !string.IsNullOrEmpty(x.Mobile) && x.Mobile.Length == 11).ToList();
Thread.Sleep(300);
foreach (var viewmodel in smsVM)
{
var smsResult = _smsService.TaskReminderSms(viewmodel.Mobile, $"{viewmodel.TaskCount}");
Thread.Sleep(1000);
var createSmsResult = new SmsResult(smsResult.MessageId, smsResult.Message, "یادآور وظایف",
viewmodel.FullName, viewmodel.Mobile, viewmodel.AccountId, viewmodel.AccountId);
_smsResultRepository.Create(createSmsResult);
_smsResultRepository.SaveChanges();
Thread.Sleep(1000);
}
}
private int GetLateTasksCount(long accountId)
{
var positionValue = _accountContext.Accounts
.Where(x => x.id == accountId)
.Include(p => p.Position)
.Select(x => x.Position.PositionValue)
.FirstOrDefault();
if (positionValue == 0)
return 0;
DateTime now = DateTime.Now;
int overdueTasksCount;
if (positionValue == 1)
{
overdueTasksCount = _accountContext.Assigns.Include(x => x.Task).Where(x => x.AssignedId == accountId &&
x.AssignerId == accountId && x.Task.Assigns.Count == 1 &&
!x.IsCancel && !x.IsCanceledRequest &&
!x.IsDone && !x.TimeRequest && !x.IsDoneRequest && x.EndTaskDate.Date <= DateTime.Now.Date && x.Task.IsActiveString == "true")
.GroupBy(x => x.TaskId).Select(x => x.First()).Count();
//overdueTasksCount = _accountContext.Tasks.Include(x =>
// x.Assigns).Count(x => !x.Assigns.Any(a => a.IsCancel) && !x.Assigns.Any(a => a.IsCanceledRequest) &&
// !x.Assigns.Any(a => a.IsDone) && !x.Assigns.Any(a => a.IsDoneRequest) &&
// !x.Assigns.Any(a => a.TimeRequest)
// && x.Assigns.Any(a => a.AssignedId == accountId && a.AssignerId == accountId) &&
// (x.Assigns.First(a => a.AssignedId == accountId && a.AssignerId == accountId)
// .EndTaskDate.Date <= DateTime.Now.Date) && x.Assigns.Count == 1);
}
else
{
overdueTasksCount = _accountContext.Assigns
.Include(x => x.Task)
.Where(x => x.AssignedId == accountId &&
!x.IsCancel && !x.IsCanceledRequest &&
!x.IsDone && !x.TimeRequest && !x.IsDoneRequest && x.EndTaskDate.Date <= DateTime.Now.Date && x.Task.IsActiveString == "true")
.GroupBy(x => x.TaskId).Select(x => x.First()).Count();
}
//overdueTasksCount = _accountContext.Tasks.Include(x =>
// x.Assigns).Count(x => !x.Assigns.Any(a => a.IsCancel) && !x.Assigns.Any(a => a.IsCanceledRequest) &&
// !x.Assigns.Any(a => a.IsDone) && !x.Assigns.Any(a => a.IsDoneRequest) &&
// !x.Assigns.Any(a => a.TimeRequest)
// && x.Assigns.Any(a => a.AssignedId == accountId) &&
// (x.Assigns.First(a => a.AssignedId == accountId).EndTaskDate.Date <= DateTime.Now.Date));
var overdueRequestsCount = _accountContext.Assigns.Include(x => x.Task)
.Where(x => (x.IsCanceledRequest
|| x.IsDoneRequest || x.TimeRequest) && !x.IsCancel && !x.IsDone &&
x.Task.IsActiveString == "true" &&
x.Task.SenderId == accountId).GroupBy(x => x.TaskId).Select(x => x.First()).Count();
return overdueTasksCount + overdueRequestsCount;
}
}
public class AccountSmsTaskViewModel
{
public int TaskCount { get; set; }
public long AccountId { get; set; }
public string Mobile { get; set; }
public string FullName { get; set; }
}

View File

@@ -0,0 +1,24 @@
using BackgroundJobs.Task.Jobs;
namespace BackgroundJobs.Task;
public class JobsBootstrapper
{
public static void Configure(IServiceCollection services)
{
var currentNamespace = typeof(JobSchedulerRegistrator).Namespace; // همون namespace کلاس
var assembly = typeof(JobSchedulerRegistrator).Assembly;
var jobTypes = assembly.GetTypes()
.Where(t =>
t is { IsClass: true, IsAbstract: false, Namespace: not null } &&
t.Namespace.StartsWith(currentNamespace, StringComparison.Ordinal))
.ToList();
foreach (var jobType in jobTypes)
{
services.AddTransient(jobType);
}
}
}

View File

@@ -0,0 +1,59 @@
using _0_Framework.Application;
using _0_Framework.Application.Sms;
using _0_Framework.Application.UID;
using _0_Framework.InfraStructure.Mongo;
using AccountManagement.Configuration;
using BackgroundJobs.Task;
using BackgroundJobs.Task.Jobs;
using CompanyManagment.EFCore.Services;
using Hangfire;
using Microsoft.AspNetCore.Identity;
using MongoDB.Driver;
using PersonalContractingParty.Config;
using Query.Bootstrapper;
using WorkFlow.Infrastructure.Config;
var builder = WebApplication.CreateBuilder(args);
var hangfireConnectionString = builder.Configuration.GetConnectionString("HangfireDb");
builder.Services.AddHangfire(x => x.UseSqlServerStorage(hangfireConnectionString));
builder.Services.AddHangfireServer();
var connectionString = builder.Configuration.GetConnectionString("MesbahDb");
var connectionStringTestDb = builder.Configuration.GetConnectionString("TestDb");
builder.Services.AddSingleton<IPasswordHasher, PasswordHasher>();
builder.Services.AddTransient<IAuthHelper, AuthHelper>();
builder.Services.AddTransient<ISmsService, SmsService>();
builder.Services.AddTransient<IUidService, UidService>();
builder.Services.AddTransient<IFileUploader, FileUploader>();
builder.Services.Configure<AppSettingConfiguration>(builder.Configuration);
#region MongoDb
var mongoConnectionSection = builder.Configuration.GetSection("MongoDb");
var mongoDbSettings = mongoConnectionSection.Get<MongoDbConfig>();
var mongoClient = new MongoClient(mongoDbSettings.ConnectionString);
var mongoDatabase = mongoClient.GetDatabase(mongoDbSettings.DatabaseName);
builder.Services.AddSingleton<IMongoDatabase>(mongoDatabase);
#endregion
PersonalBootstrapper.Configure(builder.Services, connectionString);
TestDbBootStrapper.Configure(builder.Services, connectionStringTestDb);
AccountManagementBootstrapper.Configure(builder.Services, connectionString);
WorkFlowBootstrapper.Configure(builder.Services, connectionString);
QueryBootstrapper.Configure(builder.Services);
JobsBootstrapper.Configure(builder.Services);
builder.Services.AddHttpClient();
builder.Services.AddHttpContextAccessor();
var app = builder.Build();
app.MapHangfireDashboard();
app.MapGet("/", () => "Hello World!");
using (var scope = app.Services.CreateScope())
{
var jobScheduler = scope.ServiceProvider.GetRequiredService<JobSchedulerRegistrator>();
jobScheduler.Register();
}
app.Run();

View File

@@ -0,0 +1,38 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56492",
"sslPort": 44378
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5216",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7222;http://localhost:5216",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,46 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"ConnectionStrings": {
//تست
//"MesbahDb": "Data Source=DESKTOP-NUE119G\\MSNEW;Initial Catalog=Mesbah_db;Integrated Security=True"
//server
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;",
//local
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
//dad-mehr
//"MesbahDb": "Data Source=.;Initial Catalog=teamWork;Integrated Security=True;TrustServerCertificate=true;",
"TestDb": "Data Source=.;Initial Catalog=TestDb;Integrated Security=True;TrustServerCertificate=true;",
//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;"
},
"GoogleRecaptchaV3": {
"SiteKey": "6Lfhp_AnAAAAAB79WkrMoHd1k8ir4m8VvfjE7FTH",
"SecretKey": "6Lfhp_AnAAAAANjDDY6DPrbbUQS7k6ZCRmrVP5Lb"
},
"SmsSecrets": {
"ApiKey": "Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa",
"SecretKey": "dadmehr"
},
"Domain": ".gozareshgir.ir",
"MongoDb": {
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "Gozareshgir"
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@@ -26,6 +26,35 @@ public class FinancialTransaction : EntityBase
}
/// <summary>
/// ایجاد از طرف بک گراند سرویس
/// </summary>
/// <param name="financialStatementId"></param>
/// <param name="tdateGr"></param>
/// <param name="tdateFa"></param>
/// <param name="description"></param>
/// <param name="typeOfTransaction"></param>
/// <param name="descriptionOption"></param>
/// <param name="deptor"></param>
/// <param name="creditor"></param>
/// <param name="balance"></param>
/// <param name="sentSms"></param>
public FinancialTransaction(long financialStatementId, DateTime tdateGr, string tdateFa, string description,
string typeOfTransaction, string descriptionOption, double deptor, double creditor, double balance,
bool sentSms)
{
FinancialStatementId = financialStatementId;
TdateGr = tdateGr;
TdateFa = tdateFa;
Description = description;
TypeOfTransaction = typeOfTransaction;
DescriptionOption = descriptionOption;
Deptor = deptor;
Creditor = creditor;
Balance = balance;
SentSms = sentSms;
}
public long FinancialStatementId { get; private set; }
public DateTime TdateGr { get; private set; }
public string TdateFa { get; private set; }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.Workshop;
@@ -44,7 +45,7 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
/// <param name="endOfMonthGr"></param>
/// <param name="endOfMonth"></param>
/// <param name="description"></param>
void RollcallServiceCreateTransaction();
Task RollCallServiceCreateTransaction();
Task<PagedResult<GetInstitutionContractListItemsViewModel>> GetList(InstitutionContractListSearchModel searchModel);
Task<GetInstitutionContractListStatsViewModel> GetListStats(InstitutionContractListSearchModel searchModel);
@@ -77,4 +78,71 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
#region ReminderSMS
/// <summary>
/// دریافت لیست - ارسال پیامک
/// فراخوانی از سمت بک گراند سرویس
/// </summary>
/// <returns></returns>
Task<bool> SendReminderSmsForBackgroundTask();
/// <summary>
/// ارسال پیامک صورت حساب ماهانه
/// </summary>
/// <param name="now"></param>
/// <returns></returns>
Task SendMonthlySms(DateTime now);
/// <summary>
/// ارسال پیامک مسدودی از طرف بک گراند سرویس
/// </summary>
/// <returns></returns>
Task SendBlockSmsForBackgroundTask();
/// <summary>
/// دریافت لیست واجد شرایط بلاک
/// جهت ارسال پیامک مسدودی
/// </summary>
/// <param name="checkDate"></param>
/// <returns></returns>
Task<List<BlockSmsListData>> GetBlockListData(DateTime checkDate);
/// <summary>
/// ارسال پیامک مسدودی
/// </summary>
/// <param name="smsListData"></param>
/// <param name="typeOfSms"></param>
/// <param name="sendMessStart"></param>
/// <param name="sendMessEnd"></param>
/// <returns></returns>
Task SendBlockSmsToContractingParties(List<BlockSmsListData> smsListData, string typeOfSms,
string sendMessStart, string sendMessEnd);
/// <summary>
///دریافت لیست بدهکارن
/// جهت ارسال پیامک
/// </summary>
/// <returns></returns>
Task<List<SmsListData>> GetSmsListData(DateTime checkDate, TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ارسال پیامک های یاد آور بدهی
/// </summary>
/// <returns></returns>
Task SendReminderSmsToContractingParties(List<SmsListData> smsListData, string typeOfSms, string sendMessStart, string sendMessEnd);
#endregion
#region CreateMontlyTransaction
/// <summary>
/// ایجاد سند مالی برای قرارداد ها
/// </summary>
/// <returns></returns>
Task CreateTransactionForInstitutionContracts(DateTime endOfMonthGr, string endOfMonthFa, string description);
#endregion
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Security.Cryptography;
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using Company.Domain.InstitutionContractContactInfoAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
@@ -371,20 +372,3 @@ public enum InstitutionContractAmendmentChangeType
WorkshopCreated
}
public enum InstitutionContractVerificationStatus
{
/// <summary>
/// در انتظار تایید
/// </summary>
PendingForVerify = 0,
/// <summary>
/// در انتظار کارپوشه
/// </summary>
PendingWorkflow = 1,
/// <summary>
/// تایید شده
/// </summary>
Verified = 2
}

View File

@@ -0,0 +1,30 @@
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.SmsResult;
using System.Threading.Tasks;
namespace Company.Domain.SmsResultAgg;
public interface ISmsSettingsRepository : IRepository<long, SmsSetting>
{
/// <summary>
/// ویرایش پیامک خودکار
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<EditSmsSetting> GetSmsSettingToEdit(long id);
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<SmsSettingViewModel> GetSmsSettingsByType(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// حذف از دیتابیس
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task RemoveItem(long id);
}

View File

@@ -0,0 +1,72 @@
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using System;
namespace Company.Domain.SmsResultAgg;
public class SmsSetting : EntityBaseWithoutCreationDate
{
/// <summary>
/// ایجاد تنظیمات پیامک
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
public SmsSetting(TypeOfSmsSetting typeOfSmsSetting, int dayOfMonth, TimeSpan timeOfDay)
{
TypeOfSmsSetting = typeOfSmsSetting;
DayOfMonth = dayOfMonth;
TimeOfDay = timeOfDay;
IsActive = true;
}
/// <summary>
/// نوع پیامک
/// </summary>
public TypeOfSmsSetting TypeOfSmsSetting { get; set; }
/// <summary>
/// عدد روز از ماه
/// </summary>
public int DayOfMonth { get; set; }
/// <summary>
/// ساعت
/// </summary>
public TimeSpan TimeOfDay { get; set; }
/// <summary>
/// فعال/غیرفعال
/// </summary>
public bool IsActive { get; set; }
/// <summary>
/// ویرایش تنظیمات پیامک
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
public void Edit(int dayOfMonth, TimeSpan timeOfDay)
{
DayOfMonth = dayOfMonth;
TimeOfDay = timeOfDay;
}
/// <summary>
/// فعال نمودن
/// </summary>
public void Active()
{
IsActive = true;
}
/// <summary>
/// غیر فعال نمودن
/// </summary>
public void DeActive()
{
IsActive = false;
}
}

View File

@@ -9,6 +9,7 @@ public class FinancialStatmentViewModel
public long Id { get; set; }
public long ContractingPartyId { get; set; }
public string ContractingPartyName { get; set; }
public string PublicId { get; set; }
public List<FinancialTransactionViewModel> FinancialTransactionViewModels { get; set; }

View File

@@ -10,6 +10,7 @@ public class FinancialTransactionViewModel
public string TdateFa { get; set; }
public string Description { get; set; }
public string TypeOfTransaction { get; set; }
public string DescriptionOption { get; set; }
public double Deptor { get; set; }
public string DeptorString { get; set; }
public double Creditor { get; set; }
@@ -20,4 +21,7 @@ public class FinancialTransactionViewModel
public string MessageText { get; set; }
public string SentSmsDateFa { get; set; }
public int Counter { get; set; }
}

View File

@@ -0,0 +1,20 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
namespace CompanyManagment.App.Contracts.Hubs;
public class SendSmsHub : Hub
{
public async Task send(long id)
{
await Groups.AddToGroupAsync(Context.ConnectionId, GetGroupName(id));
}
public static string GetGroupName(long id)
{
return $"group-sms-{id}";
}
}

View File

@@ -27,7 +27,13 @@ public class InstitutionContractInstallmentViewModel
/// مبلغ قسط
/// </summary>
public string Amount { get; set; }
/// <summary>
/// مبلغ قسط
/// Double
/// </summary>
public double AmountDouble { get; set; }
/// <summary>
/// عدد قسط فارسی
/// </summary>

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.Workshop;
@@ -25,6 +26,7 @@ public class InstitutionContractViewModel
public DateTime ContractEndGr { get; set; }
public string ContractEndFa { get; set; }
public string ContractAmount { get; set; }
public double ContractAmountDouble { get; set; }
public string DailyCompenseation { get; set; }
public string Obligation { get; set; }
@@ -70,4 +72,9 @@ public class InstitutionContractViewModel
public int LeftWorkEmployeeCount { get; set; }
public int InsuranceLeftWorkEmployeeCount { get; set; }
public string IsExpier { get; set; }
public bool IsInstallment { get; set; }
public InstitutionContractVerificationStatus VerificationStatus { get; set; }
public List<InstitutionContractInstallmentViewModel> InstallmentList { get; set; }
}

View File

@@ -0,0 +1,97 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
/// <summary>
/// لیست پیامکهای بدهکاران قرارداد ملی
/// </summary>
public class SmsListData
{
/// <summary>
/// شماره تماس طرف حساب
/// </summary>
public string PhoneNumber { get; set; }
/// <summary>
/// تمپلیت آی دی
/// </summary>
public int TemplateId { get; set; }
/// <summary>
/// نام طرف حساب
/// </summary>
public string PartyName { get; set; }
/// <summary>
/// مبلغ بدهی
/// </summary>
public string Amount { get; set; }
/// <summary>
/// آی دی طرف حساب
/// </summary>
public long ContractingPartyId { get; set; }
/// <summary>
/// آی دی صورت حساب مالی
/// </summary>
public string AproveId { get; set; }
/// <summary>
/// نوع متد ارسال پیامک
/// </summary>
public string TypeOfSmsMethod { get; set; }
/// <summary>
/// پابلیک آی دی بخش یک
/// </summary>
public string Code1 { get; set; }
/// <summary>
/// پابلیک آی دی بخش دو
/// </summary>
public string Code2 { get; set; }
/// <summary>
/// ای دی قراداد مالی
/// </summary>
public long InstitutionContractId { get; set; }
}
/// <summary>
/// لیست پیامک های بلاک
/// </summary>
public class BlockSmsListData
{
/// <summary>
/// شماره تماس طرف حساب
/// </summary>
public string PhoneNumber { get; set; }
/// <summary>
/// نام طرف حساب
/// </summary>
public string PartyName { get; set; }
/// <summary>
/// مبلغ بدهی
/// </summary>
public string Amount { get; set; }
/// <summary>
/// آی دی طرف حساب
/// </summary>
public long ContractingPartyId { get; set; }
/// <summary>
/// نوع حساب - رسمی یا غیر رسمی
/// </summary>
public string AccountType { get; set; }
/// <summary>
/// ای دی قراداد مالی
/// </summary>
public long InstitutionContractId { get; set; }
/// <summary>
/// آی دی صورت حساب مالی
/// </summary>
public string AproveId { get; set; }
}

View File

@@ -0,0 +1,62 @@
using _0_Framework.Application.Enums;
using System;
using System.Collections.Generic;
using _0_Framework.Domain;
namespace CompanyManagment.App.Contracts.SmsResult;
/// <summary>
/// مدل ایجاد تنظیمات پیامک
/// </summary>
public class CreateSmsSetting
{
/// <summary>
/// نوع پیامک
/// </summary>
public TypeOfSmsSetting TypeOfSmsSetting { get; set; }
/// <summary>
/// عدد روز از ماه
/// </summary>
public int DayOfMonth { get; set; }
/// <summary>
/// ساعت
/// </summary>
public TimeSpan TimeOfDay { get; set; }
}
/// <summary>
/// ویرایش تنظیمات پیامک
/// </summary>
public class EditSmsSetting : CreateSmsSetting
{
/// <summary>
/// آی دی
/// </summary>
public long Id { get; set; }
/// <summary>
/// فعال/غیرفعال
/// </summary>
public bool IsActive { get; set; }
/// <summary>
/// نمایش ساعت و دقیقه
/// </summary>
public string TimeOfDayDisplay { get; set; }
}
/// <summary>
/// ویو مدل تنظیمات پیامک
/// </summary>
public class SmsSettingViewModel
{
/// <summary>
/// لیست تنظیمات پیامک
/// </summary>
public List<EditSmsSetting> EditSmsSettings { get; set; }
}

View File

@@ -0,0 +1,78 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.InstitutionContract;
namespace CompanyManagment.App.Contracts.SmsResult;
public interface ISmsSettingApplication
{
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public Task<SmsSettingViewModel> GetSmsSettingsByType(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ایجاد تنظیمات پیامک یادآور
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<OperationResult> CreateSmsSetting(int dayOfMonth, string timeOfDay, TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ویرایش پیامک خودکار
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<EditSmsSetting> GetSmsSettingToEdit(long id);
/// <summary>
/// ایجاد تنظیمات پیامک یادآور
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<OperationResult> EditeSmsSetting(EditSmsSetting command);
/// <summary>
/// حذف از دیتابیس
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task RemoveSetting(long id);
/// <summary>
/// دریافت لیست بدهکاران
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<List<SmsListData>> GetSmsListData(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// دریافت لیست کسانی که باید بلاک شوند
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<List<BlockSmsListData>> GetBlockSmsListData(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ارسال پیامک یاد آور آنی
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> InstantSendReminderSms(List<SmsListData> command);
/// <summary>
/// ارسال پیامک مسدودس
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command);
}

View File

@@ -0,0 +1,165 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using Company.Domain.InstitutionContractAgg;
using Company.Domain.SmsResultAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.SmsResult;
namespace CompanyManagment.Application;
public class SmsSettingApplication : ISmsSettingApplication
{
private readonly ISmsSettingsRepository _smsSettingsRepository;
private readonly IInstitutionContractRepository _institutionContractRepository;
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository)
{
_smsSettingsRepository = smsSettingsRepository;
_institutionContractRepository = institutionContractRepository;
}
public async Task<SmsSettingViewModel> GetSmsSettingsByType(TypeOfSmsSetting typeOfSmsSetting)
{
return await _smsSettingsRepository.GetSmsSettingsByType(typeOfSmsSetting);
}
/// <summary>
/// ایجاد تنظیمات پیامک یادآور
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<OperationResult> CreateSmsSetting(int dayOfMonth, string timeOfDay,
TypeOfSmsSetting typeOfSmsSetting)
{
var op = new OperationResult();
var timeSpan = new TimeSpan();
if (string.IsNullOrWhiteSpace(timeOfDay))
return op.Failed("ساعت وارد نشده است");
try
{
timeSpan = TimeSpan.ParseExact(timeOfDay, @"hh\:mm", null);
}
catch (Exception e)
{
return op.Failed("فرمت ساعت اشتباه است");
}
if (dayOfMonth < 1 || dayOfMonth > 31)
{
return op.Failed("عدد روز می بایست بین 1 تا 31 باشد");
}
if (_smsSettingsRepository.Exists(x => x.DayOfMonth == dayOfMonth && x.TimeOfDay == timeSpan && x.TypeOfSmsSetting == typeOfSmsSetting))
return op.Failed("رکورد ایجاد شده تکراری است");
var create = new SmsSetting(typeOfSmsSetting, dayOfMonth, timeSpan);
await _smsSettingsRepository.CreateAsync(create);
await _smsSettingsRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task<EditSmsSetting> GetSmsSettingToEdit(long id)
{
return await _smsSettingsRepository.GetSmsSettingToEdit(id);
}
public async Task<OperationResult> EditeSmsSetting(EditSmsSetting command)
{
var op = new OperationResult();
var timeSpan = new TimeSpan();
if (string.IsNullOrWhiteSpace(command.TimeOfDayDisplay))
return op.Failed("ساعت وارد نشده است");
try
{
timeSpan = TimeSpan.ParseExact(command.TimeOfDayDisplay, @"hh\:mm", null);
}
catch (Exception e)
{
return op.Failed("فرمت ساعت اشتباه است");
}
if (command.DayOfMonth < 1 || command.DayOfMonth > 31)
{
return op.Failed("عدد روز می بایست بین 1 تا 31 باشد");
}
if (_smsSettingsRepository.Exists(x => x.DayOfMonth == command.DayOfMonth && x.TimeOfDay == timeSpan && x.TypeOfSmsSetting == command.TypeOfSmsSetting && x.id != command.Id))
return op.Failed("رکورد ایجاد شده تکراری است");
var editSmsSetting = _smsSettingsRepository.Get(command.Id);
editSmsSetting.Edit(command.DayOfMonth, timeSpan);
await _smsSettingsRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task RemoveSetting(long id)
{
await _smsSettingsRepository.RemoveItem(id);
}
public async Task<List<SmsListData>> GetSmsListData(TypeOfSmsSetting typeOfSmsSetting)
{
return await _institutionContractRepository.GetSmsListData(DateTime.Now, typeOfSmsSetting);
}
public async Task<List<BlockSmsListData>> GetBlockSmsListData(TypeOfSmsSetting typeOfSmsSetting)
{
return await _institutionContractRepository.GetBlockListData(DateTime.Now);
}
public async Task<OperationResult> InstantSendReminderSms(List<SmsListData> command)
{
var op = new OperationResult();
string typeOfSms = "یادآور بدهی ماهانه";
string sendMessStart = "شروع یادآور آنی";
string sendMessEnd = "پایان یادآور آنی";
if (command.Any())
{
await _institutionContractRepository.SendReminderSmsToContractingParties(command, typeOfSms, sendMessStart, sendMessEnd);
return op.Succcedded();
}
else
{
return op.Failed("موردی انتخاب نشده است");
}
}
public async Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command)
{
var op = new OperationResult();
string typeOfSms = "اعلام مسدودی طرف حساب";
string sendMessStart = "شروع مسدودی آنی";
string sendMessEnd = "پایان مسدودی آنی ";
if (command.Any())
{
await _institutionContractRepository.SendBlockSmsToContractingParties(command, typeOfSms, sendMessStart,
sendMessEnd);
return op.Succcedded();
}
else
{
return op.Failed("موردی انتخاب نشده است");
}
}
}

View File

@@ -163,6 +163,12 @@ public class CompanyContext : DbContext
//-------Main-Project----------------------------
#region SmsSettings
public DbSet<SmsSetting> SmsSettings { get; set; }
#endregion
#region Mahan
//-----------------------------RollCallWorkshopSettings-----------------------------

View File

@@ -0,0 +1,30 @@
using System;
using _0_Framework.Application.Enums;
using Company.Domain.SmsResultAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class SmsSettingMapping : IEntityTypeConfiguration<SmsSetting>
{
public void Configure(EntityTypeBuilder<SmsSetting> builder)
{
builder.ToTable("SmsSettings");
builder.HasKey(x => x.id);
builder.Property(x => x.DayOfMonth)
.IsRequired();
builder.Property(x => x.TimeOfDay)
.HasColumnType("time(0)")
.IsRequired();
builder.Property(x => x.TypeOfSmsSetting).HasConversion(
v => v.ToString(),
v => (TypeOfSmsSetting)Enum.Parse(typeof(TypeOfSmsSetting), v)).HasMaxLength(70);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class SmsSettingsTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SmsSettings",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
TypeOfSmsSetting = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
DayOfMonth = table.Column<int>(type: "int", nullable: false),
TimeOfDay = table.Column<TimeSpan>(type: "time(0)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SmsSettings", x => x.id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SmsSettings");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class SmsSettingsTableChange : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "TypeOfSmsSetting",
table: "SmsSettings",
type: "nvarchar(70)",
maxLength: 70,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(30)",
oldMaxLength: 30);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "TypeOfSmsSetting",
table: "SmsSettings",
type: "nvarchar(30)",
maxLength: 30,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(70)",
oldMaxLength: 70);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class addIsActiveToSmsSeting : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "SmsSettings",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsActive",
table: "SmsSettings");
}
}
}

View File

@@ -5743,6 +5743,33 @@ namespace CompanyManagment.EFCore.Migrations
b.ToTable("SmsResults", (string)null);
});
modelBuilder.Entity("Company.Domain.SmsResultAgg.SmsSetting", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<int>("DayOfMonth")
.HasColumnType("int");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<TimeSpan>("TimeOfDay")
.HasColumnType("time(0)");
b.Property<string>("TypeOfSmsSetting")
.IsRequired()
.HasMaxLength(70)
.HasColumnType("nvarchar(70)");
b.HasKey("id");
b.ToTable("SmsSettings", (string)null);
});
modelBuilder.Entity("Company.Domain.SubtitleAgg.EntitySubtitle", b =>
{
b.Property<long>("id")

View File

@@ -0,0 +1,71 @@
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application.Enums;
using _0_Framework.InfraStructure;
using Company.Domain.SmsResultAgg;
using CompanyManagment.App.Contracts.SmsResult;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
public class SmsSettingsRepository : RepositoryBase<long, SmsSetting>, ISmsSettingsRepository
{
private readonly CompanyContext _context;
public SmsSettingsRepository(CompanyContext context) : base(context)
{
_context = context;
}
/// <summary>
/// ویرایش پیامک خودکار
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<EditSmsSetting> GetSmsSettingToEdit(long id)
{
var edit = new EditSmsSetting();
var getItem = await _context.SmsSettings.FirstOrDefaultAsync(x => x.id == id);
if (getItem != null)
{
edit.Id = getItem.id;
edit.TimeOfDayDisplay = getItem.TimeOfDay.ToString(@"hh\:mm");
edit.DayOfMonth = getItem.DayOfMonth;
edit.TypeOfSmsSetting = getItem.TypeOfSmsSetting;
}
return edit;
}
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<SmsSettingViewModel> GetSmsSettingsByType(TypeOfSmsSetting typeOfSmsSetting)
{
var result = new SmsSettingViewModel();
var data =await _context.SmsSettings
.Where(x => x.TypeOfSmsSetting == typeOfSmsSetting).Select(x =>
new EditSmsSetting
{
Id = x.id,
DayOfMonth = x.DayOfMonth,
IsActive = x.IsActive,
TimeOfDay = x.TimeOfDay,
TypeOfSmsSetting = x.TypeOfSmsSetting,
TimeOfDayDisplay = x.TimeOfDay.ToString(@"hh\:mm")
}).OrderBy(x=>x.DayOfMonth).ThenBy(x=>x.TimeOfDay).ToListAsync();
result.EditSmsSettings = data;
return result;
}
public async Task RemoveItem(long id)
{
var removeItem = Get(id);
_context.SmsSettings.Remove(removeItem);
await _context.SaveChangesAsync();
}
}

View File

@@ -0,0 +1,28 @@
namespace CompanyManagment.EFCore.Repository
{
internal class ValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>
{
private string phoneNumber;
private int v1;
private string partyName;
private string balanceToMoney;
private string id;
private string aprove;
private string v2;
private string v3;
private string v4;
public ValueTuple(string phoneNumber, int v1, string partyName, string balanceToMoney, string id, string aprove, string v2, string v3, string v4)
{
this.phoneNumber = phoneNumber;
this.v1 = v1;
this.partyName = partyName;
this.balanceToMoney = balanceToMoney;
this.id = id;
this.aprove = aprove;
this.v2 = v2;
this.v3 = v3;
this.v4 = v4;
}
}
}

View File

@@ -10,6 +10,7 @@ using IPE.SmsIrClient;
using IPE.SmsIrClient.Models.Requests;
using IPE.SmsIrClient.Models.Results;
using Microsoft.Extensions.Configuration;
using SmsResult = Company.Domain.SmsResultAgg.SmsResult;
namespace CompanyManagment.EFCore.Services;
@@ -89,7 +90,7 @@ public class SmsService : ISmsService
Thread.Sleep(2000);
if (verificationSendResult.IsCompletedSuccessfully)
{
var resStartStatus = verificationSendResult.Result;
var b = resStartStatus.Status;
var resResult = verificationSendResult.Status;
@@ -99,7 +100,7 @@ public class SmsService : ISmsService
}
else
{
var resStartStatus = verificationSendResult.Status;
var resResult = verificationSendResult.Status;
var reseExceptiont = verificationSendResult.Exception;
@@ -166,10 +167,10 @@ public class SmsService : ISmsService
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);
Console.WriteLine(userName + " - " + sendResult.Result.Status);
if (sendResult.IsCompletedSuccessfully)
{
return true;
@@ -187,19 +188,19 @@ public class SmsService : ISmsService
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;
{
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)
{
@@ -214,20 +215,20 @@ public class SmsService : ISmsService
ed = endDate.ToGeorgianDateTime();
}
var res = new List<ApiResultViewModel>();
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970,1,1)).TotalSeconds;
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);
// 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()
{
foreach (var message in messages)
{
var appendData = new ApiResultViewModel()
{
MessageId = message.MessageId,
LineNumber = message.LineNumber,
Mobile = message.Mobile,
@@ -237,12 +238,12 @@ public class SmsService : ISmsService
DeliveryUnixTime = UnixTimeStampToDateTime(message.DeliveryDateTime),
DeliveryColor = DeliveryColorStatus(message.DeliveryState),
};
res.Add(appendData);
}
res.Add(appendData);
}
return res;
}
}
public string DeliveryStatus(byte? dv)
{
@@ -271,7 +272,7 @@ public class SmsService : ISmsService
mess = "لیست سیاه";
break;
default:
mess="";
mess = "";
break;
}
@@ -346,23 +347,23 @@ public class SmsService : ISmsService
{
return -1;
}
}
public async Task<bool> SendInstitutionCreationVerificationLink(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[]
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);
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه ایجاد قرارداد مالی",
fullName, number, contractingPartyId, institutionContractId);
await _smsResultRepository.CreateAsync(smsResult);
await _smsResultRepository.SaveChangesAsync();
return verificationSendResult.Status == 0;
@@ -371,16 +372,16 @@ public class SmsService : ISmsService
public async Task<bool> SendInstitutionAmendmentVerificationLink(string number, string fullName, Guid institutionId,
long contractingPartyId, long institutionContractId)
{
var guidStr=institutionId.ToString();
var guidStr = institutionId.ToString();
var firstPart = guidStr.Substring(0, 15);
var secondPart = guidStr.Substring(15);
var verificationSendResult =await VerifySendSmsAsync(number, 527519, new VerifySendParameter[]
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, "لینک تاییدیه ارتقا قرارداد مالی",
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه ارتقا قرارداد مالی",
fullName, number, contractingPartyId, institutionContractId);
await _smsResultRepository.CreateAsync(smsResult);
await _smsResultRepository.SaveChangesAsync();
@@ -390,17 +391,127 @@ public class SmsService : ISmsService
public async Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
long contractingPartyId, long institutionContractId)
{
var verificationSendResult =await VerifySendSmsAsync(number, 965348, new VerifySendParameter[]
var verificationSendResult = await VerifySendSmsAsync(number, 965348, new VerifySendParameter[]
{
new("VERIFYCODE", code)
});
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "کد تاییدیه قرارداد مالی",
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();
}
#endregion
#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)
{
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 == "موفق")
{
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);
if (sendResult.Message == "موفق")
{
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)> 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 == "موفق")
{
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, true);
return result;
}
result = (sendResult.Status, sendResult.Message, sendResult.Data.MessageId, false);
return result;
}
#endregion
#region AlarmMessage
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
}

View File

@@ -80,8 +80,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Query.Bootstrapper", "Query
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompanyManagement.Infrastructure.Excel", "CompanyManagement.Infrastructure.Excel\CompanyManagement.Infrastructure.Excel.csproj", "{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackgroundJobs.Task", "BackgroundJobs\BackgroundJobs.Task\BackgroundJobs.Task.csproj", "{97E148FA-3C36-40DD-B121-D90C1C0F3B47}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BackgroundJobs", "BackgroundJobs", "{C10E256D-7E7D-4C77-B416-E577A34AF924}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompanyManagement.Infrastructure.Mongo", "CompanyManagement.Infrastructure.Mongo\CompanyManagement.Infrastructure.Mongo.csproj", "{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackgroundInstitutionContract.Task", "BackgroundInstitutionContract\BackgroundInstitutionContract.Task\BackgroundInstitutionContract.Task.csproj", "{F78FBB92-294B-88BA-168D-F0C578B0D7D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -180,10 +186,18 @@ Global
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Release|Any CPU.Build.0 = Release|Any CPU
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Release|Any CPU.Build.0 = Release|Any CPU
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Release|Any CPU.Build.0 = Release|Any CPU
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -218,7 +232,8 @@ Global
{339E05B6-E99F-4403-AFDF-CD0540E96C8D} = {708E8D7E-F190-47C5-B78E-F43131FB7D6D}
{02892882-2A02-484B-BAF9-7E63F6BDCFA0} = {708E8D7E-F190-47C5-B78E-F43131FB7D6D}
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2} = {86921E1B-2AFA-4B8A-9403-EE16D58B5B26}
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3} = {86921E1B-2AFA-4B8A-9403-EE16D58B5B26}
{97E148FA-3C36-40DD-B121-D90C1C0F3B47} = {C10E256D-7E7D-4C77-B416-E577A34AF924}
{F78FBB92-294B-88BA-168D-F0C578B0D7D6} = {C10E256D-7E7D-4C77-B416-E577A34AF924}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E6CFB3A7-A7C8-4E82-8F06-F750408F0BA9}

View File

@@ -538,6 +538,14 @@ public class PersonalBootstrapper
services.AddTransient<IPlanPercentageRepository, PlanPercentageRepository>();
services.AddTransient<IInstitutionPlanApplication, InstitutionPlanApplication>();
#region SmsSettings
services.AddTransient<ISmsSettingsRepository, SmsSettingsRepository>();
services.AddTransient<ISmsSettingApplication, SmsSettingApplication>();
#endregion
//=========End Of Main====================================
//---File Project------------------------------------

View File

@@ -278,6 +278,7 @@
<input type="hidden" id="mobile" name="Mobile" value="@Model.Mobile"/>
<input type="hidden" id="typeOfSms" name="TypeOfSms" value="@Model.TypeOfSms"/>
<a asp-page="/Company/SmsResult/ApiResults" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 api">گزارش ای پی آی</a>
<a asp-page="/Company/SmsResult/SmsSettings" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 api"> تنظیمات پیامک خودکار </a>
<div class="container filter">
<h3 class="panel-title" style="display: inline-block;color: #7a96a6"><i class="fa fa-search" style="padding-left: 3px; font-size: 14px"></i> جستجو</h3>
<button class="btn btn-info btn-rounded waves-effect waves-light m-b-5 goToTop"> <i class="fa fa-chevron-up" style="font-size: 20px"></i> برو بالا</button>

View File

@@ -0,0 +1,236 @@
@page
@using _0_Framework.Application.Enums
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model ServiceHost.Areas.Admin.Pages.Company.SmsResult.SmsSettingsModel
@Html.AntiForgeryToken()
@{
string adminVersion = _0_Framework.Application.Version.AdminVersion;
<link href="~/admintheme/css/workshop-create.css?ver=@adminVersion" rel="stylesheet" />
<style>
body{
background-color: #fefefe;
background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%232ebfbf' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
}
.hiddenTab{
display: none;
}
.errored {
animation: shake 300ms;
box-shadow: inset 0 0 2px #eb3434, 0 0 5px #eb3434 !important;
border: 1px solid #eb3434 !important;
}
.date-input {
text-align: center;
}
button.rounded-pill {
border-radius: 5px !important;
}
.instantSendSms {
background-color: #75aea7;
color: white !important;
}
</style>
}
<div class="container">
<div class="row">
<div style="max-width: 80%;margin: 0 auto">
<div class="col-xs-12" style="float: unset;">
<div class="handle-title">
<h3 id="titleHead"> تنظیمات پیامک های خودکار مالی </h3>
<a asp-page="./index" class="btn btn-rounded" type="button">
<span>بازگشت</span>
</a>
</div>
</div>
<div class="col-xs-12" style="float: unset;">
<div class="card card-pattern">
<ul class="nav nav-tabs nav-fill wizard" id="myTab" role="tablist">
<li class="li-wizard step active" id="institutionContractDebtReminderTab" data-url="/Admin/Company/SmsResult/SmsSettings?handler=InstitutionContractDebtReminderTab">
<a class="nav-link">
<div class="success-icon" id="success-icon1" style="display:none;">
<svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.25 4L4.14393 6.89393C4.20251 6.95251 4.29749 6.95251 4.35607 6.89393L10.25 1" stroke="#222222" stroke-width="1.2" />
</svg>
</div>
<span> پیامک یاد آور </span>
</a>
</li>
<li class="li-wizard step" id="blockContractingPartyTab" data-url="/Admin/Company/SmsResult/SmsSettings?handler=BlockContractingPartyTab">
<a class="nav-link">
<div class="success-icon" id="success-icon2" style="display:none;">
<svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.25 4L4.14393 6.89393C4.20251 6.95251 4.29749 6.95251 4.35607 6.89393L10.25 1" stroke="#222222" stroke-width="1.2" />
</svg>
</div>
<span> پیامک مسدودی </span>
</a>
</li>
<li class="li-wizard step" id="warningTab" data-url="/Admin/Company/SmsResult/SmsSettings?handler=WarningTab">
<a class="nav-link">
<div class="success-icon" id="success-icon3" style="display:none;">
<svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.25 4L4.14393 6.89393C4.20251 6.95251 4.29749 6.95251 4.35607 6.89393L10.25 1" stroke="#222222" stroke-width="1.2" />
</svg>
</div>
<span> پیامک هشدار برای اقدام قضائی </span>
</a>
</li>
<li class="li-wizard step" id="legalActionTab" data-url="/Admin/Company/SmsResult/SmsSettings?handler=LegalActionTab">
<a class="nav-link">
<div class="success-icon" id="success-icon2" style="display:none;">
<svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.25 4L4.14393 6.89393C4.20251 6.95251 4.29749 6.95251 4.35607 6.89393L10.25 1" stroke="#222222" stroke-width="1.2" />
</svg>
</div>
<span> پیامک اقدام قضائی </span>
</a>
</li>
</ul>
</div>
<div class="partial-tabs" id="partialContainer"></div>
</div>
</div>
</div>
</div>
@section Script
{
<script src="~/AdminTheme/assets/js/site.js"></script>
<script src="~/AdminTheme/js/numeral.min.js"></script>
<script src="~/admintheme/js/jquery.mask_1.14.16.min.js"></script>
<script src="~/js/signalr/dist/browser/signalr.js"></script>
<script>
$(document).ready(function () {
$('.time-input').mask('00:00', {
translation: {
'0': {pattern: /[0-9]/},
// برای اولین رقم ساعت فقط 0-2
'H': {pattern: /[0-2]/},
// اگر اولین رقم 2 باشد دومین رقم فقط 0-3
'h': {pattern: /[0-3]/},
// برای دقیقه
'M': {pattern: /[0-5]/},
'm': {pattern: /[0-9]/},
}
});
// پیش‌فرض: لود تب اول با workshopId
loadPartial("/Admin/Company/SmsResult/SmsSettings?handler=InstitutionContractDebtReminderTab");
$("#institutionContractDebtReminderTab").addClass("active");
// کلیک روی تب‌ها
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").click(function (e) {
e.preventDefault();
let url = $(this).data("url");
switch(this.id){
case "institutionContractDebtReminderTab" :
loadPartial(url);
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
$(this).addClass("active");
break;
case "blockContractingPartyTab" :
loadPartial(url);
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
$(this).addClass("active");
break;
case "legalActionTab" :
loadPartial(url);
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
$(this).addClass("active");
break;
case "warningTab" :
loadPartial(url);
$("#institutionContractDebtReminderTab, #blockContractingPartyTab, #legalActionTab, #warningTab").removeClass("active");
$(this).addClass("active");
break;
}
});
function loadPartial(url) {
$.get(url, function (data) {
$("#partialContainer").html(data);
});
}
});
function remove(id){
var urlAjaxToRemove = '@Url.Page("/Company/SmsResult/SmsSettings", "RemoveSetting")';
$.ajax({
dataType: 'json',
type: 'GET',
url: urlAjaxToRemove,
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: { id: id },
success: function (response) {
if(response.isSuccess){
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
setTimeout(function () {
$(".li-wizard.step.active").trigger("click");
}, 500);
}else{
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
}
},
failure: function (response) {
//console.log(5, response);
}
});
}
</script>
}

View File

@@ -0,0 +1,243 @@
using _0_Framework.Application.Enums;
using Company.Domain.SmsResultAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.Module;
using CompanyManagment.App.Contracts.SmsResult;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using ServiceHost.Areas.Admin.Pages.Company.Bill;
namespace ServiceHost.Areas.Admin.Pages.Company.SmsResult
{
public class SmsSettingsModel : PageModel
{
private readonly ISmsSettingApplication _smsSettingApplication;
public SmsSettingsModel(ISmsSettingApplication smsSettingApplication)
{
_smsSettingApplication = smsSettingApplication;
}
public void OnGet()
{
}
//=================================== ایجاد ========================================//
#region Create
/// <summary>
/// لود مدال ایجاد پیامک خودکار
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetCreateSmsSetting(TypeOfSmsSetting typeOfSmsSetting)
{
var createModel = new CreateSmsSetting();
createModel.TypeOfSmsSetting = typeOfSmsSetting;
return Partial("_SmsSettingPartials/_CreateSmsSetting", createModel);
}
/// <summary>
/// ذخیره مدال ایجاد پیامک خودکار
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<JsonResult> OnPostCreateSmsSetting(int dayOfMonth, string timeOfDay, TypeOfSmsSetting typeOfSmsSetting)
{
var result = await _smsSettingApplication.CreateSmsSetting(dayOfMonth, timeOfDay, typeOfSmsSetting);
return new JsonResult(new
{
isSuccess = result.IsSuccedded,
message = result.Message
});
}
#endregion
//=================================== ویرایش ========================================//
#region Edit
/// <summary>
/// لود مدال ویرایش پیامک خودکار
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetEditSmsSettings(long id, TypeOfSmsSetting typeOfSmsSetting)
{
var editModel = await _smsSettingApplication.GetSmsSettingToEdit(id);
return Partial("_SmsSettingPartials/_EditSmsSetting", editModel);
}
/// <summary>
/// ذخیره مودال ویرایش پیامک خودکار
/// </summary>
/// <param name="id"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<JsonResult> OnPostEditSmsSettings(EditSmsSetting command)
{
var result = await _smsSettingApplication.EditeSmsSetting(command);
return new JsonResult(new
{
isSuccess = result.IsSuccedded,
message = result.Message
});
}
#endregion
//=================================== حذف ========================================//
/// <summary>
/// حذف از دیتابیس
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<IActionResult> OnGetRemoveSetting(long id)
{
try
{
await _smsSettingApplication.RemoveSetting(id);
return new JsonResult(new
{
isSuccess = true,
message = "حذف شد"
});
}
catch (Exception e)
{
return new JsonResult(new
{
isSuccess = false,
message = "خطا در حذف اطلاعات"
});
}
}
//=================================== ارسال آنی ========================================//
/// <summary>
/// لود مودال ارسال پیامک آنی
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<IActionResult> OnGetInstantSendSms(TypeOfSmsSetting typeOfSmsSetting)
{
return Partial("_SmsSettingPartials/InstantSms");
}
/// <summary>
/// لود دیتای ارسال پیامک آنی
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetInstantReminderSendSms()
{
var dataModel = await _smsSettingApplication.GetSmsListData(TypeOfSmsSetting.InstitutionContractDebtReminder);
return Partial("_SmsSettingPartials/_InstantReminderSms", dataModel);
}
/// <summary>
/// ارسال پیامک آنی
/// </summary>
/// <returns></returns>
public async Task<JsonResult> OnPostInstantReminderSendSms([FromBody] List<SmsListData> command)
{
var result = await _smsSettingApplication.InstantSendReminderSms(command);
return new JsonResult(new
{
isSuccess = result.IsSuccedded,
message = result.Message
});
}
/// <summary>
/// لود مودال ارسال پیامک مسدودی
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<IActionResult> OnGetInstantBlockSms(TypeOfSmsSetting typeOfSmsSetting)
{
return Partial("_SmsSettingPartials/InstantBlockSms");
}
/// <summary>
/// لود دیتای ارسال پیامک مسدودس آنی
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetInstantBlockSendSms()
{
var dataModel = await _smsSettingApplication.GetBlockSmsListData(TypeOfSmsSetting.InstitutionContractDebtReminder);
return Partial("_SmsSettingPartials/_InstantSendBlockSms", dataModel);
}
/// <summary>
/// ارسال پیامک مسدودی آنی
/// </summary>
/// <returns></returns>
public async Task<JsonResult> OnPostInstantBlockSendSms([FromBody] List<BlockSmsListData> command)
{
var result = await _smsSettingApplication.InstantSendBlockSms(command);
return new JsonResult(new
{
isSuccess = result.IsSuccedded,
message = result.Message
});
}
//=================================== تب ها ========================================//
#region Tabs
/// <summary>
/// تب پیامک یادآور
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetInstitutionContractDebtReminderTab()
{
var modelData = await _smsSettingApplication.GetSmsSettingsByType(TypeOfSmsSetting.InstitutionContractDebtReminder);
return Partial("_SmsSettingPartials/ReminderSmsListData", modelData);
}
/// <summary>
/// تب پیامک مسدودی
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetBlockContractingPartyTab()
{
var modelData = await _smsSettingApplication.GetSmsSettingsByType(TypeOfSmsSetting.BlockContractingParty);
return Partial("_SmsSettingPartials/BlockSmsListData", modelData);
}
/// <summary>
/// تب پیامک اقدام قضائی
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetLegalActionTab()
{
var modelData = await _smsSettingApplication.GetSmsSettingsByType(TypeOfSmsSetting.LegalAction);
return Partial("_SmsSettingPartials/LegalActionSmsListData", modelData);
}
/// <summary>
/// تب پیامک هشدار قضایی
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetWarningTab()
{
var modelData = await _smsSettingApplication.GetSmsSettingsByType(TypeOfSmsSetting.Warning);
return Partial("_SmsSettingPartials/WarningSmsListData", modelData);
}
#endregion
}
}

View File

@@ -0,0 +1,160 @@
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@Html.AntiForgeryToken()
@{
int index = 1;
<style>
.head-table {
font-size: 14px;
background-color: #2dbcbc;
padding: 4px 1px;
border-radius: 5px;
color: aliceblue;
margin-bottom: 9px;
}
.tr-table {
background-color: #ddf4f4;
border-radius: 5px;
padding: 4px 1px;
margin-bottom: 3px;
font-family: "IranText" !important;
}
div.tr-table:nth-of-type(even) {
background-color: #b0e0e08f !important;
}
.row-number {
background-color: rgb(187, 240, 240);
color: #0B5959;
width: 24px;
height: 24px;
line-height: 24px;
text-align: center;
border-radius: 5px;
}
.icon-span {
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: 14px;
border-radius: 5px;
padding: 2px;
}
.icon-span svg {
vertical-align: middle;
}
</style>
}
<div class="card card-pattern m-t-10">
<a class="btn btn-success"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateSmsSetting", new {typeOfSmsSetting = TypeOfSmsSetting.BlockContractingParty})">
<span class="icon-span">
<svg width="19" height="19" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round" />
</svg>
<span style="margin-right:4px"> ایجاد پیامک مسدودی </span>
</span>
</a>
<a class="btn btn-success instantSendSms"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantBlockSms")">
<span class="icon-span">
<svg width="20px" height="20px" viewBox="-11.26 -11.26 49.32 49.32" xmlns="http://www.w3.org/2000/svg" fill="#000000" transform="matrix(-1, 0, 0, 1, 0, 0)rotate(0)" stroke="#000000" stroke-width="0.00026804">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="0.053608"></g>
<g id="SVGRepo_iconCarrier">
<g id="Group_37" data-name="Group 37" transform="translate(-108.142 -942.014)">
<path id="Path_17" data-name="Path 17" d="M109.642,968.818a1.5,1.5,0,0,1-1.5-1.5v-23.8a1.5,1.5,0,0,1,2.25-1.3l20.616,11.9a1.5,1.5,0,0,1,0,2.6l-20.616,11.9A1.5,1.5,0,0,1,109.642,968.818Zm1.5-22.707V964.72l16.116-9.3Z" fill="#ffffff"></path>
</g>
</g>
</svg>
<span style="margin-right:4px"> ارسال آنی پیامک مسدودی </span>
</span>
</a>
</div>
<div class="card card-pattern m-t-10">
@if (Model.EditSmsSettings.Any())
{
<div class="container-fluid">
<!-- هدر -->
<div class="row fw-bold mb-2 head-table">
<div class="col-2 col-md-1">ردیف</div>
<div class="col-10 col-md-3"> روز ارسال </div>
<div class="col-6 col-md-2"> ساعت ارسال </div>
<div class="col-12 col-md-3" style="float:left; direction:ltr">عملیات</div>
</div>
<!-- لیست -->
@foreach (var item in Model.EditSmsSettings)
{
<div class="row align-items-center p-2 tr-table">
<div class="col-2 col-md-1"><div class="row-number">@index</div></div>
<div class="col-10 col-md-3">@item.DayOfMonth</div>
<div class="col-6 col-md-2">@item.TimeOfDayDisplay</div>
@{
index++;
}
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
<a href="#" onclick="remove(@item.Id);"
style="border-radius:5px;" return false;>
<span class="icon-span" style="background-color:#ddd3e0">
<svg width="19" height="18" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.523438 0.523438)" fill="#DDD3E0"></rect>
<path d="M7.84814 11.7031L7.84814 9.39004" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M11.7031 11.7031L11.7031 9.39004" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M2.83643 5.53125H16.7149V5.53125C16.0652 5.53125 15.7403 5.53125 15.4745 5.60604C14.8039 5.79477 14.2799 6.31884 14.0911 6.98943C14.0163 7.25518 14.0163 7.58007 14.0163 8.22985V11.5546C14.0163 13.4402 14.0163 14.383 13.4305 14.9688C12.8448 15.5546 11.902 15.5546 10.0163 15.5546H9.53502C7.64941 15.5546 6.7066 15.5546 6.12081 14.9688C5.53502 14.383 5.53502 13.4402 5.53502 11.5546V8.22985C5.53502 7.58007 5.53502 7.25518 5.46023 6.98943C5.27151 6.31884 4.74744 5.79477 4.07685 5.60604C3.8111 5.53125 3.48621 5.53125 2.83643 5.53125V5.53125Z" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M7.84799 3.22434C7.84799 3.22434 8.2335 2.45312 9.77556 2.45312C11.3176 2.45312 11.7031 3.22415 11.7031 3.22415" stroke="#BF3737" stroke-linecap="round"></path>
</svg>
</span>
</a>
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id, typeOfSmsSetting = item.TypeOfSmsSetting})">
<span class="icon-span" style="background-color:#ade7f2">
<svg width="19" height="18" viewBox="0 0 19 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.074707 0.679688)" fill="#ADE7F2"></rect>
<path d="M11.3213 5.25293C11.5664 5.19964 11.8217 5.20913 12.0635 5.28027L12.2178 5.33691C12.3659 5.40344 12.4945 5.49613 12.6152 5.59766C12.7711 5.72874 12.9467 5.90375 13.1504 6.10742L13.4326 6.39258C13.5184 6.48132 13.5946 6.56459 13.6602 6.64258C13.7953 6.80336 13.914 6.97832 13.9775 7.19434L14.0049 7.29883C14.0506 7.50888 14.0506 7.72647 14.0049 7.93652L13.9775 8.04102C13.914 8.25701 13.7953 8.43201 13.6602 8.59277C13.5946 8.67073 13.5184 8.75407 13.4326 8.84277L13.1504 9.12793L7.75879 14.5186C7.62672 14.6506 7.50929 14.7722 7.37793 14.8701L7.24121 14.959C7.14574 15.013 7.04539 15.0527 6.93848 15.0859L6.59766 15.1768L4.85938 15.6113C4.69519 15.6524 4.51668 15.6984 4.36816 15.7129C4.23271 15.7261 4.01567 15.7249 3.82324 15.584L3.74316 15.5146C3.53379 15.3053 3.52979 15.0444 3.54492 14.8896C3.55945 14.7411 3.60544 14.5626 3.64648 14.3984L4.08105 12.6602L4.17188 12.3193C4.20508 12.2124 4.24479 12.1121 4.29883 12.0166L4.3877 11.8799C4.48563 11.7485 4.60719 11.6311 4.73926 11.499L10.1299 6.10742L10.415 5.8252C10.5036 5.7396 10.5862 5.66312 10.6641 5.59766C10.8249 5.46245 11.0007 5.34385 11.2168 5.28027L11.3213 5.25293Z" stroke="#009EE2"></path>
<path d="M9.7124 6.46393L12.0255 4.92188L14.3386 7.23496L12.7965 9.54804L9.7124 6.46393Z" fill="#009EE2"></path>
</svg>
</span>
</a>
</div>
</div>
}
</div>
}
</div>

View File

@@ -0,0 +1,232 @@
@Html.AntiForgeryToken()
@{
<style>
.modal .modal-dialog .modal-content{
padding-bottom: 10px !important;
}
.modal-title{
position: absolute;
width: 291px;
font-size: 18px;
background-color: inherit;
left: 47%;
top: 19px;
margin-left: -100px;
text-align: center;
color: black;
border: 1px solid #00000030;
border-radius: 9px;
padding: 2px 0px;
}
.skeleton-loader {
width: 100%;
height: 35px;
background: linear-gradient(90deg, #EEEEEE 25%, #DEDEDE 50%, #EEEEEE 75%);
background-size: 200% 100%;
animation: loading 2s infinite ease-in-out;
border-radius: 8px;
margin-bottom: 3px
}
.progBar {
display: none;
}
#createProcess {
background-color: #fdfdfd;
height: 70px;
border-radius: 7px;
margin: 4px 2px 4px 2px;
box-shadow: 0px 1px 7px 0 #155c5c;
}
.progress-bar {
color: #fff !important;
font-size: 17px !important;
line-height: 23px !important;
border-radius: 10px !important;
}
@@keyframes loading {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
</style>
}
<div class="modal-header">
<h5 class="modal-title">ارسال آنی پیامک مسدودی</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="بستن">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="card card-pattern m-t-10" style="border-radius: 15px 15px 0px 0px;">
<div class="container-fluid">
<!-- هدر -->
<div class="row fw-bold mb-2 head-table">
<div class="col-2 col-md-1">ردیف</div>
<div class="col-10 col-md-3"> نام طرف حساب </div>
<div class="col-6 col-md-3"> شماره تماس </div>
<div class="col-6 col-md-3" style="text-align:left; left:1.2%"> مبلغ بدهی </div>
<div class="col-12 col-md-2" style="float:right;text-align:right; direction:ltr; left: 1.2%">
تیک ارسال
<label class="switch">
<input id="checkAll" type="checkbox" checked />
<span class="slider round"></span>
</label>
</div>
</div>
</div>
</div>
<div id="createProcess" class="row progress-bar-striped progBar">
<div class="form-group" style="padding: 0px 10px;">
<span style="text-align: center">
<h3 style="font-size: 15px;color: #767575;margin-top: 3px;margin-bottom:0px">درصد ارسال پیامک ها</h3>
</span>
<div class="progress" style="height: 20px">
<div id="progress-bar-w" style="background-color: rgb(16 170 18)" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
<div class="card card-pattern " style="margin-top:2px;height:600px; overflow-y:scroll; border-radius: 0 0 15px 15px">
<div class="container-fluid" id="partialAppendBlockList">
<div id="loading">
@for (var j = 0; j < 16; j++)
{
<div class="skeleton-loader"></div>
}
</div>
</div>
</div>
<div class="modal-footer border-0">
<button type="button" onclick="sendToSms()" class="btn btn-success px-4 rounded-pill">ارسال پیامک</button>
<button type="button" class="btn btn-outline-secondary px-4 rounded-pill" data-dismiss="modal">بستن</button>
</div>
<script>
$(document).ready(function () {
var url = "/Admin/Company/SmsResult/SmsSettings?handler=InstantBlockSendSms";
$.get(url, function (data) {
$("#loading").hide();
$("#partialAppendBlockList").html(data);
});
var gNo = Number(10);
setTimeout(function () {
connectToGroupW(gNo);
},
2000);
});
console.log('befor start ...');
var connection = new signalR.HubConnectionBuilder().withUrl("/trackingSendSmsHub").build();
connection.start().then(function () {
console.log("connect.....!");
}).catch(function (err) {
return console.error(err.toString());
});
function connectToGroupW(id) {
connection.invoke("send", id)
.catch(function (err) {
console.error(err.toString());
});
console.log(`connected to group...${id}`);
}
connection.on('showStatus',
function (percent) {
$('#progress-bar-w').css("width", percent + "%");
$('#progress-bar-w').text(percent + '%');
});
//ارسال پیامک
function sendToSms() {
const recordItems = document.querySelectorAll(".record");
const command = [];
recordItems.forEach(recordItem => {
const checkbox = recordItem.querySelector('input[type="checkbox"]');
if (checkbox && checkbox.checked) {
const SmsListData = {
PhoneNumber: checkbox.dataset.phonenumber,
PartyName: checkbox.dataset.partyname,
Amount: checkbox.dataset.amount,
ContractingPartyId: Number(checkbox.dataset.contractingpartyid),
AccountType: checkbox.dataset.accountType,
InstitutionContractId: Number(checkbox.dataset.institutioncontractid),
AproveId: checkbox.dataset.aproveid,
};
command.push(SmsListData);
}
});
if (command.length === 0) {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "هیچ موردی انتخاب نشده است");
return;
}
$('#createProcess').removeClass("progBar");
var urlAjaxToSendSms = '@Url.Page("/Company/SmsResult/SmsSettings", "InstantBlockSendSms")';
$.ajax({
url: urlAjaxToSendSms,
type: "POST",
contentType: "application/json",
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: JSON.stringify(command),
success: function (response) {
if (response.isSuccess) {
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
} else {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
}
},
error: function () {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "خطا در ارسال اطلاعات");
}
});
}
//روشن یا خاموش کردن تیک برای همه
$('#checkAll').on('change', function () {
const status = this.checked; // true یا false
$('input[type="checkbox"]').each(function () {
$(this).prop('checked', status);
});
});
</script>

View File

@@ -0,0 +1,235 @@
@Html.AntiForgeryToken()
@{
<style>
.modal .modal-dialog .modal-content{
padding-bottom: 10px !important;
}
.modal-title{
position: absolute;
width: 291px;
font-size: 18px;
background-color: inherit;
left: 47%;
top: 19px;
margin-left: -100px;
text-align: center;
color: black;
border: 1px solid #00000030;
border-radius: 9px;
padding: 2px 0px;
}
.skeleton-loader {
width: 100%;
height: 35px;
background: linear-gradient(90deg, #EEEEEE 25%, #DEDEDE 50%, #EEEEEE 75%);
background-size: 200% 100%;
animation: loading 2s infinite ease-in-out;
border-radius: 8px;
margin-bottom: 3px
}
.progBar {
display: none;
}
#createProcess {
background-color: #fdfdfd;
height: 70px;
border-radius: 7px;
margin: 4px 2px 4px 2px;
box-shadow: 0px 1px 7px 0 #155c5c;
}
.progress-bar {
color: #fff !important;
font-size: 17px !important;
line-height: 23px !important;
border-radius: 10px !important;
}
@@keyframes loading {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
</style>
}
<div class="modal-header">
<h5 class="modal-title">ارسال آنی پیامک یادآور</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="بستن">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="card card-pattern m-t-10" style="border-radius: 15px 15px 0px 0px;">
<div class="container-fluid">
<!-- هدر -->
<div class="row fw-bold mb-2 head-table">
<div class="col-2 col-md-1">ردیف</div>
<div class="col-10 col-md-3"> نام طرف حساب </div>
<div class="col-6 col-md-3"> شماره تماس </div>
<div class="col-6 col-md-3" style="text-align:left; left:1.2%"> مبلغ بدهی </div>
<div class="col-12 col-md-2" style="float:right;text-align:right; direction:ltr; left: 1.2%">
تیک ارسال
<label class="switch">
<input id="checkAll" type="checkbox" checked />
<span class="slider round"></span>
</label>
</div>
</div>
</div>
</div>
<div id="createProcess" class="row progress-bar-striped progBar">
<div class="form-group" style="padding: 0px 10px;">
<span style="text-align: center">
<h3 style="font-size: 15px;color: #767575;margin-top: 3px;margin-bottom:0px">درصد ارسال پیامک ها</h3>
</span>
<div class="progress" style="height: 20px">
<div id="progress-bar-w" style="background-color: rgb(16 170 18)" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
<div class="card card-pattern " style="margin-top:2px;height:600px; overflow-y:scroll; border-radius: 0 0 15px 15px">
<div class="container-fluid" id="partialAppend">
<div id="loading">
@for (var j = 0; j < 16; j++)
{
<div class="skeleton-loader"></div>
}
</div>
</div>
</div>
<div class="modal-footer border-0">
<button type="button" onclick="sendToSms()" class="btn btn-success px-4 rounded-pill">ارسال پیامک</button>
<button type="button" class="btn btn-outline-secondary px-4 rounded-pill" data-dismiss="modal">بستن</button>
</div>
<script>
$(document).ready(function () {
var url = "/Admin/Company/SmsResult/SmsSettings?handler=InstantReminderSendSms";
$.get(url, function (data) {
$("#loading").hide();
$("#partialAppend").html(data);
});
var gNo = Number(7);
setTimeout(function () {
connectToGroupW(gNo);
},
2000);
});
console.log('befor start ...');
var connection = new signalR.HubConnectionBuilder().withUrl("/trackingSendSmsHub").build();
connection.start().then(function () {
console.log("connect.....!");
}).catch(function (err) {
return console.error(err.toString());
});
function connectToGroupW(id) {
connection.invoke("send", id)
.catch(function (err) {
console.error(err.toString());
});
console.log(`connected to group...${id}`);
}
connection.on('showStatus',
function (percent) {
$('#progress-bar-w').css("width", percent + "%");
$('#progress-bar-w').text(percent + '%');
});
//ارسال پیامک
function sendToSms() {
const recordItems = document.querySelectorAll(".record");
const command = [];
recordItems.forEach(recordItem => {
const checkbox = recordItem.querySelector('input[type="checkbox"]');
if (checkbox && checkbox.checked) {
const SmsListData = {
PhoneNumber: checkbox.dataset.phonenumber,
TemplateId: Number(checkbox.dataset.templateid),
PartyName: checkbox.dataset.partyname,
Amount: checkbox.dataset.amount,
ContractingPartyId: Number(checkbox.dataset.contractingpartyid),
AproveId: checkbox.dataset.aproveid,
TypeOfSmsMethod: checkbox.dataset.typeofsmsmethod,
Code1: checkbox.dataset.code1,
Code2: checkbox.dataset.code2,
InstitutionContractId: Number(checkbox.dataset.institutioncontractid)
};
command.push(SmsListData);
}
});
if (command.length === 0) {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "هیچ موردی انتخاب نشده است");
return;
}
$('#createProcess').removeClass("progBar");
var urlAjaxToSendSms = '@Url.Page("/Company/SmsResult/SmsSettings", "InstantReminderSendSms")';
$.ajax({
url: urlAjaxToSendSms,
type: "POST",
contentType: "application/json",
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: JSON.stringify(command),
success: function (response) {
if (response.isSuccess) {
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
} else {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
}
},
error: function () {
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "خطا در ارسال اطلاعات");
}
});
}
//روشن یا خاموش کردن تیک برای همه
$('#checkAll').on('change', function () {
const status = this.checked; // true یا false
$('input[type="checkbox"]').each(function () {
$(this).prop('checked', status);
});
});
</script>

View File

@@ -0,0 +1,157 @@
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@{
int index = 1;
<style>
.head-table{
font-size: 14px;
background-color: #2dbcbc;
padding: 4px 1px;
border-radius: 5px;
color: aliceblue;
margin-bottom: 9px;
}
.tr-table{
background-color: #ddf4f4;
border-radius: 5px;
padding: 4px 1px;
margin-bottom: 3px;
font-family: "IranText" !important;
}
div.tr-table:nth-of-type(even) {
background-color: #b0e0e08f !important;
}
.row-number{
background-color: rgb(187, 240, 240);
color: #0B5959;
width: 24px;
height: 24px;
line-height: 24px;
text-align: center;
border-radius: 5px;
}
.icon-span {
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: 14px;
border-radius: 5px;
padding: 2px;
}
.icon-span svg {
vertical-align: middle;
}
</style>
}
<div class="card card-pattern m-t-10">
<a class="btn btn-success"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateSmsSetting", new {typeOfSmsSetting = TypeOfSmsSetting.LegalAction})">
<span class="icon-span">
<svg width="19" height="19" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round" />
</svg>
<span style="margin-right:4px"> ایجاد پیامک قدام قضائی </span>
</span>
</a>
<a class="btn btn-success instantSendSms"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantSendBlockSms")">
<span class="icon-span">
<svg width="20px" height="20px" viewBox="-11.26 -11.26 49.32 49.32" xmlns="http://www.w3.org/2000/svg" fill="#000000" transform="matrix(-1, 0, 0, 1, 0, 0)rotate(0)" stroke="#000000" stroke-width="0.00026804">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="0.053608"></g>
<g id="SVGRepo_iconCarrier">
<g id="Group_37" data-name="Group 37" transform="translate(-108.142 -942.014)">
<path id="Path_17" data-name="Path 17" d="M109.642,968.818a1.5,1.5,0,0,1-1.5-1.5v-23.8a1.5,1.5,0,0,1,2.25-1.3l20.616,11.9a1.5,1.5,0,0,1,0,2.6l-20.616,11.9A1.5,1.5,0,0,1,109.642,968.818Zm1.5-22.707V964.72l16.116-9.3Z" fill="#ffffff"></path>
</g>
</g>
</svg>
<span style="margin-right:4px"> ارسال آنی پیامک اقدام قضائی </span>
</span>
</a>
</div>
<div class="card card-pattern m-t-10">
@if (Model.EditSmsSettings.Any())
{
<div class="container-fluid">
<!-- هدر -->
<div class="row fw-bold mb-2 head-table">
<div class="col-2 col-md-1">ردیف</div>
<div class="col-10 col-md-3"> روز ارسال </div>
<div class="col-6 col-md-2"> ساعت ارسال </div>
<div class="col-12 col-md-3" style="float:left; direction:ltr">عملیات</div>
</div>
<!-- لیست -->
@foreach (var item in Model.EditSmsSettings)
{
<div class="row align-items-center p-2 tr-table">
<div class="col-2 col-md-1"><div class="row-number">@index</div></div>
<div class="col-10 col-md-3">@item.DayOfMonth</div>
<div class="col-6 col-md-2">@item.TimeOfDayDisplay</div>
@{
index++;
}
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
<a href="#" onclick="remove(@item.Id);"
style="border-radius:5px;" return false;>
<span class="icon-span" style="background-color:#ddd3e0">
<svg width="19" height="18" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.523438 0.523438)" fill="#DDD3E0"></rect>
<path d="M7.84814 11.7031L7.84814 9.39004" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M11.7031 11.7031L11.7031 9.39004" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M2.83643 5.53125H16.7149V5.53125C16.0652 5.53125 15.7403 5.53125 15.4745 5.60604C14.8039 5.79477 14.2799 6.31884 14.0911 6.98943C14.0163 7.25518 14.0163 7.58007 14.0163 8.22985V11.5546C14.0163 13.4402 14.0163 14.383 13.4305 14.9688C12.8448 15.5546 11.902 15.5546 10.0163 15.5546H9.53502C7.64941 15.5546 6.7066 15.5546 6.12081 14.9688C5.53502 14.383 5.53502 13.4402 5.53502 11.5546V8.22985C5.53502 7.58007 5.53502 7.25518 5.46023 6.98943C5.27151 6.31884 4.74744 5.79477 4.07685 5.60604C3.8111 5.53125 3.48621 5.53125 2.83643 5.53125V5.53125Z" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M7.84799 3.22434C7.84799 3.22434 8.2335 2.45312 9.77556 2.45312C11.3176 2.45312 11.7031 3.22415 11.7031 3.22415" stroke="#BF3737" stroke-linecap="round"></path>
</svg>
</span>
</a>
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id, typeOfSmsSetting = item.TypeOfSmsSetting})">
<span class="icon-span" style="background-color:#ade7f2">
<svg width="19" height="18" viewBox="0 0 19 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.074707 0.679688)" fill="#ADE7F2"></rect>
<path d="M11.3213 5.25293C11.5664 5.19964 11.8217 5.20913 12.0635 5.28027L12.2178 5.33691C12.3659 5.40344 12.4945 5.49613 12.6152 5.59766C12.7711 5.72874 12.9467 5.90375 13.1504 6.10742L13.4326 6.39258C13.5184 6.48132 13.5946 6.56459 13.6602 6.64258C13.7953 6.80336 13.914 6.97832 13.9775 7.19434L14.0049 7.29883C14.0506 7.50888 14.0506 7.72647 14.0049 7.93652L13.9775 8.04102C13.914 8.25701 13.7953 8.43201 13.6602 8.59277C13.5946 8.67073 13.5184 8.75407 13.4326 8.84277L13.1504 9.12793L7.75879 14.5186C7.62672 14.6506 7.50929 14.7722 7.37793 14.8701L7.24121 14.959C7.14574 15.013 7.04539 15.0527 6.93848 15.0859L6.59766 15.1768L4.85938 15.6113C4.69519 15.6524 4.51668 15.6984 4.36816 15.7129C4.23271 15.7261 4.01567 15.7249 3.82324 15.584L3.74316 15.5146C3.53379 15.3053 3.52979 15.0444 3.54492 14.8896C3.55945 14.7411 3.60544 14.5626 3.64648 14.3984L4.08105 12.6602L4.17188 12.3193C4.20508 12.2124 4.24479 12.1121 4.29883 12.0166L4.3877 11.8799C4.48563 11.7485 4.60719 11.6311 4.73926 11.499L10.1299 6.10742L10.415 5.8252C10.5036 5.7396 10.5862 5.66312 10.6641 5.59766C10.8249 5.46245 11.0007 5.34385 11.2168 5.28027L11.3213 5.25293Z" stroke="#009EE2"></path>
<path d="M9.7124 6.46393L12.0255 4.92188L14.3386 7.23496L12.7965 9.54804L9.7124 6.46393Z" fill="#009EE2"></path>
</svg>
</span>
</a>
</div>
</div>
}
</div>
}
</div>

View File

@@ -0,0 +1,152 @@
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@{
int index = 1;
<style>
.head-table{
font-size: 14px;
background-color: #2dbcbc;
padding: 4px 1px;
border-radius: 5px;
color: aliceblue;
margin-bottom: 9px;
}
.tr-table{
background-color: #ddf4f4;
border-radius: 5px;
padding: 4px 1px;
margin-bottom: 3px;
font-family: "IranText" !important;
}
div.tr-table:nth-of-type(even) {
background-color: #b0e0e08f !important;
}
.row-number{
background-color: rgb(187, 240, 240);
color: #0B5959;
width: 24px;
height: 24px;
line-height: 24px;
text-align: center;
border-radius: 5px;
}
.icon-span {
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: 14px;
border-radius: 5px;
padding: 2px;
}
.icon-span svg {
vertical-align: middle;
}
</style>
}
<div class="card card-pattern m-t-10">
<a class="btn btn-success"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateSmsSetting", new {typeOfSmsSetting = TypeOfSmsSetting.InstitutionContractDebtReminder})">
<span class="icon-span">
<svg width="19" height="19" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round" />
</svg>
<span style="margin-right:4px"> ایجاد پیامک یادآور </span>
</span>
</a>
<a class="btn btn-success instantSendSms"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantSendSms", new {typeOfSmsSetting = TypeOfSmsSetting.InstitutionContractDebtReminder})">
<span class="icon-span">
<svg width="20px" height="20px" viewBox="-11.26 -11.26 49.32 49.32" xmlns="http://www.w3.org/2000/svg" fill="#000000" transform="matrix(-1, 0, 0, 1, 0, 0)rotate(0)" stroke="#000000" stroke-width="0.00026804">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="0.053608"></g>
<g id="SVGRepo_iconCarrier"> <g id="Group_37" data-name="Group 37" transform="translate(-108.142 -942.014)">
<path id="Path_17" data-name="Path 17" d="M109.642,968.818a1.5,1.5,0,0,1-1.5-1.5v-23.8a1.5,1.5,0,0,1,2.25-1.3l20.616,11.9a1.5,1.5,0,0,1,0,2.6l-20.616,11.9A1.5,1.5,0,0,1,109.642,968.818Zm1.5-22.707V964.72l16.116-9.3Z" fill="#ffffff"></path>
</g> </g>
</svg>
<span style="margin-right:4px"> ارسال آنی پیامک یاد آور </span>
</span>
</a>
</div>
<div class="card card-pattern m-t-10">
@if (Model.EditSmsSettings.Any())
{
<div class="container-fluid">
<!-- هدر -->
<div class="row fw-bold mb-2 head-table">
<div class="col-2 col-md-1">ردیف</div>
<div class="col-10 col-md-3"> روز ارسال </div>
<div class="col-6 col-md-2"> ساعت ارسال </div>
<div class="col-12 col-md-3" style="float:left; direction:ltr">عملیات</div>
</div>
<!-- لیست -->
@foreach (var item in Model.EditSmsSettings)
{
<div class="row align-items-center p-2 tr-table">
<div class="col-2 col-md-1"><div class="row-number">@index</div></div>
<div class="col-10 col-md-3">@item.DayOfMonth</div>
<div class="col-6 col-md-2">@item.TimeOfDayDisplay</div>
@{
index++;
}
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
<a href="#" onclick="remove(@item.Id);"
style="border-radius:5px;" return false;>
<span class="icon-span" style="background-color:#ddd3e0">
<svg width="19" height="18" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.523438 0.523438)" fill="#DDD3E0"></rect>
<path d="M7.84814 11.7031L7.84814 9.39004" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M11.7031 11.7031L11.7031 9.39004" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M2.83643 5.53125H16.7149V5.53125C16.0652 5.53125 15.7403 5.53125 15.4745 5.60604C14.8039 5.79477 14.2799 6.31884 14.0911 6.98943C14.0163 7.25518 14.0163 7.58007 14.0163 8.22985V11.5546C14.0163 13.4402 14.0163 14.383 13.4305 14.9688C12.8448 15.5546 11.902 15.5546 10.0163 15.5546H9.53502C7.64941 15.5546 6.7066 15.5546 6.12081 14.9688C5.53502 14.383 5.53502 13.4402 5.53502 11.5546V8.22985C5.53502 7.58007 5.53502 7.25518 5.46023 6.98943C5.27151 6.31884 4.74744 5.79477 4.07685 5.60604C3.8111 5.53125 3.48621 5.53125 2.83643 5.53125V5.53125Z" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M7.84799 3.22434C7.84799 3.22434 8.2335 2.45312 9.77556 2.45312C11.3176 2.45312 11.7031 3.22415 11.7031 3.22415" stroke="#BF3737" stroke-linecap="round"></path>
</svg>
</span>
</a>
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id, typeOfSmsSetting = item.TypeOfSmsSetting})">
<span class="icon-span" style="background-color:#ade7f2">
<svg width="19" height="18" viewBox="0 0 19 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.074707 0.679688)" fill="#ADE7F2"></rect>
<path d="M11.3213 5.25293C11.5664 5.19964 11.8217 5.20913 12.0635 5.28027L12.2178 5.33691C12.3659 5.40344 12.4945 5.49613 12.6152 5.59766C12.7711 5.72874 12.9467 5.90375 13.1504 6.10742L13.4326 6.39258C13.5184 6.48132 13.5946 6.56459 13.6602 6.64258C13.7953 6.80336 13.914 6.97832 13.9775 7.19434L14.0049 7.29883C14.0506 7.50888 14.0506 7.72647 14.0049 7.93652L13.9775 8.04102C13.914 8.25701 13.7953 8.43201 13.6602 8.59277C13.5946 8.67073 13.5184 8.75407 13.4326 8.84277L13.1504 9.12793L7.75879 14.5186C7.62672 14.6506 7.50929 14.7722 7.37793 14.8701L7.24121 14.959C7.14574 15.013 7.04539 15.0527 6.93848 15.0859L6.59766 15.1768L4.85938 15.6113C4.69519 15.6524 4.51668 15.6984 4.36816 15.7129C4.23271 15.7261 4.01567 15.7249 3.82324 15.584L3.74316 15.5146C3.53379 15.3053 3.52979 15.0444 3.54492 14.8896C3.55945 14.7411 3.60544 14.5626 3.64648 14.3984L4.08105 12.6602L4.17188 12.3193C4.20508 12.2124 4.24479 12.1121 4.29883 12.0166L4.3877 11.8799C4.48563 11.7485 4.60719 11.6311 4.73926 11.499L10.1299 6.10742L10.415 5.8252C10.5036 5.7396 10.5862 5.66312 10.6641 5.59766C10.8249 5.46245 11.0007 5.34385 11.2168 5.28027L11.3213 5.25293Z" stroke="#009EE2"></path>
<path d="M9.7124 6.46393L12.0255 4.92188L14.3386 7.23496L12.7965 9.54804L9.7124 6.46393Z" fill="#009EE2"></path>
</svg>
</span>
</a>
</div>
</div>
}
</div>
}
</div>

View File

@@ -0,0 +1,157 @@
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.SmsSettingViewModel
@{
int index = 1;
<style>
.head-table{
font-size: 14px;
background-color: #2dbcbc;
padding: 4px 1px;
border-radius: 5px;
color: aliceblue;
margin-bottom: 9px;
}
.tr-table{
background-color: #ddf4f4;
border-radius: 5px;
padding: 4px 1px;
margin-bottom: 3px;
font-family: "IranText" !important;
}
div.tr-table:nth-of-type(even) {
background-color: #b0e0e08f !important;
}
.row-number{
background-color: rgb(187, 240, 240);
color: #0B5959;
width: 24px;
height: 24px;
line-height: 24px;
text-align: center;
border-radius: 5px;
}
.icon-span {
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: 14px;
border-radius: 5px;
padding: 2px;
}
.icon-span svg {
vertical-align: middle;
}
</style>
}
<div class="card card-pattern m-t-10">
<a class="btn btn-success"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "CreateSmsSetting", new {typeOfSmsSetting = TypeOfSmsSetting.Warning})">
<span class="icon-span">
<svg width="19" height="19" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round" />
</svg>
<span style="margin-right:4px"> ایجاد پیامک هشدار قضائی </span>
</span>
</a>
<a class="btn btn-success instantSendSms"
style="border-radius:5px;" href="#showmodal=@Url.Page("./SmsSettings", "InstantSendBlockSms")">
<span class="icon-span">
<svg width="20px" height="20px" viewBox="-11.26 -11.26 49.32 49.32" xmlns="http://www.w3.org/2000/svg" fill="#000000" transform="matrix(-1, 0, 0, 1, 0, 0)rotate(0)" stroke="#000000" stroke-width="0.00026804">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="0.053608"></g>
<g id="SVGRepo_iconCarrier">
<g id="Group_37" data-name="Group 37" transform="translate(-108.142 -942.014)">
<path id="Path_17" data-name="Path 17" d="M109.642,968.818a1.5,1.5,0,0,1-1.5-1.5v-23.8a1.5,1.5,0,0,1,2.25-1.3l20.616,11.9a1.5,1.5,0,0,1,0,2.6l-20.616,11.9A1.5,1.5,0,0,1,109.642,968.818Zm1.5-22.707V964.72l16.116-9.3Z" fill="#ffffff"></path>
</g>
</g>
</svg>
<span style="margin-right:4px"> ارسال آنی پیامک هشدار قضائی </span>
</span>
</a>
</div>
<div class="card card-pattern m-t-10">
@if (Model.EditSmsSettings.Any())
{
<div class="container-fluid">
<!-- هدر -->
<div class="row fw-bold mb-2 head-table">
<div class="col-2 col-md-1">ردیف</div>
<div class="col-10 col-md-3"> روز ارسال </div>
<div class="col-6 col-md-2"> ساعت ارسال </div>
<div class="col-12 col-md-3" style="float:left; direction:ltr">عملیات</div>
</div>
<!-- لیست -->
@foreach (var item in Model.EditSmsSettings)
{
<div class="row align-items-center p-2 tr-table">
<div class="col-2 col-md-1"><div class="row-number">@index</div></div>
<div class="col-10 col-md-3">@item.DayOfMonth</div>
<div class="col-6 col-md-2">@item.TimeOfDayDisplay</div>
@{
index++;
}
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
<a href="#" onclick="remove(@item.Id);"
style="border-radius:5px;" return false;>
<span class="icon-span" style="background-color:#ddd3e0">
<svg width="19" height="18" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.523438 0.523438)" fill="#DDD3E0"></rect>
<path d="M7.84814 11.7031L7.84814 9.39004" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M11.7031 11.7031L11.7031 9.39004" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M2.83643 5.53125H16.7149V5.53125C16.0652 5.53125 15.7403 5.53125 15.4745 5.60604C14.8039 5.79477 14.2799 6.31884 14.0911 6.98943C14.0163 7.25518 14.0163 7.58007 14.0163 8.22985V11.5546C14.0163 13.4402 14.0163 14.383 13.4305 14.9688C12.8448 15.5546 11.902 15.5546 10.0163 15.5546H9.53502C7.64941 15.5546 6.7066 15.5546 6.12081 14.9688C5.53502 14.383 5.53502 13.4402 5.53502 11.5546V8.22985C5.53502 7.58007 5.53502 7.25518 5.46023 6.98943C5.27151 6.31884 4.74744 5.79477 4.07685 5.60604C3.8111 5.53125 3.48621 5.53125 2.83643 5.53125V5.53125Z" stroke="#BF3737" stroke-linecap="round"></path>
<path d="M7.84799 3.22434C7.84799 3.22434 8.2335 2.45312 9.77556 2.45312C11.3176 2.45312 11.7031 3.22415 11.7031 3.22415" stroke="#BF3737" stroke-linecap="round"></path>
</svg>
</span>
</a>
<a href="#showmodal=@Url.Page("./SmsSettings", "EditSmsSettings" ,new {id = item.Id, typeOfSmsSetting = item.TypeOfSmsSetting})">
<span class="icon-span" style="background-color:#ade7f2">
<svg width="19" height="18" viewBox="0 0 19 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="18.5047" height="18.5047" transform="translate(0.074707 0.679688)" fill="#ADE7F2"></rect>
<path d="M11.3213 5.25293C11.5664 5.19964 11.8217 5.20913 12.0635 5.28027L12.2178 5.33691C12.3659 5.40344 12.4945 5.49613 12.6152 5.59766C12.7711 5.72874 12.9467 5.90375 13.1504 6.10742L13.4326 6.39258C13.5184 6.48132 13.5946 6.56459 13.6602 6.64258C13.7953 6.80336 13.914 6.97832 13.9775 7.19434L14.0049 7.29883C14.0506 7.50888 14.0506 7.72647 14.0049 7.93652L13.9775 8.04102C13.914 8.25701 13.7953 8.43201 13.6602 8.59277C13.5946 8.67073 13.5184 8.75407 13.4326 8.84277L13.1504 9.12793L7.75879 14.5186C7.62672 14.6506 7.50929 14.7722 7.37793 14.8701L7.24121 14.959C7.14574 15.013 7.04539 15.0527 6.93848 15.0859L6.59766 15.1768L4.85938 15.6113C4.69519 15.6524 4.51668 15.6984 4.36816 15.7129C4.23271 15.7261 4.01567 15.7249 3.82324 15.584L3.74316 15.5146C3.53379 15.3053 3.52979 15.0444 3.54492 14.8896C3.55945 14.7411 3.60544 14.5626 3.64648 14.3984L4.08105 12.6602L4.17188 12.3193C4.20508 12.2124 4.24479 12.1121 4.29883 12.0166L4.3877 11.8799C4.48563 11.7485 4.60719 11.6311 4.73926 11.499L10.1299 6.10742L10.415 5.8252C10.5036 5.7396 10.5862 5.66312 10.6641 5.59766C10.8249 5.46245 11.0007 5.34385 11.2168 5.28027L11.3213 5.25293Z" stroke="#009EE2"></path>
<path d="M9.7124 6.46393L12.0255 4.92188L14.3386 7.23496L12.7965 9.54804L9.7124 6.46393Z" fill="#009EE2"></path>
</svg>
</span>
</a>
</div>
</div>
}
</div>
}
</div>

View File

@@ -0,0 +1,130 @@
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.CreateSmsSetting
@Html.AntiForgeryToken()
@{
<style>
.modal-footer {
padding: 0.5rem 1rem !important; /* کوچکتر کردن فاصله */
margin-top: -10px; /* کمی بالا آوردن */
}
.modal .modal-dialog .modal-content{
padding-bottom : 10px !important;
}
.modal-dialog{
width: 27% !important;
max-width: 27% !important;
}
input{
text-align:center;
}
</style>
}
<div class="modal-header">
@{
switch (Model.TypeOfSmsSetting)
{
case TypeOfSmsSetting.InstitutionContractDebtReminder:
<h5 class="modal-title">ایجاد پیامک یاد آور</h5>
break;
case TypeOfSmsSetting.BlockContractingParty:
<h5 class="modal-title">ایجاد پیامک مسدودی</h5>
break;
case TypeOfSmsSetting.LegalAction:
<h5 class="modal-title">ایجاد پیامک اقدام قضائی</h5>
break;
case TypeOfSmsSetting.Warning:
<h5 class="modal-title">ایجاد پیامک هشدار قضائی</h5>
break;
}
}
<button type="button" class="close" data-dismiss="modal" aria-label="بستن">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="card shadow-sm border-0">
<div class="card-body">
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"> روز ارسال</label>
<input placeholder="31 ~ 1" type="number" id="dayOfMonth" name="dayOfMonth" class="form-control" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label">ساعت ارسال</label>
<input class="form-control time-input" placeholder="00:00" text="text" id="timeOfDay" name="TimeOfDay" class="form-control" />
</div>
</div>
<div class="lineDiv"></div>
</div>
</div>
</div>
<div class="modal-footer border-0">
<button type="button" onclick="saveBtn()" class="btn btn-success px-4 rounded-pill">ذخیره</button>
<button type="button" class="btn btn-outline-secondary px-4 rounded-pill" data-dismiss="modal">بستن</button>
</div>
<script>
function saveBtn(){
var urlAjaxToSave = '@Url.Page("/Company/SmsResult/SmsSettings", "CreateSmsSetting")';
var dayOfMonth = Number( $('#dayOfMonth').val());
var timeOfDay = $('#timeOfDay').val();
var typeOfSmsSetting = '@Model.TypeOfSmsSetting';
$.ajax({
dataType: 'json',
type: 'POST',
url: urlAjaxToSave,
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: {"dayOfMonth" : dayOfMonth, "timeOfDay" : timeOfDay, "typeOfSmsSetting" : typeOfSmsSetting},
success: function (response) {
if(response.isSuccess){
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
$('.close').click();
setTimeout(function () {
if(typeOfSmsSetting == '@TypeOfSmsSetting.InstitutionContractDebtReminder'){
$('#institutionContractDebtReminderTab').click();
}else if(typeOfSmsSetting == '@TypeOfSmsSetting.BlockContractingParty'){
$('#blockContractingPartyTab').click();
}else if(typeOfSmsSetting == '@TypeOfSmsSetting.LegalAction'){
$('#legalActionTab').click();
}else if(typeOfSmsSetting == '@TypeOfSmsSetting.Warning'){
$('#warningTab').click();
}
}, 500);
}else{
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
}
},
failure: function (response) {
//console.log(5, response);
}
});
}
</script>

View File

@@ -0,0 +1,132 @@
@using _0_Framework.Application.Enums
@model CompanyManagment.App.Contracts.SmsResult.EditSmsSetting
@Html.AntiForgeryToken()
@{
<style>
.modal-footer {
padding: 0.5rem 1rem !important; /* کوچکتر کردن فاصله */
margin-top: -10px; /* کمی بالا آوردن */
}
.modal .modal-dialog .modal-content{
padding-bottom : 10px !important;
}
.modal-dialog {
width: 27% !important;
max-width: 27% !important;
}
input{
text-align:center;
}
</style>
}
<div class="modal-header">
@{
switch (Model.TypeOfSmsSetting)
{
case TypeOfSmsSetting.InstitutionContractDebtReminder:
<h5 class="modal-title">ویرایش پیامک یاد آور</h5>
break;
case TypeOfSmsSetting.BlockContractingParty:
<h5 class="modal-title">ویرایش پیامک مسدودی</h5>
break;
case TypeOfSmsSetting.LegalAction:
<h5 class="modal-title">ویرایش پیامک اقدام قضائی</h5>
break;
case TypeOfSmsSetting.Warning:
<h5 class="modal-title">ویرایش پیامک هشدار قضائی</h5>
break;
}
}
<button type="button" class="close" data-dismiss="modal" aria-label="بستن">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="card shadow-sm border-0">
<div class="card-body">
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"> روز ارسال</label>
<input placeholder="31 ~ 1" type="number" id="dayOfMonth" asp-for="DayOfMonth" class="form-control" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label">ساعت ارسال</label>
<input class="form-control time-input" placeholder="00:00" text="text" id="timeOfDay" asp-for="TimeOfDayDisplay" class="form-control" />
</div>
</div>
<div class="lineDiv"></div>
</div>
</div>
</div>
<div class="modal-footer border-0">
<button type="button" onclick="saveBtn()" class="btn btn-success px-4 rounded-pill">ذخیره</button>
<button type="button" class="btn btn-outline-secondary px-4 rounded-pill" data-dismiss="modal">بستن</button>
</div>
<script>
function saveBtn(){
var urlAjaxToSave = '@Url.Page("/Company/SmsResult/SmsSettings", "EditSmsSettings")';
let modelTypeOfSmsSetting = '@Model.TypeOfSmsSetting';
const command = {
id: '@Model.Id',
dayOfMonth: Number($('#dayOfMonth').val()),
timeOfDayDisplay: $('#timeOfDay').val(),
typeOfSmsSetting: modelTypeOfSmsSetting,
};
$.ajax({
dataType: 'json',
type: 'POST',
url: urlAjaxToSave,
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
data: command,
success: function (response) {
if(response.isSuccess){
$.Notification.autoHideNotify('success', 'top center', 'پیام سیستم ', response.message);
$('.close').click();
setTimeout(function () {
if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.InstitutionContractDebtReminder'){
$('#institutionContractDebtReminderTab').click();
}else if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.BlockContractingParty'){
$('#blockContractingPartyTab').click();
}else if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.LegalAction'){
$('#legalActionTab').click();
}else if(modelTypeOfSmsSetting == '@TypeOfSmsSetting.Warning'){
$('#warningTab').click();
}
}, 500);
}else{
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', response.message);
}
},
failure: function (response) {
//console.log(5, response);
}
});
}
</script>

View File

@@ -0,0 +1,101 @@
@model List<CompanyManagment.App.Contracts.InstitutionContract.SmsListData>
@{
int countIndex = 1;
<style>
/* Toggle Switch */
.switch {
position: relative;
display: inline-block;
width: 46px;
height: 24px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .3s;
border-radius: 34px;
}
.slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
transition: .3s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #28a745; /* رنگ سبز مشابه Bootstrap */
}
input:checked + .slider:before {
transform: translateX(22px);
}
</style>
}
<!-- لیست -->
@foreach (var item in Model)
{
<div class="row align-items-center p-2 tr-table record">
<div class="col-2 col-md-1"><div class="row-number">@countIndex</div></div>
<div class="col-10 col-md-3">@item.PartyName</div>
<div class="col-6 col-md-3">@item.PhoneNumber</div>
<div class="col-6 col-md-3" style="text-align:left;">@item.Amount</div>
<div class="col-6 col-md-2">
<label class="switch">
<input data-id="@countIndex"
type="checkbox" checked
data-PartyName="@item.PartyName"
data-PhoneNumber="@item.PhoneNumber"
data-Amount="@item.Amount"
data-TemplateId="@item.TemplateId"
data-ContractingPartyId="@item.ContractingPartyId"
data-AproveId="@item.AproveId"
data-TypeOfSmsMethod="@item.TypeOfSmsMethod"
data-Code1="@item.Code1"
data-Code2="@item.Code2"
data-InstitutionContractId="@item.InstitutionContractId" />
<span class="slider round"></span>
</label>
</div>
@{
countIndex++;
}
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
</div>
</div>
}

View File

@@ -0,0 +1,100 @@
@model List<CompanyManagment.App.Contracts.InstitutionContract.BlockSmsListData>
@{
int countIndex = 1;
<style>
/* Toggle Switch */
.switch {
position: relative;
display: inline-block;
width: 46px;
height: 24px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .3s;
border-radius: 34px;
}
.slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
transition: .3s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #28a745; /* رنگ سبز مشابه Bootstrap */
}
input:checked + .slider:before {
transform: translateX(22px);
}
</style>
}
<!-- لیست -->
@foreach (var item in Model)
{
<div class="row align-items-center p-2 tr-table record">
<div class="col-2 col-md-1"><div class="row-number">@countIndex</div></div>
<div class="col-10 col-md-3">@item.PartyName</div>
<div class="col-6 col-md-3">@item.PhoneNumber</div>
<div class="col-6 col-md-3" style="text-align:left;">@item.Amount</div>
<div class="col-6 col-md-2">
<label class="switch">
<input data-id="@countIndex"
type="checkbox" checked
data-PhoneNumber="@item.PhoneNumber"
data-PartyName="@item.PartyName"
data-Amount="@item.Amount"
data-ContractingPartyId="@item.ContractingPartyId"
data-AccountType="@item.AccountType"
data-InstitutionContractId="@item.InstitutionContractId"
data-AproveId="@item.AproveId"
/>
<span class="slider round"></span>
</label>
</div>
@{
countIndex++;
}
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
</div>
</div>
}

View File

@@ -26,6 +26,7 @@ using System.Text.Json.Serialization;
using System.Text.Json;
using _0_Framework.InfraStructure.Mongo;
using Bogus;
using CompanyManagment.App.Contracts.Hubs;
using CompanyManagment.EFCore.Services;
using Microsoft.AspNetCore.CookiePolicy;
using Microsoft.AspNetCore.Mvc.Infrastructure;
@@ -409,6 +410,7 @@ app.MapHub<SendAccountMessage>("/trackingSmsHub");
app.MapHub<HolidayApiHub>("/trackingHolidayHub");
app.MapHub<CheckoutHub>("/trackingCheckoutHub");
// app.MapHub<FaceEmbeddingHub>("/trackingFaceEmbeddingHub");
app.MapHub<SendSmsHub>("/trackingSendSmsHub");
app.MapRazorPages();
app.MapControllers();

View File

@@ -173,6 +173,7 @@
<None Include="Areas\Admin\Pages\Company\PersonnelInfo\Index.cshtml" />
<None Include="Areas\Admin\Pages\Company\PersonnelInfo\PrintAll.cshtml" />
<None Include="Areas\Admin\Pages\Company\Reports\Index.cshtml" />
<None Include="Areas\Admin\Pages\Company\SmsResult\_SmsSettingPartials\ReminderSmsListData.cshtml" />
<None Include="Areas\Admin\Pages\Company\Workshops\_CreateForms\FormPermissionAccount.cshtml" />
<None Include="Areas\Admin\Pages\Company\Workshops\_EditForms\FormPermissionAccount.cshtml" />
<None Include="Areas\Camera\Pages\Index.cshtml" />

View File

@@ -12,7 +12,7 @@
//"MesbahDb": "Data Source=DESKTOP-NUE119G\\MSNEW;Initial Catalog=Mesbah_db;Integrated Security=True"
//server
"MesbahDbServer": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;",
//"MesbahDbServer": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;",
//local
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",