/// <summary> /// 输入的数据检测 /// </summary> /// <returns></returns> bool CheckInfor() { if (string.IsNullOrEmpty(txtName.Text)) { System.Windows.MessageBox.Show("姓名不能为空!"); txtName.Focus(); return(false); } if (string.IsNullOrEmpty(txtAge.Content.ToString())) { System.Windows.MessageBox.Show("年龄不能为空!"); txtAge.Focus(); return(false); } else if (!DataValidata.IsInteger(txtAge.Content.ToString())) { System.Windows.MessageBox.Show("年龄必须是纯数字!"); txtAge.Focus(); return(false); } if (string.IsNullOrEmpty(txtCardNo.Text)) { System.Windows.MessageBox.Show("打卡号不能为空!"); txtCardNo.Focus(); return(false); } if (string.IsNullOrEmpty(txtStuNoId.Text)) { System.Windows.MessageBox.Show("身份证号不能为空!"); txtStuNoId.Focus(); return(false); } if (string.IsNullOrEmpty(txtPhoneNumber.Text)) { System.Windows.MessageBox.Show("联系方式不能为空!"); txtPhoneNumber.Focus(); return(false); } else if (DataValidata.IsPhone(txtPhoneNumber.Text)) { System.Windows.MessageBox.Show("电话号输入错误!"); txtPhoneNumber.Focus(); return(false); } if (DataValidata.Data(Convert.ToInt32(datePkBirthday.Content))) { System.Windows.MessageBox.Show("日期格式错误!"); datePkBirthday.Focus(); return(false); } return(true); }
/// <summary> /// 联系方式判断 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtPhoneNumber_LostFocus(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtPhoneNumber.Text)) { System.Windows.MessageBox.Show("联系方式不能为空!"); txtPhoneNumber.Focus(); } else if (DataValidata.IsPhone(txtPhoneNumber.Text)) { System.Windows.MessageBox.Show("电话号输入错误!"); txtPhoneNumber.Focus(); } }