コード例 #1
0
        //добавить отпуск
        public void AddVacation(VacationPair vac, Brush color, Employee emp)
        {
            List <List <int> > rowsInDays = new List <List <int> >();

            for (int i = vac.Begin.Day; i <= vac.End.Day; i++)
            {
                rowsInDays.Add(_listDays[i - 1].FreeRows());
                //listDays[i-1].FreeRows().Find(x=>x.)
            }
            int nRow = rowsInDays[0].FindIndex(x => rowsInDays.TrueForAll(y => y.Contains(x)));

            if (nRow == -1)
            {
                if (_listDays[0].Rows == 6)
                {
                    if (MessageBox.Show("Добавление более чем шести отпусков совпадающих по дате может отрицательно сказаться на удобстве представления информации\nВы уверены, что хотите продолжить?", "Внимание!", MessageBoxButton.YesNo) == MessageBoxResult.No)
                    {
                        return;
                    }
                }
                foreach (DayOfMonth day in _listDays)
                {
                    day.AddRow();
                }
                rowsInDays[0].Add(_listDays[0].Rows - 1);
                nRow = rowsInDays[0].Count - 1;
            }
            int row = rowsInDays[0][nRow];

            for (int i = vac.Begin.Day; i <= vac.End.Day; i++)
            {
                _listDays[i - 1].AddRect(row, color, emp);
            }
        }
コード例 #2
0
 //удаление отпуска
 public void DeleteVacation(VacationPair vac, Employee emp)
 {
     for (int i = vac.Begin.Day; i <= vac.End.Day; i++)
     {
         _listDays[i - 1].DeleteRect(emp);
     }
 }