public void Hide_Eval_And_Insert_Marks_And_Update_Marks_Code() { Eval_1_Label.Hide(); Eval_1_txtbox.Hide(); Eval_2_Label.Hide(); Eval_2_txtbox.Hide(); Eval_3_Label.Hide(); Eval_3_txtbox.Hide(); Insert_eval_mode.Hide(); Enter_Eval_Modes_Label.Hide(); Enter_Student_Marks_Label.Hide(); Eval_1_Marks_Label.Hide(); Eval_1_Marks_txtbox.Hide(); Eval_2_Marks_Label.Hide(); Eval_2_Marks_txtbox.Hide(); Eval_3_Marks_Label.Hide(); Eval_3_Marks_txtbox.Hide(); Insert_Eval_Marks_Button.Hide(); Marks_Info_Label.Hide(); Total_Score_label.Hide(); Marks_Outof_50.Hide(); Update_Eval_Marks_Button.Hide(); }
private void StudentComboBox_SelectedValueChanged(object sender, EventArgs e) { Enter_Eval_Modes_Label.Show(); Total_Score_label.Hide(); Marks_Outof_50.Hide(); Insert_Eval_Marks_Button.Show(); Update_Eval_Marks_Button.Hide(); string commandText1 = "SELECT eval_mode_1,eval_mode_2,eval_mode_3 FROM Evaluation WHERE subject_id = (SELECT subject_id FROM Subject where subject_name = @s1_name)"; try { //sqlConnection1.Open(); using (SqlCommand cmd = new SqlCommand(commandText1, sqlConnection1)) { cmd.Parameters.AddWithValue("@s1_name", SubjectComboBox.Text); SqlDataReader reader = cmd.ExecuteReader(); // If the evaluation modes already are entered in the database. if (reader.HasRows) { reader.Close(); if (Check_If_Marks_Already_Exist()) { Display_And_Update_Student_Marks(StudentComboBox.SelectedItem.ToString()); } else { // Displaying Textboxes and Labels for inserting Student marks and Labels Display_Textboxes_And_Labels_For_Inserting_Marks(); } } // If the evaluation modes are not yet entered in the database. // Creation of Evaluation modes. else { reader.Close(); Enter_Modes_Of_Evaluation(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }