/// <summary> /// 验证input /// </summary> public bool Check() { try { ProjectHelper.Utils.Guard.CheckIsNullOrEmpty(ToCityName, "到达城市"); ProjectHelper.Utils.Guard.CheckIsNullOrEmpty(FlightNumber, "航班号"); ProjectHelper.Utils.Guard.CheckIsNullOrEmpty(Name, "乘客姓名"); if (IsAdultType) { if (IsIdType) { ProjectHelper.Utils.Guard.CheckIsNullOrEmpty(IdNo, "证件号"); //身份证18位 if (IdNo.Trim().Length != 18) { throw new Exception(string.Format("{0}证件号只能{1}位", IdNo, 18)); } } //ProjectHelper.Utils.Guard.CheckMobilePhoneNum(Mobile); } else { if (IsChildType && IsIdType) { ProjectHelper.Utils.Guard.CheckIsNullOrEmpty(IdNo, "证件号"); if (IsIdType) { //身份证18位 if (IdNo.Trim().Length != 18) { throw new Exception(string.Format("{0}证件号只能{1}位", IdNo, 18)); } } } } if (BirthDay != null && !(BirthDay < DisplayDateStart) && !(BirthDay > DisplayDateEnd)) { if (!IsIdType || string.IsNullOrWhiteSpace(IdNo) || IdNo.Trim().Length != 18) { return(true); } //生日转换截取字符串 var birth = Common.ExtHelper.GetBirthdayDateFromString(IdNo); if (birth != null && (birth < DisplayDateStart || birth > DisplayDateEnd)) { throw new Exception(string.Format("请核对出生日期范围{0:yyyy-MM-dd}", BirthDay)); } } else { throw new Exception(string.Format("请核对出生日期范围{0:yyyy-MM-dd}", BirthDay)); } return(true); } catch (Exception ex) { UIManager.ShowErr(ex); return(false); } }
public void Normalize() { PPNo = PPNo?.ToUpper(); IdNo = IdNo?.ToUpper(); }