public override void Run(Hashtable parameters) { POBLL poBLL = new POBLL(); ContractManagementBLL contractManagementBLL = new ContractManagementBLL(); List <CasUserEntity> listUsers = poBLL.GetAllHaveApplyPOUsers(); foreach (CasUserEntity user in listUsers) { List <CasContractFilingEntity> listAllApplyPO = poBLL.GetAllApplyPOs(user.UserId); //邮件标题 string mailTitle = $@"您有{listAllApplyPO.Count}条PO未审批({DateTime.Now.ToString("yyyy年MM月dd日")})"; string mailContent = $@"Dear {user.ChineseName},<br/>您的未审批PO清单如下:<br/><table style='font-family:verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #666666;border-collapse:collapse;'><thead><tr><th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>合同名称</th><th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>PR号</th></tr></thead><tbody>"; foreach (CasContractFilingEntity applyPO in listAllApplyPO) { CasContractEntity contract = contractManagementBLL.GetById <CasContractEntity>(applyPO.ContractId); mailContent += $@"<tr><td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{contract.ContractName}</td><td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{applyPO.PrNo}</td></tr>"; } mailContent += "</tbody></table></br>Best Regards"; #if DEBUG string reciever = "*****@*****.**"; #else string reciever = approver.Email; #endif SendEmail.Send(reciever, mailTitle, mailContent); } }
public override void Run(Hashtable parameters) { ContractManagementBLL contractManagementBLL = new ContractManagementBLL(); DepUserCommonBLL userBll = new DepUserCommonBLL(); //45天后过期的合同 List <CasContractEntity> listExpireIn45DaysContracts = contractManagementBLL.GetExpireIn45DaysContracts(); //90天后过期的合同 List <CasContractEntity> listExpireIn90DaysContracts = contractManagementBLL.GetExpireIn90DaysContracts(); foreach (CasContractEntity contract in listExpireIn45DaysContracts) { CasUserEntity user = userBll.GetById <CasUserEntity>(contract.CreatedBy); string title = $@"e-Approval – Notification of Contract Expiration"; string content = $@"Dear {user.EnglishName},<br/>尊敬的:{user.ChineseName} <br/><br/>The following contract will expire in 45 days: <br/>以下合同将在45天后过期:<br/><br/> Contract Name 合同名称:{contract.ContractName}{contract.TemplateName}<br/>Ferrero Entity 费列罗方:{contract.FerreroEntity}</br>Counter Party 相对方:{contract.CounterpartyEn}{contract.CounterpartyCn}</br>Contract Number 合同编号:{contract.ContractNo}{contract.TemplateNo}</br></br>Please check and consider if you need to renew the contract</br>请确认并考虑是否需要续签此合同。</br></br>Ferrero China Contract Approval System</br>费列罗中国合同审批系统"; var cc = "*****@*****.**"; string reciever = user.Email; SendEmail.Send(reciever, cc, title, content); } foreach (CasContractEntity contract in listExpireIn90DaysContracts) { CasUserEntity user = userBll.GetById <CasUserEntity>(contract.CreatedBy); string title = $@"e-Approval – Notification of Contract Expiration"; string content = $@"Dear {user.EnglishName},<br/>尊敬的:{user.ChineseName} <br/><br/>The following contract will expire in 90 days: <br/>以下合同将在90天后过期:<br/><br/> Contract Name 合同名称:{contract.ContractName}{contract.TemplateName}<br/>Ferrero Entity 费列罗方:{contract.FerreroEntity}</br>Counter Party 相对方:{contract.CounterpartyEn}{contract.CounterpartyCn}</br>Contract Number 合同编号:{contract.ContractNo}{contract.TemplateNo}</br></br>Please check and consider if you need to renew the contract</br>请确认并考虑是否需要续签此合同。</br></br>Ferrero China Contract Approval System</br>费列罗中国合同审批系统"; var cc = "*****@*****.**"; string reciever = user.Email; SendEmail.Send(reciever, cc, title, content); } }
protected void Page_Unload(object sender, EventArgs e) { if (contractManagementBLL != null) { contractManagementBLL.Dispose(); contractManagementBLL = null; } }
public override void Run(Hashtable parameters) { UploadSignatureStampContractRemind SignStapRe = new UploadSignatureStampContractRemind(); ContractManagementBLL contractManagementBLL = new ContractManagementBLL(); List <CasContractEntity> contracts = SignStapRe.GetNeedRemindContracts(); foreach (CasContractEntity contract in contracts) { CasUserEntity userEntity = contractManagementBLL.GetById <CasUserEntity>(contract.CreatedBy); var title = $@"e-Approval – Notification of Upload Signature Stamp Contract"; var content = $@"Dear {userEntity.EnglishName},<br/>尊敬的:{userEntity.ChineseName} <br/><br/>The following has been completed and approved before 10 working days, please upload the contract signed and sealed: <br/>以下合同10个工作日之前审批完成,请上传签字盖章合同:<br/><br/> Contract Name 合同名称:{contract.ContractName}{contract.TemplateName}<br/>Ferrero Entity 费列罗方:{contract.FerreroEntity}</br>Counter Party 相对方:{contract.CounterpartyEn}{contract.CounterpartyCn}</br>Contract Number 合同编号:{contract.ContractNo}{contract.TemplateNo}</br></br>Ferrero China Contract Approval System</br>费列罗中国合同审批系统"; var cc = "*****@*****.**"; var reciever = userEntity.Email; SendEmail.Send(reciever, cc, title, content); } }
public override void Run(Hashtable parameters) { ContractManagementBLL contractBll = new ContractManagementBLL(); UserBLL userBll = new UserBLL(); DepartmentBLL departmentBll = new DepartmentBLL(); //所有合同管理员 List <CasUserEntity> listContractManagers = userBll.GetAllContractManagers(); #if DEBUG //TODO:离职员工列表,同步员工数据时判断并获得 List <CasUserEntity> listTurnoverUsers = new List <CasUserEntity>(); //TODO:测试数据,汪敏 listTurnoverUsers.Add(new CasUserEntity() { UserId = "WANGMIN1", ChineseName = "汪敏" }); #else #endif foreach (CasUserEntity user in listTurnoverUsers) { //部门总监 CasUserEntity manager = departmentBll.GetDepartmentManagerByUserId(user.UserId); List <CasContractEntity> listApplyContracts = contractBll.GetAllApplyContractsByUserId(user.UserId); List <CasContractEntity> listApproveContracts = contractBll.GetAllApproveContractsByUserId(user.UserId); List <CasContractEntity> listPOApproveContracts = contractBll.GetAllPOApproveContractsByUserId(user.UserId); //邮件标题 string mailTitle = $@"e-Approval – User Leaving"; //邮件正文 string mailContent = $@"Dear All,<br/>尊敬的用户<br/><br/><{user.ChineseName}>left Ferrero on <{user.LastWorkDate}>. Following contracts were initiated by <{user.ChineseName}>. Please submit your request in IT Service Order System to transfer the contracts to other employee.<br/><{user.ChineseName}>于<{user.LastWorkDate}>离职,以下为该员工发起的所有合同。请在IT Service Order系统中申请将合同转移至其他员工名下。</br>"; if (listApplyContracts.Count == 0 && listApproveContracts.Count == 0 && listPOApproveContracts.Count == 0) { mailContent += "<b>他没有申请合同,也没有审批合同,也没有PO审批合同,请知悉。</b></br>Best Regards"; } else { if (listApplyContracts.Count > 0) { mailContent += $@"</br><table style='font-family:verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #666666;border-collapse:collapse;'><thead> <tr><th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Initiator 申请人</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Contract Owner 合同经办部门</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Contract Name 合同名称</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Ferrero Entity 费列罗方</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Counter Party 相对方</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Contract Number 合同编号</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Contract Status 合同状态</th> </tr></thead><tbody>"; foreach (CasContractEntity applyContract in listApplyContracts) { mailContent += $@"<tr> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{user.ChineseName}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{applyContract.ContractOwner}{applyContract.TemplateOwner}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{applyContract.ContractName}{applyContract.TemplateName}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{applyContract.FerreroEntity}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{applyContract.CounterpartyEn}{applyContract.CounterpartyCn}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{applyContract.ContractNo}{applyContract.TemplateNo}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{applyContract.Status}</td> </tr>"; } mailContent += "</tbody></table></br>"; } //if (listApproveContracts.Count > 0) //{ // mailContent += "他审批的合同清单如下:<br/><table style='font-family:verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #666666;border-collapse:collapse;'><thead><tr><th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>合同名称</th></tr></thead><tbody>"; // foreach (CasContractEntity approveContract in listApproveContracts) // { // mailContent += $@"<tr><td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{approveContract.ContractName}</td></tr>"; // } // mailContent += "</tbody></table></br>"; //} //if (listPOApproveContracts.Count > 0) //{ // mailContent += "他PO审批的合同清单如下:<br/><table style='font-family:verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #666666;border-collapse:collapse;'><thead><tr><th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>合同名称</th></tr></thead><tbody>"; // foreach (CasContractEntity poApproveContract in listPOApproveContracts) // { // mailContent += $@"<tr><td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{poApproveContract.ContractName}</td></tr>"; // } // mailContent += "</tbody></table></br>"; //} mailContent += "</br><b>Note: The contracts will be transferred to department head after 10 days if we don’t receive any notification from user department.</b></br><b>备注:如在10天之内未收到用户部门任何申请,所有该离职用户的合同将转移至部门总监名下。</b></br></br>Ferrero China Contract Approval System</br>费列罗中国合同审批系统"; } var cc = "*****@*****.**"; List <string> listRecievers = new List <string>(); if (manager != null) { listRecievers.Add(manager.Email); } foreach (CasUserEntity contractManager in listContractManagers) { listRecievers.Add(contractManager.Email); } List <string> ccs = new List <string>(); ccs.Add(cc); SendEmail.Send(listRecievers, ccs, mailTitle, mailContent); //SendEmail.Send(reciever, cc,mailTitle, mailContent); } }
public override void Run(Hashtable parameters) { ContractApprovalBLL bll = new ContractApprovalBLL(); ContractManagementBLL contractManagementBLL = new ContractManagementBLL(); List <CasUserEntity> listApprovers = bll.GetAllPendingApprovalAndOvertimeContractsApprovers(); foreach (CasUserEntity approver in listApprovers) { //待审批和超时合同 List <CasContractApproverEntity> listPendingApprovalAndOverTimeContractApprovers = bll.GetPendingApprovalAndOvertimeContractApprovers(approver.UserId); //待审批合同 List <CasContractApproverEntity> listPendingApprovalContractApprovers = listPendingApprovalAndOverTimeContractApprovers.Where(p => p.Status == ContractApproverStatusEnum.WaitApproval.GetHashCode()).ToList(); //超时合同 List <CasContractApproverEntity> listOverTimeContractApprovers = listPendingApprovalAndOverTimeContractApprovers.Where(p => p.Status == ContractApproverStatusEnum.OverTime.GetHashCode()).ToList(); //邮件标题 string mailTitle = $@"e-Approval - Contract Approval List"; //邮件正文 string mailContent = $@"Dear {approver.EnglishName},<br/>尊敬的:{approver.ChineseName}"; if (listPendingApprovalContractApprovers.Count > 0) { mailContent += $@"<br/>The following contracts have been submitted for your approval(please kindly confirm your approval or rejection within 3 working days):<br/>以下合同申请需要您的审核(请在3个工作日内批准或拒绝申请):<br/> </br><table style='font-family:verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #666666;border-collapse:collapse;'><thead> <tr><th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Initiator 申请人</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Contract Owner 合同经办部门</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Contract Name 合同名称</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Ferrero Entity 费列罗方</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Counter Party 相对方</th> </tr></thead><tbody>"; foreach (var pendingApproval in listPendingApprovalContractApprovers) { CasContractEntity contract = contractManagementBLL.GetById <CasContractEntity>(pendingApproval.ContractId); CasUserEntity userEntity = contractManagementBLL.GetById <CasUserEntity>(contract.CreatedBy); mailContent += $@"<tr> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{userEntity.ChineseName}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{contract.ContractOwner}{contract.TemplateOwner}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{contract.ContractName}{contract.TemplateName}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{contract.FerreroEntity}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{contract.CounterpartyEn}{contract.CounterpartyCn}</td> </tr>"; } mailContent += $@"</tbody></table></br>"; } if (listOverTimeContractApprovers.Count > 0) { mailContent += $@"<br/>Note below contracts are overdue, please review the contracts at your earliest convenient.<br/>请注意以下合同已超期,请尽快进行审批。<br/> </br><table style='font-family:verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #666666;border-collapse:collapse;'><thead> <tr><th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Initiator 申请人</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Contract Owner 合同经办部门</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Contract Name 合同名称</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Ferrero Entity 费列罗方</th> <th style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;'>Counter Party 相对方</th> </tr></thead><tbody>"; foreach (var listOverTime in listOverTimeContractApprovers) { CasContractEntity contract = contractManagementBLL.GetById <CasContractEntity>(listOverTime.ContractId); CasUserEntity userEntity = contractManagementBLL.GetById <CasUserEntity>(contract.CreatedBy); mailContent += $@"<tr> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{userEntity.ChineseName}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{contract.ContractOwner}{contract.TemplateOwner}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{contract.ContractName}{contract.TemplateName}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{contract.FerreroEntity}</td> <td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{contract.CounterpartyEn}{contract.CounterpartyCn}</td> </tr>"; } mailContent += $@"</tbody></table></br>"; } //foreach (CasContractApproverEntity casContractApproverEntity in listPendingApprovalAndOverTimeContractApprovers) //{ // CasContractEntity contract = contractManagementBLL.GetById<CasContractEntity>(casContractApproverEntity.ContractId); // string statusName = ""; // switch (casContractApproverEntity.Status) // { // case (2): statusName = "待审批"; break; // case (4): statusName = "超时"; break; // default: statusName = "待审批"; break; // } // string approveTypeName = ""; // switch (casContractApproverEntity.ApproverType) // { // case (1): approveTypeName = "领导"; break; // case (2): approveTypeName = "大区总监"; break; // case (3): approveTypeName = "部门总监"; break; // case (4): approveTypeName = "审批部门"; break; // default: approveTypeName = "审批部门"; break; // } // mailContent += $@"<tr><td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{contract.ContractName}</td><td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{approveTypeName}</td><td style='border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;'>{statusName}</td></tr>"; //} mailContent += "</br></br>Ferrero China Contract Approval System</br>费列罗中国合同审批系统"; var cc = "*****@*****.**"; #if DEBUG string reciever = "*****@*****.**"; #else string reciever = approver.Email; #endif SendEmail.Send(reciever, mailTitle, mailContent); } }