block and unblock
This commit is contained in:
@@ -32,7 +32,7 @@ public class JobSchedulerRegistrator
|
||||
|
||||
public void Register()
|
||||
{
|
||||
_logger.LogInformation("hangfire Started");
|
||||
//_logger.LogInformation("hangfire Started");
|
||||
//RecurringJob.AddOrUpdate(
|
||||
// "InstitutionContract.CreateFinancialTransaction",
|
||||
// () => CreateFinancialTransaction(),
|
||||
@@ -67,10 +67,24 @@ public class JobSchedulerRegistrator
|
||||
// "*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||
//);
|
||||
|
||||
//RecurringJob.AddOrUpdate(
|
||||
// "InstitutionContract.SendLegalActionSms",
|
||||
// () => SendLegalActionSms(),
|
||||
// "*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||
//);
|
||||
|
||||
|
||||
|
||||
RecurringJob.AddOrUpdate(
|
||||
"InstitutionContract.SendLegalActionSms",
|
||||
() => SendLegalActionSms(),
|
||||
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||
"InstitutionContract.Block",
|
||||
() => Block(),
|
||||
"*/30 * * * *" // هر 30 دقیقه یکبار چک کن
|
||||
);
|
||||
|
||||
RecurringJob.AddOrUpdate(
|
||||
"InstitutionContract.UnBlock",
|
||||
() => UnBlock(),
|
||||
"*/1 * * * *"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -82,14 +96,14 @@ public class JobSchedulerRegistrator
|
||||
//[DisableConcurrentExecution(timeoutInSeconds: 1200)]
|
||||
//public async System.Threading.Tasks.Task CreateFinancialTransaction()
|
||||
//{
|
||||
// var now =DateTime.Now;
|
||||
// var now = DateTime.Now;
|
||||
// var endOfMonth = now.ToFarsi().FindeEndOfMonth();
|
||||
// var endOfMonthGr = endOfMonth.ToGeorgianDateTime();
|
||||
// _logger.LogInformation("CreateFinancialTransaction job run");
|
||||
// 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();
|
||||
@@ -104,17 +118,17 @@ public class JobSchedulerRegistrator
|
||||
|
||||
// try
|
||||
// {
|
||||
// await _institutionContractRepository.CreateTransactionForInstitutionContracts(endNewGr, endNewFa, description);
|
||||
// await _institutionContractRepository.CreateTransactionForInstitutionContracts(endNewGr, endNewFa, description);
|
||||
// _lastRunCreateTransaction = now;
|
||||
// Console.WriteLine("CreateTransAction executed");
|
||||
|
||||
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// await _smsService.Alarm("09114221321", "خطا-ایجاد سند مالی");
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -170,7 +184,7 @@ public class JobSchedulerRegistrator
|
||||
//public async System.Threading.Tasks.Task SendBlockSms()
|
||||
//{
|
||||
// _logger.LogInformation("SendBlockSms job run");
|
||||
// await _institutionContractRepository.SendBlockSmsForBackgroundTask();
|
||||
// await _institutionContractSmsServiceRepository.SendBlockSmsForBackgroundTask();
|
||||
//}
|
||||
|
||||
|
||||
@@ -196,11 +210,40 @@ public class JobSchedulerRegistrator
|
||||
// await _institutionContractSmsServiceRepository.SendWarningOrLegalActionSmsTask(TypeOfSmsSetting.Warning);
|
||||
//}
|
||||
|
||||
//[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||
//public async System.Threading.Tasks.Task SendLegalActionSms()
|
||||
//{
|
||||
// _logger.LogInformation("SendWarningSms job run");
|
||||
// await _institutionContractSmsServiceRepository.SendWarningOrLegalActionSmsTask(TypeOfSmsSetting.LegalAction);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// بلاگ سازی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||
public async System.Threading.Tasks.Task SendLegalActionSms()
|
||||
public async System.Threading.Tasks.Task Block()
|
||||
{
|
||||
_logger.LogInformation("SendWarningSms job run");
|
||||
await _institutionContractSmsServiceRepository.SendWarningOrLegalActionSmsTask(TypeOfSmsSetting.LegalAction);
|
||||
_logger.LogInformation("block job run");
|
||||
var now = DateTime.Now;
|
||||
var executeDate = now.ToFarsi().Substring(8, 2);
|
||||
if (executeDate == "20")
|
||||
{
|
||||
if (now.Hour >= 9 && now.Hour < 10)
|
||||
{
|
||||
await _institutionContractSmsServiceRepository.Block(now);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||
public async System.Threading.Tasks.Task UnBlock()
|
||||
{
|
||||
_logger.LogInformation("UnBlock job run");
|
||||
|
||||
await _institutionContractSmsServiceRepository.UnBlock();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user