Пример #1
0
        private void AddWorkerButton_Click(object sender, RoutedEventArgs e)
        {
            List <Worker> wrList = new List <Worker>();

            if (workerListView.Items != null)
            {
                for (int i = 0; i < workerListView.Items.Count; i++)
                {
                    Items Value = (Items)workerListView.Items[i];
                    wrList.Add(Value.wrk);
                }
            }



            AddWorkersToConcertWindow addWorker = new AddWorkersToConcertWindow(wrList);

            this.Visibility = Visibility.Collapsed;
            addWorker.ShowDialog();
            if (addWorker.DialogResult.HasValue && addWorker.DialogResult.Value)
            {
                workerListView.Items.Add(new Items
                {
                    wrk  = addWorker.Worker,
                    mark = addWorker.Mark
                });
                workerListView.Items.Refresh();
            }
            this.Visibility = Visibility.Visible;

            //workers.Add(addWorker.Worker);


            //var c = workerListView.Items.GetItemAt(0);
        }
Пример #2
0
        private void AddWorkerButton_Click(object sender, RoutedEventArgs e)
        {
            List <Worker> wrList = new List <Worker>();

            if (workerListView.Items != null)
            {
                for (int i = 0; i < workerListView.Items.Count; i++)
                {
                    Items Value = (Items)workerListView.Items[i];
                    wrList.Add(Value.wrk);
                }
            }



            AddWorkersToConcertWindow addWorker = new AddWorkersToConcertWindow(wrList);

            this.Visibility = Visibility.Collapsed;
            addWorker.ShowDialog();
            if (addWorker.DialogResult.HasValue && addWorker.DialogResult.Value)
            {
                workerListView.Items.Add(new Items
                {
                    wrk  = addWorker.Worker,
                    mark = addWorker.Mark
                });

                ConcertEvent concert = concertRepositoty.GetByIdFromCahce(id);

                ConcertMarks concertMark = new ConcertMarks();
                concertMark.NumOfMarks     = addWorker.Mark;
                concertMark.ConcertEventID = concert.ID;
                concertMark.WorkerID       = addWorker.Worker.ID;

                concertMarksRepositoty.Insert(concertMark);
            }
            this.Visibility = Visibility.Visible;

            workerListView.Items.Refresh();
        }