public void CheckDaThoiViec(object sender, DirectEventArgs e) { try { if (cbonhanvien.SelectedItem == null) { X.MessageBox.Alert("Thông báo", "Không tìm thấy cán bộ"); return; } decimal prkeyHoSo = decimal.Parse(cbonhanvien.SelectedItem.Value); DAL.DanhSachCanBoThoiViec tv = new DanhSachCanBoThoiViecController().GetByPrkeyHoSo(prkeyHoSo); if (tv != null) // exist in DanhSachCanBoThoiViec { // alert to user X.Msg.Confirm("Xác nhận", "Cán bộ được chọn nằm trong danh sách cán bộ đã thôi việc. Bạn có muốn tiếp tục?", new MessageBoxButtonsConfig { Yes = new MessageBoxButtonConfig { Handler = "Ext.net.DirectMethods.DoYes()", Text = "Đồng ý" }, No = new MessageBoxButtonConfig { Handler = "Ext.net.DirectMethods.DoNo()", Text = "Đóng lại" } }).Show(); } } catch (Exception ex) { X.MessageBox.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message); } }
/// <summary> /// Hủy thủ tục cho các cán bộ được chọn /// </summary> protected void mnuHuyThuTuc_Click(object sender, DirectEventArgs e) { try { SelectedRowCollection SelectedRow = checkboxSelection.SelectedRows; foreach (var item in SelectedRow) { if (item.RecordID == "") { continue; } int id = int.Parse("0" + item.RecordID); DAL.DanhSachCanBoThoiViec tv = new DanhSachCanBoThoiViecController().GetByID(id); if (tv != null) { // xóa công nợ // new ThanhToanCongNoController().DeleteByIdCanBoThoiViec(tv.ID); // xóa khỏi danh sách cán bộ thôi việc new DanhSachCanBoThoiViecController().Delete(tv.ID); // cập nhật trạng thái đã nghỉ trong hồ sơ new HoSoController().UpdateDaNghiStatus(tv.PrKeyHoSo, false); } } hdfRecordID.Reset(); RM.RegisterClientScriptBlock("rload", "Store1.reload(); LoadDataInSouthPanel();"); } catch (Exception ex) { X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message.ToString()).Show(); } }
protected void cbxLyDoHanChe_Store_OnRefreshData(object sender, StoreRefreshDataEventArgs e) { List <DAL.ThamSoTrangThai> list = new DanhSachCanBoThoiViecController().GetByParamName("LyDoDuaVaoDanhSachHanChe", Session["MaDonVi"].ToString()); object[] obj = new object[list.Count]; for (int i = 0; i < list.Count; i++) { obj[i] = new { MA_LYDO_HC = list[i].ID, TEN_LYDO_HC = list[i].Value }; } cbxLyDoHanChe_Store.DataSource = obj; cbxLyDoHanChe_Store.DataBind(); }
/// <summary> /// Load dữ liệu về cán bộ thôi việc (nếu có) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCapNhatThuTuc_Click(object sender, DirectEventArgs e) { try { if (hdfRecordID.Text == "") { return; } int id = int.Parse("0" + hdfRecordID.Text); DAL.DanhSachCanBoThoiViec employee = new DanhSachCanBoThoiViecController().GetByID(id); dfNgayNghi.SetValue(employee.NgayNghi); if (employee.MaLyDoNghi != null) { cbx_lydonghi.SetValue(employee.MaLyDoNghi); } cbSoBHXH.SetValue(employee.DaTraSoBHXH.ToString()); dfNgayTraThe.SetValue(employee.NgayTraThe); cbTraTheBHYT.SetValue(employee.DaTraTheBHYT.ToString()); dfNgayTraSo.SetValue(employee.NgayTraSo); txtSoQuyetDinh.Text = employee.SoQuyetDinh; if (!string.IsNullOrEmpty(employee.AttachFile)) { int pos = employee.AttachFile.LastIndexOf('/'); if (pos != -1) { string tenTT = employee.AttachFile.Substring(pos + 1); fufTepTinDinhKem.Text = tenTT; } hdfTepTinDinhKem.Text = employee.AttachFile; } txtGhiChuTV.Text = employee.GhiChu; // lấy cán bộ duyệt nghỉ DAL.HOSO hs = new HoSoController().GetByPrKey(decimal.Parse(employee.FrCBDuyetNghi != null ? employee.FrCBDuyetNghi.ToString() : "-1")); if (hs != null) { hdfCanBoDuyet.Text = hs.PR_KEY.ToString(); cbxCanBoDuyet.Text = hs.HO_TEN; } chkThemVaoDsHanChe.Checked = employee.IsBelongToBlackList; cbxLyDoHanChe.SetValue(employee.MaLyDoBiHanChe); wdCapNhatThuTuc.Show(); } catch (Exception ex) { X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message.ToString()).Show(); } }
/// <summary> /// Bind danh sách công nợ của nhân viên lên grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void grpCongNoNhanVienStore_OnRefreshData(object sender, StoreRefreshDataEventArgs e) { try { if (string.IsNullOrEmpty(hdfRecordID.Text)) { return; } decimal prKeyHoSo = new DanhSachCanBoThoiViecController().GetHoSoPrimaryKey(int.Parse(hdfRecordID.Text)); grpCongNoNhanVienStore.DataSource = new BangTamUngController().GetByPrKeyHoSo(prKeyHoSo); grpCongNoNhanVienStore.DataBind(); } catch (Exception ex) { X.MessageBox.Alert("Thông báo lỗi", ex.Message).Show(); } }
/// <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(); } }