コード例 #1
0
        protected void CompleteClick(object sender, EventArgs e)
        {
            ExamSignSystemEntity.Student student = new ExamSignSystemEntity.Student();
            StudentMgr mgr   = new StudentMgr();
            string     stuNo = ContextObjects.CurrentStudent.stuNo;

            student.stuMobile    = this.txtMobile.Value.Trim();
            student.stuEmail     = this.inputEmail.Value.Trim();
            student.stuPolitical = this.txtPolitical.Value.Trim();
            student.stuAddress   = this.txtAddress.Value.Trim();
            if (student.stuMobile == "" || student.stuEmail == "")
            {
                Response.Write("<script>alert('手机号或者电子邮箱不能为空!');</script>");
            }
            else
            {
                Regex regex = new Regex("^1[34578]\\d{9}$");
                if (regex.IsMatch(student.stuMobile))
                {
                    mgr.UpdateStudent(stuNo, student);
                    Response.Write("<script>alert('信息已完善!');</script>");
                }
                else
                {
                    Response.Write("<script>alert('手机号码的格式不正确!');</script>");
                }
            }
        }
コード例 #2
0
        //修改
        protected void ModifySign_Click(object sender, EventArgs e)
        {
            StudentMgr mgr = new StudentMgr();

            ExamSignSystemEntity.Student student = new ExamSignSystemEntity.Student();
            student.stuName   = this.txtName.Value.Trim();
            student.stuMajor  = this.txtMajor.Value.Trim();
            student.stuClass  = this.txtClass.Value.Trim();
            student.stuMobile = this.txtMobile.Value.Trim();
            if (this.txtName.Value.Trim() == "" || this.txtMajor.Value.Trim() == "" || this.txtClass.Value.Trim() == "" || this.txtMobile.Value.Trim() == "")
            {
                Response.Write("<script>alert('请将信息填写完整!');</script>");
            }
            else
            {
                Regex regex = new Regex("^1[34578]\\d{9}$");
                if (regex.IsMatch(student.stuMobile))
                {
                    mgr.UpdateSign(ContextObjects.CurrentStudent.stuNo, student);
                    Response.Write("<script>alert('修改成功!');</script>");
                }
                else
                {
                    Response.Write("<script>alert('手机号码的格式不正确!');</script>");
                }
            }
        }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         StudentMgr mgr = new StudentMgr();
         ExamSignSystemEntity.Student student = mgr.ShowStudentInfo(ContextObjects.CurrentStudent.stuNo);
         this.stuName.InnerText    = student.stuName;
         this.stuSex.InnerText     = student.stuSex;
         this.stuAddress.InnerText = student.stuAddress;
         this.stuEmail.InnerText   = student.stuEmail;
         this.stuMobile.InnerText  = student.stuMobile;
     }
 }
コード例 #4
0
        public static int FindPwd(string stuSno, string stuEmail)
        {
            StudentMgr mgr = new StudentMgr();

            ExamSignSystemEntity.Student student = mgr.CheckEmail(stuSno, stuEmail);
            if (student != null)
            {
                MailFindPwd mail      = new MailFindPwd();
                DateTime    time      = DateTime.Now;
                Boolean     bl        = mail.SendEmail(stuEmail, "找回密码", "亲爱的" + stuEmail + ":<br/>您在" + time + "提交了找回密码请求,系统为您的学号" + stuSno + "重置了密码。<br/>重置密码为123456");
                MD5Encrypt  MD5       = new MD5Encrypt();
                string      stuNewPwd = MD5.GetMD5("123456");
                mgr.UpdateStudentPassword(stuSno, stuNewPwd);
                return(1);
            }
            else
            {
                return(0);
            }
        }
コード例 #5
0
        protected void Query_Click(object sender, EventArgs e)
        {
            string stuSno = this.txtGradeSno.Value.Trim();
            string Pwd    = this.txtGradePwd.Value.Trim();

            if (stuSno == "" || Pwd == "")
            {
                this.hintGrade.InnerHtml = "学号或者密码不能为空!";
            }
            else
            {
                MD5Encrypt MD5    = new MD5Encrypt();
                string     stuPwd = MD5.GetMD5(Pwd);
                StudentMgr mgr    = new StudentMgr();
                ExamSignSystemEntity.Student student = mgr.Login(stuSno, stuPwd);
                if (student != null)
                {
                    GradeMgr     grade = new GradeMgr();
                    List <Grade> list  = grade.ShowGradeList(stuSno);
                    if (list != null)
                    {
                        this.showGrade.Attributes.Add("style", "display:block");
                        this.Repeater1.DataSource = list;
                        this.Repeater1.DataBind();
                        this.hintGrade.InnerHtml = "";
                    }
                    else
                    {
                        this.hintGrade.InnerHtml = "可能没有考试!";
                        this.showGrade.Attributes.Add("style", "display:none");
                    }
                }
                else
                {
                    this.hintGrade.InnerHtml = "账号或者密码输入错误!";
                    this.showGrade.Attributes.Add("style", "display:none");
                }
            }
        }
コード例 #6
0
        protected void SureModify_Click(object sender, EventArgs e)
        {
            StudentMgr mgr = new StudentMgr();

            ExamSignSystemEntity.Student student = new  ExamSignSystemEntity.Student();
            student.stuName    = this.txtName.Value.Trim();
            student.stuSex     = this.txtSex.Value.Trim();
            student.stuAddress = this.txtAddress.Value.Trim();
            student.stuEmail   = this.email.Value.Trim();
            student.stuMobile  = this.txtMobile.Value.Trim();
            if (this.txtName.Value.Trim() == "" || this.txtSex.Value.Trim() == "" || this.txtAddress.Value.Trim() == "" || this.email.Value.Trim() == "" || this.txtMobile.Value.Trim() == "")
            {
                Response.Write("<script>alert('请将信息填写完整!');</script>");
            }
            else
            {
                //判断邮箱
                string emailPattern = @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
                Regex  emailEegex   = new Regex(emailPattern);
                if (emailEegex.IsMatch(student.stuEmail))
                {
                    //判断手机号
                    Regex regex = new Regex("^1[34578]\\d{9}$");
                    if (regex.IsMatch(student.stuMobile))
                    {
                        mgr.UpdateStudent(ContextObjects.CurrentStudent.stuNo, student);
                        Response.Write("<script>alert('修改成功!');</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('手机号码的格式不正确!');</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('邮箱的格式不正确!');</script>");
                }
            }
        }
コード例 #7
0
        protected void Sure_Click(object sender, EventArgs e)
        {
            string     newPwd  = this.newPassword.Value.Trim();
            string     surePwd = this.surePassword.Value.Trim();
            StudentMgr mgr     = new StudentMgr();
            string     stuNo   = ContextObjects.CurrentStudent.stuNo;

            if (newPwd == "" || surePwd == "")
            {
                Response.Write("<script>alert('新密码不能为空!');</script>");
            }
            else if (newPwd != surePwd)
            {
                Response.Write("<script>alert('两次输入的密码不一样!');</script>");
            }
            else
            {
                MD5Encrypt MD5    = new MD5Encrypt();
                string     stuPwd = MD5.GetMD5(newPwd);
                mgr.UpdateStudentPassword(stuNo, stuPwd);
                Response.Write("<script>alert('密码已修改,请记住修改后的密码!');</script>");
            }
        }
コード例 #8
0
        //学生登录
        protected void LoginClick(object sender, EventArgs e)
        {
            string     stuSno = this.txtSno.Value.Trim();
            string     Pwd    = this.stuPwd.Value.Trim();
            MD5Encrypt MD5    = new MD5Encrypt();
            string     stuPwd = MD5.GetMD5(Pwd);
            //隐藏框的值
            string hint = this.ps.Value.Trim();

            if (Session["CheckCode"] != null && hint == "")
            {
                //这样写可以不能区分大小写
                if (Session["CheckCode"].ToString().ToUpper() == this.txtVerificate.Value.Trim().ToString().ToUpper())
                {
                    StudentMgr mgr = new StudentMgr();
                    ExamSignSystemEntity.Student student = mgr.Login(stuSno, stuPwd);
                    if (student != null)
                    {
                        // 把当前用户保存下来
                        ContextObjects.CurrentStudent = student;
                        Response.Redirect("../Main/Operate.aspx", true);
                    }
                    else
                    {
                        string sp = "账号或密码错误";
                        this.hint.InnerHtml      = sp;
                        this.txtVerificate.Value = "";
                    }
                }
                else
                {
                    this.hint.InnerHtml      = "验证码错误";
                    this.txtVerificate.Value = "";
                }
            }
            else if (Session["CheckCode"] != null && hint != "")
            {
                string stuPassword = this.stuPwd.Value.Trim();
                //这样写可以不能区分大小写
                if (Session["CheckCode"].ToString().ToUpper() == this.txtVerificate.Value.Trim().ToString().ToUpper())
                {
                    StudentMgr mgr = new StudentMgr();
                    ExamSignSystemEntity.Student student = mgr.Login(stuSno, stuPassword);
                    if (student != null)
                    {
                        // 把当前用户保存下来
                        ContextObjects.CurrentStudent = student;
                        Response.Redirect("../Main/Operate.aspx", true);
                    }
                    else
                    {
                        string sp = "账号或密码错误";
                        this.hint.InnerHtml      = sp;
                        this.txtVerificate.Value = "";
                    }
                }
                else
                {
                    this.hint.InnerHtml      = "验证码错误";
                    this.txtVerificate.Value = "";
                }
            }
        }