2024-07-04 11:02:45 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
2022-05-04 15:02:12 +05:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
namespace AsbCloudInfrastructure.Services.Email;
|
2023-04-18 16:22:53 +05:00
|
|
|
|
|
2022-05-04 15:02:12 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
class DrillingMailBodyFactory : BaseFactory
|
|
|
|
|
{
|
2022-05-04 15:02:12 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
public DrillingMailBodyFactory(IConfiguration configuration)
|
|
|
|
|
: base(configuration)
|
|
|
|
|
{
|
|
|
|
|
}
|
2022-05-04 15:02:12 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
public override string MakeSubject(WellDto well, string action)
|
|
|
|
|
{
|
|
|
|
|
var subj = $"{well.Deposit}, {well.Cluster}, {well.Caption}. Программа бурения. {action}";
|
|
|
|
|
return subj;
|
|
|
|
|
}
|
2022-05-04 15:02:12 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
public string MakeMailBodyForNewPublisher(WellDto well, string publisherName, string documentCategory)
|
|
|
|
|
{
|
|
|
|
|
var drillingProgramHref = MakeDrillingProgramHref(well);
|
2022-05-04 15:02:12 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
var body = $"<html><body><h2>Здравствуйте, {publisherName}.</h2>" +
|
|
|
|
|
$"На портале {platformName} началось создание программы бурения скважины {drillingProgramHref}," +
|
|
|
|
|
$" куст {well.Cluster}, месторождение {well.Deposit}." +
|
|
|
|
|
$"<br><br>От вас ожидается загрузка на портал документа «{documentCategory}» в формате excel (*.xlsx)." +
|
|
|
|
|
MakeSignatue() +
|
|
|
|
|
$"</body></html>";
|
|
|
|
|
return body;
|
|
|
|
|
}
|
2022-05-04 15:02:12 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
public string MakeMailBodyForApproverNewFile(WellDto well, string approverName, int idFile, string fileName)
|
|
|
|
|
{
|
|
|
|
|
var drillingProgramHref = MakeDrillingProgramHref(well);
|
2022-05-04 15:02:12 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
var body = $"<html><body><h2>Здравствуйте, {approverName}.</h2>" +
|
|
|
|
|
$"На портал {platformName} загружен документ {fileName}" +
|
|
|
|
|
$" для согласования при создании программы бурения скважины {drillingProgramHref}, куст ({well.Cluster})" +
|
|
|
|
|
$", месторождение ({well.Deposit}).<br>" +
|
|
|
|
|
MakeSignatue() +
|
|
|
|
|
$"</body></html>";
|
|
|
|
|
return body;
|
|
|
|
|
}
|
2022-05-04 15:02:12 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
public string MakeMailBodyForPublisherOnReject(WellDto well, string publisherName, int idFile, string fileName, FileMarkDto fileMark)
|
|
|
|
|
{
|
|
|
|
|
var drillingProgramHref = MakeDrillingProgramHref(well);
|
2022-05-04 15:02:12 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
var body = $"<html><body><h2>Здравствуйте, {publisherName}.</h2>" +
|
|
|
|
|
$"На портале {platformName} отклонен загруженный вами документ {fileName} " +
|
|
|
|
|
$" по программе бурения скважины {drillingProgramHref}," +
|
|
|
|
|
$" куст {well.Cluster}, месторождение {well.Deposit}." +
|
|
|
|
|
$" Комментарий согласующего ({fileMark.User?.Name} {fileMark.User?.Surname}):<br>{fileMark.Comment}" +
|
|
|
|
|
MakeSignatue() +
|
|
|
|
|
$"</body></html>";
|
|
|
|
|
return body;
|
|
|
|
|
}
|
2022-05-04 15:02:12 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
public string MakeMailBodyForPublisherOnFullAccept(WellDto well, string publisherName, int idFile, string fileName)
|
|
|
|
|
{
|
|
|
|
|
var drillingProgramHref = MakeDrillingProgramHref(well);
|
2022-05-04 15:02:12 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
var body = $"<html><body><h2>Здравствуйте, {publisherName}.</h2>" +
|
|
|
|
|
$"На портале {platformName} полностью согласован документ {fileName} " +
|
|
|
|
|
$" по программе бурения скважины {drillingProgramHref}," +
|
|
|
|
|
$" куст {well.Cluster}, месторождение {well.Deposit}." +
|
|
|
|
|
MakeSignatue() +
|
|
|
|
|
$"</body></html>";
|
|
|
|
|
return body;
|
2024-05-24 10:55:05 +05:00
|
|
|
|
}
|
2023-04-18 16:22:53 +05:00
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
|
private string MakeDrillingProgramHref(WellDto well)
|
|
|
|
|
{
|
|
|
|
|
var drillingProgramUrl = $"{platformUrl}/well/{well.Id}/drillingProgram";
|
|
|
|
|
var drillingProgramHref = MakeHref(drillingProgramUrl, well.Caption);
|
|
|
|
|
return drillingProgramHref;
|
|
|
|
|
}
|
2022-05-04 15:02:12 +05:00
|
|
|
|
}
|