private void SaveButton_Click(object sender, EventArgs e) { searchCrit = new Topics(); if (TopicTextbox.Text != "" && InfoRichTextbox.Text != "" && TeacherTextbox.Text != "") { searchCrit.Title = TopicTextbox.Text; searchCrit.Description = InfoRichTextbox.Text; searchCrit.TeacherID = LoginPanel.TeacherID; if (IDTextbox.Text != "") { searchCrit.ID = Convert.ToInt32(IDTextbox.Text); } if (StatusCombobox.SelectedItem.ToString() == "Open") { searchCrit.Status = "Open"; } else if (StatusCombobox.SelectedItem.ToString() == "Closed") { searchCrit.Status = "Close"; } else { searchCrit.Status = "Final"; } if (opentype == 1) { DependencyFacade.InsertTopic(searchCrit); } else { DependencyFacade.UpdateTopics(searchCrit); } this.Hide(); } else { MessageBox.Show("Wrong parameters of topic.", "Warning", MessageBoxButtons.OK); } }
private void DelTopicButton_Click(object sender, EventArgs e) { Sections grp = new Sections(); Topics top = new Topics(); foreach (DataGridViewRow row in dataGridView1.SelectedRows) { if (row.Cells[4].Value != null) { top.ID = (int)row.Cells[4].Value; top.Status = "Open"; DependencyFacade.UpdateTopics(top); grp.ID = (int)row.Cells[0].Value; grp.GroupSize = (byte)row.Cells[1].Value; grp.TopicID = null; grp.SemID = (int)row.Cells[3].Value; grp.Status = row.Cells[2].Value.ToString(); DependencyFacade.UpdateSection(grp); } } SearchButton_Click(sender, e); }