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