/// <summary> /// 验证记录仪系统设置选项卡输入是否正确 /// </summary> private bool ValidateSysSetInput(out string msg) { bool ok; msg = string.Empty; ok = MetarnetRegex.IsTime(txtComTime_T.Text); if (!ok) { txtComTime_T.Focus(); txtComTime_T.SelectAll(); msg = "通讯时间设置错误!"; return(ok); } ok = MetarnetRegex.IsTime(txtRecTime_T.Text); if (!ok) { txtRecTime_T.Focus(); txtRecTime_T.SelectAll(); msg = "记录时间设置错误!"; return(ok); } ok = MetarnetRegex.IsUint(txtLeakValue_T.Text); if (!ok) { txtLeakValue_T.Focus(); txtLeakValue_T.SelectAll(); msg = "报漏幅度值设置错误!"; return(ok); } ok = MetarnetRegex.IsUint(txtConPort_T.Text); if (!ok) { txtConPort_T.Focus(); txtConPort_T.SelectAll(); msg = "远传端口设置错误!"; return(ok); } ok = MetarnetRegex.IsIPv4(txtConAdree_T.Text); if (!ok) { txtConAdree_T.Focus(); txtConAdree_T.SelectAll(); msg = "远传地址设置错误!"; return(ok); } // 通讯时间与记录时间不能重叠 int comTime = Convert.ToInt32(txtComTime_T.Text); int recTime1 = Convert.ToInt32(txtRecTime_T.Text); int recTime2 = Convert.ToInt32(txtRecTime1_T.Text); if (comTime == recTime1 || comTime == recTime2 || (comTime > recTime1 && comTime < recTime2)) { txtComTime_T.Focus(); txtComTime_T.SelectAll(); msg = "通讯时间/记录时间设置重叠!"; return(false); } return(ok); }
/// <summary> /// 验证记录仪管理选项卡输入是否正确 /// </summary> private bool ValidateRecorderManageInput(out string msg) { bool ok; msg = string.Empty; ok = MetarnetRegex.IsTime(txtComTime.Text); if (!ok) { txtComTime.Focus(); txtComTime.SelectAll(); msg = "通讯时间设置错误!"; return(ok); } ok = MetarnetRegex.IsTime(txtRecTime.Text); if (!ok) { txtRecTime.Focus(); txtRecTime.SelectAll(); msg = "记录时间设置错误!"; return(ok); } ok = MetarnetRegex.IsUint(txtLeakValue.Text); if (!ok) { txtLeakValue.Focus(); txtLeakValue.SelectAll(); msg = "报漏幅度值设置错误!"; return(ok); } //if (cbConStart.Checked) //{ // ok = MetarnetRegex.IsUint(txtConId.Text); // if (!ok) // { // txtConId.Focus(); // txtConId.SelectAll(); // msg = "控制器编号设置错误!"; // return ok; // } // ok = MetarnetRegex.IsUint(txtConPort.Text); // if (!ok) // { // txtConPort.Focus(); // txtConPort.SelectAll(); // msg = "远传端口设置错误!"; // return ok; // } // ok = MetarnetRegex.IsIPv4(txtConAdress.Text); // if (!ok) // { // txtConAdress.Focus(); // txtConAdress.SelectAll(); // msg = "远传地址设置错误!"; // return ok; // } //} // 通讯时间与记录时间不能重叠 int comTime = Convert.ToInt32(txtComTime.Text); int recTime1 = Convert.ToInt32(txtRecTime.Text); int recTime2 = Convert.ToInt32(txtRecTime1.Text); if (comTime == recTime1 || comTime == recTime2 || (comTime > recTime1 && comTime < recTime2)) { txtComTime.Focus(); txtComTime.SelectAll(); msg = "通讯时间/记录时间设置重叠!"; return(false); } return(ok); }