示例#1
0
        private void GetMailToCc(MailBody mailBody)
        {
            if (mailBody == null)
            {
                return;
            }

            List <List <string> > emails;
            List <Account>        accounts;

            if (_AssessActivity.NextStepIndex != -1)
            {
                accounts = _AssessActivity.DiyProcess.DiySteps[_AssessActivity.NextStepIndex].MailAccount;
                Account nextOperator =
                    new GetAssessActivity().GetDiyStepAccount(_AssessActivity.ItsEmployee.Account.Id,
                                                              _AssessActivity.DiyProcess.DiySteps[
                                                                  _AssessActivity.NextStepIndex]);
                if (nextOperator != null)
                {
                    accounts.Add(nextOperator);
                }
            }
            else
            {
                Department dept = BllInstance.DepartmentBllInstance.GetDept(_AssessActivity.ItsEmployee.Account.Id,
                                                                            new Account(Account.AdminPkid, "", ""));
                accounts = new AuthDal().GetAccountsByAuthIdAndDeptId(HrmisPowers.A704, dept.Id);
            }
            emails          = BllUtility.GetEmailsByAccountIds(accounts);
            mailBody.MailTo = emails[0];
            mailBody.MailCc = emails[1];
            return;
        }
        private MailBody CreateMailBody()
        {
            MailBody mailBody = new MailBody();

            mailBody.Subject = "您的【" +
                               AssessActivityUtility.GetCharacterNameByType(_AssessActivity.AssessCharacterType) + " " +
                               _AssessActivity.ScopeFrom.ToShortDateString() + "至" +
                               _AssessActivity.ScopeTo.ToShortDateString() + "】已经结束,请登录系统查看评估表。";

            StringBuilder sbMailBody = new StringBuilder(mailBody.Subject);

            mailBody.Body = sbMailBody.ToString();

            Account        account  = BllInstance.AccountBllInstance.GetAccountById(_AssessActivity.ItsEmployee.Account.Id);
            List <Account> accounts = new List <Account>();

            accounts.Add(account);
            List <List <string> > emails;

            emails = BllUtility.GetEmailsByAccountIds(accounts);

            mailBody.MailTo = emails[0];
            mailBody.MailCc = emails[1];

            return(mailBody);
        }
示例#3
0
        private List <Model.AssessActivity> GetActivitysByStatusAndOperAccountId(int accountId, AssessStatus status)
        {
            List <Model.AssessActivity> retVal = new List <Model.AssessActivity>();

            List <Model.AssessActivity> employeeAssessActivitys = AssessActivityLogic.GetAssessActivityByEmployeeStatus(-1, status);

            foreach (Model.AssessActivity item in employeeAssessActivitys)
            {
                Account operAccount =
                    GetDiyStepAccount(item.ItsEmployee.Account.Id, item.DiyProcess.DiySteps[item.NextStepIndex]);
                if (operAccount == null)
                {
                    //mail通知人事
                    List <Account> accounts = new GetDiyProcess().GetHRPrincipalByAccountID(item.ItsEmployee.Account.Id);
                    if (accounts != null && accounts.Count > 0)
                    {
                        List <List <string> > mails = BllUtility.GetEmailsByAccountIds(accounts);
                        MailBody mailBody           = new MailBody();
                        mailBody.Subject = "绩效考核流程中断";

                        StringBuilder sbMailBody = new StringBuilder(item.ItsEmployee.Account.Name);
                        sbMailBody.Append("的");
                        sbMailBody.Append(
                            AssessActivityUtility.GetCharacterNameByType(item.AssessCharacterType));
                        sbMailBody.Append("未能找到下一步处理人,被系统自动中断!");
                        mailBody.Body = sbMailBody.ToString();
                        if (mails[0].Count > 0)
                        {
                            mailBody.MailTo = mails[0];
                        }
                        if (mails[1].Count > 0)
                        {
                            mailBody.MailCc = mails[1];
                        }
                        if (mails[0].Count > 0 || mails[1].Count > 0)
                        {
                            BllInstance.MailGateWayBllInstance.Send(mailBody);
                        }
                    }

                    new InterruptActivity(item.AssessActivityID).Excute();
                    continue;
                }
                if (operAccount.Id == accountId)
                {
                    retVal.Add(item);
                }
            }
            return(retVal);
        }
示例#4
0
        private void DoFinsh()
        {
            SetStatusAndSave();
            CalculateItsScore();
            try
            {
                MailBody mailBody = new MailBody();
                mailBody.Subject = "一个绩效考核流程结束";

                StringBuilder sbMailBody = new StringBuilder("员工");
                sbMailBody.Append(_AssessActivity.ItsEmployee.Account.Name);
                sbMailBody.Append("的绩效考核流程结束了。");
                if (_AssessActivity != null &&
                    _AssessActivity.ItsAssessActivityPaper != null &&
                    _AssessActivity.ItsAssessActivityPaper.SubmitInfoes != null && _AssessActivity.IfHasEmployeeFlow)
                {
                    foreach (SubmitInfo info in _AssessActivity.ItsAssessActivityPaper.SubmitInfoes)
                    {
                        if (info.SubmitInfoType.Id == SubmitInfoType.SummarizeCommment.Id)
                        {
                            sbMailBody.Append("终结评语:");
                            sbMailBody.Append(info.Comment);
                        }
                    }
                }
                mailBody.Body = sbMailBody.ToString();

                List <List <string> > emails;
                List <Account>        accounts = _AssessActivity.DiyProcess.DiySteps[_AssessActivity.DiyProcess.DiySteps.Count - 1].MailAccount;
                if (_AssessActivity.ItsEmployee != null && _AssessActivity.ItsEmployee.Account != null)
                {
                    accounts.Add(_AssessActivity.ItsEmployee.Account);
                }
                emails          = BllUtility.GetEmailsByAccountIds(accounts);
                mailBody.MailTo = emails[0];
                mailBody.MailCc = emails[1];

                if ((mailBody.MailTo.Count != 0 || mailBody.MailCc.Count != 0))
                {
                    BllInstance.MailGateWayBllInstance.Send(mailBody);
                }
            }
            catch
            {
            }
        }