コード例 #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 btnLuuKiThi_Click(object sender, EventArgs e)
 {
     try
     {
         bindingSource1.EndEdit();
         TTKyThi obj = bindingSource1.Current as TTKyThi;
         if (obj != null)
         {
             obj = KyThiService.Save(obj, objState);
             //metroGrid1.Refresh();
             objState = EntityState.Unchanged;
             MetroFramework.MetroMessageBox.Show(this, "Đã Cập Nhật Thành Công", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MetroFramework.MetroMessageBox.Show(this, ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #3
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);
         }
     }
 }