Beispiel #1
0
        private void BackScreen_Click(object sender, EventArgs e)
        {
            ManageEvaluationForm form = new ManageEvaluationForm();

            this.Close();
            form.Show();
        }
Beispiel #2
0
        private void GoToEvaluationForm_Click_1(object sender, EventArgs e)
        {
            ManageEvaluationForm form = new ManageEvaluationForm();

            form.Show();
            this.Hide();
        }
Beispiel #3
0
 private void InsertEvaluation_Click(object sender, EventArgs e)
 {
     try
     {
         Evaluation evaluation = new Evaluation();
         evaluation.Name = NameTextBox.Text;
         try
         {
             evaluation.Marks = MarksTextBox.Text;
         }
         catch (ArgumentException)
         {
             MessageBox.Show("Please enter the marks of evaluation in digits");
             throw new ArgumentException();
         }
         try
         {
             evaluation.TotalWeightage = WeightageTextBox.Text;
         }
         catch (ArgumentException)
         {
             MessageBox.Show("Please enter the correct weightage");
             throw new ArgumentException();
         }
         if (value1 == "add")
         {
             SqlConnection connection = new SqlConnection(connString);
             connection.Open();
             string     addEvaluation = string.Format("INSERT INTO Evaluation(Name, TotalMarks, TotalWeightage) values('{0}', '{1}', '{2}')", evaluation.Name, int.Parse(evaluation.Marks), int.Parse(evaluation.TotalWeightage));
             SqlCommand cmd           = new SqlCommand(addEvaluation, connection);
             cmd.ExecuteNonQuery();
             MessageBox.Show("Evaluation Added!");
             connection.Close();
         }
         else if (value1 == "edit")
         {
             SqlConnection connection = new SqlConnection(connString);
             connection.Open();
             string update = string.Format("UPDATE Evaluation SET Name = '{0}', TotalMarks = '{1}', TotalWeightage = '{2}'" +
                                           "WHERE Id = '{3}'", evaluation.Name, int.Parse(evaluation.Marks), int.Parse(evaluation.TotalWeightage), id);
             SqlCommand cmd = new SqlCommand(update, connection);
             cmd.ExecuteNonQuery();
             MessageBox.Show("Evaluation Updated!");
             connection.Close();
         }
         ManageEvaluationForm form = new ManageEvaluationForm();
         this.Close();
         form.Show();
     }
     catch (Exception)
     {
         MessageBox.Show("Evaluation not saved!");
     }
 }