Example #1
0
        /// <summary>
        /// 得到一组机构字符串下所有人员
        /// </summary>
        /// <param name="idString"></param>
        /// <returns></returns>
        public List <RoadFlow.Data.Model.UsersModel> GetAllUsers(string idString)
        {
            if (idString.IsNullOrEmpty())
            {
                return(new List <RoadFlow.Data.Model.UsersModel>());
            }
            string[] idArray = idString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            List <RoadFlow.Data.Model.UsersModel> userList = new List <RoadFlow.Data.Model.UsersModel>();
            UsersBLL  busers = new UsersBLL();
            WorkGroup bwg    = new WorkGroup();

            foreach (string id in idArray)
            {
                if (id.StartsWith(UsersBLL.PREFIX))//人员
                {
                    userList.Add(busers.Get(UsersBLL.RemovePrefix(id).Convert <Guid>()));
                }
                else if (id.IsGuid())//机构
                {
                    userList.AddRange(GetAllUsers(id.Convert <Guid>()));
                }
                else if (id.StartsWith(WorkGroup.PREFIX))//工作组
                {
                    addWorkGroupUsers(userList, bwg.Get(WorkGroup.RemovePrefix(id).Convert <Guid>()));
                }
            }
            userList.RemoveAll(p => p == null);
            return(userList.Distinct(new UsersEqualityComparer()).ToList());
        }
Example #2
0
        private void addWorkGroupUsers(List <RoadFlow.Data.Model.UsersModel> userList, RoadFlow.Data.Model.WorkGroup wg)
        {
            if (wg == null || wg.Members.IsNullOrEmpty())
            {
                return;
            }
            string[]  idArray = wg.Members.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            UsersBLL  busers  = new UsersBLL();
            WorkGroup bwg     = new WorkGroup();

            foreach (var id in idArray)
            {
                if (id.StartsWith(UsersBLL.PREFIX))//人员
                {
                    userList.Add(busers.Get(UsersBLL.RemovePrefix(id).Convert <Guid>()));
                }
                else if (id.IsGuid())//机构
                {
                    userList.AddRange(GetAllUsers(id.Convert <Guid>()));
                }
                else if (id.StartsWith(WorkGroup.PREFIX))//工作组
                {
                    addWorkGroupUsers(userList, bwg.Get(WorkGroup.RemovePrefix(id).Convert <Guid>()));
                }
            }
        }
Example #3
0
        /// <summary>
        /// 根据ID得到名称(有前缀的情况)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetName(string id)
        {
            string name = string.Empty;

            if (id.IsGuid())//机构
            {
                return(GetName(id.Convert <Guid>()));
            }
            else if (id.StartsWith(UsersBLL.PREFIX))//用户
            {
                string uid = UsersBLL.RemovePrefix(id);
                Guid   userID;
                if (!uid.IsGuid(out userID))
                {
                    return("");
                }
                else
                {
                    return(new UsersBLL().GetName(userID));
                }
            }
            else if (id.StartsWith(WorkGroup.PREFIX))//工作组
            {
                string uid = WorkGroup.RemovePrefix(id);
                Guid   wid;
                if (!uid.IsGuid(out wid))
                {
                    return("");
                }
                else
                {
                    return(new WorkGroup().GetName(wid));
                }
            }
            return("");
        }
Example #4
0
 /// <summary>
 /// 去掉ID前缀。
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public string RemovePrefix1(string id)
 {
     return(UsersBLL.RemovePrefix(id));
 }
Example #5
0
 /// <summary>
 /// 得到一页日志数据
 /// </summary>
 /// <param name="pager"></param>
 /// <param name="query"></param>
 /// <param name="order"></param>
 /// <param name="size"></param>
 /// <param name="number"></param>
 /// <param name="title"></param>
 /// <param name="type"></param>
 /// <param name="date1"></param>
 /// <param name="date2"></param>
 /// <param name="userID"></param>
 /// <returns></returns>
 public System.Data.DataTable GetPagerData(out string pager, string query = "", string title = "", string type = "", string date1 = "", string date2 = "", string userID = "")
 {
     return(dataLog.GetPagerData(out pager, query, RoadFlow.Utility.Tools.GetPageSize(), RoadFlow.Utility.Tools.GetPageNumber(),
                                 title, type, date1, date2, UsersBLL.RemovePrefix(userID)));
 }