Example #1
0
        /// <summary>
        /// 得到DMM,BD审批用户(DMM的用户级别为4以上则不用BD审批)
        /// </summary>
        /// <returns></returns>
        List<QuickFlow.NameCollection> GetDMMBDApprover()
        {
            List<QuickFlow.NameCollection> listName = new List<NameCollection>();
            ///找DMM审批人
            QuickFlow.NameCollection DMMApprover = new QuickFlow.NameCollection();
            Employee managerEmp = OSPCommon.GetDMMApprover(this.Userinfo1.Applicant); //WorkFlowUtil.GetApproverByLevelPAD(this.Userinfo1.Applicant);
            if (managerEmp == null)
            {
                DisplayMessage("此用户没有Level-5或Level-4级的审批用户,无法提交");
                return null;
            }
            string sManager = managerEmp.UserAccount;
            DMMApprover.Add(sManager);
            var deleman = WorkFlowUtil.GetDeleman(managerEmp.UserAccount, WorkFlowUtil.GetModuleIdByListName("OSPWorkflow"));
            if (deleman != null)
            {
                DMMApprover.Add(deleman);
            }
            listName.Add(DMMApprover);

            //查找BD审批人
            QuickFlow.NameCollection BDMApprover = new QuickFlow.NameCollection();
            Employee eBD = WorkFlowUtil.GetNextApprover(sManager);
            if (null == eBD)
            {
                DisplayMessage("Can not find next approver for " + sManager);
                return null;
            }

            int iLevel = GetLevel(eBD.JobLevel.AsString());
            if (iLevel < 4)
            {
                listName.Add(null);
                return listName;//BD的用户级别为4以上则不用BD审批。
            }

            BDMApprover.Add(eBD.UserAccount);
            //string delemanBD = WorkFlowUtil.GetDeleman(managerEmp.UserAccount, CA.WorkFlow.UI.Constants.CAModules.PADChangeRequest);
            string delemanBD = WorkFlowUtil.GetDeleman(eBD.UserAccount, WorkFlowUtil.GetModuleIdByListName("OSPWorkflow"));
            if (delemanBD != null)
            {
                BDMApprover.Add(delemanBD);
            }
            listName.Add(BDMApprover);
            return listName;
        }
Example #2
0
        /// <summary>
        /// 得到DMM,BD审批用户
        /// </summary>
        /// <returns></returns>
        List<QuickFlow.NameCollection> GetDMMApprover()
        {
            List<QuickFlow.NameCollection> listName = new List<NameCollection>();
            ///找DMM审批人
            QuickFlow.NameCollection DMMApprover = new QuickFlow.NameCollection();
            Employee managerEmp = WorkFlowUtil.GetApproverByLevelPAD(CurrentEmployee);
            if (managerEmp == null)
            {
                DisplayMessage("此用户没有Level-5级以上的审批用户,无法提交");
               return null;
            }
            string sManager = managerEmp.UserAccount;
            DMMApprover.Add(sManager);
            var deleman = WorkFlowUtil.GetDeleman(managerEmp.UserAccount, WorkFlowUtil.GetModuleIdByListName("POTypeChangeWorkflow"));
            if (deleman != null)
            {
                DMMApprover.Add(deleman);
            }
            listName.Add(DMMApprover);

            //查找BD审批人
            QuickFlow.NameCollection BDMApprover = new QuickFlow.NameCollection();
            Employee eBD = WorkFlowUtil.GetNextApprover(sManager);
            if (null == eBD)
            {
                DisplayMessage("Can not find next approver for " + sManager);
                return null;
            }
            BDMApprover.Add(eBD.UserAccount);
            string delemanBD = WorkFlowUtil.GetDeleman(eBD.UserAccount, WorkFlowUtil.GetModuleIdByListName("POTypeChangeWorkflow"));
            if (delemanBD != null)
            {
                BDMApprover.Add(delemanBD);
            }
            listName.Add(BDMApprover);
            return listName;
        }
Example #3
0
        public static QuickFlow.NameCollection GetNewsApproveUsers(string listTitle)
        {
            QuickFlow.NameCollection names = new QuickFlow.NameCollection();
            try
            {
                QueryField field = new QueryField("Title");
                CA.SharePoint.ISharePointService sps = CA.SharePoint.ServiceFactory.GetSharePointService(true);
                SPList list = sps.GetList("NewsApproveConfig");
                SPListItemCollection items = sps.Query(list, field.Equal(listTitle), 1);

                if (items != null && items.Count > 0)
                {
                    SPFieldUserValueCollection users = items[0]["Approvers"] as SPFieldUserValueCollection;
                    foreach (SPFieldUserValue user in users)
                    {
                        string userLoginName = user.LookupValue;
                        names.Add(userLoginName);
                    }
                }
            }
            catch { }
            return names;
        }
Example #4
0
        public static QuickFlow.NameCollection GetUsersInGroup(string strGroupName)
        {
            QuickFlow.NameCollection names = new QuickFlow.NameCollection();
            //SPGroup group = null;
            //SPSecurity.RunWithElevatedPrivileges(delegate()
            //{
            //    using (SPSite site = new SPSite(SPContext.Current.Site.ID))
            //    {
            //        using (SPWeb web = site.OpenWeb(SPContext.Current.Site.RootWeb.ID))
            //        {
            //            //group = web.Groups[strGroupName];
            //            group = web.SiteGroups[strGroupName];
            //        }
            //    }
            //});
            SPGroup group = null;
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite(SPContext.Current.Site.ID))
                {
                    using (SPWeb web = site.OpenWeb(SPContext.Current.Site.RootWeb.ID))
                    {
                        group = web.SiteGroups[strGroupName];
                    }
                }
            });

            if (group != null)
            {
                foreach (SPUser user in group.Users)
                {
                    if (user.IsSiteAdmin || user.Name == "System Account")
                        continue;
                    names.Add(user.LoginName);
                }
            }

            return names;
        }
Example #5
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;
 }