From 9d9f0e14d33060c6f10b0f81537c1683c528c998 Mon Sep 17 00:00:00 2001 From: MahanCh Date: Sat, 9 Aug 2025 12:40:31 +0330 Subject: [PATCH] add task job --- 0_Framework/Application/Sms/ISmsService.cs | 1 + 0_Framework/Application/Sms/SmsResult.cs | 32 +++++ 0_Framework/Application/Sms/SmsService.cs | 28 +++++ .../BackgroundJobs.Task.csproj | 17 +++ .../BackgroundJobs.Task}/FileUploader.cs | 2 +- .../Jobs/JobSchedulerRegistrator.cs | 63 ++++++++++ .../BackgroundJobs.Task/Jobs/SmsReminder.cs | 119 ++++++++++++++++++ .../BackgroundJobs.Task/JobsBootstrapper.cs | 24 ++++ .../BackgroundJobs.Task}/Program.cs | 6 +- .../Properties/launchSettings.json | 8 +- .../appsettings.Development.json | 26 +++- .../BackgroundJobs.Task/appsettings.json | 9 ++ BackgroundService/BackgroundService.csproj | 22 ---- .../Jobs/JobSchedulerRegistrator.cs | 23 ---- .../PaymentTransactionValidatePending.cs | 27 ---- BackgroundService/Jobs/Test/ITestService.cs | 6 - BackgroundService/Jobs/Test/TestService.cs | 11 -- BackgroundService/JobsBootstrapper.cs | 14 --- .../appsettings.Development.json | 26 ---- DadmehrGostar.sln | 13 +- 20 files changed, 330 insertions(+), 147 deletions(-) create mode 100644 0_Framework/Application/Sms/SmsResult.cs create mode 100644 BackgroundJobs/BackgroundJobs.Task/BackgroundJobs.Task.csproj rename {BackgroundService => BackgroundJobs/BackgroundJobs.Task}/FileUploader.cs (96%) create mode 100644 BackgroundJobs/BackgroundJobs.Task/Jobs/JobSchedulerRegistrator.cs create mode 100644 BackgroundJobs/BackgroundJobs.Task/Jobs/SmsReminder.cs create mode 100644 BackgroundJobs/BackgroundJobs.Task/JobsBootstrapper.cs rename {BackgroundService => BackgroundJobs/BackgroundJobs.Task}/Program.cs (94%) rename {BackgroundService => BackgroundJobs/BackgroundJobs.Task}/Properties/launchSettings.json (80%) rename BackgroundService/appsettings.json => BackgroundJobs/BackgroundJobs.Task/appsettings.Development.json (53%) create mode 100644 BackgroundJobs/BackgroundJobs.Task/appsettings.json delete mode 100644 BackgroundService/BackgroundService.csproj delete mode 100644 BackgroundService/Jobs/JobSchedulerRegistrator.cs delete mode 100644 BackgroundService/Jobs/PaymentTransactions/PaymentTransactionValidatePending.cs delete mode 100644 BackgroundService/Jobs/Test/ITestService.cs delete mode 100644 BackgroundService/Jobs/Test/TestService.cs delete mode 100644 BackgroundService/JobsBootstrapper.cs delete mode 100644 BackgroundService/appsettings.Development.json diff --git a/0_Framework/Application/Sms/ISmsService.cs b/0_Framework/Application/Sms/ISmsService.cs index 36a38030..edcd5e72 100644 --- a/0_Framework/Application/Sms/ISmsService.cs +++ b/0_Framework/Application/Sms/ISmsService.cs @@ -26,6 +26,7 @@ public interface ISmsService #region Mahan Task GetCreditAmount(); + SmsResult TaskReminderSms(string number, string taskCount); #endregion diff --git a/0_Framework/Application/Sms/SmsResult.cs b/0_Framework/Application/Sms/SmsResult.cs new file mode 100644 index 00000000..266a76d4 --- /dev/null +++ b/0_Framework/Application/Sms/SmsResult.cs @@ -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; + } +} \ No newline at end of file diff --git a/0_Framework/Application/Sms/SmsService.cs b/0_Framework/Application/Sms/SmsService.cs index 9513791c..e8e3a813 100644 --- a/0_Framework/Application/Sms/SmsService.cs +++ b/0_Framework/Application/Sms/SmsService.cs @@ -332,6 +332,34 @@ public class SmsService : ISmsService } + public SmsResult TaskReminderSms(string number, string taskCount) + { + var tamplateId = 909433; + var result = new SmsResult(); + var smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa"); + var sendResult = smsIr.VerifySendAsync(number, tamplateId, + new VerifySendParameter[] + { + new("TASKCOUNT", taskCount), + }); + Thread.Sleep(500); + + + if (sendResult.IsCompletedSuccessfully) + { + var status = sendResult.Result.Status; + var message = sendResult.Result.Message; + var messaeId = sendResult.Result.Data.MessageId; + return result.Succedded(status, message, messaeId); + } + else + { + var status = sendResult.Result.Status; + var message = sendResult.Result.Message; + var messaeId = sendResult.Result.Data.MessageId; + return result.Failed(status, message, messaeId); + } + } #endregion } diff --git a/BackgroundJobs/BackgroundJobs.Task/BackgroundJobs.Task.csproj b/BackgroundJobs/BackgroundJobs.Task/BackgroundJobs.Task.csproj new file mode 100644 index 00000000..0ab571f8 --- /dev/null +++ b/BackgroundJobs/BackgroundJobs.Task/BackgroundJobs.Task.csproj @@ -0,0 +1,17 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + diff --git a/BackgroundService/FileUploader.cs b/BackgroundJobs/BackgroundJobs.Task/FileUploader.cs similarity index 96% rename from BackgroundService/FileUploader.cs rename to BackgroundJobs/BackgroundJobs.Task/FileUploader.cs index 71073a3a..0d8610d9 100644 --- a/BackgroundService/FileUploader.cs +++ b/BackgroundJobs/BackgroundJobs.Task/FileUploader.cs @@ -1,6 +1,6 @@ using _0_Framework.Application; -namespace BackgroundService +namespace BackgroundJobs.Task { public class FileUploader : IFileUploader { diff --git a/BackgroundJobs/BackgroundJobs.Task/Jobs/JobSchedulerRegistrator.cs b/BackgroundJobs/BackgroundJobs.Task/Jobs/JobSchedulerRegistrator.cs new file mode 100644 index 00000000..f35edd74 --- /dev/null +++ b/BackgroundJobs/BackgroundJobs.Task/Jobs/JobSchedulerRegistrator.cs @@ -0,0 +1,63 @@ + +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(), + Cron.Minutely() // هر 5 دقیقه یکبار چک کن + ); + } + + private 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; + } + } + } +} \ No newline at end of file diff --git a/BackgroundJobs/BackgroundJobs.Task/Jobs/SmsReminder.cs b/BackgroundJobs/BackgroundJobs.Task/Jobs/SmsReminder.cs new file mode 100644 index 00000000..13c05074 --- /dev/null +++ b/BackgroundJobs/BackgroundJobs.Task/Jobs/SmsReminder.cs @@ -0,0 +1,119 @@ +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() { 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; } +} \ No newline at end of file diff --git a/BackgroundJobs/BackgroundJobs.Task/JobsBootstrapper.cs b/BackgroundJobs/BackgroundJobs.Task/JobsBootstrapper.cs new file mode 100644 index 00000000..a89f8265 --- /dev/null +++ b/BackgroundJobs/BackgroundJobs.Task/JobsBootstrapper.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/BackgroundService/Program.cs b/BackgroundJobs/BackgroundJobs.Task/Program.cs similarity index 94% rename from BackgroundService/Program.cs rename to BackgroundJobs/BackgroundJobs.Task/Program.cs index 4f00341d..5d012801 100644 --- a/BackgroundService/Program.cs +++ b/BackgroundJobs/BackgroundJobs.Task/Program.cs @@ -2,10 +2,10 @@ using _0_Framework.Application; using _0_Framework.Application.Sms; using _0_Framework.Application.UID; using AccountManagement.Configuration; -using BackgroundService; -using BackgroundService.Jobs; -using BackgroundService.Services; +using BackgroundJobs.Task; +using BackgroundJobs.Task.Jobs; using Hangfire; +using Microsoft.AspNetCore.Identity; using PersonalContractingParty.Config; using Query.Bootstrapper; using WorkFlow.Infrastructure.Config; diff --git a/BackgroundService/Properties/launchSettings.json b/BackgroundJobs/BackgroundJobs.Task/Properties/launchSettings.json similarity index 80% rename from BackgroundService/Properties/launchSettings.json rename to BackgroundJobs/BackgroundJobs.Task/Properties/launchSettings.json index 1e0366b9..197ad0e4 100644 --- a/BackgroundService/Properties/launchSettings.json +++ b/BackgroundJobs/BackgroundJobs.Task/Properties/launchSettings.json @@ -4,8 +4,8 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:38468", - "sslPort": 44358 + "applicationUrl": "http://localhost:56492", + "sslPort": 44378 } }, "profiles": { @@ -13,7 +13,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "http://localhost:5105", + "applicationUrl": "http://localhost:5216", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -22,7 +22,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "https://localhost:7000;http://localhost:5105", + "applicationUrl": "https://localhost:7222;http://localhost:5216", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/BackgroundService/appsettings.json b/BackgroundJobs/BackgroundJobs.Task/appsettings.Development.json similarity index 53% rename from BackgroundService/appsettings.json rename to BackgroundJobs/BackgroundJobs.Task/appsettings.Development.json index f372fc70..cecbb2cc 100644 --- a/BackgroundService/appsettings.json +++ b/BackgroundJobs/BackgroundJobs.Task/appsettings.Development.json @@ -1,8 +1,10 @@ { + "DetailedErrors": true, "Logging": { "LogLevel": { "Default": "Information", - "Microsoft.AspNetCore": "Warning" + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" } }, "ConnectionStrings": { @@ -16,11 +18,25 @@ //local "MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;", - "TestDb": "Data Source=.;Initial Catalog=TestDb;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;" + //"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", - "AllowedHosts": "*" -} + + +} \ No newline at end of file diff --git a/BackgroundJobs/BackgroundJobs.Task/appsettings.json b/BackgroundJobs/BackgroundJobs.Task/appsettings.json new file mode 100644 index 00000000..10f68b8c --- /dev/null +++ b/BackgroundJobs/BackgroundJobs.Task/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/BackgroundService/BackgroundService.csproj b/BackgroundService/BackgroundService.csproj deleted file mode 100644 index bd14b71a..00000000 --- a/BackgroundService/BackgroundService.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - - - - - - - - diff --git a/BackgroundService/Jobs/JobSchedulerRegistrator.cs b/BackgroundService/Jobs/JobSchedulerRegistrator.cs deleted file mode 100644 index f7ed9d53..00000000 --- a/BackgroundService/Jobs/JobSchedulerRegistrator.cs +++ /dev/null @@ -1,23 +0,0 @@ -using BackgroundService.Services; -using Hangfire; - -namespace BackgroundService.Jobs; - -public class JobSchedulerRegistrator -{ - - private readonly ITestService _testService; - public JobSchedulerRegistrator(ITestService testService) - { - _testService = testService; - } - - public void Register() - { - RecurringJob.AddOrUpdate( - "job1", - () => _testService.Execute(), - Cron.Hourly - ); - } -} \ No newline at end of file diff --git a/BackgroundService/Jobs/PaymentTransactions/PaymentTransactionValidatePending.cs b/BackgroundService/Jobs/PaymentTransactions/PaymentTransactionValidatePending.cs deleted file mode 100644 index f35153a9..00000000 --- a/BackgroundService/Jobs/PaymentTransactions/PaymentTransactionValidatePending.cs +++ /dev/null @@ -1,27 +0,0 @@ -using _0_Framework.Application; -using _0_Framework.Application.PaymentGateway; -using CompanyManagment.App.Contracts.PaymentTransaction; -using CompanyManagment.EFCore; -using Microsoft.Extensions.Options; - -namespace BackgroundService.Jobs.PaymentTransactions; - -public class PaymentTransactionValidatePending -{ - private readonly CompanyContext _companyContext; - private readonly IPaymentGateway _paymentGateway; - public PaymentTransactionValidatePending(CompanyContext companyContext, IHttpClientFactory httpClientFactory,IOptions appSetting) - { - _companyContext = companyContext; - _paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory,appSetting); - } - - public async Task Execute() - { - var paymentTransactions = _companyContext.PaymentTransactions.Where(x => - x.Status == PaymentTransactionStatus.Pending && x.CreationDate.AddMinutes(30) <= DateTime.Now); - //Todo: وریفای تراکنش - - - } -} \ No newline at end of file diff --git a/BackgroundService/Jobs/Test/ITestService.cs b/BackgroundService/Jobs/Test/ITestService.cs deleted file mode 100644 index 80e2bf42..00000000 --- a/BackgroundService/Jobs/Test/ITestService.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace BackgroundService.Services; - -public interface ITestService -{ - void Execute(); -} \ No newline at end of file diff --git a/BackgroundService/Jobs/Test/TestService.cs b/BackgroundService/Jobs/Test/TestService.cs deleted file mode 100644 index 2d2e0dc4..00000000 --- a/BackgroundService/Jobs/Test/TestService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using BackgroundService.Services; - -namespace BackgroundService.Jobs.Test; - -public class TestService:ITestService -{ - public void Execute() - { - Console.WriteLine("Hello World!"); - } -} \ No newline at end of file diff --git a/BackgroundService/JobsBootstrapper.cs b/BackgroundService/JobsBootstrapper.cs deleted file mode 100644 index e8fd6397..00000000 --- a/BackgroundService/JobsBootstrapper.cs +++ /dev/null @@ -1,14 +0,0 @@ -using BackgroundService.Jobs; -using BackgroundService.Jobs.Test; -using BackgroundService.Services; - -namespace BackgroundService; - -public class JobsBootstrapper -{ - public static void Configure(IServiceCollection services) - { - services.AddTransient(); - services.AddTransient(); - } -} \ No newline at end of file diff --git a/BackgroundService/appsettings.Development.json b/BackgroundService/appsettings.Development.json deleted file mode 100644 index 6fb4e9d1..00000000 --- a/BackgroundService/appsettings.Development.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "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;", - "hangfireDb": "Data Source=.;Initial Catalog=hangfire_db;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;" - }, - "Domain": ".gozareshgir.ir" -} diff --git a/DadmehrGostar.sln b/DadmehrGostar.sln index ef48c55e..76bfd3e1 100644 --- a/DadmehrGostar.sln +++ b/DadmehrGostar.sln @@ -80,7 +80,9 @@ 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}") = "BackgroundService", "BackgroundService\BackgroundService.csproj", "{6C97118D-0497-48A6-846B-E44402FB824F}" +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 Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -180,10 +182,10 @@ 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 - {6C97118D-0497-48A6-846B-E44402FB824F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C97118D-0497-48A6-846B-E44402FB824F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C97118D-0497-48A6-846B-E44402FB824F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C97118D-0497-48A6-846B-E44402FB824F}.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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -218,6 +220,7 @@ 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} + {97E148FA-3C36-40DD-B121-D90C1C0F3B47} = {C10E256D-7E7D-4C77-B416-E577A34AF924} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E6CFB3A7-A7C8-4E82-8F06-F750408F0BA9}