Esempio n. 1
0
        private void StudyingStatusesWindow_Load(object sender, RoutedEventArgs e)
        {
            List <StudentViewModel> list = logicS.Read(new StudentBindingModel
            {
                ProviderId = App.SelectProvider.Id
            });

            if (list != null)
            {
                comboBoxStudentId.ItemsSource  = list;
                comboBoxStudentId.SelectedItem = null;
            }
            comboBoxStudyingBase.Items.Clear();
            foreach (string _base in Enum.GetNames(typeof(StudyingBase)))
            {
                comboBoxStudyingBase.Items.Add(_base);
            }
            comboBoxStudyingForm.Items.Clear();
            foreach (string form in Enum.GetNames(typeof(StudyingForm)))
            {
                comboBoxStudyingForm.Items.Add(form);
            }
            if (id.HasValue)
            {
                StudyingStatusViewModel status = logicSS.Read(new StudyingStatusBindingModel
                {
                    Id = id
                })?[0];

                comboBoxStudentId.SelectedValue   = status.StudentId;
                comboBoxStudyingBase.SelectedItem = status.StudyingBase.ToString();
                comboBoxStudyingForm.SelectedItem = status.StudyingForm.ToString();
                textBoxCourse.Text = status.Course.ToString();
            }
        }
Esempio n. 2
0
        public void Delete(StudyingStatusBindingModel model)
        {
            StudyingStatusViewModel element = _studyingStatusStorage.GetElement(new StudyingStatusBindingModel {
                Id = model.Id
            });

            if (element == null)
            {
                throw new Exception("Элемент не найден");
            }
            _studyingStatusStorage.Delete(model);
        }