コード例 #1
0
        /// <summary>
        /// 判断输入的信息是否合理
        /// </summary>
        /// <returns></returns>
        bool CheckInfor()
        {
            if (string.IsNullOrEmpty(textName.Text))
            {
                System.Windows.MessageBox.Show("姓名不能为空!");
                textName.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(textGardNo.Text))
            {
                System.Windows.MessageBox.Show("打卡号不能为空!");
                textGardNo.Focus();
                return(false);
            }

            /*else if (DataValidate.IsInteger(textGardNo.Text.Trim()))
             * {
             *  System.Windows.MessageBox.Show("打卡号必须为纯数字!");
             *  textGardNo.Focus();
             *  return false;
             * }*/
            if (string.IsNullOrEmpty(textstuNub.Text))
            {
                System.Windows.MessageBox.Show("身份证号不能为空!");
                textstuNub.Focus();
                return(false);
            }
            else if (DataValidate.IsIDcard(textstuNub.Text.Trim()))
            {
                System.Windows.MessageBox.Show("请输入正确身份证格式!");
                textstuNub.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(textstuPhon.Text))
            {
                System.Windows.MessageBox.Show("手机号不能为空!");
                textstuPhon.Focus();
                return(false);
            }
            else if (DataValidate.IsPhonenum(textstuPhon.Text.Trim()))
            {
                System.Windows.MessageBox.Show("请输入正确的手机号格式!");
                textstuPhon.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(textstuAddress.Text))
            {
                System.Windows.MessageBox.Show("地址不能为空!");
                textstuAddress.Focus();
                return(false);
            }
            return(true);
        }
コード例 #2
0
 //身份证号失去焦点事件
 private void textstuNub_LostFocus(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(textstuNub.Text.Trim()))
     {
         System.Windows.MessageBox.Show("身份证号不能为空!");
         textstuNub.Focus();
     }
     else if (DataValidate.IsIDcard(textstuNub.Text.Trim()))
     {
         System.Windows.MessageBox.Show("请输入正确身份证格式!");
         textstuNub.Focus();
         return;
     }
     else  //在失去焦点后将生日信息和年龄存入相应框
     {
         dateBirthday.Content = Commmon.GetValueBystuIDcard.GetBirthday(textstuNub.Text.Trim()).ToString("yyyy-MM-dd"); //存储生日
         textAge.Content      = GetValueBystuIDcard.GetAge(
             Commmon.GetValueBystuIDcard.GetBirthday(textstuNub.Text.Trim()));
     }
 }
コード例 #3
0
 /// <summary>
 /// 判断输入的信息是否合理
 /// </summary>
 /// <returns></returns>
 bool CheckInfor()
 {
     if (string.IsNullOrEmpty(textName.Text))
     {
         System.Windows.MessageBox.Show("姓名不能为空!");
         return(false);
     }
     if (string.IsNullOrEmpty(textClockNo.Text))
     {
         System.Windows.MessageBox.Show("打卡号不能为空!");
         return(false);
     }
     if (string.IsNullOrEmpty(textStuNubIDcard.Text))
     {
         System.Windows.MessageBox.Show("身份证号不能为空!");
         return(false);
     }
     else if (DataValidate.IsIDcard(textStuNubIDcard.Text.Trim()))
     {
         System.Windows.MessageBox.Show("请输入正确身份证格式!");
         return(false);
     }
     if (string.IsNullOrEmpty(textPhonNumb.Text))
     {
         System.Windows.MessageBox.Show("手机号不能为空!");
         return(false);
     }
     else if (DataValidate.IsPhonenum(textPhonNumb.Text.Trim()))
     {
         System.Windows.MessageBox.Show("请输入正确的手机号格式!");
         return(false);
     }
     if (string.IsNullOrEmpty(textAdderss.Text))
     {
         System.Windows.MessageBox.Show("地址不能为空!");
         return(false);
     }
     return(true);
 }