Пример #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int currentRow         = int.Parse(e.RowIndex.ToString());
            int currentColumnIndex = int.Parse(e.ColumnIndex.ToString());
            int gid  = Convert.ToInt32(dataGridView1.Rows[currentRow].Cells[1].Value.ToString());
            int evid = Convert.ToInt32(dataGridView1.Rows[currentRow].Cells[2].Value.ToString());

            /*if (currentColumnIndex == 0)
             * {
             *  ManageGroupEvaluation_1 f4 = new ManageGroupEvaluation_1(gid);
             *  this.Close();
             *  f4.Show();
             * }*/

            if (currentColumnIndex == 0)
            {
                var confirmResult = MessageBox.Show("Are you sure to delete this item ??",
                                                    "Confirm Delete!!",
                                                    MessageBoxButtons.YesNo);
                if (confirmResult == DialogResult.Yes)
                {
                    SqlConnection con = new SqlConnection(conURL);
                    con.Open();
                    string     delete = "DELETE FROM GroupEvaluation Where GroupId = @val1 AND EvaluationId = @val2";
                    SqlCommand cmd    = new SqlCommand(delete, con);
                    cmd.Parameters.AddWithValue("@val1", gid);
                    cmd.Parameters.AddWithValue("@val2", evid);
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Record deleted succesfully");
                    ManageGroupEvaluation f5 = new ManageGroupEvaluation();
                    this.Close();
                    f5.Show();
                }
            }
        }
        /* private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
         * {
         *   int currentRow = int.Parse(e.RowIndex.ToString());
         *   int currentColumnIndex = int.Parse(e.ColumnIndex.ToString());
         *   int evid = Convert.ToInt32(dataGridView1.Rows[currentRow].Cells[1].Value.ToString());
         *   if (currentColumnIndex == 0)
         *   {
         *       Evaluationid.Text = evid.ToString();
         *   }
         * } */


        private void Back_Click(object sender, EventArgs e)
        {
            ManageGroupEvaluation form = new ManageGroupEvaluation();

            this.Close();
            form.Show();
        }
Пример #3
0
        private void ManageGroupEvaluation_Click(object sender, EventArgs e)
        {
            ManageGroupEvaluation E10 = new ManageGroupEvaluation();

            E10.Show();
            this.Hide();
        }
        private void Save_Click(object sender, EventArgs e)
        {
            bool i = myvalidations();

            if (i == true)
            {
                SqlConnection con = new SqlConnection(conURL);
                con.Open();
                SqlCommand cmd1;
                string     insertgroupev = "INSERT INTO GroupEvaluation(GroupId, EvaluationId, ObtainedMarks, EvaluationDate) values(@GroupId, @EvaluationId, @ObtainedMarks, @EvaluationDate)";
                cmd1 = new SqlCommand(insertgroupev, con);
                cmd1.Parameters.AddWithValue("@GroupId", flag);
                cmd1.Parameters.AddWithValue("@EvaluationId", Evaluationid.Text);
                cmd1.Parameters.AddWithValue("@ObtainedMarks", ObtainedMarks.Text);
                cmd1.Parameters.AddWithValue("@EvaluationDate", DateTime.Today);
                cmd1.ExecuteNonQuery();
                MessageBox.Show("Record Inserted");
                ManageGroupEvaluation form1 = new ManageGroupEvaluation();
                this.Close();
                form1.Show();
            }
        }