change WorningSms methoth
This commit is contained in:
@@ -6334,268 +6334,275 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///دریافت لیست پیامک قرادا های آبی بدهکار
|
///دریافت لیست پیامک قراداد های آبی بدهکار
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
//public async Task<List<SmsListData>> GetBlueSmsListData()
|
public async Task<List<SmsListData>> GetWarningSmsListData()
|
||||||
//{
|
{
|
||||||
|
|
||||||
// var institutionContracts = await _context.InstitutionContractSet.AsQueryable().Select(x => new InstitutionContractViewModel
|
var institutionContracts = await _context.InstitutionContractSet.AsQueryable().Select(x => new InstitutionContractViewModel
|
||||||
// {
|
{
|
||||||
// Id = x.id,
|
Id = x.id,
|
||||||
// ContractingPartyId = x.ContractingPartyId,
|
ContractingPartyId = x.ContractingPartyId,
|
||||||
// ContractingPartyName = x.ContractingPartyName,
|
ContractingPartyName = x.ContractingPartyName,
|
||||||
// ContractStartGr = x.ContractStartGr,
|
ContractStartGr = x.ContractStartGr,
|
||||||
// ContractStartFa = x.ContractStartFa,
|
ContractStartFa = x.ContractStartFa,
|
||||||
// ContractEndGr = x.ContractEndGr,
|
ContractEndGr = x.ContractEndGr,
|
||||||
// ContractEndFa = x.ContractEndFa,
|
ContractEndFa = x.ContractEndFa,
|
||||||
// IsActiveString = x.IsActiveString,
|
IsActiveString = x.IsActiveString,
|
||||||
// ContractAmountDouble = x.ContractAmount,
|
ContractAmountDouble = x.ContractAmount,
|
||||||
// OfficialCompany = x.OfficialCompany,
|
OfficialCompany = x.OfficialCompany,
|
||||||
// IsInstallment = x.IsInstallment,
|
IsInstallment = x.IsInstallment,
|
||||||
// VerificationStatus = x.VerificationStatus,
|
VerificationStatus = x.VerificationStatus,
|
||||||
// SigningType = x.SigningType,
|
SigningType = x.SigningType,
|
||||||
// }).Where(x => x.IsActiveString == "blue" &&
|
}).Where(x => x.IsActiveString == "blue" &&
|
||||||
// x.ContractAmountDouble > 0).GroupBy(x => x.ContractingPartyId).Select(x => x.First()).ToListAsync();
|
x.ContractAmountDouble > 0).GroupBy(x => x.ContractingPartyId).Select(x => x.First()).ToListAsync();
|
||||||
|
|
||||||
// // قرارداد هایی که بطور یکجا پرداخت شده اند
|
var institutionContractsIds = institutionContracts.Select(x => x.id).ToList();
|
||||||
// var paidInFull = institutionContracts.Where(x =>
|
|
||||||
// x.SigningType != InstitutionContractSigningType.Legacy && x.IsInstallment == false && x.SigningType != null).ToList();
|
|
||||||
|
|
||||||
// //حذف قراداد هایی که یکجا پرداخت شده اند از لیست ایجاد سند ماهانه
|
// قرارداد هایی که بطور یکجا پرداخت شده اند
|
||||||
// institutionContracts = institutionContracts.Except(paidInFull).ToList();
|
var paidInFull = institutionContracts.Where(x =>
|
||||||
|
x.SigningType != InstitutionContractSigningType.Legacy && x.IsInstallment == false && x.SigningType != null).ToList();
|
||||||
|
|
||||||
// var contractingPartyList = await _context.PersonalContractingParties
|
//حذف قراداد هایی که یکجا پرداخت شده اند از لیست ایجاد سند ماهانه
|
||||||
// .Where(x => institutionContracts.Select(ins => ins.ContractingPartyId).Contains(x.id)).ToListAsync();
|
institutionContracts = institutionContracts.Except(paidInFull).ToList();
|
||||||
|
|
||||||
// var financialStatmentList = await _context.FinancialStatments.AsSplitQuery()
|
var contractingPartyList = await _context.PersonalContractingParties
|
||||||
// .Where(x => institutionContracts.Select(ins => ins.ContractingPartyId).Contains(x.ContractingPartyId))
|
.Where(x => institutionContracts.Select(ins => ins.ContractingPartyId).Contains(x.id)).ToListAsync();
|
||||||
// .Include(x => x.FinancialTransactionList).Where(x => x.FinancialTransactionList.Count > 0).ToListAsync();
|
|
||||||
|
|
||||||
// var phoneNumberList = await _context.InstitutionContractContactInfos
|
var financialStatmentList = await _context.FinancialStatments.AsSplitQuery()
|
||||||
// .Where(x => institutionContracts.Select(ins => ins.Id).Contains(x.InstitutionContractId))
|
.Where(x => institutionContracts.Select(ins => ins.ContractingPartyId).Contains(x.ContractingPartyId))
|
||||||
// .Where(x => x.SendSms && x.PhoneType == "شماره همراه" && !string.IsNullOrWhiteSpace(x.PhoneNumber) &&
|
.Include(x => x.FinancialTransactionList).Where(x => x.FinancialTransactionList.Count > 0).ToListAsync();
|
||||||
// x.PhoneNumber.Length == 11).ToListAsync();
|
|
||||||
// var legalActionSentSms =await _context.SmsResults
|
|
||||||
// .Where(x => x.TypeOfSms == "اقدام قضایی").ToListAsync();
|
|
||||||
// var warningSentSms = await _context.SmsResults.Where(x => x.TypeOfSms.Contains("هشدار")).ToListAsync();
|
|
||||||
|
|
||||||
// var oldInstitutionContract = institutionContracts.Where(x => x.IsInstallment == false).ToList();
|
var phoneNumberList = await _context.InstitutionContractContactInfos
|
||||||
// var electronicInstitutionContract = institutionContracts.Where(x => x.IsInstallment == true).ToList();
|
.Where(x => institutionContracts.Select(ins => ins.Id).Contains(x.InstitutionContractId))
|
||||||
|
.Where(x => x.SendSms && x.PhoneType == "شماره همراه" && !string.IsNullOrWhiteSpace(x.PhoneNumber) &&
|
||||||
|
x.PhoneNumber.Length == 11).ToListAsync();
|
||||||
|
var legalActionSentSms = await _context.SmsResults
|
||||||
|
.Where(x => x.TypeOfSms == "اقدام قضایی").ToListAsync();
|
||||||
|
var warningSentSms = await _context.SmsResults.Where(x => x.TypeOfSms.Contains("هشدار")).ToListAsync();
|
||||||
|
|
||||||
// foreach (var item in oldInstitutionContract)
|
var oldInstitutionContract = institutionContracts.Where(x => x.IsInstallment == false).ToList();
|
||||||
// {
|
var electronicInstitutionContract = institutionContracts.Where(x => x.IsInstallment == true).ToList();
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// var contractingParty = GetDetails(item.ContractingPartyId);
|
|
||||||
// bool hasLegalActionSentSms = legalActionSentSms.Any(x => x.InstitutionContractId == item.Id);
|
|
||||||
|
|
||||||
// if (!string.IsNullOrWhiteSpace(contractingParty.LName) && !hasLegalActionSentSms)
|
foreach (var item in oldInstitutionContract)
|
||||||
// {
|
{
|
||||||
// //Thread.Sleep(500);
|
try
|
||||||
// var partyName = contractingParty.LName;
|
{
|
||||||
|
var contractingParty = GetDetails(item.ContractingPartyId);
|
||||||
|
bool hasLegalActionSentSms = legalActionSentSms.Any(x => x.InstitutionContractId == item.Id);
|
||||||
|
int year = Convert.ToInt32(item.ContractEndFa.Substring(0, 4));
|
||||||
|
int month = Convert.ToInt32(item.ContractEndFa.Substring(5, 2));
|
||||||
|
var endOfContractNextMonthStart = new PersianDateTime(year, month, 1).AddMonths(1);
|
||||||
|
var endOfContractNextMonthEnd = (($"{endOfContractNextMonthStart}").FindeEndOfMonth()).ToGeorgianDateTime();
|
||||||
|
var now = DateTime.Now
|
||||||
|
|
||||||
// if (partyName.Length > 25) partyName = $"{partyName.Substring(0, 25)}";
|
if (!string.IsNullOrWhiteSpace(contractingParty.LName) && !hasLegalActionSentSms && now.Date <= endOfContractNextMonthEnd.Date)
|
||||||
|
{
|
||||||
|
//Thread.Sleep(500);
|
||||||
|
var partyName = contractingParty.LName;
|
||||||
|
|
||||||
// var isLegal = contractingParty.IsLegal == "حقوقی" ? true : false;
|
if (partyName.Length > 25) partyName = $"{partyName.Substring(0, 25)}";
|
||||||
// var isBlock = contractingParty.IsBlock == "true" ? true : false;
|
|
||||||
// var isActive = contractingParty.IsActiveString == "true" ? true : false;
|
|
||||||
// if (!string.IsNullOrWhiteSpace(contractingParty.IsActiveString))
|
|
||||||
// {
|
|
||||||
// var hasFinancialStatement =
|
|
||||||
// financialStatmentList.Any(x => x.ContractingPartyId == item.ContractingPartyId);
|
|
||||||
|
|
||||||
// var hasPhonNumber = phoneNumberList.Any(x => x.InstitutionContractId == item.Id);
|
var isLegal = contractingParty.IsLegal == "حقوقی" ? true : false;
|
||||||
|
var isBlock = contractingParty.IsBlock == "true" ? true : false;
|
||||||
|
var isActive = contractingParty.IsActiveString == "true" ? true : false;
|
||||||
|
if (!string.IsNullOrWhiteSpace(contractingParty.IsActiveString))
|
||||||
|
{
|
||||||
|
var hasFinancialStatement =
|
||||||
|
financialStatmentList.Any(x => x.ContractingPartyId == item.ContractingPartyId);
|
||||||
|
|
||||||
// if (hasFinancialStatement && hasPhonNumber)
|
var hasPhonNumber = phoneNumberList.Any(x => x.InstitutionContractId == item.Id);
|
||||||
// {
|
|
||||||
// var phoneNumbers = phoneNumberList.Where(x => x.InstitutionContractId == item.Id)
|
|
||||||
// .Select(x => new CreateContactInfo
|
|
||||||
// {
|
|
||||||
// PhoneType = x.PhoneType,
|
|
||||||
// PhoneNumber = x.PhoneNumber,
|
|
||||||
|
|
||||||
// InstitutionContractId = x.InstitutionContractId,
|
if (hasFinancialStatement && hasPhonNumber)
|
||||||
// SendSms = x.SendSms
|
{
|
||||||
// }).Where(x => x.PhoneNumber.Length == 11).ToList();
|
var phoneNumbers = phoneNumberList.Where(x => x.InstitutionContractId == item.Id)
|
||||||
|
.Select(x => new CreateContactInfo
|
||||||
|
{
|
||||||
|
PhoneType = x.PhoneType,
|
||||||
|
PhoneNumber = x.PhoneNumber,
|
||||||
|
|
||||||
// var transactions = financialStatmentList.FirstOrDefault(x =>
|
InstitutionContractId = x.InstitutionContractId,
|
||||||
// x.ContractingPartyId == item.ContractingPartyId);
|
SendSms = x.SendSms
|
||||||
|
}).Where(x => x.PhoneNumber.Length == 11).ToList();
|
||||||
|
|
||||||
|
var transactions = financialStatmentList.FirstOrDefault(x =>
|
||||||
|
x.ContractingPartyId == item.ContractingPartyId);
|
||||||
|
|
||||||
|
|
||||||
// var debtor = transactions.FinancialTransactionViewModels.Sum(x => x.Deptor);
|
var debtor = transactions.FinancialTransactionViewModels.Sum(x => x.Deptor);
|
||||||
// var creditor = transactions.FinancialTransactionViewModels.Sum(x => x.Creditor);
|
var creditor = transactions.FinancialTransactionViewModels.Sum(x => x.Creditor);
|
||||||
|
|
||||||
|
|
||||||
// var id = $"{item.ContractingPartyId}";
|
|
||||||
// var aprove = $"{transactions.Id}";
|
|
||||||
// var balance = debtor - creditor;
|
|
||||||
|
|
||||||
// if (balance > 0) // اگر بدهکار بود
|
var id = $"{item.ContractingPartyId}";
|
||||||
// {
|
var aprove = $"{transactions.Id}";
|
||||||
|
var balance = debtor - creditor;
|
||||||
|
|
||||||
// if (isLegal)
|
if (balance > 0) // اگر بدهکار بود
|
||||||
// {
|
{
|
||||||
// if (item.OfficialCompany == "Official") // حقوقی بدهکار رسمی
|
|
||||||
// {
|
|
||||||
// var balanceToMoney = balance.ToMoney();
|
|
||||||
|
|
||||||
// foreach (var number in phoneNumbers)
|
if (isLegal)
|
||||||
// {
|
{
|
||||||
|
if (item.OfficialCompany == "Official") // حقوقی بدهکار رسمی
|
||||||
// var isLastAlarmSend = _context.SmsResults.Any(x => (
|
{
|
||||||
// x.ContractingPatyId == contractingParty.Id &&
|
var balanceToMoney = balance.ToMoney();
|
||||||
// x.Mobile == number.PhoneNumber) && (x.TypeOfSms == "اقدام قضایی" || x.TypeOfSms == "هشدار دوم"));
|
|
||||||
|
|
||||||
// if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
foreach (var number in phoneNumbers)
|
||||||
// number.PhoneNumber.Length == 11 && !isSend && !isLastAlarmSend)
|
{
|
||||||
// {
|
|
||||||
|
|
||||||
// var smsResult = _smsService.MonthlyBill(number.PhoneNumber, 608443,
|
var isLastAlarmSend = _context.SmsResults.Any(x => (
|
||||||
// partyName,
|
x.ContractingPatyId == contractingParty.Id &&
|
||||||
// balanceToMoney, id, aprove);
|
x.Mobile == number.PhoneNumber) && (x.TypeOfSms == "اقدام قضایی" || x.TypeOfSms == "هشدار دوم"));
|
||||||
// Thread.Sleep(1000);
|
var t = warningSentSms.Any(x=> x.)
|
||||||
// if (smsResult.IsSuccedded)
|
if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
||||||
// {
|
number.PhoneNumber.Length == 11 && !isSend && !isLastAlarmSend)
|
||||||
// var createSmsResult = new SmsResult(smsResult.MessageId,
|
{
|
||||||
// smsResult.Message, typeOfSms, partyName, number.PhoneNumber,
|
|
||||||
// item.ContractingPartyId, item.Id);
|
|
||||||
// _smsResultRepository.Create(createSmsResult);
|
|
||||||
// _smsResultRepository.SaveChanges();
|
|
||||||
// Thread.Sleep(1000);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
var smsResult = _smsService.MonthlyBill(number.PhoneNumber, 608443,
|
||||||
// }
|
partyName,
|
||||||
|
balanceToMoney, id, aprove);
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
if (smsResult.IsSuccedded)
|
||||||
|
{
|
||||||
|
var createSmsResult = new SmsResult(smsResult.MessageId,
|
||||||
|
smsResult.Message, typeOfSms, partyName, number.PhoneNumber,
|
||||||
|
item.ContractingPartyId, item.Id);
|
||||||
|
_smsResultRepository.Create(createSmsResult);
|
||||||
|
_smsResultRepository.SaveChanges();
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
// else if (item.OfficialCompany == "NotOfficial") // حقوقی بدهکار غیر رسمی
|
else if (item.OfficialCompany == "NotOfficial") // حقوقی بدهکار غیر رسمی
|
||||||
// {
|
{
|
||||||
// var balanceToMoney = balance.ToMoney();
|
var balanceToMoney = balance.ToMoney();
|
||||||
// foreach (var number in phoneNumbers)
|
foreach (var number in phoneNumbers)
|
||||||
// {
|
{
|
||||||
// var isSend = _context.SmsResults.Any(x =>
|
var isSend = _context.SmsResults.Any(x =>
|
||||||
// x.ContractingPatyId == contractingParty.Id &&
|
x.ContractingPatyId == contractingParty.Id &&
|
||||||
// x.Mobile == number.PhoneNumber && x.TypeOfSms == typeOfSms);
|
x.Mobile == number.PhoneNumber && x.TypeOfSms == typeOfSms);
|
||||||
// var isLastAlarmSend = _context.SmsResults.Any(x => (
|
var isLastAlarmSend = _context.SmsResults.Any(x => (
|
||||||
// x.ContractingPatyId == contractingParty.Id &&
|
x.ContractingPatyId == contractingParty.Id &&
|
||||||
// x.Mobile == number.PhoneNumber) && (x.TypeOfSms == "اقدام قضایی" || x.TypeOfSms == "هشدار دوم"));
|
x.Mobile == number.PhoneNumber) && (x.TypeOfSms == "اقدام قضایی" || x.TypeOfSms == "هشدار دوم"));
|
||||||
// if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
||||||
// number.PhoneNumber.Length == 11 && !isSend && !isLastAlarmSend)
|
number.PhoneNumber.Length == 11 && !isSend && !isLastAlarmSend)
|
||||||
// {
|
{
|
||||||
|
|
||||||
// var smsResult = _smsService.MonthlyBill(number.PhoneNumber, 351691,
|
var smsResult = _smsService.MonthlyBill(number.PhoneNumber, 351691,
|
||||||
// partyName,
|
partyName,
|
||||||
// balanceToMoney, id, aprove);
|
balanceToMoney, id, aprove);
|
||||||
// Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
// if (smsResult.IsSuccedded)
|
if (smsResult.IsSuccedded)
|
||||||
// {
|
{
|
||||||
// var createSmsResult = new SmsResult(smsResult.MessageId,
|
var createSmsResult = new SmsResult(smsResult.MessageId,
|
||||||
// smsResult.Message, typeOfSms, partyName, number.PhoneNumber,
|
smsResult.Message, typeOfSms, partyName, number.PhoneNumber,
|
||||||
// item.ContractingPartyId, item.Id);
|
item.ContractingPartyId, item.Id);
|
||||||
// _smsResultRepository.Create(createSmsResult);
|
_smsResultRepository.Create(createSmsResult);
|
||||||
// _smsResultRepository.SaveChanges();
|
_smsResultRepository.SaveChanges();
|
||||||
// Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// else
|
else
|
||||||
// {
|
{
|
||||||
// if (item.OfficialCompany == "Official") // حقیقی بدهکار رسمی
|
if (item.OfficialCompany == "Official") // حقیقی بدهکار رسمی
|
||||||
// {
|
{
|
||||||
// var balanceToMoney = balance.ToMoney();
|
var balanceToMoney = balance.ToMoney();
|
||||||
|
|
||||||
// foreach (var number in phoneNumbers)
|
foreach (var number in phoneNumbers)
|
||||||
// {
|
{
|
||||||
// var isSend = _context.SmsResults.Any(x =>
|
var isSend = _context.SmsResults.Any(x =>
|
||||||
// x.ContractingPatyId == contractingParty.Id &&
|
x.ContractingPatyId == contractingParty.Id &&
|
||||||
// x.Mobile == number.PhoneNumber && x.TypeOfSms == typeOfSms);
|
x.Mobile == number.PhoneNumber && x.TypeOfSms == typeOfSms);
|
||||||
// var isLastAlarmSend = _context.SmsResults.Any(x => (
|
var isLastAlarmSend = _context.SmsResults.Any(x => (
|
||||||
// x.ContractingPatyId == contractingParty.Id &&
|
x.ContractingPatyId == contractingParty.Id &&
|
||||||
// x.Mobile == number.PhoneNumber) && (x.TypeOfSms == "اقدام قضایی" || x.TypeOfSms == "هشدار دوم"));
|
x.Mobile == number.PhoneNumber) && (x.TypeOfSms == "اقدام قضایی" || x.TypeOfSms == "هشدار دوم"));
|
||||||
// if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
||||||
// number.PhoneNumber.Length == 11 && !isSend && !isLastAlarmSend)
|
number.PhoneNumber.Length == 11 && !isSend && !isLastAlarmSend)
|
||||||
// {
|
{
|
||||||
|
|
||||||
// var smsResult = _smsService.MonthlyBill(number.PhoneNumber, 190430,
|
var smsResult = _smsService.MonthlyBill(number.PhoneNumber, 190430,
|
||||||
// partyName,
|
partyName,
|
||||||
// balanceToMoney, id, aprove);
|
balanceToMoney, id, aprove);
|
||||||
// Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
// if (smsResult.IsSuccedded)
|
if (smsResult.IsSuccedded)
|
||||||
// {
|
{
|
||||||
// var createSmsResult = new SmsResult(smsResult.MessageId,
|
var createSmsResult = new SmsResult(smsResult.MessageId,
|
||||||
// smsResult.Message, typeOfSms, partyName, number.PhoneNumber,
|
smsResult.Message, typeOfSms, partyName, number.PhoneNumber,
|
||||||
// item.ContractingPartyId, item.Id);
|
item.ContractingPartyId, item.Id);
|
||||||
// _smsResultRepository.Create(createSmsResult);
|
_smsResultRepository.Create(createSmsResult);
|
||||||
// _smsResultRepository.SaveChanges();
|
_smsResultRepository.SaveChanges();
|
||||||
// Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
// else if (item.OfficialCompany == "NotOfficial") // حقیقی بدهکار غیر رسمی
|
else if (item.OfficialCompany == "NotOfficial") // حقیقی بدهکار غیر رسمی
|
||||||
// {
|
{
|
||||||
// var balanceToMoney = balance.ToMoney();
|
var balanceToMoney = balance.ToMoney();
|
||||||
|
|
||||||
// foreach (var number in phoneNumbers)
|
foreach (var number in phoneNumbers)
|
||||||
// {
|
{
|
||||||
// var isSend = _context.SmsResults.Any(x =>
|
var isSend = _context.SmsResults.Any(x =>
|
||||||
// x.ContractingPatyId == contractingParty.Id &&
|
x.ContractingPatyId == contractingParty.Id &&
|
||||||
// x.Mobile == number.PhoneNumber && x.TypeOfSms == typeOfSms);
|
x.Mobile == number.PhoneNumber && x.TypeOfSms == typeOfSms);
|
||||||
// var isLastAlarmSend = _context.SmsResults.Any(x => (
|
var isLastAlarmSend = _context.SmsResults.Any(x => (
|
||||||
// x.ContractingPatyId == contractingParty.Id &&
|
x.ContractingPatyId == contractingParty.Id &&
|
||||||
// x.Mobile == number.PhoneNumber) && (x.TypeOfSms == "اقدام قضایی" || x.TypeOfSms == "هشدار دوم"));
|
x.Mobile == number.PhoneNumber) && (x.TypeOfSms == "اقدام قضایی" || x.TypeOfSms == "هشدار دوم"));
|
||||||
// if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
if (!string.IsNullOrWhiteSpace(number.PhoneNumber) &&
|
||||||
// number.PhoneNumber.Length == 11 && !isSend && !isLastAlarmSend)
|
number.PhoneNumber.Length == 11 && !isSend && !isLastAlarmSend)
|
||||||
// {
|
{
|
||||||
// var smsResult = _smsService.MonthlyBill(number.PhoneNumber, 412829,
|
var smsResult = _smsService.MonthlyBill(number.PhoneNumber, 412829,
|
||||||
// partyName,
|
partyName,
|
||||||
// balanceToMoney, id, aprove);
|
balanceToMoney, id, aprove);
|
||||||
// Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
// if (smsResult.IsSuccedded)
|
if (smsResult.IsSuccedded)
|
||||||
// {
|
{
|
||||||
// var createSmsResult = new SmsResult(smsResult.MessageId,
|
var createSmsResult = new SmsResult(smsResult.MessageId,
|
||||||
// smsResult.Message, typeOfSms, partyName, number.PhoneNumber,
|
smsResult.Message, typeOfSms, partyName, number.PhoneNumber,
|
||||||
// item.ContractingPartyId, item.Id);
|
item.ContractingPartyId, item.Id);
|
||||||
// _smsResultRepository.Create(createSmsResult);
|
_smsResultRepository.Create(createSmsResult);
|
||||||
// _smsResultRepository.SaveChanges();
|
_smsResultRepository.SaveChanges();
|
||||||
// Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// catch (Exception e)
|
catch (Exception e)
|
||||||
// {
|
{
|
||||||
|
|
||||||
|
|
||||||
// string name = item.ContractingPartyName.Length > 18 ? item.ContractingPartyName.Substring(0, 18) : item.ContractingPartyName;
|
string name = item.ContractingPartyName.Length > 18 ? item.ContractingPartyName.Substring(0, 18) : item.ContractingPartyName;
|
||||||
// string errMess = $"{name}-خطا";
|
string errMess = $"{name}-خطا";
|
||||||
// _smsService.Alarm("09114221321", errMess);
|
_smsService.Alarm("09114221321", errMess);
|
||||||
// _logger.LogError(e, "BlueWarningSms");
|
_logger.LogError(e, "BlueWarningSms");
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user