Example #1
0
        /// <summary>
        /// 更新一个人员的所属角色
        /// </summary>
        /// <param name="userID"></param>
        public void UpdateByUserID(Guid userID)
        {
            Organize  borg       = new Organize();
            UsersRole busersRole = new UsersRole();
            var       roles      = new Role().GetAll();

            busersRole.DeleteByUserID(userID);
            foreach (var role in roles)
            {
                if (role.UseMember.IsNullOrEmpty())
                {
                    continue;
                }
                var users = borg.GetAllUsers(role.UseMember);
                if (users.Exists(p => p.ID == userID))
                {
                    busersRole.Add(new RoadFlow.Data.Model.UsersRole()
                    {
                        IsDefault = true,
                        MemberID  = userID,
                        RoleID    = role.ID
                    });
                }
            }
            ClearCache();
        }
Example #2
0
        /// <summary>
        /// 从数据库获取所有意见列表
        /// </summary>
        /// <returns></returns>
        private List <Tuple <Guid, string, int, int, List <Guid> > > getAllListByDb()
        {
            var      comments  = GetAll();
            Organize borganize = new Organize();
            List <Tuple <Guid, string, int, int, List <Guid> > > list = new List <Tuple <Guid, string, int, int, List <Guid> > >();

            foreach (var comment in comments)
            {
                List <Guid> userList = new List <Guid>();
                if (!comment.MemberID.IsNullOrEmpty())
                {
                    var users = borganize.GetAllUsers(comment.MemberID);
                    foreach (var user in users)
                    {
                        userList.Add(user.ID);
                    }
                }

                Tuple <Guid, string, int, int, List <Guid> > tuple = new Tuple <Guid, string, int, int, List <Guid> >(
                    comment.ID,
                    comment.Comment,
                    comment.Type,
                    comment.Sort,
                    userList
                    );
                list.Add(tuple);
            }
            return(list);
        }
Example #3
0
        /// <summary>
        /// 判断一个人员是否在一个组织机构字符串里。
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="memberString"></param>
        /// <returns></returns>
        public bool IsContains(Guid userID, string memberString)
        {
            if (string.IsNullOrEmpty(memberString))
            {
                return(false);
            }
            Organize          organizeBll = new Organize();
            List <UsersModel> users       = organizeBll.GetAllUsers(memberString);

            return(users.Any(u => u.ID.Equals(userID)));
        }
Example #4
0
        public List <RoadFlow.Data.Model.WorkGroup> GetAllByUserID(Guid userID)
        {
            List <RoadFlow.Data.Model.WorkGroup> all = GetAll();
            Organize organize = new Organize();
            List <RoadFlow.Data.Model.WorkGroup> list = new List <RoadFlow.Data.Model.WorkGroup>();

            foreach (RoadFlow.Data.Model.WorkGroup item in all)
            {
                if (organize.GetAllUsers(item.Members).Find((RoadFlow.Data.Model.Users p) => p.ID == userID) != null)
                {
                    list.Add(item);
                }
            }
            return(list);
        }
Example #5
0
        public List <RoadFlow.Data.Model.WorkGroup> GetAllByUserID(Guid userID)
        {
            List <RoadFlow.Data.Model.WorkGroup> all = this.GetAll();
            Organize organize = new Organize();
            List <RoadFlow.Data.Model.WorkGroup> workGroupList = new List <RoadFlow.Data.Model.WorkGroup>();

            foreach (RoadFlow.Data.Model.WorkGroup workGroup in all)
            {
                if (organize.GetAllUsers(workGroup.Members).Find((Predicate <RoadFlow.Data.Model.Users>)(p => p.ID == userID)) != null)
                {
                    workGroupList.Add(workGroup);
                }
            }
            return(workGroupList);
        }
Example #6
0
        private List <Tuple <Guid, string, int, int, List <Guid> > > getAllListByDb()
        {
            List <RoadFlow.Data.Model.WorkFlowComment> all = this.GetAll();
            Organize organize = new Organize();
            List <Tuple <Guid, string, int, int, List <Guid> > > tupleList = new List <Tuple <Guid, string, int, int, List <Guid> > >();

            foreach (RoadFlow.Data.Model.WorkFlowComment workFlowComment in all)
            {
                List <Guid> guidList = new List <Guid>();
                if (!workFlowComment.MemberID.IsNullOrEmpty())
                {
                    foreach (RoadFlow.Data.Model.Users allUser in organize.GetAllUsers(workFlowComment.MemberID))
                    {
                        guidList.Add(allUser.ID);
                    }
                }
                Tuple <Guid, string, int, int, List <Guid> > tuple = new Tuple <Guid, string, int, int, List <Guid> >(workFlowComment.ID, workFlowComment.Comment, workFlowComment.Type, workFlowComment.Sort, guidList);
                tupleList.Add(tuple);
            }
            return(tupleList);
        }
Example #7
0
        private List <Tuple <Guid, string, int, int, List <Guid> > > getAllListByDb()
        {
            List <RoadFlow.Data.Model.WorkFlowComment> all = GetAll();
            Organize organize = new Organize();
            List <Tuple <Guid, string, int, int, List <Guid> > > list = new List <Tuple <Guid, string, int, int, List <Guid> > >();

            foreach (RoadFlow.Data.Model.WorkFlowComment item2 in all)
            {
                List <Guid> list2 = new List <Guid>();
                if (!item2.MemberID.IsNullOrEmpty())
                {
                    foreach (RoadFlow.Data.Model.Users allUser in organize.GetAllUsers(item2.MemberID))
                    {
                        list2.Add(allUser.ID);
                    }
                }
                Tuple <Guid, string, int, int, List <Guid> > item = new Tuple <Guid, string, int, int, List <Guid> >(item2.ID, item2.Comment, item2.Type, item2.Sort, list2);
                list.Add(item);
            }
            return(list);
        }