Пример #1
0
        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>");

            }
        }
Пример #2
0
        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>");

            }
        }
Пример #3
0
        protected void Button_submit_Click(object sender, EventArgs e)
        {
            if (!checkEmpty())
            {
                string oldPSD = TextBox_oldPWD.Text.Trim();
                string newPSD1 = TextBox_newPSD1.Text.Trim();
                string newPSD2 = TextBox_newPSD2.Text.Trim();

                UserBLL userBLL = new UserBLL();

                User user = Session["User"] as User;

                if (newPSD1.Equals(newPSD2))
                {
                    //新密码和确定密码相同的情况

                    //取得加密后的密码
                    string encryptPWD = EncryptUtil.MD5Encrypt(oldPSD);

                    if (!user.Password.Equals(encryptPWD))
                    {
                        //当前密码不匹配的情况

                        checkOldPWD.ErrorMessage = "当前密码输入错误!";
                        checkOldPWD.IsValid = false;

                    }
                    else
                    {
                        user.Password = EncryptUtil.MD5Encrypt(newPSD1);
                        userBLL.update(user);

                        Response.Write("<script>alert('密码修改成功!');location = 'logout.aspx';</script>");
                    }
                }
                else
                {
                    //新密码和确定密码不相同的情况

                    checkNewPWD2.ErrorMessage = "两次输入密码不一致!";
                    checkNewPWD2.IsValid = false;

                }
            }
        }