Esempio n. 1
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            this.Hide();
            Attendence c = new Attendence();

            c.Show();
        }
Esempio n. 2
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Edit")
     {
         dash.classAttendence = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
         dash.stdAttendence   = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[1].Value);
         this.Hide();
         Attendence addAttendence = new Attendence();
         addAttendence.Show();
     }
     if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Delete")
     {
         int Attendence        = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
         int StudentAttendence = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[1].Value);
         if (MessageBox.Show("Do you want to delete " + dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() + "?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             SqlConnection connect = new SqlConnection(cnn);
             connect.Open();
             SqlCommand command = new SqlCommand("DELETE FROM StudentAttendance WHERE AttendanceId='" + Attendence + "' AND StudentId  = '" + StudentAttendence + "'", connect);
             command.ExecuteNonQuery();
             connect.Close();
             this.studentAttendanceTableAdapter.Fill(this.projectBDataSet1.StudentAttendance);
         }
     }
 }