forked from ddrilling/AsbCloudServer
97 lines
12 KiB
C#
97 lines
12 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
namespace AsbCloudInfrastructure
|
|||
|
{
|
|||
|
|
|||
|
abstract class BodyCreation
|
|||
|
{
|
|||
|
public int idWell { get; set; }
|
|||
|
public int idDocument { get; set; }
|
|||
|
public string mailSubject { get; set; } = "#fieldName, #clusterName, #wellName. Программа бурения. #action.";
|
|||
|
public string wellName { get; set; }
|
|||
|
public string clusterName { get; set; }
|
|||
|
public string fieldName { get; set; }
|
|||
|
public string documentCategory { get; set; }
|
|||
|
public string documentName { get; set; }
|
|||
|
public string coordinatingName { get; set; }
|
|||
|
public string coordinatingComment { get; set; }
|
|||
|
public string userName { get; set; }
|
|||
|
public static string logo { get; } = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQgAAAAtCAIAAADdgmKZAAABg2lDQ1BJQ0MgUHJvZmlsZQAAKM+VkUsoRFEcxn8zaIbIwiyExU1YUUKy1BApSmPUeCzce8cMNfea7h3ZWCrbKQuPjdfCxpqtha1SyqNkZ2dFbKTrf+6omdQop07n13fO93XOdyB4kDEtt7IbLDvnxEajWmJmVgs9EyJMNa0066abnZgaiVN2fNwSUOtNl8rif6MuueiaENCEB82skxNeEO5fy2UV7whHzCU9KXwq3OnIBYXvlW4U+EVx2uegyow48diQcERYS5ewUcLmkmMJ9wm3JS1b8oOJAicVryu2Mqvmzz3VC2sX7ekppctsYZQxJphEw2CVZTLk6JLVFsUlJvvRMv4m3z8pLkNcy5jiGGYFC933o/7gd7duqrenkFQbhaonz3trh9AWfOU97/PQ876OoOIRLuyif+UABt5Fzxe1tn2o34Czy6JmbMP5JjQ+ZHVH96UKmcFUCl5P5JtmoOEaauYKvf3sc3wHcelq/Ap296AjLdnzZd4dLu3tzzN+f0S/AWEIcqDaIFZ5AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAQzElEQVR4Xu2dCVhTxxbHw75vYRNQBFGUCi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ldPTorvAYaUB++d+6s8ONHDjK3k/4mpk6bTmtbVVUVeAUJd+6QD5j3sVhOdna2gawrlFUIIpcspW3HPn2eJqoWuzrYpmZk0T4fRu6yiqqL53+h5ZsYG48a9snMqZPh6OvXA3PluLZ3JopGD//U3Jxiy
|
|||
|
public static string bodySign { get; } = $"<br><br><br><br><font size=\"4\"><i><img src=\"{logo}\"/>" +
|
|||
|
$"{companyName}<br>Это письмо сформировано автоматически.<br>Для получения помощи по работе на портале " +
|
|||
|
$"{webPlatform} обращайтесь по адресу {supportMail}</i></body></html>";
|
|||
|
public static string webPlatform { get; } = "";
|
|||
|
public static string companyName { get; } = "ООО \"НафтаГаз\"";
|
|||
|
public static string supportMail { get; } = "support@autodrilling.ru";
|
|||
|
public abstract string GetBodyHTML();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
class MailUserPublisher : BodyCreation
|
|||
|
{
|
|||
|
public override string GetBodyHTML()
|
|||
|
{
|
|||
|
mailSubject = mailSubject.Replace("#fieldName", fieldName);
|
|||
|
mailSubject = mailSubject.Replace("#clusterName", clusterName);
|
|||
|
mailSubject = mailSubject.Replace("#wellName", fieldName);
|
|||
|
mailSubject = mailSubject.Replace("#action", "Добавление публикатора");
|
|||
|
return $"<html><body><br><strong><font size=\"5\">Здравствуйте, {userName}.<br></font></strong><br >< font size = \"5\">На портале " +
|
|||
|
$"{webPlatform} началось создание программы бурения скважины <a href=\"{webPlatform}/api/well/{idWell}\">{wellName}</a>, " +
|
|||
|
$"куст {clusterName}, месторождение {fieldName}." +
|
|||
|
$"<br><br>От вас ожидается загрузка на портал документа «{documentCategory}» в формате excel (*.xlsx)." + bodySign;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
class MailCoordinating : BodyCreation
|
|||
|
{
|
|||
|
public override string GetBodyHTML()
|
|||
|
{
|
|||
|
mailSubject = mailSubject.Replace("#fieldName", fieldName);
|
|||
|
mailSubject = mailSubject.Replace("#clusterName", clusterName);
|
|||
|
mailSubject = mailSubject.Replace("#wellName", fieldName);
|
|||
|
mailSubject = mailSubject.Replace("#action", "Документ на согласование");
|
|||
|
return $"<html><body><br><strong><font size=\"5\">Здравствуйте, {userName}.<br></font></strong><br><font size=\"5\">На портал " +
|
|||
|
$"{webPlatform} загружен документ <a href=\"{webPlatform}/api/well/{idWell}/files/{idDocument}\">" +
|
|||
|
$" для согласования при создании программы бурения скважины <a href=\"{ webPlatform}/api/well/{idWell}\">, куст ({clusterName})" +
|
|||
|
$", месторождение ({fieldName})." + bodySign;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
class PublisherRejected : BodyCreation
|
|||
|
{
|
|||
|
public override string GetBodyHTML()
|
|||
|
{
|
|||
|
mailSubject = mailSubject.Replace("#fieldName", fieldName);
|
|||
|
mailSubject = mailSubject.Replace("#clusterName", clusterName);
|
|||
|
mailSubject = mailSubject.Replace("#wellName", fieldName);
|
|||
|
mailSubject = mailSubject.Replace("#action", "Документ отклонен");
|
|||
|
return $"<html><body><br><strong><font size=\"5\">Здравствуйте, {userName}.<br></font></strong><br><font size=\"5\">На портале " +
|
|||
|
$"{webPlatform} отклонен загруженный вами документ <a href=\"{webPlatform}/api/well/{idWell}/files/{idDocument}\">" +
|
|||
|
$" по программе бурения скважины <a href=\"{ webPlatform}/api/well/{idWell}\">, куст " +
|
|||
|
$"({clusterName}), месторождение ({fieldName}). Комментарий согласующего " +
|
|||
|
$"({coordinatingName}):<br><br><i>{coordinatingComment}</i>" + bodySign;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
class AllApprovals : BodyCreation
|
|||
|
{
|
|||
|
public override string GetBodyHTML()
|
|||
|
{
|
|||
|
mailSubject = mailSubject.Replace("#fieldName", fieldName);
|
|||
|
mailSubject = mailSubject.Replace("#clusterName", clusterName);
|
|||
|
mailSubject = mailSubject.Replace("#wellName", fieldName);
|
|||
|
mailSubject = mailSubject.Replace("#action", "Все документы согласованы");
|
|||
|
return $"<html><body><br><strong><font size=\"5\">Здравствуйте, {userName}.<br></font></strong><br><font size=\"5\">На портале " +
|
|||
|
$"{webPlatform} полностью согласован документ " +
|
|||
|
$"<a href=\"{webPlatform}/api/well/{idWell}/files/{idDocument}\">{documentName}</a> " +
|
|||
|
$"по программе бурения скважины <a href=\"{ webPlatform}/api/well/{idWell}\">, куст ({clusterName}), " +
|
|||
|
$"месторождение ({fieldName}).<br>От вас ожидается загрузка на портал документа " +
|
|||
|
$"«{documentCategory}» в формате excel (*.xlsx)." + bodySign;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|