Пример #1
0
 private DateTime GetDateByPos(SourceGrid.Position pos)
 {
     if (YearUsed == -1)
     {
         return(DateTime.MinValue);
     }
     for (int i = 0; i < 12; i++)
     {
         var fc = GetMTFirstCell(i);
         if (pos.Column >= fc.X && pos.Column <= fc.X + 6 &&
             pos.Row >= fc.Y + 1 && pos.Row <= fc.Y + 6)
         {
             return(MonthData.GetByCoord(YearUsed, i, pos.Row - fc.Y - 1, pos.Column - fc.X));
         }
     }
     return(DateTime.MinValue);
 }
Пример #2
0
        private void MakeMonth(int yr, int mt)
        {
            var pos = GetMTFirstCell(mt);
            var mtd = new MonthData(yr, mt);

            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 7; j++)
                {
                    var cell = grid[pos.Y + i + 1, pos.X + j];
                    SourceGrid.Cells.Views.Cell vm = null;
                    cell.Value = mtd.Days[i][j].ToString();
                    var daytag = mtd.DayTags[i][j];
                    if (j == 0)
                    {
                        if (daytag == ECalendarDayType.Day)
                        {
                            vm = grid.gridViewModel.dayCellModelLeft;
                        }
                        else if (daytag == ECalendarDayType.Out)
                        {
                            vm = grid.gridViewModel.dayCellModelOutLeft;
                        }
                        else
                        {
                            vm = grid.gridViewModel.dayCellModelHollydayLeft;
                        }
                    }
                    else if (j > 4)
                    {
                        if (daytag == ECalendarDayType.Day)
                        {
                            vm = grid.gridViewModel.dayCellModelWeekend;
                        }
                        else if (daytag == ECalendarDayType.Out)
                        {
                            vm = grid.gridViewModel.dayCellModelOutWeekend;
                        }
                        else
                        {
                            vm = grid.gridViewModel.dayCellModelHollydayWeekend;
                        }
                    }
                    else
                    {
                        if (daytag == ECalendarDayType.Day)
                        {
                            vm = grid.gridViewModel.dayCellModel;
                        }
                        else if (daytag == ECalendarDayType.Out)
                        {
                            vm = grid.gridViewModel.dayCellModelOut;
                        }
                        else
                        {
                            vm = grid.gridViewModel.dayCellModelHollyday;
                        }
                    }
                    cell.View = vm;
                }
            }
        }