protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string Opera = Request.QueryString["Opera"]; if (Opera == "Edit") { string DId = Request.QueryString["DId"]; MeetingModel.Department dept = meetingbll.GetDepartmentInfo(DId); Txtdept_id.Text = dept.dept_id; Txtdept_name.Text = dept.dept_name; } } }
protected void btnSave_Click(object sender, EventArgs e) { MeetingsBLL meetingbll = new MeetingsBLL(); string Opera = Request.QueryString["Opera"]; if (CheckValue()) { if (Opera == "Add") { //新增子管理员 MeetingModel.Department dept = new MeetingModel.Department(); dept.dept_id = Txtdept_id.Text; dept.dept_name = Txtdept_name.Text; if (meetingbll.AddDepartment(dept) > 0) { Response.Write("<script>alert('添加成功')</script>"); } else { Response.Write("<script>alert('添加失败')</script>"); } } else { //更改子管理员信息 string DId = Request.QueryString["DId"]; MeetingModel.Department dept = meetingbll.GetDepartmentInfo(DId); dept.dept_id = Txtdept_id.Text; dept.dept_name = Txtdept_name.Text; if (meetingbll.UpdateDepartment(dept) > 0) { Response.Write("<script>alert('修改成功')</script>"); } else { Response.Write("<script>alert('修改失败')</script>"); } } } }