/// <summary> /// 验证输入 /// </summary> /// <returns></returns> private bool validateInput() { if (EmptyUtils.EmptyObj(cboLeaveType.SelectedValue)) { MessageBoxEx.Show(this, "请选择请假类型"); cboLeaveType.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtLeaveDay.Text)) { MessageBoxEx.Show(this, "请输入请假天数"); txtLeaveDay.Focus(); return(false); } if (EmptyUtils.IsNaN(txtLeaveDay.Text)) { MessageBoxEx.Show(this, "请假天数格式不合法,请输入数字。"); txtLeaveDay.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtCause.Text)) { MessageBoxEx.Show(this, "请输入请假原因"); txtCause.Focus(); return(false); } return(true); }
/// <summary> /// 验证输入 /// </summary> /// <returns></returns> private bool validateInput() { if (EmptyUtils.EmptyObj(cboEmp.SelectedValue)) { MessageBoxEx.Show(this, "请选择员工"); cboEmp.Focus(); return(false); } if (EmptyUtils.EmptyStr(dtSTime.Text)) { MessageBoxEx.Show(this, "请选择合同开始时间。"); txtSalary.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtProbation.Text)) { MessageBoxEx.Show(this, "请输入试用期"); txtProbation.Focus(); return(false); } if (EmptyUtils.IsNaN(txtProbation.Text)) { MessageBoxEx.Show(this, "试用期格式不正确,请重新输入。"); txtProbation.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtSalary.Text)) { MessageBoxEx.Show(this, "请输入工资"); txtSalary.Focus(); return(false); } if (EmptyUtils.IsNaN(txtSalary.Text)) { MessageBoxEx.Show(this, "试用期格式不正确,请重新输入。"); txtSalary.Focus(); return(false); } if (EmptyUtils.EmptyStr(dtETime.Text)) { MessageBoxEx.Show(this, "请选择合同结束时间。"); txtSalary.Focus(); return(false); } DateTime sDt = Convert.ToDateTime(dtSTime.Text); DateTime eDt = Convert.ToDateTime(dtETime.Text); if (DateTime.Compare(sDt, eDt) > 0) { MessageBoxEx.Show(this, "合同开始时间不能大于合同结束时间。"); dtSTime.Focus(); return(false); } return(true); }
/// <summary> /// 验证输入 /// </summary> /// <returns></returns> private bool validateInput() { if (EmptyUtils.EmptyStr(txtName.Text)) { MessageBoxEx.Show(this, "请输入姓名"); txtName.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboSex.SelectedValue)) { MessageBoxEx.Show(this, "请选择性别"); cboSex.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboPo.SelectedValue)) { MessageBoxEx.Show(this, "请选择政治面貌"); cboPo.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboEdu.SelectedValue)) { MessageBoxEx.Show(this, "请选择学历"); cboEdu.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboEdu.SelectedValue)) { MessageBoxEx.Show(this, "请选择学历"); cboEdu.Focus(); return(false); } if (EmptyUtils.EmptyStr(dtTime.Text)) { MessageBoxEx.Show(this, "请选择毕业时间"); dtTime.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtPhone.Text)) { MessageBoxEx.Show(this, "请输入电话号码"); txtPhone.Focus(); return(false); } if (EmptyUtils.IsNaN(txtPhone.Text)) { MessageBoxEx.Show(this, "电话号码格式不正确"); txtPhone.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtIdCard.Text)) { MessageBoxEx.Show(this, "请输入身份证号码"); txtIdCard.Focus(); return(false); } if (txtIdCard.Text.Length != 18) { MessageBoxEx.Show(this, "身份证号码长度不正确,请输入18位身份证号码。"); txtIdCard.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboDept.SelectedValue)) { MessageBoxEx.Show(this, "请选择部门"); cboDept.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboJob.SelectedValue)) { MessageBoxEx.Show(this, "请选择职位"); cboJob.Focus(); return(false); } return(true); }