private void Delete(HttpContext context) { int value = base.GetIntParam(context, "managerId", false).Value; if (value <= 0) { throw new HidistroAshxException("错误的参数"); } SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (HiContext.Current.Manager.ManagerId == value) { throw new HidistroAshxException("不能删除自己"); } ManagerInfo manager = Users.GetManager(value); if (manager != null && manager.UserName.ToLower() == "admin" && masterSettings.IsDemoSite) { throw new HidistroAshxException("演示站点,不能删除超级管理员账号"); } if (!ManagerHelper.Delete(manager.ManagerId)) { throw new HidistroAshxException("未知错误"); } base.ReturnSuccessResult(context, "成功删除了一个管理员", 0, true); }
private void grdManager_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { int num = (int)this.grdManager.DataKeys[e.RowIndex].Value; if (Hidistro.Membership.Context.HiContext.Current.User.UserId == num) { this.ShowMsg("不能删除自己", false); return; } Hidistro.Membership.Context.SiteManager manager = ManagerHelper.GetManager(num); if (!ManagerHelper.Delete(manager.UserId)) { this.ShowMsg("未知错误", false); return; } this.BindData(); this.ShowMsg("成功删除了一个供应商", true); }
private void grdManager_RowDeleting(object sender, GridViewDeleteEventArgs e) { int userId = (int)this.grdManager.DataKeys[e.RowIndex].Value; if (HiContext.Current.User.UserId == userId) { this.ShowMsg("不能删除自己", false); } else if (!ManagerHelper.Delete(ManagerHelper.GetManager(userId).UserId)) { this.ShowMsg("未知错误", false); } else { this.BindData(); this.ShowMsg("成功删除了一个管理员", true); } }
private void btnRemark_Click(object sender, System.EventArgs e) { string value = this.hid_UserId.Value; if (this.ddl_UserIdList.SelectedValue == value) { this.ShowMsg("不能转移给自己", false); return; } Methods.Supplier_UpdateSupProjectsByUserId(int.Parse(value), int.Parse(this.ddl_UserIdList.SelectedValue), this.ddl_UserIdList.SelectedItem.Text); Hidistro.Membership.Context.SiteManager manager = ManagerHelper.GetManager(int.Parse(value)); if (!ManagerHelper.Delete(manager.UserId)) { this.ShowMsg("未知错误", false); return; } this.BindData(); this.ShowMsg("转移成功", true); }
private void grdManager_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { int num = (int)this.grdManager.DataKeys[e.RowIndex].Value; if (Globals.GetCurrentManagerUserId() == num) { this.ShowMsg("不能删除自己", false); return; } ManagerInfo manager = ManagerHelper.GetManager(num); if (!ManagerHelper.Delete(manager.UserId)) { this.ShowMsg("未知错误", false); return; } this.BindData(); this.ShowMsg("成功删除了一个管理员", true); }
private void grdManager_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { int userId = (int)this.grdManager.DataKeys[e.RowIndex].Value; if (Globals.GetCurrentManagerUserId() == userId) { this.ShowMsg("不能删除自己", false); } else { if (!ManagerHelper.Delete(ManagerHelper.GetManager(userId).UserId)) { this.ShowMsg("未知错误", false); } else { this.BindData(); this.ShowMsg("成功删除了一个管理员", true); } } }