protected void ImageButton_delete_Click(object sender, ImageClickEventArgs e) { ImageButton imageButton = sender as ImageButton; string id = imageButton.CommandArgument; StaffBLL staffBLL = new StaffBLL(); UserBLL userBLL = new UserBLL(); Staff staff = staffBLL.get(id); User user = userBLL.get(staff.UserId); staffBLL.delete(staff); userBLL.delete(user); Response.Write("<script>alert('删除成功!');location.href='showStaffs.aspx';</script>"); }
private void bind() { string id = Request.QueryString["id"].ToString(); StaffBLL staffBLL = new StaffBLL(); staff = staffBLL.get(id); UserBLL userBLL = new UserBLL(); User user = userBLL.get(staff.UserId); TextBox_username.Text = user.UserName; TextBox_name.Text = staff.Name; if (staff.Gender.Equals("女")) RadioButton_female.Checked = true; PageUtil.bindDropDownList(DropDownList_yearPart1, staff.Birth[0].ToString()); PageUtil.bindDropDownList(DropDownList_yearPart2, staff.Birth[1].ToString()); PageUtil.bindDropDownList(DropDownList_yearPart3, staff.Birth[2].ToString()); PageUtil.bindDropDownList(DropDownList_yearPart4, staff.Birth[3].ToString()); PageUtil.bindDropDownList(DropDownList_month, staff.Birth.Substring(4, 2)); TextBox_phone.Text = staff.Phone; PageUtil.bindDropDownList(DropDownList_type, staff.Type); }