Exemplo n.º 1
0
        public static string AddCustomGroupingUser(IList <int> UserIdList, int groupId)
        {
            string str  = string.Empty;
            int    num  = 0;
            int    num2 = 0;
            CustomGroupingUserDao dao = new CustomGroupingUserDao();

            foreach (int num3 in UserIdList)
            {
                if (dao.GetGroupIdByUserId(num3, groupId) > 0)
                {
                    num++;
                }
                else if (!dao.AddCustomGroupingUser(num3, groupId))
                {
                    num2++;
                }
            }
            if (num2 > 0)
            {
                return(string.Concat(new object[] { "成功添加", UserIdList.Count - num2, "条,失败", num2, "条" }));
            }
            if (num > 0)
            {
                str = string.Concat(new object[] { "有效添加", UserIdList.Count - num, "条,其余", num, "条已经在该分组中" });
            }
            return(str);
        }
Exemplo n.º 2
0
        public static string GetMemberGroupList(int userId)
        {
            IList <int> memberGroupList = new CustomGroupingUserDao().GetMemberGroupList(userId);

            if ((memberGroupList != null) && (memberGroupList.Count > 0))
            {
                string str = "";
                foreach (int num in memberGroupList)
                {
                    str = str + num.ToString() + ",";
                }
                return(str.Substring(0, str.Length - 1));
            }
            return("-1");
        }
Exemplo n.º 3
0
        public static void SetUserCustomGroup(int userId, IList <int> GroupIdList)
        {
            CustomGroupingUserDao customGroupingUserDao = new CustomGroupingUserDao();
            IList <int>           memberGroupList       = customGroupingUserDao.GetMemberGroupList(userId);

            if (memberGroupList != null && memberGroupList.Count > 0)
            {
                foreach (int current in memberGroupList)
                {
                    customGroupingUserDao.DelGroupUser(userId.ToString(), current);
                }
            }
            if (GroupIdList != null && GroupIdList.Count > 0)
            {
                foreach (int current in GroupIdList)
                {
                    customGroupingUserDao.AddCustomGroupingUser(userId, current);
                }
            }
        }
Exemplo n.º 4
0
        public static void SetUserCustomGroup(int userId, IList <int> GroupIdList)
        {
            CustomGroupingUserDao dao             = new CustomGroupingUserDao();
            IList <int>           memberGroupList = dao.GetMemberGroupList(userId);

            if ((memberGroupList != null) && (memberGroupList.Count > 0))
            {
                foreach (int num in memberGroupList)
                {
                    dao.DelGroupUser(userId.ToString(), num);
                }
            }
            if ((GroupIdList != null) && (GroupIdList.Count > 0))
            {
                foreach (int num in GroupIdList)
                {
                    dao.AddCustomGroupingUser(userId, num);
                }
            }
        }
Exemplo n.º 5
0
        public static string GetMemberGroupList(int userId)
        {
            IList <int> memberGroupList = new CustomGroupingUserDao().GetMemberGroupList(userId);
            string      result;

            if (memberGroupList != null && memberGroupList.Count > 0)
            {
                string text = "";
                foreach (int current in memberGroupList)
                {
                    text = text + current.ToString() + ",";
                }
                text   = text.Substring(0, text.Length - 1);
                result = text;
            }
            else
            {
                result = "-1";
            }
            return(result);
        }