Example #1
0
        private bool ValidateInfo()//验证输入的信息
        {
            bool b = true;

            if (string.IsNullOrWhiteSpace(txtName.Text))
            {
                MessageBox.Show("学号不能为空!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtName.Focus();
                return(false);
            }
            //限定学号必须为5位数字
            if (!ValidataInput.IsSNO(txtName.Text) && rbtnstudent.Checked == true)
            {
                MessageBox.Show("学号为95开头的5位数字!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Information);

                return(false);
            }
            if (!ValidataInput.IsPWD(txtPassword.Text))
            {
                MessageBox.Show("密码为5位数字!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Information);

                return(false);
            }
            if (rbtnmanager.Checked == false && rbtnstudent.Checked == false && rbtnteacher.Checked == false)
            {
                MessageBox.Show("请选择身份信息", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            return(b);
        }
Example #2
0
        private bool ValidateInfo()//验证修改的密码
        {
            bool b = true;

            //限定密码必须为5位数字
            if (!ValidataInput.IsPWD(txtnpd.Text))
            {
                MessageBox.Show("密码必须为5为数字!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            return(b);
        }
Example #3
0
        private bool ValidateInfo()//验证输入的信息
        {
            bool b = true;

            if (string.IsNullOrWhiteSpace(txtJnum.Text))
            {
                MessageBox.Show("工号不能为空!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtName.Focus();
                return(false);
            }
            //限定学号必须为5位数字
            if (!ValidataInput.IsJNum(txtJnum.Text))
            {
                MessageBox.Show("工号为必须为10开头的5位数字!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            return(b);
        }
Example #4
0
        private bool ValidateInfoS()//验证分数
        {
            bool b = true;

            if (!ValidataInput.IsNumber(txtsMark.Text))
            {
                MessageBox.Show("分数必须为数字!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            string markS = txtsMark.Text;
            int    markI = Int32.Parse(markS);

            if (markI > 100 || markI < 0)
            {
                MessageBox.Show("分数必须在0-100之间", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            return(b);
        }
Example #5
0
        private bool ValidataInfo()//信息录入真实性验证
        {
            bool b = true;

            //学号不能为空
            if (string.IsNullOrWhiteSpace(txtSNO.Text))
            {
                MessageBox.Show("学号不能为空!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtSNO.Focus();
                return(false);
            }
            //学号必须为10位数字
            if (!ValidataInput.IsSNo(txtSNO.Text))
            {
                MessageBox.Show("学号必须为16开头十位数字!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtSNO.Focus();
                return(false);
            }
            //学号不能重复
            if (actionFlag == 1)
            {
                if (objStudentService.IsExistSNO(txtSNO.Text.Trim(), objListStudent))
                {
                    MessageBox.Show("该学号已存在!请重新输入", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtSNO.Focus();
                    return(false);
                }
            }
            //姓名不能为空
            if (string.IsNullOrWhiteSpace(txtSName.Text))
            {
                MessageBox.Show("姓名不能为空!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtSName.Focus();
                return(false);
            }
            //姓名必须为汉字
            if (!ValidataInput.IsChinese(txtSName.Text))
            {
                MessageBox.Show("姓名必须为汉字", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtSName.Focus();
                return(false);
            }
            //生日不能晚于当前系统时间
            if (Convert.ToDateTime(dtpBirthdy.Text) > DateTime.Now)
            {
                MessageBox.Show("日期必须小于当前日期!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                dtpBirthdy.Focus();
                return(false);
            }
            //手机号码
            if (!ValidataInput.IsMobileNo(txtMobile.Text))
            {
                MessageBox.Show("手机号必须为11位数字!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtMobile.Focus();
                return(false);
            }
            //邮箱地址
            if (!ValidataInput.IsEMail(txtEmail.Text))
            {
                MessageBox.Show("邮箱格式错误!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtEmail.Focus();
                return(false);
            }

            return(b);
        }