private void BackBtn_Click(object sender, EventArgs e)
        {
            Evaluation form = new Evaluation();

            form.Show();
            this.Hide();
        }
Beispiel #2
0
        private void DeleteEvaluationsBtn_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(conURL);

            conn.Open();

            if (EvaluationsGridView.SelectedCells.Count != 0)
            {
                int row = EvaluationsGridView.SelectedCells[0].RowIndex;
                int id  = Convert.ToInt32(EvaluationsGridView.Rows[row].Cells[0].Value);

                String     delEvaluationCMD1     = String.Format("DELETE FROM GroupEvaluation WHERE GroupEvaluation.EvaluationId = {0}", id);
                SqlCommand delEvaluationCommand1 = new SqlCommand(delEvaluationCMD1, conn);

                int count = delEvaluationCommand1.ExecuteNonQuery();

                String     delEvaluationCMD     = String.Format("DELETE FROM Evaluation WHERE Id = {0}", id);
                SqlCommand delEvaluationCommand = new SqlCommand(delEvaluationCMD, conn);

                count = delEvaluationCommand.ExecuteNonQuery();
                Evaluation form = new Evaluation();
                this.Hide();
                form.Show();
            }
        }
        private void AddEvaluationSaveBtn_Click(object sender, EventArgs e)
        {
            if (ValidateEntries())
            {
                if (flag == 0)
                {
                    SqlConnection conn = new SqlConnection(conURL);
                    conn.Open();
                    String     AddEvaluationCMD     = "INSERT INTO Evaluation (Name, TotalMarks, TotalWeightage) VALUES (@name, @marks, @weightage)";
                    SqlCommand AddEvaluationCommand = new SqlCommand(AddEvaluationCMD, conn);
                    AddEvaluationCommand.Parameters.Add(new SqlParameter("name", EvaluationNameTextBox.Text));
                    AddEvaluationCommand.Parameters.Add(new SqlParameter("marks", EvaluationMarksTextBox.Text));
                    AddEvaluationCommand.Parameters.Add(new SqlParameter("weightage", TotalWeightageTextBox.Text));
                    int        count = AddEvaluationCommand.ExecuteNonQuery();
                    Evaluation form  = new Evaluation();
                    form.Show();
                    this.Hide();
                }
                if (flag == 1)
                {
                    SqlConnection conn = new SqlConnection(conURL);
                    conn.Open();
                    String     UpdateEvaluationCMD     = "UPDATE Evaluation SET Name = @name, TotalMarks = @marks, TotalWeightage = @weightage WHERE Id = @id";
                    SqlCommand UpdateEvaluationCommand = new SqlCommand(UpdateEvaluationCMD, conn);
                    UpdateEvaluationCommand.Parameters.Add(new SqlParameter("name", EvaluationNameTextBox.Text));
                    UpdateEvaluationCommand.Parameters.Add(new SqlParameter("marks", EvaluationMarksTextBox.Text));
                    UpdateEvaluationCommand.Parameters.Add(new SqlParameter("weightage", TotalWeightageTextBox.Text));
                    UpdateEvaluationCommand.Parameters.Add(new SqlParameter("id", incomingId));

                    int count = UpdateEvaluationCommand.ExecuteNonQuery();

                    Evaluation form = new Evaluation();
                    form.Show();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Invalid input");
            }
        }