Exemplo n.º 1
0
        public CalendarModel(BaseModel <int> employee, int year, int month)
        {
            int daysInMonth = DateTime.DaysInMonth(year, month);

            Year     = year;
            Month    = month;
            Employee = employee;
            Days     = new DayModel[daysInMonth];
            for (int i = 0; i < daysInMonth; i++)
            {
                Days[i] = new DayModel(employee)
                {
                    Date  = new DateTime(year, month, i + 1),
                    Hours = 0,
                    Id    = 0
                };
                if (Days[i].Date.DayOfWeek == DayOfWeek.Saturday || Days[i].Date.DayOfWeek == DayOfWeek.Sunday)
                {
                    Days[i].Type = 8;
                }
                if (Days[i].Date > DateTime.Today)
                {
                    Days[i].Type = 9;
                }
            }
        }
Exemplo n.º 2
0
        public CalendarModel(BaseModel employee, int year, int month)
        {
            Employee = employee;
            Month    = month;
            Year     = year;
            int Limit = DateTime.DaysInMonth(year, month);

            Days = new DayModel[Limit];
            for (int i = 0; i < Limit; i++)
            {
                Days[i] = new DayModel(employee)
                {
                    Date  = new DateTime(year, month, i + 1),
                    Hours = 0,
                    Type  = 0
                };
                if (Days[i].Date >= DateTime.Today)
                {
                    Days[i].Type = 9;                                               // future
                }
                if (Days[i].Date.DayOfWeek == DayOfWeek.Saturday ||
                    Days[i].Date.DayOfWeek == DayOfWeek.Sunday)
                {
                    Days[i].Type = 8;                                               // weekend
                }
            }
        }
Exemplo n.º 3
0
 public Day Create(DayModel dm, UnitOfWork unit)
 {
     return new Day()
     {
         Id = dm.Id,
         Date = dm.Date,
         Hours = dm.Hours,
         Type = (DayType)dm.Type,
         Employee = unit.Employees.Get(dm.Employee.Id)
     };
 }