Exemple #1
0
        private void GenerateDayElements()
        {
            dayElements = new List <MonthDayElement>();
            for (int i = 0; i < numberOfCellsInGrid; i++)
            {
                int   candidateDayNumber          = i - GetfirstDayGridColumnIndex() + iterationIndexOffset;
                Point dayElementGridCoordinates   = GetGridCoordinatesByIterationIndex(i);
                bool  isDayNumberInDisplayedMonth = IsDayNumberInDisplayedMonth(candidateDayNumber, dayElementGridCoordinates);

                if (isDayNumberInDisplayedMonth)
                {
                    int      year           = DateUtilities.DisplayedDate.Year;
                    int      month          = DateUtilities.DisplayedDate.Month;
                    int      day            = candidateDayNumber;
                    DateTime dayElementDate = new DateTime(year, month, day);

                    MonthDayElement monthDayElement = new MonthDayElement(dayElementDate, sourceSessionController);
                    monthDayElement.SetValue(Grid.ColumnProperty, (int)dayElementGridCoordinates.X);
                    monthDayElement.SetValue(Grid.RowProperty, (int)dayElementGridCoordinates.Y);

                    dayElements.Add(monthDayElement);
                }
                else
                {
                    MonthDayElement monthDayElementBlank = new MonthDayElement();
                    monthDayElementBlank.SetValue(Grid.ColumnProperty, (int)dayElementGridCoordinates.X);
                    monthDayElementBlank.SetValue(Grid.RowProperty, (int)dayElementGridCoordinates.Y);

                    dayElements.Add(monthDayElementBlank);
                }
            }
        }
Exemple #2
0
        private List <Appointment> GetDayAppointments(MonthDayElement dayElement)
        {
            List <Appointment> dayElementAppointments = new List <Appointment>();

            foreach (Appointment appointment in monthAppointmens)
            {
                bool hasReadPermission = appointment.HasReadPermissions(sourceSessionController.CurrentUserName);
                bool isOfTheDayElement = IsAppointmentOfDay(appointment, dayElement);

                if (isOfTheDayElement & hasReadPermission)
                {
                    dayElementAppointments.Add(appointment);
                }
            }

            return(dayElementAppointments);
        }
Exemple #3
0
 private void HighLightWeekends()
 {
     foreach (var child in BodyGrid.Children)
     {
         if (IsDayElement(child))
         {
             MonthDayElement dayElementChild  = child as MonthDayElement;
             int             childColumnIndex = (int)dayElementChild.GetValue(Grid.ColumnProperty);
             if (IsInWeekendColumn(childColumnIndex))
             {
                 dayElementChild.Foreground = highlightColor;
             }
         }
         else if (IsWeekDayNameElement(child))
         {
             TextBlock textBlockDayNameElement = child as TextBlock;
             int       childrenColumnIndex     = (int)textBlockDayNameElement.GetValue(Grid.ColumnProperty);
             if (IsInWeekendColumn(childrenColumnIndex))
             {
                 textBlockDayNameElement.Foreground = highlightColor;
             }
         }
     }
 }
Exemple #4
0
        private static bool IsAppointmentOfDay(Appointment appointment, MonthDayElement dayElement)
        {
            bool areTheSameDate = appointment.StartTime.Date == dayElement.Date.Date;

            return(areTheSameDate);
        }