protected void RecoveryButton_Click(object sender, EventArgs e) { base.CheckAdminPower("RecoveryUser", PowerCheckType.Single); string intsForm = RequestHelper.GetIntsForm("SelectID"); if (intsForm != string.Empty) { UserBLL.ChangeUserStatus(intsForm, (int)UserState.Normal); TestPaperBLL.RecoveryPaperByUserID(intsForm); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("RecoveryRecord"), ShopLanguage.ReadLanguage("User"), intsForm); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("RecoveryRecord"), ShopLanguage.ReadLanguage("TestPaperRecord"), intsForm); ScriptHelper.Alert(ShopLanguage.ReadLanguage("RecoveryOK"), RequestHelper.RawUrl); } }
protected void SubmitButton_Click(object sender, EventArgs e) { string text = this.UserName.Text; int queryString = RequestHelper.GetQueryString <int>("ID"); int groupID = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "GroupID"); int oldCompanyID = int.MinValue; int oldStudyPostID = int.MinValue; UserInfo user = new UserInfo(); if (queryString > 0) { user = UserBLL.ReadUser(queryString); oldCompanyID = user.CompanyID; oldStudyPostID = user.StudyPostID; } else { Regex regex = new Regex("^([a-zA-Z0-9_一-龥])+$"); if (!regex.IsMatch(text)) { ScriptHelper.Alert("用户名只能包含字母、数字、下划线、中文", RequestHelper.RawUrl); } user.UserPassword = StringHelper.Password(this.UserPassword.Text, (PasswordType)ShopConfig.ReadConfigInfo().PasswordType); } user.ID = queryString; companyID = RequestHelper.GetForm <int>("CompanyID"); if (companyID < 0) { ScriptHelper.Alert("请选择公司"); } user.CompanyID = companyID; user.RealName = RealName.Text; user.UserName = text; user.GroupID = groupID; if (user.GroupID <= 0) { ScriptHelper.Alert("请选择管理组"); } user.Email = this.Email.Text; user.Sex = Convert.ToInt32(this.Sex.Text); user.Tel = this.Tel.Text; user.Mobile = this.Mobile.Text; //验证手机号码是否存在 //if (UserBLL.IsExistMobile(user.Mobile, user.ID)) // ScriptHelper.Alert("手机号码已存在"); user.RegisterDate = RequestHelper.DateNow; user.LastLoginDate = RequestHelper.DateNow; user.FindDate = RequestHelper.DateNow; //判断是否需要恢复考试记录 bool isRecoveryTestPaper = false; int userState = Convert.ToInt32(this.Status.Text); if (user.Status == (int)UserState.Del && userState != (int)UserState.Del) { isRecoveryTestPaper = true; } user.Status = userState; string department = this.Department.SelectedValue; user.Department = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "Department"); if (user.Department <= 0) { ScriptHelper.Alert("请选择部门"); } user.WorkingPostID = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "PostList"); if (user.WorkingPostID <= 0) { ScriptHelper.Alert("请选择工作岗位"); } user.PostName = this.PostName.Text; user.StudyPostID = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "StudyPostId"); if (user.StudyPostID <= 0) { ScriptHelper.Alert("请选择学习岗位"); } //user.Introduce = this.Introduce.Text; //user.Photo = this.Photo.Text; //user.MSN = this.MSN.Text; //user.QQ = this.QQ.Text; //user.RegionID = this.UserRegion.ClassID; //user.Address = this.Address.Text; //user.Birthday = this.Birthday.Text; string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (user.ID == -2147483648) { user.PostStartDate = RequestHelper.DateNow; base.CheckAdminPower("AddUser", PowerCheckType.Single); if (UserBLL.IsUserNumOverflow(user.CompanyID)) { ScriptHelper.Alert("超过用户数量,暂不能添加!"); } int id = UserBLL.AddUser(user); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("User"), id); } else { base.CheckAdminPower("UpdateUser", PowerCheckType.Single); if (!string.IsNullOrEmpty(PostStartDate.Text)) { user.PostStartDate = Convert.ToDateTime(PostStartDate.Text); } //变换学习岗位,如果岗位已通过则更新注册时间,以便岗位计划按新时间重新计数,否则不更改原有岗位计划统计时间 PostInfo studyPost = PostBLL.ReadPost(user.StudyPostID); PostInfo oldStudyPost = PostBLL.ReadPost(oldStudyPostID); if (oldCompanyID != user.CompanyID || (user.StudyPostID != oldStudyPostID && (studyPost.ParentId == 3 || oldStudyPost.ParentId == 3) && studyPost.ParentId != oldStudyPost.ParentId)) { if (user.PostStartDate < DateTime.Today) { user.PostStartDate = DateTime.Today; } } UserBLL.UpdateUser(user); if (isRecoveryTestPaper) { TestPaperBLL.RecoveryPaperByUserID(user.ID.ToString()); } //如果公司ID更改,相应修改成绩列表 //if (oldCompanyID != user.CompanyID) //{ // TestPaperBLL.UpdatePaperCompanyId(user.ID, user.CompanyID); //} AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("User"), user.ID); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl); }
protected override void PageLoad() { base.PageLoad(); base.Title = "т╠╧╓ап╠М"; this.dt = UserBLL.CompanyIndexStatistics(base.UserCompanyID); this.currentCompany = CompanyBLL.ReadCompany(base.UserCompanyID); string companyPostSetting = CookiesHelper.ReadCookieValue("UserCompanyPostSetting"); workingPostList = PostBLL.ReadPostListByPostId(companyPostSetting); string action = RequestHelper.GetQueryString <string>("Action"); if (!string.IsNullOrEmpty(action)) { string selectID = RequestHelper.GetQueryString <string>("SelectID"); if (!string.IsNullOrEmpty(selectID)) { string alertMessage = string.Empty; if (action == "Delete") { base.CheckUserPower("DeleteUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Del); TestPaperBLL.DeletePaperByUserID(selectID); alertMessage = ShopLanguage.ReadLanguage("DeleteOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("User"), selectID); } else if (action == "Freeze") { base.CheckUserPower("FreezeUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Frozen); TestPaperBLL.DeletePaperByUserID(selectID); alertMessage = ShopLanguage.ReadLanguage("FreezeOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("FreezeRecord"), ShopLanguage.ReadLanguage("User"), selectID); } else if (action == "UnFreeze") { base.CheckUserPower("UnFreezeUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Normal); TestPaperBLL.RecoveryPaperByUserID(selectID); alertMessage = ShopLanguage.ReadLanguage("UnFreezeOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UnFreezeRecord"), ShopLanguage.ReadLanguage("User"), selectID); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("RecoveryRecord"), ShopLanguage.ReadLanguage("TestPaperRecord"), selectID); } else if (action == "Free") { base.CheckUserPower("FreezeUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Free); alertMessage = ShopLanguage.ReadLanguage("FreeOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("FreeRecord"), ShopLanguage.ReadLanguage("User"), selectID); } ScriptHelper.Alert(alertMessage, Request.UrlReferrer.ToString()); } } else { base.CheckUserPower("ReadUser", PowerCheckType.Single); UserSearchInfo userSearch = new UserSearchInfo(); if (companyID > 0) { userSearch.InCompanyID = companyID.ToString(); } else { userSearch.InCompanyID = base.SonCompanyID; } //userSearch.OutUserID = base.UserID.ToString(); userSearch.UserName = RequestHelper.GetQueryString <string>("UserId"); userSearch.RealName = RequestHelper.GetQueryString <string>("RealName"); userSearch.Email = RequestHelper.GetQueryString <string>("Email"); userSearch.Mobile = RequestHelper.GetQueryString <string>("Mobile"); userSearch.InWorkingPostID = RequestHelper.GetQueryString <string>("WorkingPostID"); if (state < 0) { state = (int)UserState.Normal; } //userSearch.Status = state; if (state == (int)UserState.Free) { userSearch.InStatus = string.Concat(state, ",", (int)UserState.Other); } else { userSearch.Status = state; } //userSearch.GroupId = 36; //userSearch.Sex = RequestHelper.GetQueryString<int>("Sex"); //userSearch.StartRegisterDate = RequestHelper.GetQueryString<DateTime>("StartRegisterDate"); //userSearch.EndRegisterDate = ShopCommon.SearchEndDate(RequestHelper.GetQueryString<DateTime>("EndRegisterDate")); //if (UserDel > 0) user.Del = UserDel; userList = UserBLL.SearchUserList(base.CurrentPage, base.PageSize, userSearch, ref this.Count); base.BindPageControl(ref base.CommonPager); } }