protected void ImageButton_submit_Click(object sender, ImageClickEventArgs e) { if (check()) { TeacherBLL teachBLL = new TeacherBLL(); string name = TextBox_name.Text.Trim(); string gender = RadioButton_male.Checked ? "男" : "女"; string birth = DropDownList_yearPart1.SelectedValue + DropDownList_yearPart2.SelectedValue + DropDownList_yearPart3.SelectedValue + DropDownList_yearPart4.SelectedValue; birth += DropDownList_month.SelectedValue; string title = DropDownList_title.SelectedValue; string phone = TextBox_phone.Text.Trim(); string email = TextBox_email.Text.Trim(); if (!teacher.Title.Equals(title)) { UserBLL userBLL = new UserBLL(); User user = userBLL.get(teacher.UserID); user.Type = title.Equals("辅导员") ? "2" : "1"; userBLL.update(user); } teacher.Name = name; teacher.Gender = gender; teacher.Birth = birth; teacher.Title = title; teacher.Phone = phone; teacher.Email = email; teachBLL.update(teacher); Response.Write("<script>alert('修改成功!');location.href='showTeachers.aspx';</script>"); } }
protected void ImageButton_submit_Click(object sender, ImageClickEventArgs e) { if (check()) { StaffBLL staffBLL = new StaffBLL(); UserBLL userBLL = new UserBLL(); string username = TextBox_username.Text.Trim(); string name = TextBox_name.Text.Trim(); string gender = RadioButton_male.Checked ? "男" : "女"; string birth = DropDownList_yearPart1.SelectedValue + DropDownList_yearPart2.SelectedValue + DropDownList_yearPart3.SelectedValue + DropDownList_yearPart4.SelectedValue; birth += DropDownList_month.SelectedValue; string phone = TextBox_phone.Text.Trim(); string type = DropDownList_type.SelectedValue; User user = userBLL.get(staff.UserId); if (!user.UserName.Equals(username) || !staff.Type.Equals(type)) { user.UserName = username; user.Type = type.Equals("考勤维护员") ? "6" : "5"; userBLL.update(user); } staff.Name = name; staff.Gender = gender; staff.Birth = birth; staff.Phone = phone; staff.Type = type; staffBLL.update(staff); Response.Write("<script>alert('修改成功!');location.href='showStaffs.aspx';</script>"); } }
protected void ImageButton_delete_Click(object sender, ImageClickEventArgs e) { ImageButton imageButton = sender as ImageButton; string id = imageButton.CommandArgument; TeacherBLL teachBLL = new TeacherBLL(); UserBLL userBLL = new UserBLL(); Teacher teacher = teachBLL.get(id); User user = userBLL.get(teacher.UserID); teachBLL.delete(teacher); userBLL.delete(user); Response.Write("<script>alert('删除成功!');location.href='showTeachers.aspx';</script>"); }
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); }
protected void ImageButton_delete_Click(object sender, ImageClickEventArgs e) { ImageButton imageButton = sender as ImageButton; string id = imageButton.CommandArgument; ClassBLL classBLL = new ClassBLL(); StudentBLL stuBLL = new StudentBLL(); UserBLL userBLL = new UserBLL(); Student stu = stuBLL.get(id); User user = userBLL.get(stu.UserID); stuBLL.delete(stu); userBLL.delete(user); Class clazz = classBLL.get(stu.ClassID); clazz.StudCount = (Convert.ToInt32(clazz.StudCount) - 1).ToString(); classBLL.update(clazz); Response.Write("<script>alert('删除成功!');location.href='showStudents.aspx';</script>"); }