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/AWEIcqDaIFZ5AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAQzElEQVR4Xu2dCVhTxxbHw75vYRNQBFGUCiioqFXr0ta1tpYnqCiWKqLUXUStPq3WHRR3qpWq9bnhbt33LoriA7RaFWTzCYJsIS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WeheV9RzOGAdPfoZ8PMH+iwMLynqIZwwB0tKRHDx+ihcNZWN5TNGYYwKOkxN9+vU0LaLCwvI9o0jCA9Wu/z8ujv0XDwvLeocowiJ04hUAhVqJib2sTE72xRiLBeu8aaAI7X7FoAMXh2np09JT1fkAiFqv4qYdUS0db+X8h8Pchra3V5uCb3iwsLUG5YbCw/B+j4TUGC0vrgDUMFhYFsIbBwqIA1jBYWBTAGgYLCwMO57/Mhkjdhw6YDwAAAABJRU5ErkJggg==";
|
||
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;
|
||
}
|
||
}
|
||
}
|
||
|