コード例 #1
0
        private void SaveWorkerButton_Click(object sender, RoutedEventArgs e)
        {
            Worker workr = workerRepositoty.FindByID(this.worker.ID);;

            worker.Name              = this.name.Text;
            worker.DepartamentID     = departamentRepositoty.Get(p => p.Name == this.departament.Text).Select(p => p.ID).First();
            worker.BirthPlace        = this.birthPlace.Text;
            worker.Surname           = surname.Text;
            worker.Patronymic        = patronymic.Text;
            worker.RegistrationPlace = registrationPlace.Text;
            worker.BirthPlace        = birthPlace.Text;
            worker.DateOfBirth       = (DateTime)dateOfBirth.SelectedDate;
            worker.Nationality       = nationality.Text;
            worker.Education         = education.Text;
            worker.Sex           = sex.Text == "мужской" ? true : false;
            worker.MaritalStatus = maritalStatus.Text == "холост" ? true : false;
            worker.PhoneNum      = phoneNum.Text;
            worker.Email         = email.Text;


            workerRepositoty.Modified(workr);
            workerRepositoty.Update(workr);
            workerRepositoty.UpdateCache(worker, worker.ID);

            MessageBox.Show("changed");
            Close_Click(sender, e);
        }
コード例 #2
0
        public AddWorkersToConcertWindow(List <Worker> wrList)
        {
            InitializeComponent();
            workerRepositoty = new WorkerRepository(new ApplicationContext());
            List <Worker> wrk = workerRepositoty.getAll().Where(p => p.DepartamentID == 1).ToList();

            //Worker www = workerRepositoty.FindByID(1);
            //wrk.Remove(www);
            if (wrList != null)
            {
                for (int i = 0; i < wrList.Count; i++)
                {
                    Worker www = workerRepositoty.FindByID(wrList[i].ID);

                    wrk.Remove(www);
                }
            }
            listView.ItemsSource = wrk;
        }