Beispiel #1
0
            protected override ActionResult DoTask(string data)
            {
                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();

                string delStrIds = Request.QueryString["id"];
                string pageNoStr = Request.QueryString["PageN"];
                int pageNo = 0;
                if (!int.TryParse(pageNoStr, out pageNo))
                    pageNo = 0;
                string[] delStrIdCol = delStrIds.Split(',');
                List<int> delIds = new List<int>();
                foreach (string delStrId in delStrIdCol)
                {
                    string tmpDelIdStr = (delStrId ?? string.Empty).Trim();
                    if (string.IsNullOrEmpty(tmpDelIdStr))
                        continue;
                    else
                    {
                        int tmpDelId = 0;
                        if (int.TryParse(tmpDelIdStr, out tmpDelId))
                            delIds.Add(tmpDelId);
                        else
                            continue;
                    }
                }
                string flag = "";
                int currentId = (SessionManager.User == null) ? 0 : SessionManager.User.UserId;
                bool isFilter = this.filterIds(delIds, currentId);
                if (isFilter)
                {
                    if (string.IsNullOrEmpty(flag))
                        flag = "1";
                    else
                        flag = flag + "1";
                }
                UserCollection userCollection = new UserCollection();
                userCollection.FillByUserLevel(UserLevelType.Admin);
                if (userCollection.Count == 1)
                {
                    currentId = userCollection[0].UserId;
                    isFilter = this.filterIds(delIds, currentId);
                    if (isFilter)
                    {
                        if (string.IsNullOrEmpty(flag))
                            flag = "2";
                        else
                            flag = flag + "2";
                    }
                }
                if (delIds.Count == 0)
                {
                    if (string.IsNullOrEmpty(flag))
                        flag = "3";
                    else
                        flag = flag + "3";
                }
                else
                {
                    int[] ids = delIds.ToArray();
                    userCollection.DeleteByUserIds(ids);
                    HistoryCollection historyCollection = new HistoryCollection();
                    historyCollection.DeleteByUserIds(ids);

                    string condition = PageManageTaskUtility.CurrentExpVal();
                    userCollection.PageSize = 6;
                    userCollection.FillByCondition(condition);
                    if (pageNo > userCollection.PageCount)
                        pageNo = userCollection.PageCount;
                    userCollection.AbsolutePage = pageNo;
                    userCollection.IsReturnDataTable = true;
                    userCollection.FillByCondition(condition);

                    response.Append(ActionTaskUtility.ReturnClientDataArray(userCollection.GetFillDataTable()));
                    flag = flag + "|" + userCollection.PageCount;
                }
                result.IsSuccess = true;
                response.Append(string.Format("TmpStr='{0}';", flag));
                result.ResponseData = response.ToString();
                return result;
            }