private void Manage_Group_Evaluation_Click(object sender, EventArgs e) { this.Hide(); ManageEvaluation f1 = new ManageEvaluation(); f1.ShowDialog(); this.Close(); }
private void Back_Click(object sender, EventArgs e) { con1.Close(); this.Hide(); ManageEvaluation f2 = new ManageEvaluation(); f2.ShowDialog(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { con.Open(); int UP_Row = int.Parse(e.RowIndex.ToString()); int UP_RowIndex = int.Parse(e.ColumnIndex.ToString()); ID1 = Convert.ToInt32(dataGridView1.Rows[UP_Row].Cells[0].Value.ToString()); int dd = (int)dataGridView1.CurrentRow.Cells[0].Value; if (UP_RowIndex == 4) { if (UP_RowIndex == 1) { if (UP_RowIndex == 0) { MessageBox.Show("Click Again"); } } if (UP_RowIndex != 0) { var askfirst1 = MessageBox.Show("Are you sure you want to add this Evaluation Id?", "Add", MessageBoxButtons.YesNo); if (askfirst1 == DialogResult.Yes) { FromGroupStudent t = new FromGroupStudent(); ManageEvaluation s = new ManageEvaluation(dd); ID = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); //s.Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); s.textBox1.Text = t.Flags.ToString(); s.Flagg2 = 0; s.ShowDialog(); con.Close(); this.Close(); } else { con.Close(); this.Hide(); FromEvaluation f2 = new FromEvaluation(); f2.ShowDialog(); } } } else { MessageBox.Show("Click on add button"); } }
private void Insert_Click(object sender, EventArgs e) { bool a = G_Id(); if (a == false) { bool b = P_Id(); if (b == false) { bool d = Group_Exists(Convert.ToInt32(textBox1.Text), Convert.ToInt32(comboBox1.Text)); if (d == false) { if (Flagg2 == 0) { con.Open(); DateTime time = DateTime.Now; cmd2 = new SqlCommand("insert into [GroupProject]([GroupId], ProjectId, AssignmentDate) values ('" + textBox1.Text + "','" + comboBox1.Text + "', @time)", con); cmd2.Parameters.AddWithValue("@time", time); cmd2.ExecuteNonQuery(); MessageBox.Show("Inserted Successfully"); con.Close(); this.Hide(); ManageGroupProject f4 = new ManageGroupProject(); f4.ShowDialog(); this.Close(); } if (Flagg2 > 0) { con.Open(); DateTime time = DateTime.Now; cmd2 = new SqlCommand("UPDATE [GroupProject] set GroupId = @GroupId, ProjectId = @ProjectId, AssignmentDate = @AssignmentDate WHERE GroupId = @d1 AND [ProjectId] = @d2", con); cmd2.Parameters.AddWithValue("@d1", Flagg2); cmd2.Parameters.AddWithValue("@d2", ID1); cmd2.Parameters.AddWithValue("@GroupId", Convert.ToInt32(textBox1.Text)); cmd2.Parameters.AddWithValue("@ProjectId", Convert.ToInt32(comboBox1.Text)); cmd2.Parameters.AddWithValue("@AssignmentDate", time); cmd2.ExecuteNonQuery(); MessageBox.Show("Updated Successfully"); con.Close(); this.Hide(); ManageGroupProject f4 = new ManageGroupProject(); f4.ShowDialog(); this.Close(); } } else { MessageBox.Show("This Project Id is already assigned to this group"); } if (Flagg2 > 0) { con.Open(); DateTime time = DateTime.Now; cmd2 = new SqlCommand("UPDATE GroupEvaluation SET GroupId = @GroupId, EvaluationId = @EvaluationId, ObtainedMarks = @ObtainedMarks, EvaluationDate = @EvaluationDate WHERE GroupId = @d1 AND EvaluationId = @d2", con); cmd2.Parameters.AddWithValue("@d1", Flagg2); cmd2.Parameters.AddWithValue("@d2", ID1); cmd2.Parameters.AddWithValue("@GroupId", Convert.ToInt32(textBox1.Text)); cmd2.Parameters.AddWithValue("@EvaluationId", Convert.ToInt32(comboBox1.Text)); cmd2.Parameters.AddWithValue("@EvaluationDate", time); cmd2.ExecuteNonQuery(); MessageBox.Show("Updated successfully Successfully"); con.Close(); this.Hide(); ManageEvaluation f4 = new ManageEvaluation(); f4.ShowDialog(); this.Close(); } } else { MessageBox.Show("Select Evaluation Id"); } } else { MessageBox.Show("Add Group"); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { con.Open(); int URow = int.Parse(e.RowIndex.ToString()); int URowIndex = int.Parse(e.ColumnIndex.ToString()); ID = Convert.ToInt32(dataGridView1.Rows[URow].Cells[0].Value.ToString()); ID1 = Convert.ToInt32(dataGridView1.Rows[URow].Cells[1].Value.ToString()); int dd = (int)dataGridView1.CurrentRow.Cells[0].Value; if (URowIndex == 5) { int d1 = (int)dataGridView1.CurrentRow.Cells[0].Value; if (URowIndex == 0) { MessageBox.Show("Click again"); con.Close(); } if (URowIndex != 0) { var askfirst1 = MessageBox.Show("Are you sure you want to Update this?", "Update", MessageBoxButtons.YesNo); if (askfirst1 == DialogResult.Yes) { Flagg2 = ID; textBox1.Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); comboBox1.Text = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); textBox3.Text = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString(); con.Close(); } else { Flagg2 = 0; con.Close(); this.Hide(); ManageEvaluation f2 = new ManageEvaluation(); f2.ShowDialog(); } } } else if (URowIndex == 6) { ID = Convert.ToInt32(dataGridView1.Rows[URow].Cells[0].Value.ToString()); if (URowIndex == 0) { MessageBox.Show("Click on Delete Again"); } if (URowIndex != 0) { var askfirst = MessageBox.Show("Are you sure you want to delete this?", "Delete", MessageBoxButtons.YesNo); if (askfirst == DialogResult.Yes) { cmd1 = new SqlCommand("DELETE FROM [GroupEvaluation] WHERE GroupId = @d1 AND EvaluationId = @d2", con); cmd1.Parameters.AddWithValue("@d1", ID); cmd1.Parameters.AddWithValue("@d2", ID1); cmd1.ExecuteNonQuery(); con.Close(); MessageBox.Show("Deleted Succesfully"); this.Hide(); ManageEvaluation f2 = new ManageEvaluation(); f2.ShowDialog(); this.Close(); } else { con.Close(); this.Hide(); ManageEvaluation f2 = new ManageEvaluation(); f2.ShowDialog(); } } else { Flagg2 = 0; con.Close(); } } }