Example #1
0
 public ChangeConcertWindow()
 {
     InitializeComponent();
     concertRepositoty          = new ConcertEventRepository(new ApplicationContext());
     workerRepositoty           = new WorkerRepository(new ApplicationContext());
     concertMarksRepositoty     = new ConcertMarksRepository(new ApplicationContext());
     concertTypeRepositoty      = new ConcertTypeRepository(new ApplicationContext());
     concertPlaceTypeRepository = new ConcertPlaceTypeRepository(new ApplicationContext());
 }
Example #2
0
        //private List<Worker> workers;
        public AddConcerWindow2()
        {
            InitializeComponent();
            concertRepositoty          = new ConcertEventRepository(new ApplicationContext());
            concertMarksRepositoty     = new ConcertMarksRepository(new ApplicationContext());
            concertTypeRepositoty      = new ConcertTypeRepository(new ApplicationContext());
            concertPlaceTypeRepository = new ConcertPlaceTypeRepository(new ApplicationContext());

            TypeComboBox.ItemsSource      = concertTypeRepositoty.getAll().Select(p => p.Name);
            TypePlaceComboBox.ItemsSource = concertPlaceTypeRepository.getAll().Select(p => p.Name);
            //workerListView.ItemsSource = concertMarksRepositoty.getAll();
            //workers = new List<Worker>();
        }
Example #3
0
        public InfoWorker(Worker worker)
        {
            int          sum   = 0;
            List <Items> items = new List <Items>();

            InitializeComponent();
            lessonRepository      = new LessonEventRepository(new ApplicationContext());
            workerRepository      = new WorkerRepository(new ApplicationContext());
            lessonMarkRepository  = new LessonMarksRepository(new ApplicationContext());
            concertRepository     = new ConcertEventRepository(new ApplicationContext());
            concertMarkRepository = new ConcertMarksRepository(new ApplicationContext());



            foreach (ConcertEvent con in concertRepository.Get(p => p.EndDate.Value.Month == DateTime.Now.Month))
            {
                if (concertMarkRepository.IsExist(p => p.ConcertEventID == con.ID &&
                                                  p.WorkerID == worker.ID))
                {
                    Items item = new Items()
                    {
                        concert = con,
                        marks   = concertMarkRepository.Get(p => p.ConcertEventID == con.ID &&
                                                            p.WorkerID == worker.ID).First().NumOfMarks
                    };
                    sum += item.marks;
                    items.Add(item);
                }
            }
            concertListView.ItemsSource = items;

            this.Namelabel.Content    = worker.Name;
            this.Surnamelabel.Content = worker.Surname;

            int lessonVisited = 0;

            foreach (LessonEvent lesson in lessonRepository.Get(p => p.Date.Month == DateTime.Now.Month))
            {
                if (lessonMarkRepository.IsExist(p => p.LessonEventID == lesson.ID &&
                                                 p.WorkerID == worker.ID && p.IsVisited == true))
                {
                    lessonVisited++;
                }
            }
            sum += lessonVisited;
            this.numOfMakrslabel.Content       = sum.ToString();
            this.lessonVisitedNumLabel.Content = lessonVisited.ToString();
        }
Example #4
0
        public InfoEventWindow()
        {
            List <Items> items = new List <Items>();

            InitializeComponent();
            lessonRepository      = new LessonEventRepository(new ApplicationContext());
            workerRepository      = new WorkerRepository(new ApplicationContext());
            lessonMarkRepository  = new LessonMarksRepository(new ApplicationContext());
            concertRepository     = new ConcertEventRepository(new ApplicationContext());
            concertMarkRepository = new ConcertMarksRepository(new ApplicationContext());
            foreach (Worker wr in workerRepository.GetAllFromCache(1))
            {
                Items item = new Items()
                {
                    wrk = wr
                };
                //wrk = wr;
                items.Add(item);
            }

            for (int i = 1; i <= DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); i++)
            {
                DataGridTextColumn chekColumn = new DataGridTextColumn();
                chekColumn.Header     = i.ToString();
                chekColumn.Binding    = new Binding(i.ToString());
                chekColumn.IsReadOnly = true;


                chekColumn.CellStyle = new Style(typeof(DataGridCell));
                chekColumn.CellStyle.Setters.Add(new Setter(DataGridCell.BackgroundProperty, new SolidColorBrush(Colors.LightGray)));

                lessonGrid.Columns.Add(chekColumn);
            }

            DataGridTextColumn num = new DataGridTextColumn();

            num.Header  = "Sum";
            num.Binding = new Binding("Sum");

            num.CellStyle = new Style(typeof(DataGridCell));
            num.CellStyle.Setters.Add(new Setter(DataGridCell.BackgroundProperty, new SolidColorBrush(Colors.LightGray)));
            lessonGrid.Columns.Add(num);

            lessonGrid.ItemsSource = items;
        }
Example #5
0
        public ChangeConcertWindow(int id)
        {
            this.id = id;
            InitializeComponent();
            concertRepositoty          = new ConcertEventRepository(new ApplicationContext());
            workerRepositoty           = new WorkerRepository(new ApplicationContext());
            concertMarksRepositoty     = new ConcertMarksRepository(new ApplicationContext());
            concertTypeRepositoty      = new ConcertTypeRepository(new ApplicationContext());
            concertPlaceTypeRepository = new ConcertPlaceTypeRepository(new ApplicationContext());

            ConcertEvent concert = concertRepositoty.GetByIdFromCahce(id);

            this.BeginingDate.SelectedDate      = concert.BeginningDate;
            this.EndDate.SelectedDate           = concert.EndDate;
            this.CountryTextBox.Text            = concert.Country;
            this.CitytextBox.Text               = concert.City;
            this.AddresTextBox.Text             = concert.Address;
            this.TypeComboBox.SelectedItem      = concertTypeRepositoty.FindByID(concert.ConcertTypeId).Name;
            this.TypePlaceComboBox.SelectedItem = concertPlaceTypeRepository.FindByID(concert.ConcertPlaceTypeId).Name;
            this.DescriptionTextBox.Text        = concert.Description;


            TypeComboBox.ItemsSource      = concertTypeRepositoty.getAll().Select(p => p.Name);
            TypePlaceComboBox.ItemsSource = concertPlaceTypeRepository.getAll().Select(p => p.Name);

            IEnumerable <ConcertMarks> concertMarks;

            concertMarks = concertMarksRepositoty.getAll().Where(p => p.ConcertEventID == id);

            foreach (ConcertMarks conMark in concertMarks)
            {
                workerListView.Items.Add(new Items
                {
                    wrk  = workerRepositoty.GetByIdFromCahce(conMark.WorkerID),
                    mark = conMark.NumOfMarks
                });
            }
        }