private void ViewGroupProjectDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { int currentRow = int.Parse(e.RowIndex.ToString()); int curentcolumnindex = int.Parse(e.ColumnIndex.ToString()); int prid = Convert.ToInt32(ViewGroupProjectDataGridView.Rows[currentRow].Cells[1].Value.ToString()); if (curentcolumnindex == 0) { SqlConnection conn = new SqlConnection(conURL); conn.Open(); String DeleteCMD = "DELETE FROM GroupProject WHERE GroupProject.ProjectId = @id"; SqlCommand DeleteCommand = new SqlCommand(DeleteCMD, conn); DeleteCommand.Parameters.Add(new SqlParameter("id", prid)); int count = DeleteCommand.ExecuteNonQuery(); ViewGroupProject form = new ViewGroupProject(groupId); form.Show(); this.Hide(); } }
private void StdGroupDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { int currentRow = int.Parse(e.RowIndex.ToString()); int curentcolumnindex = int.Parse(e.ColumnIndex.ToString()); string gid = StdGroupDataGridView.Rows[currentRow].Cells[0].Value.ToString(); if (curentcolumnindex == 2) { AddStudentGroup form = new AddStudentGroup(Convert.ToInt32(gid)); form.Show(); this.Hide(); } if (curentcolumnindex == 3) { ViewGroupStudents form = new ViewGroupStudents(Convert.ToInt32(gid)); form.Show(); this.Hide(); } if (curentcolumnindex == 4) { AddEvaluationGroup form = new AddEvaluationGroup(Convert.ToInt32(gid)); form.Show(); this.Hide(); } if (curentcolumnindex == 5) { ViewGroupEvaluation form = new ViewGroupEvaluation(Convert.ToInt32(gid)); form.Show(); this.Hide(); } if (curentcolumnindex == 6) { AddGroupProject form = new AddGroupProject(Convert.ToInt32(gid)); form.Show(); this.Hide(); } if (curentcolumnindex == 7) { ViewGroupProject form = new ViewGroupProject(Convert.ToInt32(gid)); form.Show(); this.Hide(); } if (curentcolumnindex == 8) { SqlConnection conn = new SqlConnection(conURL); conn.Open(); String DeleteCMD = "DELETE FROM GroupStudent WHERE GroupStudent.GroupId = @id"; SqlCommand DeleteCommand = new SqlCommand(DeleteCMD, conn); DeleteCommand.Parameters.Add(new SqlParameter("id", Convert.ToInt32(gid))); int count = DeleteCommand.ExecuteNonQuery(); String DeleteCMD2 = "DELETE FROM GroupEvaluation WHERE GroupEvaluation.GroupId = @id"; SqlCommand DeleteCommand2 = new SqlCommand(DeleteCMD2, conn); DeleteCommand2.Parameters.Add(new SqlParameter("id", Convert.ToInt32(gid))); count = DeleteCommand2.ExecuteNonQuery(); String DeleteCMD3 = "DELETE FROM GroupProject WHERE GroupProject.GroupId = @id"; SqlCommand DeleteCommand3 = new SqlCommand(DeleteCMD3, conn); DeleteCommand3.Parameters.Add(new SqlParameter("id", Convert.ToInt32(gid))); count = DeleteCommand3.ExecuteNonQuery(); String DeleteCMD4 = "DELETE FROM [Group] WHERE [Group].Id = @id"; SqlCommand DeleteCommand4 = new SqlCommand(DeleteCMD4, conn); DeleteCommand4.Parameters.Add(new SqlParameter("id", Convert.ToInt32(gid))); count = DeleteCommand4.ExecuteNonQuery(); GroupStudent form = new GroupStudent(); form.Show(); this.Hide(); } }