protected override ActionResult DoTask(string data) { string[] param = StringUtility.Split(data, "%27"); string usernum = Escape.JsUnEscape(param[0]); string username = Escape.JsUnEscape(param[1]); string password = EncryptMD5.MD5to16Code(Escape.JsUnEscape(param[2])); UserLevelType usertype = (UserLevelType)int.Parse(Escape.JsUnEscape(param[3])); UserEntity entity = new UserEntity(); if (usertype == UserLevelType.Student) { entity.FillIdentityStudentUserId(); } else { entity.UserNo = usernum; entity.FillByUserNo(); if (entity.EntityState == DataFrameworkLibrary.Core.EntityState.Inserted) throw new ActionParseException("系统中已存在相同编号的用户<br>请更换别的编号"); } entity.UserName = username; entity.Password = password; entity.UserLevel = usertype; entity.IsLogin = false; entity.DoTest = true; entity.Save(); UserCollection collection = new UserCollection(); collection.PageSize = 6; collection.AbsolutePage = 1; collection.IsReturnDataTable = true; collection.Fill(); ActionResult result = new ActionResult(); result.IsSuccess = true; StringBuilder response = new StringBuilder(); response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable())); response.Append(string.Format("TmpStr={0};", collection.PageCount)); result.ResponseData = response.ToString(); return result; }
protected override ActionResult DoTask(string data) { string pageNoStr = Request.QueryString["pagenum"]; int pageNo = 0; if (!int.TryParse(pageNoStr, out pageNo)) pageNo = 0; string condition = PageManageTaskUtility.ParseExpVal("0", ""); UserCollection userCollection = new UserCollection(); if (pageNo == 0) { userCollection.PageSize = 0; userCollection.IsReturnDataTable = true; userCollection.FillByCondition(condition); } else { userCollection.PageSize = 6; userCollection.FillByCondition(condition); if (pageNo > userCollection.PageCount) pageNo = userCollection.PageCount; userCollection.AbsolutePage = pageNo; userCollection.IsReturnDataTable = true; userCollection.FillByCondition(condition); } ActionResult result = new ActionResult(); StringBuilder response = new StringBuilder(); response.Append(ActionTaskUtility.ReturnClientDataArray(userCollection.GetFillDataTable())); response.Append(string.Format("TmpStr={0};", userCollection.PageCount)); result.IsSuccess = true; result.ResponseData = response.ToString(); return result; }
protected override ActionResult DoTask(string data) { string sign = Request.QueryString["sign"]; string condition = PageManageTaskUtility.ParseExpVal(sign, data); UserCollection collection = new UserCollection(); collection.PageSize = 6; collection.AbsolutePage = 1; collection.IsReturnDataTable = true; collection.FillByCondition(condition); ActionResult result = new ActionResult(); StringBuilder response = new StringBuilder(); response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable())); response.Append(string.Format("TmpStr={0};", collection.PageCount)); result.IsSuccess = true; result.ResponseData = response.ToString(); return result; }
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; }