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);
        }