示例#1
0
 public dtoCalendar(ProjectCalendar calendar, Boolean loadExcpetions = false) : this()
 {
     WorkingDaysHour = (calendar.WorkingDaysHour != null && calendar.WorkingDaysHour.Where(w => w.Deleted == BaseStatusDeleted.None).Any()) ? calendar.WorkingDaysHour.Where(w => w.Deleted == BaseStatusDeleted.None).Select(w => new dtoWorkingDayHour(w)).ToList() : new List <dtoWorkingDayHour>();
     if (loadExcpetions)
     {
         DateExceptions = (calendar.DateExceptions != null && calendar.DateExceptions.Where(w => w.Deleted == BaseStatusDeleted.None).Any()) ? calendar.DateExceptions.Where(e => e.Deleted == BaseStatusDeleted.None).Select(e => new dtoDateException(e)).ToList() : new List <dtoDateException>();
     }
 }
示例#2
0
        public static List <WorkingDayHour> GetDefaultWorkingDayHours(FlagDayOfWeek days, ProjectCalendar calendar = null, Project project = null)
        {
            List <WorkingDayHour> items = new List <WorkingDayHour>();

            foreach (FlagDayOfWeek fEnum in (from e in Enum.GetValues(typeof(FlagDayOfWeek)).OfType <FlagDayOfWeek>() where e != FlagDayOfWeek.Weekend && e != FlagDayOfWeek.None && e != FlagDayOfWeek.WorkWeek && e != FlagDayOfWeek.AllWeek select e))
            {
                if (days.HasFlag(fEnum))
                {
                    items.Add(new WorkingDayHour(8, 0, 12, 0)
                    {
                        DayOfWeek = fEnum, Project = project, Calendar = calendar
                    });
                    items.Add(new WorkingDayHour(13, 0, 17, 0)
                    {
                        DayOfWeek = fEnum, Project = project, Calendar = calendar
                    });
                }
            }
            return(items);
        }