学海无涯

导航

日期,时间判断

/// <summary>
        /// 检查是否有重叠的时段
        /// <returns>true:跟其它时段有重叠 false:没有重叠</returns>
        /// </summary>
        public bool CheckDuplicatedTime()
        {
            Filter filter = new Filter();
            filter.Add("ID", this.ID, RELEATTION_TYPE.NOTEQUAL, LOGIC_TYPE.AND);
            filter.Add("FacilityID", this.FacilityID, RELEATTION_TYPE.EQUAL, LOGIC_TYPE.AND);
            filter.Add("SpecialDate", this.SpecialDate, RELEATTION_TYPE.EQUAL, LOGIC_TYPE.AND);
            List<SpecialCalendar> lst = SpecialCalendar.GetList(filter);
            return lst.Find(x => (this.StartHour >= x.StartHour && this.StartHour <= x.EndHour)
                || (this.EndHour >= x.StartHour && this.EndHour <= x.EndHour)) != null;
        }

  

posted on 2024-01-09 09:38  宁静致远.  阅读(10)  评论(0编辑  收藏  举报