111
This commit is contained in:
@@ -98,6 +98,7 @@
|
||||
<Compile Include="APIService\APIMessagePushService.cs" />
|
||||
<Compile Include="Common\AttachFileService.cs" />
|
||||
<Compile Include="Common\BaseInfo\Base_ProjectTypeService.cs" />
|
||||
<Compile Include="Common\MailHelper.cs" />
|
||||
<Compile Include="Common\ProjectSet\Base_ProjectService.cs" />
|
||||
<Compile Include="Common\ProjectSet\Base_UnitService.cs" />
|
||||
<Compile Include="Common\ChartControlService.cs" />
|
||||
@@ -119,6 +120,11 @@
|
||||
<Compile Include="Common\Const.cs" />
|
||||
<Compile Include="NPOIHelper.cs" />
|
||||
<Compile Include="PublicInfo\BaseInfo\Base_PIPClassService.cs" />
|
||||
<Compile Include="SendEmail\Email_ParamsService.cs" />
|
||||
<Compile Include="SendEmail\Email_PopService.cs" />
|
||||
<Compile Include="SendEmail\Email_SendLogService.cs" />
|
||||
<Compile Include="SendEmail\Email_SendTemplateService.cs" />
|
||||
<Compile Include="SendEmail\Email_ToPeopleService.cs" />
|
||||
<Compile Include="WelderManage\WelderQualifiedService.cs" />
|
||||
<Compile Include="WelderManage\WelderService.cs" />
|
||||
<Compile Include="DropListService.cs" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -693,10 +693,38 @@ namespace BLL
|
||||
#endregion
|
||||
|
||||
|
||||
#region 邮箱发送
|
||||
/// <summary>
|
||||
/// 发送邮件
|
||||
/// </summary>
|
||||
public const string SendEmailMenuId = "97143EDB-6A32-4BBA-9F49-E33E87912BC8";
|
||||
|
||||
/// <summary>
|
||||
/// 邮件配置
|
||||
/// </summary>
|
||||
public const string SendEmailPopMenuId = "9E9DD8E3-D91B-4FD4-B922-2F5CC23D2745";
|
||||
|
||||
/// <summary>
|
||||
/// 邮件记录
|
||||
/// </summary>
|
||||
public const string SendEmailLogMenuId = "5941BE0C-C262-48C7-899F-F0BE5A779926";
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱模板设置
|
||||
/// </summary>
|
||||
public const string SendEmailTemplateListMenuId = "06EB7C08-6F6E-433B-91A7-579BFC435A0C";
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱参数设置
|
||||
/// </summary>
|
||||
public const string MailParametersMenuId = "F19A6438-C757-4BC2-ADC2-72AAF02089E5";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public const string CCType = "1";//抄送人
|
||||
|
||||
|
||||
public const string SenderType = "0";//发送人
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Mail;
|
||||
namespace FineUIPro.Web.common
|
||||
{
|
||||
public class MailHelper
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 私有构造方法,不允许创建实例
|
||||
/// </summary>
|
||||
private MailHelper()
|
||||
{
|
||||
// TODO: Add constructor logic here
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SendNetMail(须配置SMTP服务器地址)(多个收件人、抄送人、附件其参数用";"隔开,最后一个不能有";")
|
||||
/// </summary>
|
||||
/// <param name="mailFrom">发件人</param>
|
||||
/// <param name="mailTo">收件人(多个收件人用";"隔开,最后一个不能有";")</param>
|
||||
/// <param name="mailSubject">主题</param>
|
||||
/// <param name="mailBody">内容</param>
|
||||
/// <param name="mailAttch">附件(多个附件用";"隔开,最后一个不能有";")</param>
|
||||
/// <param name="mailCode">密码(对加密过的)</param>
|
||||
/// <param name="mailPriority">优先级</param>
|
||||
/// <param name="mailCC">抄送(多个抄送人用";"隔开,最后一个不能有";")</param>
|
||||
/// <param name="resultMessage">输出信息</param>
|
||||
public static bool SendNetMail(Email_Pop ps, string mailFrom, string[] mailTo, string mailSubject, string mailBody, string mailAttch, string mailCode, string mailPriority, string[] mailCC, out string resultMessage)
|
||||
{
|
||||
//初始化输出参数
|
||||
resultMessage = "";
|
||||
|
||||
//发件人和收件人不为空
|
||||
if (string.IsNullOrEmpty(ps.EmailYx) || mailTo == null)
|
||||
{
|
||||
resultMessage = "Please Fill Email Addresser Or Addressee . ";
|
||||
return false;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(ps.EmailYx))
|
||||
{
|
||||
mailFrom = ps.EmailYx;
|
||||
}
|
||||
|
||||
MailMessage email = new MailMessage();
|
||||
//MailAddress emailFrom = new MailAddress(mailFrom);
|
||||
|
||||
//发件人
|
||||
email.From = new MailAddress(mailFrom, ps.EmailYx);//发件人地址
|
||||
|
||||
//收件人
|
||||
if (mailTo != null && mailTo.Length > 0)
|
||||
{
|
||||
foreach (string send in mailTo)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(send))
|
||||
{
|
||||
email.To.Add(send);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//加抄送
|
||||
if (mailCC != null && mailCC.Length > 0)
|
||||
{
|
||||
|
||||
foreach (string cc in mailCC)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(cc))
|
||||
{
|
||||
email.CC.Add(cc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//主题
|
||||
email.Subject = mailSubject;
|
||||
//内容
|
||||
email.Body = mailBody;
|
||||
//附件
|
||||
if (!string.IsNullOrEmpty(mailAttch))
|
||||
{
|
||||
string[] attachments = mailAttch.Split(';');
|
||||
foreach (string file in attachments)
|
||||
{
|
||||
System.Net.Mail.Attachment attach = new System.Net.Mail.Attachment(file, System.Net.Mime.MediaTypeNames.Application.Octet);
|
||||
//为附件添加发送时间
|
||||
System.Net.Mime.ContentDisposition disposition = attach.ContentDisposition;
|
||||
disposition.CreationDate = System.IO.File.GetCreationTime(file);
|
||||
disposition.ModificationDate = System.IO.File.GetLastWriteTime(file);
|
||||
disposition.ReadDate = System.IO.File.GetLastAccessTime(file);
|
||||
//添加附件
|
||||
email.Attachments.Add(attach);
|
||||
}
|
||||
}
|
||||
//优先级
|
||||
email.Priority = (mailPriority == "High") ? System.Net.Mail.MailPriority.High : System.Net.Mail.MailPriority.Normal;
|
||||
//内容编码、格式
|
||||
email.BodyEncoding = System.Text.Encoding.UTF8;
|
||||
email.IsBodyHtml = true;
|
||||
//SMTP服务器
|
||||
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(ps.EmailFwq);
|
||||
|
||||
client.UseDefaultCredentials = true;
|
||||
//验证(Credentials 凭证)
|
||||
client.Credentials = new System.Net.NetworkCredential(mailFrom, ps.EmailPass);
|
||||
|
||||
//处理待发的电子邮件的方法 (Delivery 发送,传输)
|
||||
client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
//发送邮件
|
||||
client.Send(email);
|
||||
if (mailTo != null && mailTo.Length > 0)
|
||||
{
|
||||
foreach (string send in mailTo)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(send))
|
||||
{
|
||||
Email_SendLog newSendEmail = new Email_SendLog();
|
||||
newSendEmail.EmailId = Guid.NewGuid().ToString();
|
||||
newSendEmail.EmailTile = mailSubject;
|
||||
newSendEmail.EmailContent = mailBody;
|
||||
newSendEmail.EmailURL = send;
|
||||
newSendEmail.EmailName = send;
|
||||
newSendEmail.EmailStatus = "发送成功";
|
||||
newSendEmail.CreateTime = DateTime.Now;
|
||||
newSendEmail.CreateName = "sys";
|
||||
BLL.Email_Send.Email_SendLogService.AddEmail_SendLog(newSendEmail);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (mailTo != null && mailTo.Length > 0)
|
||||
{
|
||||
List<Email_SendLog> ss = new List<Email_SendLog>();
|
||||
foreach (string send in mailTo)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(send))
|
||||
{
|
||||
Email_SendLog newSendEmail = new Email_SendLog();
|
||||
newSendEmail.EmailId = Guid.NewGuid().ToString();
|
||||
newSendEmail.EmailTile = mailSubject;
|
||||
newSendEmail.EmailContent = mailBody;
|
||||
newSendEmail.EmailURL = send;
|
||||
newSendEmail.EmailName = send;
|
||||
newSendEmail.EmailStatus = "发送失败";
|
||||
newSendEmail.CreateTime = DateTime.Now;
|
||||
newSendEmail.CreateName = "sys";
|
||||
BLL.Email_Send.Email_SendLogService.AddEmail_SendLog(newSendEmail);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultMessage = ex.Message;
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
//及时释放占用的资源
|
||||
email.Attachments.Clear();
|
||||
email.Attachments.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Email_Pop getEmailPop(string EmailID)
|
||||
{
|
||||
Email_Pop pp = new Email_Pop();
|
||||
pp = BLL.Email_Send.Email_PopService.GetEmail_Pop(EmailID);
|
||||
|
||||
return pp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL.Email_Send
|
||||
{
|
||||
public static class Email_ParamsService
|
||||
{
|
||||
#region 根据主键查询信息
|
||||
/// <summary>
|
||||
/// 根据主键查询信息
|
||||
/// </summary>
|
||||
/// <param name="EmailID">主键</param>
|
||||
/// <returns>对象</returns>
|
||||
public static Email_Params GetEmail_ParamsPop(string EmailID)
|
||||
{
|
||||
return Funs.DB.Email_Params.FirstOrDefault(x => x.ID == EmailID);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 查询列表
|
||||
/// <summary>
|
||||
/// 查询列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Email_Params> GetEmail_ParamsList()
|
||||
{
|
||||
return (from x in Funs.DB.Email_Params orderby x.CreateTime descending select x).ToList();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 新增
|
||||
/// <summary>
|
||||
/// 新增
|
||||
/// </summary>
|
||||
/// <param name="email_Params"></param>
|
||||
public static void AddEmail_Params(Email_Params email_Params)
|
||||
{
|
||||
Email_Params newemail_Params = new Email_Params();
|
||||
newemail_Params.ID = Guid.NewGuid().ToString();
|
||||
newemail_Params.MailClassName = email_Params.MailClassName;
|
||||
newemail_Params.MailClassID = email_Params.MailClassID;
|
||||
newemail_Params.CreateName = email_Params.CreateName;
|
||||
newemail_Params.CreateTime = DateTime.Now;
|
||||
newemail_Params.UpdateName = email_Params.UpdateName;
|
||||
newemail_Params.UpdateTime = DateTime.Now;
|
||||
|
||||
Funs.DB.Email_Params.InsertOnSubmit(newemail_Params);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 修改
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="email_Params"></param>
|
||||
public static void UpdateEmail_Params(Email_Params email_Params)
|
||||
{
|
||||
Email_Params newemail_Params = Funs.DB.Email_Params.FirstOrDefault(x => x.ID == email_Params.ID);
|
||||
newemail_Params.MailClassName = email_Params.MailClassName;
|
||||
newemail_Params.MailClassID = email_Params.MailClassID;
|
||||
newemail_Params.UpdateName = email_Params.UpdateName;
|
||||
newemail_Params.UpdateTime = DateTime.Now;
|
||||
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="EmailId"></param>
|
||||
public static void DeleteEmail_ParamsById(string EmailId)
|
||||
{
|
||||
Email_Params newemail_Params = Funs.DB.Email_Params.FirstOrDefault(e => e.ID == EmailId);
|
||||
|
||||
Funs.DB.Email_Params.DeleteOnSubmit(newemail_Params);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL.Email_Send
|
||||
{
|
||||
public static class Email_PopService
|
||||
{
|
||||
#region 获取邮件设置
|
||||
/// <summary>
|
||||
/// 获取邮件设置
|
||||
/// </summary>
|
||||
/// <param name="EmailID">邮件设置Id</param>
|
||||
/// <returns></returns>
|
||||
public static Email_Pop GetEmail_Pop(string EmailID)
|
||||
{
|
||||
return Funs.DB.Email_Pop.FirstOrDefault(x => x.EmailID == EmailID);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 邮件管理
|
||||
/// <summary>
|
||||
/// 邮件设置
|
||||
/// </summary>
|
||||
/// <param name="eProject"></param>
|
||||
public static void AddEmail_Pop(Email_Pop email_Pop)
|
||||
{
|
||||
Email_Pop pf = Funs.DB.Email_Pop.FirstOrDefault(e => e.EmailID == email_Pop.EmailID);
|
||||
if (pf == null)
|
||||
{
|
||||
pf = new Email_Pop();
|
||||
pf.EmailID = email_Pop.EmailID;
|
||||
pf.EmailFwq = email_Pop.EmailFwq;
|
||||
pf.EmailDk = email_Pop.EmailDk;
|
||||
pf.EmailUsername = email_Pop.EmailUsername;
|
||||
pf.EmailPass = email_Pop.EmailPass;
|
||||
pf.CreateTime = email_Pop.CreateTime;
|
||||
pf.CreateName = email_Pop.CreateName;
|
||||
pf.EmailYx = email_Pop.EmailYx;
|
||||
|
||||
Funs.DB.Email_Pop.InsertOnSubmit(pf);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 修改
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="email_Params"></param>
|
||||
public static void UpdateEmail_Pop(Email_Pop email_Pop)
|
||||
{
|
||||
Email_Pop pf = Funs.DB.Email_Pop.FirstOrDefault(e => e.EmailID == email_Pop.EmailID);
|
||||
|
||||
pf.EmailID = email_Pop.EmailID;
|
||||
pf.EmailFwq = email_Pop.EmailFwq;
|
||||
pf.EmailDk = email_Pop.EmailDk;
|
||||
pf.EmailUsername = email_Pop.EmailUsername;
|
||||
pf.EmailPass = email_Pop.EmailPass;
|
||||
pf.CreateTime = email_Pop.CreateTime;
|
||||
pf.CreateName = email_Pop.CreateName;
|
||||
pf.EmailYx = email_Pop.EmailYx;
|
||||
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL.Email_Send
|
||||
{
|
||||
public static class Email_SendLogService
|
||||
{
|
||||
#region 邮件管理
|
||||
/// <summary>
|
||||
/// 邮件增加
|
||||
/// </summary>
|
||||
/// <param name="eProject"></param>
|
||||
public static void AddEmail_SendLog(Email_SendLog email_SendLog)
|
||||
{
|
||||
Email_SendLog newEmail_SendLog = new Email_SendLog();
|
||||
newEmail_SendLog.EmailId = Guid.NewGuid().ToString();
|
||||
newEmail_SendLog.EmailTile = email_SendLog.EmailTile;
|
||||
newEmail_SendLog.EmailContent = email_SendLog.EmailContent;
|
||||
newEmail_SendLog.EmailURL = email_SendLog.EmailURL;
|
||||
newEmail_SendLog.EmailName = email_SendLog.EmailName;
|
||||
newEmail_SendLog.EmailStatus = email_SendLog.EmailStatus;
|
||||
newEmail_SendLog.CreateTime = email_SendLog.CreateTime;
|
||||
newEmail_SendLog.CreateName = email_SendLog.CreateName;
|
||||
|
||||
Funs.DB.Email_SendLog.InsertOnSubmit(newEmail_SendLog);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Email_SendLog> GetEmail_SendLogList()
|
||||
{
|
||||
return (from x in Funs.DB.Email_SendLog orderby x.CreateTime descending select x).ToList();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据主键查询信息
|
||||
/// <summary>
|
||||
/// 根据主键查询信息
|
||||
/// </summary>
|
||||
/// <param name="EmailID">主键</param>
|
||||
/// <returns>对象</returns>
|
||||
public static Email_SendLog GetEmail_SendLog(string EmailID)
|
||||
{
|
||||
return Funs.DB.Email_SendLog.FirstOrDefault(x => x.EmailId == EmailID);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL.Email_Send
|
||||
{
|
||||
public static class Email_SendTemplateService
|
||||
{
|
||||
#region 邮件模板添加
|
||||
/// <summary>
|
||||
/// 邮件模板添加
|
||||
/// </summary>
|
||||
/// <param name="eProject"></param>
|
||||
public static void AddSendEmail(Model.Email_SendTemplate Email_SendTemplate)
|
||||
{
|
||||
Model.Email_SendTemplate newsendTemplate = new Model.Email_SendTemplate();
|
||||
newsendTemplate.EmailId = Guid.NewGuid().ToString();
|
||||
newsendTemplate.EmailParamsID = Email_SendTemplate.EmailParamsID;
|
||||
newsendTemplate.EailTiaoJian = Email_SendTemplate.EailTiaoJian;
|
||||
newsendTemplate.EmailUserYN = Email_SendTemplate.EmailUserYN;
|
||||
newsendTemplate.EmailTitle = Email_SendTemplate.EmailTitle;
|
||||
newsendTemplate.EmailContext = Email_SendTemplate.EmailContext;
|
||||
newsendTemplate.CreateName = Email_SendTemplate.CreateName;
|
||||
newsendTemplate.CreateTime = Email_SendTemplate.CreateTime;
|
||||
newsendTemplate.UpdateName = Email_SendTemplate.UpdateName;
|
||||
newsendTemplate.UpdateTime = Email_SendTemplate.UpdateTime;
|
||||
newsendTemplate.EmailDesc = Email_SendTemplate.EmailDesc;
|
||||
|
||||
|
||||
Funs.DB.Email_SendTemplate.InsertOnSubmit(newsendTemplate);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 邮件模板修改
|
||||
/// <summary>
|
||||
/// 邮件模板修改
|
||||
/// </summary>
|
||||
/// <param name="Email_SendTemplate"></param>
|
||||
public static void UpdateEmail_SendTemplate(Model.Email_SendTemplate Email_SendTemplate)
|
||||
{
|
||||
Model.Email_SendTemplate newsendTemplate = Funs.DB.Email_SendTemplate.FirstOrDefault(x => x.EmailId == Email_SendTemplate.EmailId);
|
||||
newsendTemplate.EmailParamsID = Email_SendTemplate.EmailParamsID;
|
||||
newsendTemplate.EailTiaoJian = Email_SendTemplate.EailTiaoJian;
|
||||
newsendTemplate.EmailUserYN = Email_SendTemplate.EmailUserYN;
|
||||
newsendTemplate.EmailTitle = Email_SendTemplate.EmailTitle;
|
||||
newsendTemplate.EmailContext = Email_SendTemplate.EmailContext;
|
||||
newsendTemplate.UpdateName = Email_SendTemplate.UpdateName;
|
||||
newsendTemplate.UpdateTime = Email_SendTemplate.UpdateTime;
|
||||
newsendTemplate.EmailDesc = Email_SendTemplate.EmailDesc;
|
||||
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据主键获取邮件设置
|
||||
/// <summary>
|
||||
/// 根据主键获取邮件设置
|
||||
/// </summary>
|
||||
/// <param name="EmailID">邮件设置Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.Email_SendTemplate GetEmail_SendTemplate(string EmailID)
|
||||
{
|
||||
return Funs.DB.Email_SendTemplate.FirstOrDefault(x => x.EmailId == EmailID);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取邮件模板列表
|
||||
/// <summary>
|
||||
/// 获取邮件模板列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Email_SendTemplate> GetEmail_SendTemplateList()
|
||||
{
|
||||
return (from x in Funs.DB.Email_SendTemplate orderby x.CreateTime descending select x).ToList();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据主键删除EProject
|
||||
/// <summary>
|
||||
/// 根据主键删除EProject
|
||||
/// </summary>
|
||||
/// <param name="EmailId"></param>
|
||||
public static void DeleteEproejctById(string EmailId)
|
||||
{
|
||||
Model.Email_SendTemplate Email_SendTemplate = Funs.DB.Email_SendTemplate.FirstOrDefault(e => e.EmailId == EmailId);
|
||||
if (Email_SendTemplate != null)
|
||||
{
|
||||
Funs.DB.Email_SendTemplate.DeleteOnSubmit(Email_SendTemplate);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据EmailNotifier查询EProject
|
||||
/// <summary>
|
||||
/// 根据EmailNotifier查询EProject
|
||||
/// </summary>
|
||||
/// <param name="EmailId"></param>
|
||||
public static List<Email_SendTemplate> GetEmailNotifierList(string EmailNotifier)
|
||||
{
|
||||
return (from x in Funs.DB.Email_SendTemplate orderby x.CreateTime descending select x).Where(o => o.EmailParamsID == EmailNotifier).ToList();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据EmailNotifier查询EProject
|
||||
/// <summary>
|
||||
/// 根据EmailNotifier查询EProject
|
||||
/// </summary>
|
||||
/// <param name="EmailId"></param>
|
||||
public static Email_SendTemplate GetEmailNotifier(string EmailNotifier)
|
||||
{
|
||||
return Funs.DB.Email_SendTemplate.FirstOrDefault(x => x.EmailParamsID == EmailNotifier);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 事务提交 新增
|
||||
/// <summary>
|
||||
/// 事物提交
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="PlanDetailList"></param>
|
||||
/// <param name="ManHoursPlanList"></param>
|
||||
/// <returns></returns>
|
||||
public static bool Add(Model.Email_SendTemplate Email_SendTemplate, List<Model.Email_ToPeople> peopleList)
|
||||
{
|
||||
bool result = true;
|
||||
if (Email_SendTemplate == null)
|
||||
return false;
|
||||
Funs.DB.Connection.Close();
|
||||
Funs.DB.Connection.Open();
|
||||
Funs.DB.CommandTimeout = 30000;
|
||||
using (DbTransaction tran = Funs.DB.Connection.BeginTransaction())
|
||||
{
|
||||
Funs.DB.Transaction = tran;
|
||||
try
|
||||
{
|
||||
Model.Email_SendTemplate newsendTemplate = new Email_SendTemplate();
|
||||
newsendTemplate.EmailId = Email_SendTemplate.EmailId;
|
||||
newsendTemplate.EmailParamsID = Email_SendTemplate.EmailParamsID;
|
||||
newsendTemplate.EailTiaoJian = Email_SendTemplate.EailTiaoJian;
|
||||
newsendTemplate.EmailUserYN = Email_SendTemplate.EmailUserYN;
|
||||
newsendTemplate.EmailTitle = Email_SendTemplate.EmailTitle;
|
||||
newsendTemplate.EmailContext = Email_SendTemplate.EmailContext;
|
||||
newsendTemplate.CreateName = Email_SendTemplate.CreateName;
|
||||
newsendTemplate.CreateTime = Email_SendTemplate.CreateTime;
|
||||
newsendTemplate.UpdateName = Email_SendTemplate.UpdateName;
|
||||
newsendTemplate.UpdateTime = Email_SendTemplate.UpdateTime;
|
||||
newsendTemplate.EmailDesc = Email_SendTemplate.EmailDesc;
|
||||
|
||||
Funs.DB.Email_SendTemplate.InsertOnSubmit(newsendTemplate);
|
||||
|
||||
if (newsendTemplate != null)
|
||||
{
|
||||
var list = (from x in Funs.DB.Email_ToPeople where x.EmtempID == newsendTemplate.EmailId select x).ToList();
|
||||
if (list != null || list.Count > 0)
|
||||
{
|
||||
Funs.DB.Email_ToPeople.DeleteAllOnSubmit(list);
|
||||
}
|
||||
}
|
||||
if (peopleList != null)
|
||||
{
|
||||
Funs.DB.Email_ToPeople.InsertAllOnSubmit(peopleList);
|
||||
}
|
||||
|
||||
Funs.DB.SubmitChanges();
|
||||
|
||||
tran.Commit();
|
||||
result = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
tran.Rollback();//回滚事务
|
||||
// db.Connection.Close();
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
Funs.DB.Connection.Close();
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 事务提交 修改
|
||||
/// <summary>
|
||||
/// 事物提交
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="PlanDetailList"></param>
|
||||
/// <param name="ManHoursPlanList"></param>
|
||||
/// <returns></returns>
|
||||
public static bool Update(Model.Email_SendTemplate Email_SendTemplate, List<Model.Email_ToPeople> peopleList)
|
||||
{
|
||||
bool result = true;
|
||||
if (Email_SendTemplate == null)
|
||||
return false;
|
||||
Funs.DB.Connection.Close();
|
||||
Funs.DB.Connection.Open();
|
||||
Funs.DB.CommandTimeout = 30000;
|
||||
using (DbTransaction tran = Funs.DB.Connection.BeginTransaction())
|
||||
{
|
||||
Funs.DB.Transaction = tran;
|
||||
try
|
||||
{
|
||||
Model.Email_SendTemplate newsendTemplate = Funs.DB.Email_SendTemplate.FirstOrDefault(x => x.EmailId == Email_SendTemplate.EmailId);
|
||||
|
||||
newsendTemplate.EmailParamsID = Email_SendTemplate.EmailParamsID;
|
||||
newsendTemplate.EailTiaoJian = Email_SendTemplate.EailTiaoJian;
|
||||
newsendTemplate.EmailUserYN = Email_SendTemplate.EmailUserYN;
|
||||
newsendTemplate.EmailTitle = Email_SendTemplate.EmailTitle;
|
||||
newsendTemplate.EmailContext = Email_SendTemplate.EmailContext;
|
||||
newsendTemplate.CreateName = Email_SendTemplate.CreateName;
|
||||
newsendTemplate.CreateTime = Email_SendTemplate.CreateTime;
|
||||
newsendTemplate.UpdateName = Email_SendTemplate.UpdateName;
|
||||
newsendTemplate.UpdateTime = Email_SendTemplate.UpdateTime;
|
||||
newsendTemplate.EmailDesc = Email_SendTemplate.EmailDesc;
|
||||
|
||||
if (newsendTemplate != null)
|
||||
{
|
||||
// var list = (from x in Funs.DB.Em_toPeople where x.EmuserID == newsendTemplate.EmailId select x).ToList();
|
||||
var list = (from x in Funs.DB.Email_ToPeople where x.EmtempID == newsendTemplate.EmailId select x).ToList();
|
||||
if (list == null || list.Count == 0)
|
||||
{ }
|
||||
else
|
||||
{
|
||||
Funs.DB.Email_ToPeople.DeleteAllOnSubmit(list);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
if (peopleList != null)
|
||||
{
|
||||
Funs.DB.Email_ToPeople.InsertAllOnSubmit(peopleList);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
Funs.DB.SubmitChanges();
|
||||
tran.Commit();
|
||||
result = true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
string ss = e.Message;
|
||||
tran.Rollback();//回滚事务
|
||||
// db.Connection.Close();
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
Funs.DB.Connection.Close();
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 事务提交 删除
|
||||
/// <summary>
|
||||
/// 事物提交
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="PlanDetailList"></param>
|
||||
/// <param name="ManHoursPlanList"></param>
|
||||
/// <returns></returns>
|
||||
public static bool Delete(string EmailId)
|
||||
{
|
||||
bool result = true;
|
||||
if (EmailId == null)
|
||||
return false;
|
||||
Funs.DB.Connection.Close();
|
||||
Funs.DB.Connection.Open();
|
||||
Funs.DB.CommandTimeout = 30000;
|
||||
using (DbTransaction tran = Funs.DB.Connection.BeginTransaction())
|
||||
{
|
||||
Funs.DB.Transaction = tran;
|
||||
try
|
||||
{
|
||||
Model.Email_SendTemplate newsendTemplate = Funs.DB.Email_SendTemplate.FirstOrDefault(x => x.EmailId == EmailId);
|
||||
Funs.DB.Email_SendTemplate.DeleteOnSubmit(newsendTemplate);
|
||||
Funs.DB.SubmitChanges();
|
||||
|
||||
if (newsendTemplate != null)
|
||||
{
|
||||
// var list = (from x in Funs.DB.Em_toPeople where x.EmuserID == newsendTemplate.EmailId select x).ToList();
|
||||
var list = (from x in Funs.DB.Email_ToPeople where x.EmtempID == EmailId select x).ToList();
|
||||
if (list == null || list.Count == 0)
|
||||
{ }
|
||||
else {
|
||||
Funs.DB.Email_ToPeople.DeleteAllOnSubmit(list);
|
||||
}
|
||||
}
|
||||
Funs.DB.SubmitChanges();
|
||||
tran.Commit();
|
||||
result = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
tran.Rollback();//回滚事务
|
||||
// db.Connection.Close();
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
Funs.DB.Connection.Close();
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL.Email_Send
|
||||
{
|
||||
public static class Email_ToPeopleService
|
||||
{
|
||||
#region 根据EmtempID查询Em_toPeople
|
||||
/// <summary>
|
||||
/// 获取抄送人信息
|
||||
/// </summary>
|
||||
/// <param name="EmtempID">邮件主键</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Email_ToPeople> GetCCTopeopleList(string EmtempID)
|
||||
{
|
||||
return (from x in Funs.DB.Email_ToPeople select x).Where(o => o.EmtempID == EmtempID && o.EMPeopleType == Const.CCType).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取发送人信息
|
||||
/// </summary>
|
||||
/// <param name="EmtempID">邮件主键</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Email_ToPeople> GetSenderTopeopleList(string EmtempID)
|
||||
{
|
||||
return (from x in Funs.DB.Email_ToPeople select x).Where(o => o.EmtempID == EmtempID && o.EMPeopleType == Const.SenderType).ToList();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user