private void btnThemMoi_Click(object sender, EventArgs e) { isAdd = true; Oid = 0; var frm = new frm_ChiTietPhieuKiemKe(this); frm.ShowDialog(); var idKiemKe = frm.IdKiemKe; var lst = KiemKeDataProvider.Instance.GetListKiemKe2(); grcDanhSach.DataSource = lst; if (idKiemKe > 0) { var kiemKeInfo = lst.Find(delegate(KiemKeInfor match) { return(match.IdKiemKe == idKiemKe); }); if (kiemKeInfo != null) { CommonProvider.Instance.UnLock_KiemKe(kiemKeInfo); } } }
private void grvDanhSach_DoubleClick(object sender, EventArgs e) { try { if (grvDanhSach.FocusedRowHandle < 0) { return; } isAdd = false; var info = ((KiemKeInfor)grvDanhSach.GetRow(grvDanhSach.FocusedRowHandle)); info = KiemKeDataProvider.Instance.GetKiemKeInfoById(info.IdKiemKe); if (CommonProvider.Instance.Lock_KiemKe(info)) { var frmChiTietPhieuKiemKe = new frm_ChiTietPhieuKiemKe(this, info.IdKiemKe, info.IdDotKiemKe, info.TrangThai, info.IdNhanVien); frmChiTietPhieuKiemKe.ShowDialog(); CommonProvider.Instance.UnLock_KiemKe(info); ReLoad(); } } catch (ManagedException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { #if DEBUG MessageBox.Show(ex.ToString()); #else MessageBox.Show(ex.Message); #endif } }