Esempio n. 1
0
        /// <summary>
        /// 查找提交人的DMM级用户等级为L-4或L-5的
        /// </summary>
        /// <param name="emp"></param>
        /// <returns></returns>
        public static Employee GetDMMApprover(Employee emp)
        {
            Employee approver = null;
            approver = string.IsNullOrEmpty(emp.ManagerID) ? null : UserProfileUtil.GetEmployeeByProp("EmployeeId", emp.ManagerID);

            if (approver == null)
            {
                return null;
            }
            var jobLevel = approver != null ? approver.JobLevel : "L-0";

            var start = jobLevel.IndexOf("-") + 1; //L-3
            var length = jobLevel.Length - start;
            var level = Convert.ToInt32(jobLevel.Substring(start, length));
            while (level >5)
            {
                approver = UserProfileUtil.GetEmployeeByProp("EmployeeId", approver.ManagerID);
                jobLevel = approver != null ? approver.JobLevel : "L-0";
                length = jobLevel.Length - start;
                level = Convert.ToInt32(jobLevel.Substring(start, length));
            }

            if (level < 4)
            {
                return null;
            }
            return approver;
        }
Esempio n. 2
0
 private void FillEmployeeData(Employee employee)
 {
     this.ApplicantField.Value = this.Applicant.DisplayName + "(" + this.Applicant.UserAccount + ")";
     this.DepartmentField.Value = this.Applicant.Department;
 }
Esempio n. 3
0
        //
        private void FillEmployeeData(Employee employee, bool isOverwrite)
        {
            if (isOverwrite)
            {
                this.ffChineseName.Value = this.Applicant.DisplayName;
                this.ffEnglishName.Value = this.Applicant.PreferredName;
                this.ffMobile.Value = this.Applicant.Mobile;
                this.ffOfficeExt.Value = this.Applicant.Phone;
            }
            else
            {
                if (this.ffChineseName.Value.AsString().IsNullOrWhitespace())
                {
                    this.ffChineseName.Value = this.Applicant.DisplayName;
                }
                if (this.ffEnglishName.Value.AsString().IsNullOrWhitespace())
                {
                    this.ffEnglishName.Value = this.Applicant.PreferredName;
                }
                if (this.ffMobile.Value.AsString().IsNullOrWhitespace())
                {
                    this.ffMobile.Value = this.Applicant.Mobile;
                }
                if (this.ffOfficeExt.Value.AsString().IsNullOrWhitespace())
                {
                    this.ffOfficeExt.Value = this.Applicant.Phone;
                }
            }

            this.lblDepartment.Text = this.Applicant.Department;
        }
Esempio n. 4
0
 public void FillEmployeeData(Employee employee)
 {
     if (FindUser)
     {
         this.txtEnglishName.Text = employee.DisplayName;
         this.txtEnglishDept.Text = employee.Department;
         this.txtEnglishJobTitle.Text = employee.Title;
         this.txtTelehpone.Text = employee.Phone;
         this.txtMobilePhone.Text = employee.Mobile;
         this.txtFax.Text = employee.Fax;
         this.txtEmail.Text = employee.WorkEmail.Replace("C-AND-A.CN", "c-and-a.cn");
         this.lblLogUser.Text = SPContext.Current.Web.CurrentUser.LoginName;
         this.lblApplyDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
     }
     Page.RegisterStartupScript("colorCard", "<script>setActiveStyleSheet('" + hdColorCard.Value + "');</script>");
 }
Esempio n. 5
0
 //Add one account to list
 protected void AddToEmployees(List<Employee> employees, Employee e)
 {
     bool isExist = false;
     foreach (Employee emp in employees)
     {
         if (emp.UserAccount.Equals(e.UserAccount, StringComparison.CurrentCultureIgnoreCase))
         {
             isExist = true;
             break;
         }
     }
     if (!isExist)
     {
         employees.Add(e);
     }
 }
Esempio n. 6
0
        private bool IsStart(Employee employee, string uploadDate)
        {
            bool isStart = false;

            SPList list = SPContext.Current.Web.Lists[WorkflowConfigName.CreditCardClaim];
            SPQuery query = new SPQuery();
            string queryFormat = @" <Where>
              <And>
            <Eq>
               <FieldRef Name='ApplicantSPUser' />
               <Value Type='User'>{0}</Value>
            </Eq>
            <Eq>
               <FieldRef Name='Month' />
               <Value Type='Text'>{1}</Value>
            </Eq>
             </And>
               </Where>";
            query.Query = string.Format(queryFormat, employee.UserAccount, uploadDate);

            SPListItemCollection items = list.GetItems(query);

            if (items.Count > 0)
            {
                isStart = true;
            }
            return isStart;
        }
Esempio n. 7
0
        private Employee GetNextApprover(Employee emp)
        {
            Employee approver = null;
            approver = string.IsNullOrEmpty(emp.ManagerID) ? null : UserProfileUtil.GetEmployeeByProp("EmployeeId", emp.ManagerID);

            if (approver == null)
            {
                return null;
            }
            return approver;
        }
Esempio n. 8
0
        //20110913
        //
        public static long GetQuota(Employee emp, string type)
        {
            var quotaStr = GetQuotaByType(type);
            if (string.IsNullOrEmpty(quotaStr))
            {
                return -1;
            }

            char[] split = { ';' };
            string[] quotas = quotaStr.Split(split);

            long quota = 0;
            var start = emp.JobLevel.IndexOf("-") + 1; //L-3
            var length = emp.JobLevel.Length - start;
            var level = Convert.ToInt32(emp.JobLevel.Substring(start, length));

            if (WorkflowPerson.IsCEO(emp.UserAccount))
            {
                quota = Int64.MaxValue;
            }
            else if (WorkflowPerson.IsCFO(emp.UserAccount))
            {
                quota = Convert.ToInt32(quotas[3]);
            }
            else if (WorkflowPerson.IsMTM(emp.UserAccount))
            {
                quota = Convert.ToInt32(quotas[2]);
            }
            else if (level <= 5)
            {
                quota = Convert.ToInt32(quotas[1]);

            }
            else
            {
                quota = Convert.ToInt32(quotas[0]);
            }

            return quota;
        }
Esempio n. 9
0
 public static Employee GetApproverIgnoreRight(Employee emp)
 {
     Employee approver = null;
     approver = string.IsNullOrEmpty(emp.ManagerID) ? null : UserProfileUtil.GetEmployeeByProp("EmployeeId", emp.ManagerID);
     return approver;
 }
Esempio n. 10
0
        public static bool GetApproverIsLastPAD(Employee emp)
        {
            bool flag = false;
            if (emp == null)
            {
                return flag;
            }
            var jobLevel = emp != null ? emp.JobLevel : "L-0";
            var start = jobLevel.IndexOf("-") + 1; //L-3
            var length = jobLevel.Length - start;
            var level = Convert.ToInt32(jobLevel.Substring(start, length));

            if (level < 5)
            {
                flag = true;
            }
            return flag;
        }
Esempio n. 11
0
        private void FillEmployeeData(Employee employee)
        {
            this.lblEnglishName.Text = employee.DisplayName;
            this.lblDepartment.Text = employee.Department;
            this.lblJobTitle.Text = employee.Title;

            if (!Applicant.UserAccount.Equals(this.CurrentEmployee.UserAccount, StringComparison.CurrentCultureIgnoreCase))
            {
                cpfUser.CommaSeparatedAccounts = Applicant.UserAccount;
                currentAccount = cpfUser.Accounts[0] + "";
            }

            FillAssistants();
            //if(rbbookticketNo.Checked)
            //{
            //    btUser.CommaSeparatedAccounts= SPContext.Current.ListItem["btUser"] + "";
            //}
        }
Esempio n. 12
0
        private void SendEmail(Employee employee, string type, string uploadDate, Employee originalEmp)
        {
            var templateTitle = "CreditCardClaim" + type;

            var applicantAccount = employee.UserAccount;
            var applicantName = employee.DisplayName;

            string detailLink = string.Format("{0}/CA/MyTasks.aspx",
                                                SPContext.Current.Site.Url);

            List<string> parameters = new List<string>();
            parameters.Add("");
            parameters.Add(uploadDate);
            parameters.Add(detailLink);
            List<string> to = new List<string>();
            to.Add(applicantAccount);

            switch (type)
            {
                case "BillNotice":
                    SendNotificationMail(templateTitle, parameters, to, true);
                    break;
                case "BillNoticeForDelegate":
                    detailLink = string.Format("{0}/{1}/NewForm.aspx",
                                                SPContext.Current.Site.Url,
                                                SPContext.Current.Web.Lists[WorkflowConfigName.CreditCardClaim].RootFolder.ServerRelativeUrl);
                    parameters.Clear();
                    parameters.Add("");
                    parameters.Add(originalEmp.DisplayName);
                    parameters.Add(uploadDate);
                    parameters.Add(detailLink);

                    SendNotificationMail(templateTitle, parameters, to, true);
                    break;
                default:
                    break;
            }
        }
Esempio n. 13
0
 private void SendEmail(Employee employee, string uploadDate)
 {
     SendEmail(employee, "BillNotice", uploadDate, null);
     SPQuery query = new SPQuery();
     query.Query = CreditCardClaimCommon.GetQuery("OriginalCardHolderAccount", employee.UserAccount);
     SPList list = SPContext.Current.Web.Lists[WorkflowListName.CreditCardEmployeeDelegateMapping];
     SPListItemCollection items = list.GetItems(query);
     foreach (SPListItem item in items)
     {
         Employee delegateEmp = UserProfileUtil.GetEmployeeEx(item["DelegateCardHolderAccount"].AsString());
         if (delegateEmp != null)
         {
             SendEmail(delegateEmp, "BillNoticeForDelegate", uploadDate, employee);
         }
     }
 }
Esempio n. 14
0
        public static Employee GetEmployeeApprover(Employee emp)
        {
            Employee approver = null;
            try
            {
                emp = UserProfileUtil.GetEmployee(emp.Manager);
                do
                {
                    if (emp.ApproveRight)
                    {
                        approver = emp;
                    }
                    else
                    {
                        emp = UserProfileUtil.GetEmployee(emp.Manager);
                    }
                }
                while ((approver == null) && (emp != null));
            }
            catch (Exception ex)
            {
                approver = null; ;
            }

            return approver;
        }
Esempio n. 15
0
 private void FillEmployeeData(Employee emp)
 {
     if (FindUser)
     {
         this.txtName.Value = emp.DisplayName;
         this.txtDept.Value = emp.Department;
         //txtDate.Value = DateTime.Now.ToString("yyyy-MM-dd");
     }
 }
Esempio n. 16
0
        //在同部门找上级审批人
        public static Employee GetEmployeeApproverInDept(Employee emp, bool isFindmanager, bool isFQ)
        {
            Employee approver = null;
            Employee old = emp;
            try
            {
                do
                {
                    if (!isFindmanager)
                    {
                        if (emp.ApproveRight)
                        {
                            approver = emp;
                        }
                        else
                        {
                            emp = UserProfileUtil.GetEmployee(emp.Manager);
                        }
                    }
                    else
                    {
                        emp = UserProfileUtil.GetEmployee(emp.Manager);
                        if (!IsSameDepartment(old.Department, emp.Department))
                        {
                            if (isFQ)
                            {
                                if (old.ApproveRight)
                                {
                                    approver = old;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            if (emp.ApproveRight)
                            {
                                approver = emp;
                                break;
                            }
                        }
                    }
                }
                while ((approver == null) && (emp != null) && (IsSameDepartment(old.Department, emp.Department)));
            }
            catch (Exception ex)
            {
                approver = null;
            }

            return approver;
        }
Esempio n. 17
0
 private void InitData(Employee employee)
 {
     txtName.Value = employee.DisplayName;
     txtDept.Value = employee.Department;
     txtDate.Value = DateTime.Now.ToString("yyyy-MM-dd");
 }
Esempio n. 18
0
        /// <summary>
        /// 给页面员工基本信息赋值
        /// </summary>
        /// <param name="employee"></param>
        private void FillEmployeeData(Employee employee)
        {
            this.labPeople.Text = employee.DisplayName;
            this.labDepartment.Text = employee.Department;
            this.labPostion.Text = employee.Title;
            this.txtEmplyeeNum.Text = employee.EmployeeID;

            this.formFieldApplicant.Value = employee.PreferredName;
            this.formFieldDeptment.Value = employee.Department;
            this.formFieldJobTitle.Value = employee.Title;
            this.formFieldEmployeeID.Value = employee.EmployeeID;
        }
Esempio n. 19
0
 /// <summary>
 /// 得到DMM,BD审批用户
 /// </summary>
 /// <returns></returns>
 public StringBuilder GetDMMBDManager(Employee emp)
 {
     StringBuilder sbManager = new System.Text.StringBuilder();
        Employee managerEmp = WorkFlowUtil.GetApproverByLevelPAD(emp);//DMM
        string sDMMManager = string.Empty;
        if (managerEmp != null)
        {
        sDMMManager = managerEmp.UserAccount;
        sbManager.Append(sDMMManager);
        }
        else
        {
        return null;
        }
        //查找BD审批人
        QuickFlow.NameCollection BDMApprover = new QuickFlow.NameCollection();
        Employee eBD = WorkFlowUtil.GetNextApprover(sDMMManager);
        if (null != eBD)
        {
        sbManager.Append(";");
        sbManager.Append(eBD.UserAccount);
        }
        return sbManager;
 }
Esempio n. 20
0
        public static Employee InstanceEmployee(UserProfile profile, SPSite site)
        {
            Employee employee = new Employee();
            employee.UserAccount = profile[PropertyConstants.AccountName].Value + "";
            employee.DisplayName = profile[PropertyConstants.FirstName].Value + " " + profile[PropertyConstants.LastName].Value;

            employee.PreferredName=profile[PropertyConstants.PreferredName].Value + "";
            string strDepartment = profile[PropertyConstants.Department].Value + "";
            if (strDepartment.Contains(';'))
            {
                employee.Department = strDepartment.Substring(0, strDepartment.IndexOf(';') );
                employee.AllDepartment = strDepartment;
            }
            else
            {
                employee.Department = strDepartment;
                employee.AllDepartment = strDepartment;
            }
            employee.Manager = profile[PropertyConstants.Manager].Value + "";
            //add by wujun 20100709
            //begin
            employee.Phone = profile[PropertyConstants.WorkPhone].Value + "";
            employee.Mobile = profile[PropertyConstants.CellPhone].Value + "";
            employee.WorkEmail = profile[PropertyConstants.WorkEmail].Value + "";
            //http://wsc2337:91/personal/wsq/Shared%20Pictures/配置文件图片/懂得.gif
            employee.PhotoUrl = profile[PropertyConstants.PictureUrl].Value + "";
            //end
            //add by wujun 20100714
            employee.Title = profile[PropertyConstants.Title].Value + "";
            employee.More = profile[PropertyConstants.Office].Value + "";
            employee.Fax = profile[PropertyConstants.Fax].Value + "";
            employee.PopulateName = "";
            if (string.IsNullOrEmpty(employee.PhotoUrl))
            {
                string fileName = profile[PropertyConstants.UserName].Value + "";
                employee.PhotoUrl = ConfigurationManager.AppSettings["userPhotoLocation"] + fileName.Replace('.', ' ') + ConfigurationManager.AppSettings["userPhotoType"];
                if (!site.RootWeb.GetFile(employee.PhotoUrl).Exists)
                {
                    employee.PhotoUrl = ConfigurationManager.AppSettings["userPhotoLocation"] + "default.jpg";
                }
            }
            employee.ApproveRight = !string.IsNullOrEmpty((profile["ApproveRight"].Value + "").Trim());
            employee.EmployeeID = (profile["EmployeeId"].Value + "").Trim();

            //added by wsq 20101118
            List<string> listreports = new List<string>();
            foreach(UserProfile report in profile.GetDirectReports())
            {
                listreports.Add(report["UserName"].Value + "");

            }
            employee.DirectReports = listreports.ToArray();
            return employee;
        }
Esempio n. 21
0
        private SPListItem GetFinancePendingWFItem(string claimedMonth, SPWeb web, Employee applicantEmployee, string type, string currentId)
        {
            SPListItem wfItem = null;
            SPList list = web.Lists[WorkflowListName.CreditCardClaim];
            foreach (SPListItem item in list.Items)
            {
                if (IsSpecificWFItem(item, claimedMonth, applicantEmployee.UserAccount, type, currentId))
                {
                    wfItem = item;
                    break;
                }
            }

            return wfItem;
        }