public void Delete(int id) { DAL.DanhSachCanBoThoiViec tv = dataContext.DanhSachCanBoThoiViecs.Where(t => t.ID == id).SingleOrDefault(); if (tv != null) { dataContext.DanhSachCanBoThoiViecs.DeleteOnSubmit(tv); Save(); } }
/// <summary> /// /// </summary> /// <param name="prKey">Khóa chính của bảng DanhSachCanBoTHoiViec</param> /// <returns></returns> public decimal GetHoSoPrimaryKey(int prKey) { DAL.DanhSachCanBoThoiViec item = dataContext.DanhSachCanBoThoiViecs.FirstOrDefault(p => p.ID == prKey); if (item != null) { return(item.PrKeyHoSo); } return(0); }
public void UpdateThuTuc(DAL.DanhSachCanBoThoiViec thoiViec) { DAL.DanhSachCanBoThoiViec tv = dataContext.DanhSachCanBoThoiViecs.Where(t => t.ID == thoiViec.ID).SingleOrDefault(); if (tv != null) { tv.NgayNghi = thoiViec.NgayNghi; tv.MaLyDoNghi = thoiViec.MaLyDoNghi; tv.DaTraTheBHYT = thoiViec.DaTraTheBHYT; tv.NgayTraThe = thoiViec.NgayTraThe; tv.DaTraSoBHXH = thoiViec.DaTraSoBHXH; tv.NgayTraSo = thoiViec.NgayTraSo; tv.FrCBDuyetNghi = thoiViec.FrCBDuyetNghi; tv.NgayHoanThanhThuTuc = thoiViec.NgayHoanThanhThuTuc; tv.IsBelongToBlackList = thoiViec.IsBelongToBlackList; tv.MaLyDoBiHanChe = thoiViec.MaLyDoBiHanChe; tv.DaHoanThanhThuTuc = thoiViec.DaHoanThanhThuTuc; tv.AttachFile = thoiViec.AttachFile; tv.GhiChu = thoiViec.GhiChu; tv.SoQuyetDinh = thoiViec.SoQuyetDinh; Save(); } }
public int Insert(DAL.DanhSachCanBoThoiViec thoiViec) { dataContext.DanhSachCanBoThoiViecs.InsertOnSubmit(thoiViec); Save(); return(thoiViec.ID); }
/// <summary> /// Cập nhật lại các thủ tục /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void CapNhatThuTuc_Click(object sender, DirectEventArgs e) { try { // upload file string path = string.Empty; if (fufTepTinDinhKem.HasFile) { string directory = Server.MapPath(""); path = UploadFile(fufTepTinDinhKem, "File/ThoiViec"); } // cập nhật thủ tục DAL.DanhSachCanBoThoiViec tv = new DAL.DanhSachCanBoThoiViec(); tv.ID = int.Parse("0" + hdfRecordID.Text); if (!dfNgayNghi.SelectedDate.ToString().Contains("0001")) { tv.NgayNghi = dfNgayNghi.SelectedDate; } if (cbx_lydonghi.SelectedItem.Value != null) { tv.MaLyDoNghi = cbx_lydonghi.SelectedItem.Value; } tv.DaTraTheBHYT = bool.Parse(cbTraTheBHYT.SelectedItem.Value); if (!dfNgayTraThe.SelectedDate.ToString().Contains("0001")) { tv.NgayTraThe = dfNgayTraThe.SelectedDate; } tv.DaTraSoBHXH = bool.Parse(cbSoBHXH.SelectedItem.Value); if (!dfNgayTraSo.SelectedDate.ToString().Contains("0001")) { tv.NgayTraSo = dfNgayTraSo.SelectedDate; } if (hdfCanBoDuyet.Text != "") { tv.FrCBDuyetNghi = decimal.Parse("0" + hdfCanBoDuyet.Text); } tv.IsBelongToBlackList = chkThemVaoDsHanChe.Checked; if (cbxLyDoHanChe.SelectedItem.Value != null) { tv.MaLyDoBiHanChe = int.Parse(cbxLyDoHanChe.SelectedItem.Value); } tv.DaHoanThanhThuTuc = chkHoanTatThuTuc.Checked; tv.GhiChu = txtGhiChuTV.Text; tv.SoQuyetDinh = txtSoQuyetDinh.Text; if (path != "") { tv.AttachFile = path; } else { tv.AttachFile = hdfTepTinDinhKem.Text; } // if (tv.DaHoanThanhThuTuc == true) // { //bool htTaiSan = new BanGiaoTaiSanController().KiemTraHoanThanhBGTaiSan(tv.ID); //if (htTaiSan == false) //{ // X.Msg.Alert("Thông báo", "Bạn không thể cập nhật trạng thái Hoàn tất thủ tục khi chưa hoàn thành bàn giao tất cả tài sản").Show(); // return; //} //bool htCongNo = new ThanhToanCongNoController().KiemTraHoanThanhCongNo(tv.ID); //if (htCongNo == false) //{ // X.Msg.Alert("Thông báo", "Bạn không thể cập nhật trạng thái Hoàn tất thủ tục khi chưa hoàn thành thanh toán công nợ").Show(); // return; //} // } new DanhSachCanBoThoiViecController().UpdateThuTuc(tv); if (tv.DaHoanThanhThuTuc == true) { // cập nhật trạng thái đã nghỉ trong bảng HOSO DAL.HOSO hs = new DAL.HOSO(); DAL.DanhSachCanBoThoiViec ds = new DanhSachCanBoThoiViecController().GetByID(tv.ID); hs.PR_KEY = ds.PrKeyHoSo; hs.DA_NGHI = true; hs.NGAY_NGHI = tv.NgayNghi; hs.MA_LYDO_NGHI = tv.MaLyDoNghi; new DanhSachCanBoThoiViecController().UpdateNghiViecHoSo(hs); // cập nhật thông tin bảo hiểm nhân viên (trạng thái đã trả thẻ hay chưa) DAL.BHNHANVIEN_BAOHIEM nvbh = new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByIDNhanVien_BaoHiem(int.Parse(ds.PrKeyHoSo.ToString())); if (nvbh != null) { if (tv.DaTraSoBHXH == true) { nvbh.TrangThaiCapSoBHXH = "DaTraSo"; } if (tv.DaTraTheBHYT == true) { nvbh.TrangThaiCapTheBHYT = "DaTraThe"; } new NhanVien_BaoHiemController().UpdateNhanVien_BaoHiem(nvbh); } } RM.RegisterClientScriptBlock("rsl", "Store1.reload();wdCapNhatThuTuc.hide(); LoadDataInSouthPanel();"); } catch (Exception ex) { X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message.ToString()).Show(); } }