/// <summary> /// 修改或删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void GVinfo_RowCommand(object sender, GridViewCommandEventArgs e) { int Id = 0; // 保存ID int theRow = 0; // 保存行号 string theCol = ""; // 保存列位置信息 theRow = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; theCol = e.CommandName.ToString(); Id = Convert.ToInt32(GVinfo.DataKeys[theRow].Value); BLL.CMS_AdminUser bau = new BLL.CMS_AdminUser(); switch (e.CommandName) { case "MyDel": bau.Delete(Id); break; // 删除操作 case "MyUp": { Model.CMS_AdminUser user = new Model.CMS_AdminUser(); user = bau.GetModel(Id); Panel1.Visible = true; tbUserName.Text = user.Name; ddlRole.SelectedValue = user.RoleId.ToString(); break; } } Flush(); }
protected void tbLogin_Click(object sender, EventArgs e) { BLL.CMS_AdminUser bau = new BLL.CMS_AdminUser(); string code = tbx_yzm.Text; HttpCookie htco = Request.Cookies["ImageV"]; string scode = htco.Value.ToString(); if (code != scode) { Response.Write("<script>alert('验证码输入不正确!')</script>"); } else { CMS_AdminUser admin = bau.GetModel(tbAdmName.Text); if (admin == null) { lbWarningName.Text = "用户不存在"; return; } else { lbWarningName.Text = ""; } if (admin.Pwd != FormsAuthentication.HashPasswordForStoringInConfigFile(tbAdmPwd.Text, "MD5")) { lbWarningPwd.Text = "密码错误"; return; } else { lbWarningPwd.Text = ""; } CMS_AdminUser.CurrentAdmin = admin; Response.Redirect("Index.aspx"); } }