protected override void BtSave_Click(object sender, RoutedEventArgs e) { SpecialtyInformation newSpecialtyInformation; if (cbSpecialty.SelectedIndex < 0 || cbFormOfEducation.SelectedIndex < 0) { MessageForms.MessageForms.MessageBoxMessage("Выберите специальность и форму обучения"); return; } if ((rbBase.IsChecked.Value == false && rbNoBase.IsChecked.Value == false) || (rbBase.IsChecked == null || rbNoBase.IsChecked == null) ) { MessageForms.MessageForms.MessageBoxMessage("Выберите профиль(базовый или углубленный)"); return; } try { newSpecialtyInformation = CreateUser(); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } MessageBox.Show(SpecialtyInfoController.CreateOrUpdateSpecialtyInformation(newSpecialtyInformation)); Close(); }
protected override void BtSave_Click(object sender, RoutedEventArgs e) { try { SelectedSpecialty = (SpecialtyInformation)grids.DataContext; SelectedSpecialty.BaseEndNoBase = GetValueRadioButton(); SelectedSpecialty.FormOfEducationId = ((FormOfEducation)cbFormOfEducation.SelectedItem).FormOfEducationId; SelectedSpecialty.SpecialtyId = ((Specialty)cbSpecialty.SelectedItem).SpecialtyId; SelectedSpecialty.TrainingPeriod = new DateTime(Convert.ToInt32(tbTrainingPeriodY.Text), Convert.ToInt32(tbTrainingPeriodM.Text), 1); MessageBox.Show(SpecialtyInfoController.CreateOrUpdateSpecialtyInformation(SelectedSpecialty)); Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } }