Ejemplo n.º 1
0
        private void HandleChangedMonthYear(object newValue)
        {
            char[] sep = new char[1] {
                '.'
            };
            var value = YearMonth;
            int day   = 1;

            if (value == null)
            {
                return;
            }
            string[] yearmonth = value.Split(sep);
            if (yearmonth.Length != 2)
            {
                return;
            }
            var      year          = Convert.ToInt16(yearmonth[0]);
            var      month         = Convert.ToInt16(yearmonth[1]);
            DateTime firstDayMonth = new DateTime(year, month, day);

            if (month == 12)
            {
                var m = false;
            }

            // now i shall generate the numbers.
            DayOfWeek dayOfWeek = firstDayMonth.DayOfWeek;

            MonthName = firstDayMonth.ToString("Y");
            int currentIterator = (int)dayOfWeek;
            int numdays         = computeNumberDays(year, month - 1);
            int j = 1;

            for (int k = currentIterator; k < 38; ++k)
            {
                if (j > numdays)
                {
                    break;
                }

                _monthGrid[k] = string.Format("{0}", j);
                if (DaysOff.Contains <int>(k))
                {
                    HighlightOffDay(k);
                }
                else
                {
                    HighlightWorkingDay(k);
                }
                j++;
            }
            RaisePropertyChanged("MonthGrid");
        }
Ejemplo n.º 2
0
        private void HandleChangedMonthYear()
        {
            int day = 1;

            string[] yearMonth = YearMonthArray();
            if ((yearMonth.Length == 2) && (!string.IsNullOrEmpty(yearMonth[0])) && (!string.IsNullOrEmpty(yearMonth[1])))
            {
                var      year          = Convert.ToInt16(yearMonth[0]);
                var      month         = Convert.ToInt16(yearMonth[1]);
                DateTime firstDayMonth = new DateTime(year, month, day);
                // now i shall generate the numbers.
                DayOfWeek dayOfWeek = firstDayMonth.DayOfWeek;
                MonthName = firstDayMonth.ToString("Y");
                int currentIterator = (int)dayOfWeek;
                int numdays         = computeNumberDays(year, month - 1);
                int j = 1;
                for (int k = currentIterator; k < 38; ++k)
                {
                    if (j > numdays)
                    {
                        break;
                    }

                    _monthGrid[k] = string.Format("{0}", j);
                    if (DaysOff.Contains <int>(j))
                    {
                        HighlightOffDay(j, k);
                    }
                    else
                    {
                        HighlightWorkingDay(j, k);
                    }
                    j++;
                }
                RaisePropertyChanged("MonthGrid");
            }
        }