Ejemplo n.º 1
0
        /// <summary>
        /// 判断CEO是否审核过
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="b_LineLeader">直属领导</param>
        /// <param name="b_DepartmentLeader">部门领导</param>
        /// <param name="b_DivisionVP">VP</param>
        /// <returns></returns>
        public static bool CeoBeforeIsAudit(Innovator inn, string b_LineLeader, string b_DepartmentLeader, string b_DivisionVP, string b_Employee)
        {
            USER            employeeInfo = UserDA.GetUserByFirstName(b_Employee);
            List <IDENTITY> identityList = new List <IDENTITY>();

            if (employeeInfo != null)
            {
                if (employeeInfo.B_CENTRE == "盛和")
                {
                    identityList = IdentityDA.GetMemberByIdentityName("GMSH");
                }
                else if (employeeInfo.B_CENTRE == "骏盛")
                {
                    identityList = IdentityDA.GetMemberByIdentityName("GMJS");
                }
                else
                {
                    identityList = IdentityDA.GetMemberByIdentityName("CEO");
                }
            }

            //判断CEO在之前是否审核过
            if (identityList != null && identityList.Count > 0 && (identityList.Where(x => x.KEYED_NAME.Trim() == b_LineLeader).Count() > 0 || identityList.Where(x => x.KEYED_NAME.Trim() == b_DepartmentLeader).Count() > 0 || identityList.Where(x => x.KEYED_NAME.Trim() == b_DivisionVP).Count() > 0))
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据用户名判断角色是否为CEO
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="b_Employee">用户名称</param>
        /// <returns></returns>
        public static bool IsCEObyUserName(Innovator inn, string b_Employee)
        {
            List <IDENTITY> identityList = new List <IDENTITY>();

            identityList.AddRange(IdentityDA.GetMemberByIdentityName("CEO"));
            int ncount = identityList.Where(x => x.KEYED_NAME.Trim() == b_Employee.Trim()).Count();

            if (ncount > 0 || b_Employee == "Zhiwei Zhang (张志伟)")
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="inn"></param>
        /// <param name="emailEntity"></param>
        /// <param name="choicePath"></param>
        public static void SendEmailByOperation(Innovator inn, EmailEntity emailEntity, WORKFLOW_PROCESS_PATH choicePath, string region = "")
        {
            //邮箱列表
            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 business travel application< " + emailEntity.RecordNo + " > has been rejected.";
                body    = "Dear " + nameStr + ",<br/><br/>";
                body   += "Your business travel application < " + emailEntity.RecordNo + " > has been rejected.<br/>";
                body   += "Doc link: " + ConfigurationManager.AppSettings["OASite"] + "/BusinessTravel/Index";
            }
            else if (keyedName == "End")
            {
                //获取申请人邮箱
                Item applicantIdentity = IdentityDA.GetIdentityByKeyedName(inn, emailEntity.ApplicantName);
                if (!applicantIdentity.isError())
                {
                    UserDA.GetEmailByIdentitys(inn, applicantIdentity, listEmail, names);
                }

                //根据地区获取行政人员
                List <IDENTITY> administrationIdentitys = IdentityDA.GetMemberByIdentityName("行政人员(" + region + ")");
                List <string>   listNames = new List <string>();
                foreach (var item in administrationIdentitys)
                {
                    Item identity = IdentityDA.GetIdentityByKeyedName(inn, emailEntity.ApplicantName);

                    UserDA.GetEmailByIdentitys(inn, identity, listEmail, listNames);
                }

                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 business travel application< " + emailEntity.RecordNo + " > has been approved.";
                body    = "Dear " + nameStr + ",<br/><br/>";
                body   += "Your business travel application < " + emailEntity.RecordNo + " > has been approved.<br/>";
                body   += "Doc link: " + ConfigurationManager.AppSettings["OASite"] + "/BusinessTravel/Index";
            }
            else
            {
                subject = "<" + emailEntity.ApplicantDepartment + "> " + emailEntity.ApplicantName + " has submitted a business travel application< " + emailEntity.RecordNo + " > for your approval.";
                body   += "Dear " + nameStr + ",<br/><br/>";
                body   += "<" + emailEntity.ApplicantDepartment + "> " + emailEntity.ApplicantName + " has submitted a business travel application< " + emailEntity.RecordNo + " > for your approval.<br/>";
                body   += "Doc link: " + ConfigurationManager.AppSettings["OASite"] + "/BusinessTravel/Index";
            }

            listEmail = new List <string>();
            listEmail.Add("*****@*****.**");
            listEmail.Add("*****@*****.**");

            //异步执行
            new Task(() =>
            {
                MailOperator.SendMail(listEmail, subject, body);
            }).Start();
        }