PIbd-22. Stroev V.M. Lab Work 07 #7
@ -6,6 +6,6 @@
|
||||
<add key="PopHost" value="pop.gmail.com" />
|
||||
<add key="PopPort" value="995" />
|
||||
<add key="MailLogin" value="labwork7Stroev@gmail.com" />
|
||||
<add key="MailPassword" value="passlab7" />
|
||||
<add key="MailPassword" value="ilvf bkyd gali fhus" />
|
||||
</appSettings>
|
||||
</configuration>
|
||||
|
@ -75,7 +75,12 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
SendOrderMessage(result.ClientId, $"Ремонт сантехники, Заказ №{result.Id}", $"Заказ №{result.Id} от {result.DateCreate} на сумму {result.Sum:0.00} принят");
|
||||
Task.Run(() => _mailWorker.MailSendAsync(new MailSendInfoBindingModel
|
||||
{
|
||||
MailAddress = result.ClientEmail,
|
||||
Subject = $"Новый заказ создан. Номер заказа - {result.Id}",
|
||||
Text = $"Ваш заказ номер {result.Id} на работу {result.WorkName} от {result.DateCreate} на сумму {result.Sum} принят."
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
public bool StatusUpdate(OrderBindingModel model, OrderStatus newStatus)
|
||||
@ -113,24 +118,12 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private bool SendOrderMessage(int clientId, string subject, string text)
|
||||
{
|
||||
var client = _clientLogic.ReadElement(new() { Id = clientId });
|
||||
|
||||
if (client == null)
|
||||
Task.Run(() => _mailWorker.MailSendAsync(new MailSendInfoBindingModel
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_mailWorker.MailSendAsync(new()
|
||||
{
|
||||
MailAddress = client.Email,
|
||||
Subject = subject,
|
||||
Text = text
|
||||
});
|
||||
|
||||
MailAddress = viewModel.ClientEmail,
|
||||
Subject = $"Изменение статуса заказа номер {viewModel.Id}",
|
||||
Text = $"У заказа номер {viewModel.Id} изменен статус на {newStatus}"
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
public bool TakeOrderInWork(OrderBindingModel model)
|
||||
|
@ -33,5 +33,6 @@ namespace PlumbingRepairContracts.ViewModels
|
||||
public DateTime DateCreate { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
|
||||
[DisplayName("Дата выполнения")]
|
||||
public DateTime? DateImplement { get; set; }
|
||||
public string ClientEmail { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ namespace PlumbingRepairDataBaseImplement.Models
|
||||
Sum = Sum,
|
||||
Status = Status,
|
||||
DateCreate = DateCreate,
|
||||
ClientEmail = Client.Email,
|
||||
DateImplement = DateImplement
|
||||
};
|
||||
}
|
||||
|
@ -12,5 +12,5 @@
|
||||
"PopHost": "pop.gmail.com",
|
||||
"PopPort": "995",
|
||||
"MailLogin": "labwork7Stroev@gmail.com",
|
||||
"MailPassword": "passlab7"
|
||||
"MailPassword": "ilvf bkyd gali fhus"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user