Example #1
0
 public ChooseEvent()
 {
     InitializeComponent();
     concertRepositoty           = new ConcertEventRepository(new ApplicationContext());
     workerRepositoty            = new WorkerRepository(new ApplicationContext());
     concertListView.ItemsSource = concertRepositoty.GetListFromCache().OrderByDescending(x => x.EndDate).Take(10);
 }
Example #2
0
        public ConcertsWindow()
        {
            InitializeComponent();

            concertRepositoty           = new ConcertEventRepository(new ApplicationContext());
            concertListView.ItemsSource = concertRepositoty.GetListFromCache();
        }
Example #3
0
        public void SetValue()
        {
            List <Items> wrList = (List <Items>)lessonGrid.ItemsSource;

            for (int column = 1; column < DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month) + 1; column++)
            {
                DateTime    dt       = new DateTime(DateTime.Now.Year, DateTime.Now.Month, column);
                LessonEvent lsnEvent = new LessonEvent();
                if (lessonRepository.IsExist(p => p.Date == dt))
                {
                    lsnEvent = lessonRepository.GetAllFromCache().Where(d => d.Date == dt).First();
                }
                //lsnEvent = lessonRepository.Get(d => d.Date == dt).First();

                ConcertEvent concEvent = new ConcertEvent();
                if (concertRepository.IsExist(p => dt >= p.BeginningDate && dt <= p.EndDate))
                {
                    concEvent = concertRepository.GetListFromCache().Where(p => dt >= p.BeginningDate && dt <= p.EndDate).First();
                    //concEvent = concertRepository.Get(p => dt >= p.BeginningDate && dt <= p.EndDate).First();
                }
                for (int row = 0; row < workerRepository.GetAllFromCache(1).Count(); row++)
                {
                    int         wrId = wrList[row].wrk.ID;
                    DataGridRow r    = lessonGrid.GetRow(row);

                    if (lessonMarkRepository.IsExist(p => p.LessonEventID == lsnEvent.ID && p.IsVisited == true && p.WorkerID == wrId))
                    {
                        lessonGrid.GetCell(r, column).Background = new SolidColorBrush(Colors.Red);
                    }
                    if (concertMarkRepository.IsExist(p => p.ConcertEventID == concEvent.ID && p.WorkerID == wrId))
                    {
                        lessonGrid.GetCell(r, column).Background = new SolidColorBrush(Colors.Green);
                    }
                }
            }

            GridSum(wrList);
        }
Example #4
0
        private void RemoveButton_Click(object sender, RoutedEventArgs e)
        {
            if (concertListView.SelectedItem == null)
            {
                MessageBox.Show("errror");
                return;
            }

            ConcertEvent Value = (ConcertEvent)concertListView.SelectedItem;

            concertRepositoty.Delete(Value);
            concertRepositoty.DeleteFromCache(Value.ID);

            concertListView.ItemsSource = concertRepositoty.GetListFromCache();
            concertListView.Items.Refresh();
        }