Ejemplo n.º 1
0
 private void dgvHocSinh_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0 || e.RowIndex >= dgvHocSinh.RowCount)
     {
         return;
     }
     if (dgvHocSinh.Columns[e.ColumnIndex].Name == "ChucNang")
     {
         //Console.WriteLine("Hoc sinh: " + dgvContent.Rows[e.RowIndex].Cells[2].Value.ToString());
         int maHocSinh            = int.Parse(dgvHocSinh.Rows[e.RowIndex].Cells[0].Value.ToString());
         BienLaiThuHocPhi bienLai = db.BienLaiThuHocPhis.Where(bl => bl.MaHocSinh == maHocSinh && bl.MaLopHoc == curClassId).FirstOrDefault();
         db.BienLaiThuHocPhis.Remove(bienLai);
         db.SaveChanges();
         RebindBindingSources();
     }
 }
Ejemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            int maHocSinh            = int.Parse(lueHocSinh.EditValue.ToString());
            BienLaiThuHocPhi bienLai = new BienLaiThuHocPhi()
            {
                TongSoBuoi = 0,
                TongTien   = 0,
                NgayThu    = DateTime.Now,
                MaHocSinh  = maHocSinh,
                MaLopHoc   = curClassId
            };

            db.BienLaiThuHocPhis.Add(bienLai);
            db.SaveChanges();
            RebindBindingSources();
        }