예제 #1
0
 private void FrmTaoKiThi_Load(object sender, EventArgs e)
 {
     try
     {
         bindingSource1.DataSource = KyThiService.GetAll();
         //pContainer.Enabled = False
         DTO.TTKyThi obj = bindingSource1.Current as DTO.TTKyThi;
     }
     catch (Exception ex)
     {
         MetroFramework.MetroMessageBox.Show(this, ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
 private void btnXoaKiThi_Click(object sender, EventArgs e)
 {
     objState = EntityState.Deleted;
     if (MetroFramework.MetroMessageBox.Show(this, "Bạn có chắc muốn xóa không?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         try
         {
             DTO.TTKyThi obj = bindingSource1.Current as DTO.TTKyThi;
             if (obj != null)
             {
                 bool result = KyThiService.Delete(obj.KyThi);
                 if (result)
                 {
                     bindingSource1.RemoveCurrent();
                     objState = EntityState.Unchanged;
                 }
             }
         }
         catch (Exception ex)
         {
             MetroFramework.MetroMessageBox.Show(this, ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }