private void ViewSubbutton_Click(object sender, EventArgs e) { if (fm == null || fm.IsDisposed) { fm = new FormManage(); } fm.Show(); this.Hide(); }
private void buttonManageUpdate_Click(object sender, EventArgs e) { //Database connection SqlConnection con = new SqlConnection("Server = localhost\\SQLEXPRESS01; Database = IT19119618; Integrated Security = True;"); SqlCommand cmd; string RoomType = ""; if (radioButton1.Checked) { RoomType = "1st Semester"; } else { RoomType = "2nd Semester"; } cmd = new SqlCommand("update subject set SubjectCode=@SubjectCode,SubjectName=@SubjectName,OfferdYear=@OfferdYear,OfferedSemester=@OfferedSemester,LectureHours=@LectureHours,TutorialHours=@TutorialHours,LabHours=@LabHours,EvaluationHours=@EvaluationHours where id=@id", con); con.Open(); cmd.Parameters.AddWithValue("@SubjectCode", textBox1.Text.ToString()); cmd.Parameters.AddWithValue("@SubjectName", LecturetextBox.Text.ToString()); cmd.Parameters.AddWithValue("@OfferdYear", FacultycomboBox.Text.ToString()); cmd.Parameters.AddWithValue("@OfferedSemester", RoomType); cmd.Parameters.AddWithValue("@LectureHours", numericUpDown1.Text.ToString()); cmd.Parameters.AddWithValue("@TutorialHours", numericUpDown2.Text.ToString()); cmd.Parameters.AddWithValue("@LabHours", numericUpDown3.Text.ToString()); cmd.Parameters.AddWithValue("@EvaluationHours", numericUpDown4.Text.ToString()); cmd.Parameters.AddWithValue("@id", dataId); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Record Updated Successfully"); FormManage m1 = new FormManage(); this.Hide(); m1.Show(); }
private void buttonManageDelete_Click(object sender, EventArgs e) { //Database connection SqlConnection con = new SqlConnection("Server = localhost\\SQLEXPRESS01; Database = IT19119618; Integrated Security = True;"); SqlCommand cmd; cmd = new SqlCommand("delete from subject where id=@id", con); con.Open(); cmd.Parameters.AddWithValue("@id", dataId); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Record Deleted Successfully"); FormManage m1 = new FormManage(); this.Hide(); m1.Show(); }
public AddSubjects(FormManage f) { InitializeComponent(); this.fm = f; }