public void UpdateDateBoxes() { for (int i = 0; i < 5; i++) { DateBox curr = DateBoxes[i]; curr.UpdateDate(SelectedWeekStartDate.AddDays(i)); } }
public void SetShiftDropHandler() { Mediator.GetInstance().ShiftDropped += (s, e) => { Clear(); if (!e.IsLastElement && IsVisible) { ScheduleShift ss = (ScheduleShift)e.Shift; DateBox db = DateBoxes[ss.StartTime.Day - 1]; DateTime dt = new DateTime(db.Date.Year, db.Date.Month, db.Date.Day, ss.StartTime.Hour, ss.StartTime.Minute, 0); ss.StartTime = dt; } LoadShiftsIntoCalendar(); }; }
public void SetEmployeeDroppedHandler() { Mediator.GetInstance().EmployeeDropped += (e, tod, dow) => { if (IsVisible) { Clear(); ScheduleShift ss = new ScheduleShift(); DateBox db = DateBoxes[(int)dow - 1]; DateTime dt = new DateTime(db.Date.Year, db.Date.Month, db.Date.Day, tod.Hours, tod.Minutes, 0); ss.StartTime = dt; ss.Employee = e; ss.Hours = DEFAULTSHIFTLENGTH; Shifts.Add(ss); LoadShiftsIntoCalendar(); } }; }
public void BuildDateBoxes() { DateTime currentDate = DateTime.Now; DateTime date = (currentDate.DayOfWeek == DayOfWeek.Sunday) ? (currentDate.AddDays(-6)) : (currentDate.AddDays(-((int)currentDate.DayOfWeek - 1))); int row = 2; int col = 1; int day = 0; while (day < 5) { DateBox dBox = new DateBox(date.AddDays(day)); CalendarGrid.Children.Add(dBox); Grid.SetColumn(dBox, col); Grid.SetRow(dBox, row); day++; col++; DateBoxes.Add(dBox); } }