private void T02addButton_Click(object sender, EventArgs e) { if (name_test.Text == "" || duration.Text == "") { MessageBox.Show("Заполните поля!"); } else { var person = new T02_tests() { name_test = name_test.Text, id_method_material = null, id_author = int.Parse(testAuthorSelect.SelectedValue.ToString()), date_create = datePicker_create.Value.ToString("dd.MM.yyyy"), date_correct = null, max_passing_duration_sec = int.Parse(duration.Text), note = note.Text == "" ? " " : note.Text, id_teach_material = null, max_count_TT_bcause_time_limit = null, max_count_TT_not_done_full_try = null }; bd.T02_tests.Add(person); bd.SaveChanges(); } name_test.Clear(); duration.Clear(); note.Clear(); updateT02(); }
public AdaptiveTestConstructor(string testName, long testID) { try { name = testName; InitializeComponent(); this.testID = testID; this.test = connect.T02_tests.Where(x => x.id_test == testID).FirstOrDefault(); if (test == null) { this.Hide(); } this.max_duration_testing.Text = test.max_passing_duration_sec.ToString(); this.max_not_done_TT.Text = test.max_count_TT_not_done_full_try.ToString(); this.max_TT_with_high_time_limit.Text = test.max_count_TT_bcause_time_limit.ToString(); }catch (Exception ee) { MessageBox.Show("Возникла ошибка загрузки данных, выберите тест"); } }