private void btAdminConfirm_Click(object sender, EventArgs e) { if (tbAdminID.Text.Trim() == "" || tbAdminPasswd.Text.Trim() == "") { MessageBox.Show("输入信息不完整!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); flag = 1; } if (flag == 0) { Maticsoft.BLL.Admin adm = new BLL.Admin(); string string1 = string.Format("userID = '{0}' and passwd = '{1}'", tbAdminID.Text.Trim(), tbAdminPasswd.Text.Trim()); string str2 = string.Format("{0}", tbAdminID.Text.Trim()); if (adm.GetRecordCount(string1) > 0) { if (adm.Delete(str2) == true) { MessageBox.Show("删除成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("删除失败!"); } } else { MessageBox.Show("身份验证错误!", "删除出错", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
protected void LbDel_Click(object sender, EventArgs e) { string id = (sender as LinkButton).CommandArgument.ToString(); bllAdmin.Delete(int.Parse(id)); //DataInfoBind(); Response.Redirect("AdminList.aspx"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string id = this.GridView1.DataKeys[e.RowIndex].Value.ToString(); if (this.IsAllowDelete(id)) { blladmin.Delete(Convert.ToInt32(id)); this.BindData(); } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "alertNotDelete", "alert('不允许删除改用户,必须存在一个超级管理员!')", true); } }