private void BtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int id = (int)GrvCreateJob.GetFocusedRowCellValue("Id_CongViec"); try { using (_theoDoiVanBanEntities = new TheoDoiVanBanEntities()) { var _exits = _theoDoiVanBanEntities.GetOneCongViec(id).FirstOrDefault(); if (_exits.StatusForward == true) { XtraMessageBox.Show("Công việc đã được giao.\nKhông thể xóa"); } else { _theoDoiVanBanEntities.DeleteCreateJob(id); XtraMessageBox.Show("Xóa thông tin thành công"); } } GetCreateJob(); } catch (Exception) { XtraMessageBox.Show("Vui lòng xóa ở bảng dưới trước khi xóa ở đây"); } }
private void GetOneGDVanBanDen() { try { using (_theoDoiVanBanEntities = new TheoDoiVanBanEntities()) { var _GetOne = _theoDoiVanBanEntities.GetOneCongViec(IdEdit).Single(); IdNguoikhoitao = (int)_GetOne.Id_AccountKhoiTao; IdNguoiGiaoviec = (int)_GetOne.Id_AccountGiaoViec; dateNgayNhanVanBan.EditValue = _GetOne.NgayNhanVanBan; SearchCoQuanBanHanh.EditValue = _GetOne.Id_CoQuanBanHanh; SearchLoaiVanBan.EditValue = _GetOne.Id_loaiVanBan; searchLinhVucVanBan.EditValue = _GetOne.Id_LinhVucVanBan; txtSoVanBan.EditValue = _GetOne.SoVanBan; dateNgayPhatHanh.EditValue = _GetOne.NgayPhatHanh; txtSoGhiSoCongVan.EditValue = _GetOne.SoGhiSoCongVan; memoTrichYeuVanBan.EditValue = _GetOne.NoiDungVanBan; memoCommentGD.EditValue = _GetOne.CommentLanhDao; dateNgayChiDao.EditValue = _GetOne.NgayChiDao; dateNgayPhaiHoanThanh.EditValue = _GetOne.NgayPhaiHoanThanh; radioPhaiBaoCao.EditValue = _GetOne.PhaiBaoCao; txtNguoiNhanVanBan.EditValue = _GetOne.NguoiNhanVanBan; //btnTaiLieuDinhKem.EditValue = _GetOne.Patition + ":\\" + _GetOne.TaiLIeuDinhKem; DateHoanThanh.EditValue = _GetOne.NgayHoanThanh; StatusForward = (bool)_GetOne.StatusForward; checkHoanThanh.Checked = (bool)_GetOne.HoanThanh; checkChuaHoanThanh.Checked = (bool)_GetOne.ChuaHoanThanh; checkDangThucHien.Checked = (bool)_GetOne.DangThucHien; checkChuaThucHien.Checked = (bool)_GetOne.ChuaThucHien; checkThucHienCham.Checked = (bool)_GetOne.ThucHienCham; checkKetThucCongViec.Checked = (bool)_GetOne.KetThucCongViec; memoTomTatKetQua.EditValue = _GetOne.TomTatKetQua; } } catch (Exception) { XtraMessageBox.Show("Lỗi kết nối với cơ sở dữ liệu"); } }