Example #1
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            var error = new List <ValidationResult>();

            if (DayType == EScheduleDayType.Week && (DayList ?? "").Split(',').ToList().Any(a => int.Parse(a) > 7))
            {
                error.Add(new ValidationResult("当以星期的形式排班时,日期只能是1到7之间的数字"));
            }
            if (DayType == EScheduleDayType.Week && (DayList ?? "").Split(',').ToList().Any(a => int.Parse(a) > 31))
            {
                error.Add(new ValidationResult("当以月的形式排班时,日期只能是1到31之间的数字"));
            }
            if (EndTime <= BeginTime)
            {
                error.Add(new ValidationResult("结束时间必须小于开始时间"));
            }
            if (ExceptDate.HasValue() && ExceptDate.Split(',').Any(a => DateTime.TryParse(a, out DateTime exceptDateTemp)))
            {
                error.Add(new ValidationResult($"不包含日期参数里有不合法的日期"));
            }
            if (ExceptDate.HasValue() && InDate.Split(',').Any(a => DateTime.TryParse(a, out DateTime exceptDateTemp)))
            {
                error.Add(new ValidationResult($"包含日期参数里有不合法的日期"));
            }
            return(error);
        }
 public override string ToString()
 {
     return(string.Format("姓名:{0} 年龄:{1} 性别:{2} 入院日期:{3} 病区:{4} 床号:{5} 住院号:{6}",
                          Name,
                          Age,
                          Sex,
                          InDate.ToString("yyyy年MM月dd日"),
                          Area,
                          BedNo,
                          IpNo));
 }
        public override int GetHashCode()
        {
            var hashCode = 1081298760;

            hashCode = hashCode * -1521134295 + EqualityComparer <Airport> .Default.GetHashCode(OriginAirport);

            hashCode = hashCode * -1521134295 + EqualityComparer <Airport> .Default.GetHashCode(DestinationAirport);

            hashCode = hashCode * -1521134295 + OutDate.GetHashCode();
            hashCode = hashCode * -1521134295 + InDate.GetHashCode();
            hashCode = hashCode * -1521134295 + Return.GetHashCode();
            return(hashCode);
        }
Example #4
0
 public void InTheYear()
 {
     Assert.Equal(new DateOnly(2009, 1, 1), InDate.TheYear(2009));
 }
Example #5
0
 public void InJanuaryOf2009()
 {
     Assert.Equal(new DateOnly(2009, 1, 1), InDate.JanuaryOf(2009));
 }