70 lines
2.2 KiB
C#
70 lines
2.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using _0_Framework.Application;
|
|
using Company.Domain.SmsResultAgg;
|
|
using CompanyManagment.App.Contracts.SmsResult;
|
|
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
|
|
|
namespace CompanyManagment.Application;
|
|
|
|
public class SmsResultApplication : ISmsResultApplication
|
|
{
|
|
private readonly ISmsResultRepository _smsResultRepository;
|
|
|
|
public SmsResultApplication(ISmsResultRepository smsResultRepository)
|
|
{
|
|
_smsResultRepository = smsResultRepository;
|
|
}
|
|
|
|
|
|
#region ForApi
|
|
|
|
public async Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel)
|
|
{
|
|
return await _smsResultRepository.GetSmsReportList(searchModel);
|
|
}
|
|
|
|
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
|
|
{
|
|
return await _smsResultRepository.GetSmsReportExpandList(searchModel, date);
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
public OperationResult Create(CreateSmsResult command)
|
|
{
|
|
var op = new OperationResult();
|
|
|
|
var create = new SmsResult(command.MessageId,command.Status,command.TypeOfSms,command.ContractingPartyName,command.Mobile,command.ContractingPatyId,command.InstitutionContractId);
|
|
_smsResultRepository.Create(create);
|
|
_smsResultRepository.SaveChanges();
|
|
return op.Succcedded();
|
|
}
|
|
|
|
public List<App.Contracts.SmsResult.SmsResultViewModel> Search(SmsResultSearchModel searchModel)
|
|
{
|
|
|
|
var result = _smsResultRepository.Search(searchModel);
|
|
|
|
result = result.Select(x => new SmsResultViewModel
|
|
{
|
|
Id = x.Id,
|
|
MessageId = x.MessageId,
|
|
Status = x.Status,
|
|
TypeOfSms = x.TypeOfSms,
|
|
ContractingPartyName = x.ContractingPartyName,
|
|
Mobile = x.Mobile,
|
|
ContractingPartyId = x.ContractingPartyId,
|
|
InstitutionContractId = x.InstitutionContractId,
|
|
CreationDate = x.CreationDate,
|
|
CreationDateFa = x.CreationDate.ToFarsi(),
|
|
HourAndMinute = $"{x.Hour}:{x.Minute}"
|
|
|
|
|
|
}).ToList();
|
|
return result;
|
|
}
|
|
} |