/// <summary> /// 当财务总监审核通过后,发送邮件 /// </summary> /// <param name="inn"></param> /// <param name="proposer"></param> /// <param name="recordNo"></param> public static void SendEmailToProposer(Innovator inn, string proposer, string recordNo) { //邮箱列表 List <string> listEmail = new List <string>(); List <string> names = new List <string>(); string subject = ""; string body = ""; //获取申请人邮箱 Item applicantIdentity = IdentityDA.GetIdentityByKeyedName(inn, proposer); if (!applicantIdentity.isError()) { UserDA.GetEmailByIdentitys(inn, applicantIdentity, listEmail, names); } subject = "Your expense reimbursement application <" + recordNo + "> has been approved by financial analyst, Please hand in your application and receipts to finance department."; body = "您单号为< " + recordNo + " >的费用报销单已通过财务分析员审核,请将报销单打印并附上报销凭证,交到财务部门进行费用审核。<br/>"; body += "Your expense reimbursement application < " + recordNo + " > has been approved by financial analyst, Please hand in your application and receipts to finance department."; listEmail = new List <string>(); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); //listEmail.Add("*****@*****.**"); //异步执行 new Task(() => { MailOperator.SendMail(listEmail, subject, body); }).Start(); }
/// <summary> /// 管理员重发凭证邮件 /// </summary> /// <param name="inn"></param> /// <param name="b_Employee"></param> /// <param name="recordNo"></param> public static void ExpenseAccountantCheckSendEmail(Innovator inn, string b_Employee, string recordNo) { //邮箱列表 List <string> listEmail = new List <string>(); List <string> names = new List <string>(); string subject = ""; string body = ""; //获取申请人邮箱 Item applicantIdentity = IdentityDA.GetIdentityByKeyedName(inn, b_Employee); if (!applicantIdentity.isError()) { UserDA.GetEmailByIdentitys(inn, applicantIdentity, listEmail, names); } subject = "您单号为[" + recordNo + "]的费用报销单已通过财务分析员审核,请将报销单打印并附上报销凭证,交到财务部门进行费用审核。——如已打印并交到财务部,请忽略此邮件。"; body = "您单号为[" + recordNo + "]的费用报销单已通过财务分析员审核,请将报销单打印并附上报销凭证,交到财务部门进行费用审核。——如已打印并交到财务部,请忽略此邮件。<br/>"; body += "打印方式:进入 https://oa.bordrin.com ,打开菜单 报销管理->查询费用报销,找到对应申请单,单击单号后面的打印按钮打印申请单。"; listEmail = new List <string>(); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); listEmail.Add("Kai.Feng @bordrin.com"); //异步执行 new Task(() => { MailOperator.SendMail(listEmail, subject, body); }).Start(); }
/// <summary> /// 委托代理发送邮件 /// </summary> /// <param name="inn"></param> /// <param name="b_DelegateName">委托人</param> /// <param name="b_AgentName">代理人</param> /// <param name="StartDate">生效时间</param> /// <param name="EndDate">终止时间</param> /// <param name="b_AgentContent"></param> public static void SendAgentEmail(Innovator inn, string b_DelegateName, string b_AgentName, DateTime StartDate, DateTime EndDate, string b_AgentContent) { List <string> listEmail = new List <string>(); USER user = UserDA.GetUserByFirstName(b_AgentName); string emailAddress = ""; if (user != null) { emailAddress = user.EMAIL; listEmail.Add(emailAddress); } if (!string.IsNullOrEmpty(emailAddress)) { string subject = "OA代理设置通知:" + b_DelegateName + "设置您为" + StartDate.ToString("yyyy-MM-dd hh:mm:ss") + "至" + EndDate.ToString("yyyy-MM-dd hh:mm:ss") + "这段期间内的职务代理人。【OA system notification】" + b_DelegateName + " sets up the OA approval agent for the period from " + StartDate.ToString("yyyy-MM-dd hh:mm:ss") + " to " + EndDate.ToString("yyyy-MM-dd hh:mm:ss"); string body = "Dear " + b_AgentName + ",<br/><br/>"; body += "" + b_DelegateName + "设置您为" + StartDate.ToString("yyyy-MM-dd hh:mm:ss") + "至" + EndDate.ToString("yyyy-MM-dd hh:mm:ss") + "这段期间内的职务代理人。<br/>"; body += "代理模块: " + b_AgentContent + "<br/>"; body += "" + b_DelegateName + " sets up the OA approval agent for the period from " + StartDate.ToString("yyyy-MM-dd hh:mm:ss") + " to " + EndDate.ToString("yyyy-MM-dd hh:mm:ss") + "<br/>"; listEmail = new List <string>(); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); new Task(() => { MailOperator.SendMail(listEmail, subject, body); }).Start(); } }
/// <summary> /// 加签发送邮件 /// </summary> /// <param name="addSignUserName"></param> /// <param name="todoUserName"></param> /// <param name="recordNo"></param> /// <param name="linkStr"></param> /// <param name="listEmail"></param> public static void WorkflowActivitySignSendEmail(string addSignUserName, string todoUserName, string recordNo, string linkStr, List <string> listEmail) { string subject = addSignUserName + " has added a request[" + recordNo + "] for your approval."; string body = "Dear " + todoUserName + ",<br/><br/>"; body += addSignUserName + " has added a request[" + recordNo + "] for your approval.<br/>"; body += "Doc link: " + ConfigurationManager.AppSettings["OASite"] + linkStr; listEmail = new List <string>(); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); //listEmail.Add("*****@*****.**"); new Task(() => { MailOperator.SendMail(listEmail, subject, body); }).Start(); }
/// <summary> /// 转办发送邮件 /// </summary> /// <param name="trunUserName"></param> /// <param name="todoUserName"></param> /// <param name="recordNo"></param> public static void TurnToDoSendEmail(string trunUserName, string todoUserName, string recordNo, string linkStr, string emailAddress) { string subject = "The form No.< " + recordNo + " > has been transferred to you by <" + trunUserName + "> for your approval."; string body = "Dear " + todoUserName + ",<br/><br/>"; body += "The form No. < " + recordNo + " > has been transferred to you by <" + trunUserName + "> for your approval.<br/>"; body += "Doc link: " + ConfigurationManager.AppSettings["OASite"] + linkStr; List <string> listEmail = new List <string>(); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); //listEmail.Add("*****@*****.**"); new Task(() => { MailOperator.SendMail(listEmail, subject, body); }).Start(); }
/// <summary> /// 发送邮件 /// </summary> /// <param name="inn"></param> /// <param name="emailEntity"></param> public static void SendEmailByOperation(Innovator inn, EmailEntity emailEntity, WORKFLOW_PROCESS_PATH choicePath) { //邮箱列表 List <string> listEmail = new List <string>(); List <string> names = new List <string>(); string nameStr = ""; string subject = ""; string body = ""; Item activity = ActivityDA.GetActivityById(inn, choicePath.RELATED_ID); string keyedName = activity.getProperty("keyed_name").Trim(); //获取邮件需要发送的人员信息 Item identitys = IdentityDA.GetIdentityByActivityId(inn, choicePath.RELATED_ID); //获取邮箱信息 UserDA.GetEmailByIdentitys(inn, identitys, listEmail, names); if (names != null && names.Count > 0) { for (int i = 0; i < names.Count; i++) { if (i != names.Count - 1) { nameStr += names[i] + "、"; } else { nameStr += names[i]; } } } if (choicePath.NAME.Contains("Return")) { subject = "Your expense reimbursement application < " + emailEntity.RecordNo + " > has been rejected."; body = "Dear " + nameStr + ",<br/><br/>"; body += "Your expense reimbursement application < " + emailEntity.RecordNo + " > has been rejected.<br/>"; body += "Doc link: " + ConfigurationManager.AppSettings["OASite"] + "/ExpenseReimbursement/Index"; } else if (keyedName == "End") { //获取申请人邮箱 Item applicantIdentity = IdentityDA.GetIdentityByKeyedName(inn, emailEntity.ApplicantName); if (!applicantIdentity.isError()) { UserDA.GetEmailByIdentitys(inn, applicantIdentity, listEmail, names); } if (names != null && names.Count > 0) { for (int i = 0; i < names.Count; i++) { if (i != names.Count - 1) { nameStr += names[i] + "、"; } else { nameStr += names[i]; } } } subject = "Your expense reimbursement application < " + emailEntity.RecordNo + " > has been approved."; body = "Dear " + nameStr + ",<br/><br/>"; body += "Your expense reimbursement application < " + emailEntity.RecordNo + " > has been approved.<br/>"; body += "Doc link: " + ConfigurationManager.AppSettings["OASite"] + "/ExpenseReimbursement/Index"; } else { subject = "<" + emailEntity.ApplicantDepartment + "> " + emailEntity.ApplicantName + " has submitted an expense reimbursement application < " + emailEntity.RecordNo + " > for your approval."; body += "Dear " + nameStr + ",<br/><br/>"; body += "<" + emailEntity.ApplicantDepartment + "> " + emailEntity.ApplicantName + " has submitted an expense reimbursement application < " + emailEntity.RecordNo + " > for your approval.<br/>"; body += "Doc link: " + ConfigurationManager.AppSettings["OASite"] + "/ExpenseReimbursement/Index"; } listEmail = new List <string>(); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); //listEmail.Add("*****@*****.**"); //异步执行 new Task(() => { MailOperator.SendMail(listEmail, subject, body); }).Start(); }
/// <summary> /// 单据状态 /// </summary> /// <param name="status"></param> public static void SendEmailByOperation(Innovator inn, string b_prRecordNo, string b_Applicant, string b_Buyer, WORKFLOW_PROCESS_PATH choicePath, string itemId = "") { //邮箱列表 List <string> listEmail = new List <string>(); List <string> names = new List <string>(); string nameStr = ""; string subject = ""; string body = ""; Item activity = ActivityDA.GetActivityById(inn, choicePath.RELATED_ID); string keyedName = activity.getProperty("keyed_name").Trim(); //获取邮件需要发送的人员信息 Item identitys = IdentityDA.GetIdentityByActivityId(inn, choicePath.RELATED_ID); //获取邮箱信息 UserDA.GetEmailByIdentitys(inn, identitys, listEmail, names); if (choicePath.NAME.Contains("Return")) { SendReturnFinancialAnalystMail(inn, keyedName, choicePath, listEmail, itemId); } if (names != null && names.Count > 0) { for (int i = 0; i < names.Count; i++) { if (i != names.Count - 1) { nameStr += names[i] + "、"; } else { nameStr += names[i]; } } } if (choicePath.NAME.Contains("Return")) { subject = "Your purchase request [" + b_prRecordNo + "] has been rejected."; body = "Dear " + nameStr + ",<br/><br/>"; body += "Your purchase request [" + b_prRecordNo + "] has been rejected.<br/>"; body += "Doc link: " + ConfigurationManager.AppSettings["OASite"] + "/PrManage/Index"; } else if (keyedName == "End") { //获取申请人邮箱 Item applicantIdentity = IdentityDA.GetIdentityByKeyedName(inn, b_Applicant); if (!applicantIdentity.isError()) { UserDA.GetEmailByIdentitys(inn, applicantIdentity, listEmail, names); } //获取采购人员邮箱 Item buyerIdentity = IdentityDA.GetIdentityByKeyedName(inn, b_Buyer); if (!buyerIdentity.isError()) { UserDA.GetEmailByIdentitys(inn, buyerIdentity, listEmail, names); } if (names != null && names.Count > 0) { for (int i = 0; i < names.Count; i++) { if (i != names.Count - 1) { nameStr += names[i] + "、"; } else { nameStr += names[i]; } } } subject = "Your purchase request [" + b_prRecordNo + "] has been approved."; body = "Dear " + nameStr + ",<br/><br/>"; body += " Your purchase request [" + b_prRecordNo + "] has been approved.<br/>"; body += "Doc link: " + ConfigurationManager.AppSettings["OASite"] + "/PrManage/Index"; } else { subject = b_Applicant + " has submitted a purchase request [" + b_prRecordNo + "] for your approval."; body += "Dear " + nameStr + ",<br/><br/>"; body += b_Applicant + " has submitted a purchase request [" + b_prRecordNo + "]" + " for your approval.<br/>"; body += "Doc link: " + ConfigurationManager.AppSettings["OASite"] + "/PrManage/Index"; } listEmail = new List <string>(); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); //listEmail.Add("*****@*****.**"); //异步执行 new Task(() => { MailOperator.SendMail(listEmail, subject, body); }).Start(); }