示例#1
0
        public static IEnumerable <WorkPeriod> GetWorkPeriods(DateTime startDate, DateTime endDate)
        {
            var wp = WorkPeriods.Where(x => x.EndDate >= endDate && x.StartDate < startDate);

            if (!wp.Any())
            {
                wp = WorkPeriods.Where(x => x.StartDate >= startDate && x.StartDate < endDate);
            }
            if (!wp.Any())
            {
                wp = WorkPeriods.Where(x => x.EndDate >= startDate && x.EndDate < endDate);
            }
            if (!wp.Any() && ApplicationState.CurrentWorkPeriod.StartDate < startDate)
            {
                wp = new List <WorkPeriod> {
                    ApplicationState.CurrentWorkPeriod
                }
            }
            ;
            return(wp.OrderBy(x => x.StartDate));
        }
示例#2
0
        public static IEnumerable <WorkPeriod> GetWorkPeriods(DateTime startDate, DateTime endDate)
        {
            var wp = WorkPeriods.Where(x => x.EndDate >= endDate && x.StartDate < startDate);

            if (wp.Count() == 0)
            {
                wp = WorkPeriods.Where(x => x.StartDate >= startDate && x.StartDate < endDate);
            }
            if (wp.Count() == 0)
            {
                wp = WorkPeriods.Where(x => x.EndDate >= startDate && x.EndDate < endDate);
            }
            if (wp.Count() == 0 && AppServices.MainDataContext.CurrentWorkPeriod.StartDate < startDate)
            {
                wp = new List <WorkPeriod> {
                    AppServices.MainDataContext.CurrentWorkPeriod
                }
            }
            ;
            return(wp.OrderBy(x => x.StartDate));
        }