Exemple #1
0
        protected void Egv_RowCommand(object sender, CommandEventArgs e)
        {
            int adminId = DataConverter.CLng(e.CommandArgument);

            if (string.Compare("ModifyAdmin", e.CommandName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                BasePage.ResponseRedirect("Administrator.aspx?Action=Modify&AdminId=" + adminId);
            }
            if (string.Compare("DeleteAdmin", e.CommandName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (PEContext.Current.Admin.AdministratorInfo.AdminId == adminId)
                {
                    AdminPage.WriteErrMsg("不能删除自己!", "AdministratorManage.aspx");
                }
                else
                {
                    Administrators.Delete(adminId);
                    AdminPage.WriteSuccessMsg("删除管理员成功!", "AdministratorManage.aspx");
                }
            }
            if (string.Compare("LockAdmin", e.CommandName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                AdministratorInfo administratorByAdminId = Administrators.GetAdministratorByAdminId(adminId);
                administratorByAdminId.IsLock = !administratorByAdminId.IsLock;
                Administrators.Update(administratorByAdminId);
                this.Egv.DataBind();
            }
        }