private void T04addButton_Click(object sender, EventArgs e) { if (T04_name_task.Text == "" || filePath == "") { MessageBox.Show("Заполните поля!"); } else { var person = new T04_testing_tasks() { name_task = T04_name_task.Text, id_author = int.Parse(T04_id_author.SelectedValue.ToString()), date_create = T04_date_create.Value.ToString("dd.MM.yyyy"), date_correct = null, code_type = int.Parse(T04_code_type.SelectedValue.ToString()), note = note.Text == "" ? " " : note.Text, file_location = filePath, }; bd.T04_testing_tasks.Add(person); bd.SaveChanges(); } T04_name_task.Clear(); T04_note.Clear(); updateT04(); }
public AdaptiveTTConstructor(string taskName) { InitializeComponent(); name = taskName; this.testingTask = bd.T04_testing_tasks.Where(x => x.name_task == taskName).FirstOrDefault(); if (testingTask == null) { MessageBox.Show("не выбран элемент"); this.Close(); } }