private void Attendancerecord_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (Attendancerecord.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Edit") { Class1.atId = Convert.ToInt32(Attendancerecord.Rows[e.RowIndex].Cells[0].Value); Class1.stuId = Convert.ToInt32(Attendancerecord.Rows[e.RowIndex].Cells[1].Value); this.Hide(); MarkStudentAttendance cl = new MarkStudentAttendance(); cl.Show(); } if (Attendancerecord.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Delete") { int AId = Convert.ToInt32(Attendancerecord.Rows[e.RowIndex].Cells[0].Value); int SId = Convert.ToInt32(Attendancerecord.Rows[e.RowIndex].Cells[1].Value); if (MessageBox.Show("Are you sure to perform this action!?" + Attendancerecord.Rows[e.RowIndex].Cells[1].Value.ToString() + "?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { SqlConnection newconn = new SqlConnection(con); newconn.Open(); SqlCommand command = new SqlCommand("delete from StudentAttendance where AttendanceId='" + AId + "' AND StudentId = '" + SId + "'", newconn); command.ExecuteNonQuery(); newconn.Close(); this.studentAttendanceTableAdapter.Fill(this.projectBDataSet.StudentAttendance); } } }
private void btnmarkAttendance_Click(object sender, EventArgs e) { this.Hide(); MarkStudentAttendance mark = new MarkStudentAttendance(); mark.Show(); }
private void btnaddclo_Click(object sender, EventArgs e) { this.Hide(); MarkStudentAttendance bck = new MarkStudentAttendance(); bck.Show(); }