Esempio n. 1
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);
        }
Esempio n. 2
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 BizProcess.Data.Model.UsersRole()
                    {
                        IsDefault = true,
                        MemberID  = userID,
                        RoleID    = role.ID
                    });
                }
            }
            ClearCache();
        }
Esempio n. 3
0
        /// <summary>
        /// 得到一个人员的分管领导
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public string GetChargeLeader(Guid userID)
        {
            var mainStation = GetMainStation(userID);

            if (mainStation == null)
            {
                return("");
            }
            BizProcess.Platform.Organize borg = new Organize();
            var station = borg.Get(mainStation);

            if (station == null)
            {
                return("");
            }
            if (!station.ChargeLeader.IsNullOrEmpty())
            {
                return(station.ChargeLeader);
            }
            var parents = borg.GetAllParent(station.Number);

            foreach (var parent in parents)
            {
                if (!parent.ChargeLeader.IsNullOrEmpty())
                {
                    return(parent.ChargeLeader);
                }
            }
            return("");
        }
Esempio n. 4
0
        /// <summary>
        /// 判断一个人员是否在一个组织机构字符串里
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="memberString"></param>
        /// <returns></returns>
        public bool IsContains(Guid userID, string memberString)
        {
            if (memberString.IsNullOrEmpty())
            {
                return(false);
            }
            var user = new Organize().GetAllUsers(memberString).Find(p => p.ID == userID);

            return(user != null);
        }
Esempio n. 5
0
        /// <summary>
        /// 更新应用程序库使用人员缓存
        /// </summary>
        /// <param name="appid"></param>
        /// <param name="userIdString"></param>
        public List <Guid> UpdateUseMemberCache(Guid appid)
        {
            string key = BizProcess.Utility.Keys.CacheKeys.AppLibraryUseMember.ToString();
            var    obj = BizProcess.Cache.IO.Opation.Get(key);
            Dictionary <Guid, List <Guid> > dict;

            if (obj != null && obj is Dictionary <Guid, List <Guid> > )
            {
                dict = obj as Dictionary <Guid, List <Guid> >;
            }
            else
            {
                dict = new Dictionary <Guid, List <Guid> >();
            }
            var app = new AppLibrary().Get(appid);

            if (app == null)
            {
                return(new List <Guid>());
            }
            if (dict.ContainsKey(appid))
            {
                if (app.UseMember.IsNullOrEmpty())
                {
                    dict.Remove(appid);
                    return(new List <Guid>());
                }
                else
                {
                    var userIDs = new Organize().GetAllUsersIdList(app.UseMember);
                    dict[appid] = userIDs;
                    return(userIDs);
                }
            }
            else if (!app.UseMember.IsNullOrEmpty())
            {
                var userIDs = new Organize().GetAllUsersIdList(app.UseMember);
                dict.Add(appid, userIDs);
                return(userIDs);
            }
            return(new List <Guid>());
        }