迁移7项目签名邮件等等功能
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" />
|
||||
@@ -120,6 +121,11 @@
|
||||
<Compile Include="NPOIHelper.cs" />
|
||||
<Compile Include="PublicInfo\BaseInfo\Base_PIPClassService.cs" />
|
||||
<Compile Include="PublicInfo\BaseInfo\MaterialCoodeService.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" />
|
||||
|
||||
@@ -698,7 +698,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,215 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using Org.BouncyCastle.Bcpg.OpenPgp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Web;
|
||||
using System.Web.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.EnableSsl = false;
|
||||
//client.UseDefaultCredentials = true;
|
||||
////验证(Credentials 凭证)
|
||||
//client.Credentials = new System.Net.NetworkCredential(mailFrom, ps.EmailPass);
|
||||
|
||||
////处理待发的电子邮件的方法 (Delivery 发送,传输)
|
||||
//client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
|
||||
|
||||
System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
|
||||
try
|
||||
{
|
||||
mail.From = ps.EmailYx;
|
||||
mail.To = string.Join(",", mailTo);
|
||||
mail.Subject = mailSubject;
|
||||
mail.BodyFormat = System.Web.Mail.MailFormat.Html;
|
||||
mail.Body = mailBody;
|
||||
if (mailCC != null && mailCC.Length > 0)
|
||||
mail.Cc = string.Join(",", mailCC);
|
||||
|
||||
if (!string.IsNullOrEmpty(mailAttch))
|
||||
{
|
||||
string[] arr = mailAttch.Split(',');
|
||||
for (int i = 0; i < arr.Length; i++)
|
||||
{
|
||||
|
||||
mail.Attachments.Add(new System.Web.Mail.MailAttachment(@arr[i]));
|
||||
}
|
||||
}
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", ps.EmailYx);
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", ps.EmailPass);
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", ps.EmailDk);
|
||||
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true");
|
||||
System.Web.Mail.SmtpMail.SmtpServer = ps.EmailFwq;
|
||||
System.Web.Mail.SmtpMail.Send(mail);
|
||||
BLL.ErrLogInfo.WriteLog("开始发送邮件");
|
||||
//发送邮件
|
||||
//client.Send(email);
|
||||
BLL.ErrLogInfo.WriteLog("发送中...");
|
||||
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)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog(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.ErrorMsg = ex.Message;
|
||||
newSendEmail.CreateName = "sys";
|
||||
BLL.Email_Send.Email_SendLogService.AddEmail_SendLog(newSendEmail);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultMessage = ex.Message;
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
//及时释放占用的资源
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Email_Pop getEmailPop()
|
||||
{
|
||||
var pp = Funs.DB.Email_Pop.FirstOrDefault();
|
||||
|
||||
return pp;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,30 @@ namespace BLL
|
||||
|
||||
public static class Sys_UserService
|
||||
{
|
||||
public static (string, string) GetSingtrueImageUrl(string userId)
|
||||
{
|
||||
var result = (from a in Funs.DB.Sys_User
|
||||
join
|
||||
b in Funs.DB.Base_Unit on a.UnitId equals b.UnitId
|
||||
into bb
|
||||
from bu in bb.DefaultIfEmpty()
|
||||
join c in Funs.DB.Base_UnitType on bu.UnitTypeId equals c.UnitTypeId
|
||||
into dd
|
||||
from ss in dd.DefaultIfEmpty()
|
||||
where a.UserId == userId
|
||||
select new
|
||||
{
|
||||
a.SigntrueImage,
|
||||
ss.UnitTypeName
|
||||
}).FirstOrDefault();
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
return (result.SigntrueImage, result.UnitTypeName);
|
||||
}
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户登陆方法
|
||||
/// </summary>
|
||||
@@ -220,6 +244,7 @@ namespace BLL
|
||||
newUser.Email = user.Email;
|
||||
newUser.EmailPassword = user.EmailPassword;
|
||||
newUser.AllowLoginSystem = user.AllowLoginSystem;
|
||||
newUser.SigntrueImage = user.SigntrueImage;
|
||||
|
||||
db.Sys_User.InsertOnSubmit(newUser);
|
||||
db.SubmitChanges();
|
||||
@@ -243,6 +268,7 @@ namespace BLL
|
||||
newUser.RoleIds = user.RoleIds;
|
||||
newUser.IsPost = user.IsPost;
|
||||
newUser.Email = user.Email;
|
||||
newUser.SigntrueImage = user.SigntrueImage;
|
||||
if (!String.IsNullOrEmpty(user.EmailPassword))
|
||||
{
|
||||
newUser.EmailPassword = user.EmailPassword;
|
||||
|
||||
@@ -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,324 @@
|
||||
using Model;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
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 根据主键删除
|
||||
/// <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查询
|
||||
/// <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查询
|
||||
/// <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 根据模版ID获取发送人列表
|
||||
public static List<string> GetEmailByTemplateId(string templateId,string isCc)
|
||||
{
|
||||
var result = (from a in Funs.DB.Email_ToPeople
|
||||
join b in Funs.DB.Sys_User on a.EmuserID equals b.UserId
|
||||
where b.IsPost.Value && b.Email!=""
|
||||
&& a.EMPeopleType==isCc && a.EmtempID==templateId
|
||||
select b.Email
|
||||
).ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
#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
|
||||
}
|
||||
}
|
||||
@@ -117,5 +117,200 @@ namespace BLL
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
#region 资质分析
|
||||
public static bool IsOK(List<Model.Welder_WelderQualify> welderQualifys, string wmeCode, string location, string weldTypeGroup, string ste, decimal? dia, decimal? sch)
|
||||
{
|
||||
bool isok = false;
|
||||
foreach (var welderQualify in welderQualifys)
|
||||
{
|
||||
int okNum = 0;
|
||||
|
||||
if (!string.IsNullOrEmpty(wmeCode)) //焊接方法
|
||||
{
|
||||
if (wmeCode.Contains(welderQualify.WeldingMethodId))
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
|
||||
if (welderQualify.WeldingLocationId == "ALL") //焊接位置
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(location))
|
||||
{
|
||||
if (welderQualify.WeldingLocationId.Contains(location))
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(weldTypeGroup))
|
||||
{
|
||||
if (welderQualify.WeldType.Contains(weldTypeGroup))
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
|
||||
var steel = BLL.Base_MaterialService.GetMaterialByMaterialId(ste);
|
||||
if (steel != null) //钢材类型
|
||||
{
|
||||
if (welderQualify.MaterialType.Contains(steel.MaterialType ?? ""))
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
|
||||
if (weldTypeGroup != "2") // 承插焊
|
||||
{
|
||||
if (welderQualify.SizesMin == 0) // 0表示不限
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
else //最小寸径
|
||||
{
|
||||
if (dia != null)
|
||||
{
|
||||
if (dia >= welderQualify.SizesMin)
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
}
|
||||
|
||||
if (welderQualify.ThicknessMax == 0) // 0表示不限
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sch != null) //最大壁厚
|
||||
{
|
||||
if (sch <= welderQualify.ThicknessMax)
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
okNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // 当为角焊缝时,管径和壁厚不限制
|
||||
{
|
||||
okNum++;
|
||||
okNum++;
|
||||
}
|
||||
|
||||
|
||||
if (okNum == 6) //全部条件符合
|
||||
{
|
||||
isok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return isok;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 两种焊接方法的资质判断
|
||||
/// </summary>
|
||||
/// <param name="floorWelderQualifys"></param>
|
||||
/// <param name="cellWelderQualifys"></param>
|
||||
/// <param name="wmeCode1"></param>
|
||||
/// <param name="wmeCode2"></param>
|
||||
/// <param name="location"></param>
|
||||
/// <param name="ste"></param>
|
||||
/// <param name="dia"></param>
|
||||
/// <param name="sch"></param>
|
||||
/// <returns></returns>
|
||||
public static bool TwoWmeIsOK(List<Model.Welder_WelderQualify> floorWelderQualifys, List<Model.Welder_WelderQualify> cellWelderQualifys, string wmeCode1, string wmeCode2, string location, string weldTypeGroup, string ste, decimal? dia, decimal? sch)
|
||||
{
|
||||
bool isok = false;
|
||||
|
||||
decimal? fThicknessMax = 0;
|
||||
decimal? cThicknessMax = 0;
|
||||
|
||||
var steel = BLL.Base_MaterialService.GetMaterialByMaterialId(ste);
|
||||
var floorQ = from x in floorWelderQualifys
|
||||
where wmeCode1.Contains(x.WeldingMethodId)
|
||||
&& (x.WeldingLocationId == "ALL" || (location == null || location == "" || x.WeldingLocationId.Contains(location)))
|
||||
&& (steel == null || x.MaterialType.Contains(steel.MaterialType ?? ""))
|
||||
&& (weldTypeGroup == null || x.WeldType.Contains(weldTypeGroup))
|
||||
// && (dia == null || x.SizesMin<=dia)
|
||||
select x;
|
||||
var cellQ = from x in cellWelderQualifys
|
||||
where wmeCode2.Contains(x.WeldingMethodId)
|
||||
&& (x.WeldingLocationId == "ALL" || (location == null || location == "" || x.WeldingLocationId.Contains(location)))
|
||||
&& (steel == null || x.MaterialType.Contains(steel.MaterialType ?? ""))
|
||||
&& (weldTypeGroup == null || x.WeldType.Contains(weldTypeGroup))
|
||||
// && (dia == null || x.SizesMin <= dia)
|
||||
select x;
|
||||
if (floorQ.Count() > 0 && cellQ.Count() > 0)
|
||||
{
|
||||
if (weldTypeGroup != "2") // 当为角焊缝时,管径和壁厚不限制
|
||||
{
|
||||
var floorDiaQ = floorQ.Where(x => x.SizesMin <= dia);
|
||||
var cellDiaQ = cellQ.Where(x => x.SizesMin <= dia);
|
||||
|
||||
if (floorDiaQ.Count() > 0 && cellDiaQ.Count() > 0)
|
||||
{
|
||||
var fThick = floorDiaQ.Where(x => x.ThicknessMax == 0);
|
||||
var cThick = cellDiaQ.Where(x => x.ThicknessMax == 0);
|
||||
|
||||
// 只要有一个不限(为0)就通过
|
||||
if (fThick.Count() > 0 || cThick.Count() > 0)
|
||||
{
|
||||
isok = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fThicknessMax = floorQ.Max(x => x.ThicknessMax);
|
||||
cThicknessMax = cellQ.Max(x => x.ThicknessMax);
|
||||
|
||||
if ((fThicknessMax + cThicknessMax) >= sch)
|
||||
{
|
||||
isok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isok = true;
|
||||
}
|
||||
}
|
||||
|
||||
return isok;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user