Beispiel #1
0
        // Method for displaying the marks of students already entered in the database.
        public void Display_And_Update_Student_Marks(string stud_name)
        {
            Eval_1_Marks_Label.Show();
            Eval_1_Marks_txtbox.Show();
            Eval_2_Marks_Label.Show();
            Eval_2_Marks_txtbox.Show();
            Eval_3_Marks_Label.Show();
            Eval_3_Marks_txtbox.Show();
            Marks_Info_Label.Show();
            Enter_Eval_Modes_Label.Hide();
            Enter_Student_Marks_Label.Show();
            Update_Eval_Marks_Button.Show();
            Insert_Eval_Marks_Button.Hide();
            Total_Score_label.Show();
            Marks_Outof_50.Show();


            Enter_Student_Marks_Label.Text = "Update marks of : " + stud_name;

            Get_Evaluation_Modes_For_Labels();

            string commandText1 = "SELECT eval_1_marks, eval_2_marks, eval_3_marks, final_marks from Evaluation_Marks where student_id  = (SELECT student_id from Student where student_name = @stud_name) and subject_id = (SELECT subject_id from Subject where subject_name = @subj_name)";


            try
            {
                using (SqlCommand cmd = new SqlCommand(commandText1, sqlConnection1))
                {
                    cmd.Parameters.AddWithValue("@stud_name", stud_name);
                    cmd.Parameters.AddWithValue("@subj_name", SubjectComboBox.SelectedItem);
                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        Eval_1_Marks_txtbox.Text = reader.GetInt32(0).ToString();

                        Eval_2_Marks_txtbox.Text = reader.GetInt32(1).ToString();

                        Eval_3_Marks_txtbox.Text = reader.GetInt32(2).ToString();

                        Marks_Outof_50.Text = reader.GetInt32(3).ToString() + " / 50";
                    }
                    reader.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        // Method for displaying Textboxes and Labels for inserting marks of student.
        // Called from private void StudentComboBox_SelectedValueChange() , private void Insert_eval_mode_Click() and , Display_And_Update_Student_Marks().
        public void Display_Textboxes_And_Labels_For_Inserting_Marks()
        {
            Eval_1_Marks_Label.Show();
            Eval_1_Marks_txtbox.Show();
            Eval_2_Marks_Label.Show();
            Eval_2_Marks_txtbox.Show();
            Eval_3_Marks_Label.Show();
            Eval_3_Marks_txtbox.Show();
            Insert_eval_mode.Hide();
            Insert_Eval_Marks_Button.Show();
            Marks_Info_Label.Show();
            Enter_Eval_Modes_Label.Hide();
            Enter_Student_Marks_Label.Show();

            Enter_Student_Marks_Label.Text = "Enter Marks of : " + StudentComboBox.SelectedItem;

            Get_Evaluation_Modes_For_Labels();
        }