Esempio n. 1
0
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     dgvContent.Enabled = false;
     ResetAllTextboxes();
     curClass = null;
     db.SaveChanges();
     BoundDataSource();
     dgvContent.Enabled = true;
 }
Esempio n. 2
0
        private void dgvContent_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= dgvContent.RowCount)
            {
                return;
            }
            var classId = int.Parse(dgvContent.Rows[e.RowIndex].Cells[0].Value.ToString());

            curClass   = db.MucHocPhis.Where(mhp => mhp.Ma == classId).FirstOrDefault();
            tbMhp.Text = curClass.SoHocPhi.ToString();
        }
Esempio n. 3
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (curClass != null)
     {
         //db.LopHocs.Where(lh => lh.Ma == curClass.Ma).FirstOrDefault();
         db.MucHocPhis.Remove(curClass);
         db.SaveChanges();
         curClass = null;
         BoundDataSource();
     }
 }
Esempio n. 4
0
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     if (curClass == null)
     {
         MucHocPhi mhp = new MucHocPhi()
         {
             SoHocPhi = int.Parse(tbMhp.Text),
         };
         db.MucHocPhis.Add(mhp);
     }
     else
     {
         curClass.SoHocPhi = int.Parse(tbMhp.Text);
     }
     db.SaveChanges();
     BoundDataSource();
     dgvContent.Enabled = true;
 }