public void updateLuong(HOSO hs) { DAL.HOSO tmp = GetByMaCB(hs.MA_CB); tmp.MA_CHUCVU = hs.MA_CHUCVU; //tmp.HS_LUONG = hs.HS_LUONG; tmp.MA_NGACH = hs.MA_NGACH; tmp.MA_CONGVIEC = hs.MA_CONGVIEC; Save(); }
public void UpdateDaNghiStatus(decimal prkeyHoSo, bool value) { DAL.HOSO hs = dataContext.HOSOs.Where(t => t.PR_KEY == prkeyHoSo).FirstOrDefault(); if (hs != null) { hs.DA_NGHI = value; Save(); } }
public void DeleteByMaCB(decimal pr_key) { DAL.HOSO tmp = dataContext.HOSOs.Where(t => t.PR_KEY == pr_key).FirstOrDefault(); if (tmp != null) { dataContext.HOSOs.DeleteOnSubmit(tmp); Save(); } }
public void UpdateMaChamCong(string macb, string machamcong) { DAL.HOSO hs = dataContext.HOSOs.FirstOrDefault(t => t.ID_MAY_CHAMCONG == machamcong); if (hs != null) { throw new Exception("Mã chấm công này đã được dùng cho nhân viên " + hs.HO_TEN + " (" + hs.MA_CB + ")"); } DAL.HOSO hoso = GetByMaCB(macb); hoso.ID_MAY_CHAMCONG = machamcong; Save(); }
public void CopyToHoSo(decimal MaUngVien, string maDV, int planID, DateTime ngayThuViec, string newMaCB) { try { DAL.HOSO hs = new DAL.HOSO(); DAL.HoSoUngVien hsuv = dataContext.HoSoUngViens.SingleOrDefault(t => t.MaUngVien == MaUngVien); DAL.KeHoachTuyenDung khtd = dataContext.KeHoachTuyenDungs.SingleOrDefault(t => t.ID == planID); //Insert bảng HOSO hs.MA_CB = newMaCB; hs.CAN_NANG = decimal.Parse("0" + hsuv.CanNang); hs.CHIEU_CAO = decimal.Parse("0" + hsuv.ChieuCao); hs.DI_DONG = hsuv.DiDong; hs.DIA_CHI_LH = hsuv.DiaChiLienHe; hs.DiaChiNguoiLienHe = hsuv.DiaChiNguoiLienHe; hs.EMAIL = hsuv.Email; hs.DT_NHA = hsuv.DTCoDinh; hs.EmailNguoiLienHe = hsuv.EmailNguoiLienHe; hs.HO_CB = hsuv.HoDem; hs.HO_KHAU = hsuv.HoKhauThuongTru; hs.HO_TEN = hsuv.HoTen; hs.MA_CHUYENNGANH = hsuv.MaChuyenNganh; hs.MA_CONGVIEC = hsuv.MaViTriCongViec; hs.MA_CHUCVU = khtd.MaChucVu; hs.MA_DANTOC = hsuv.MaDanToc; hs.MA_DONVI = khtd.MA_DONVI; hs.MA_GIOITINH = hsuv.GioiTinh; hs.MA_HT_TUYENDUNG = hsuv.HinhThucTuyenDung; hs.MA_NGOAINGU = hsuv.MaTrinhDoNgoaiNgu; hs.MA_NOICAP_CMND = hsuv.NoiCapCMT; hs.MA_NOICAP_HOCHIEU = hsuv.MaNoiCapHoChieu; hs.MA_NUOC = hsuv.MaQuocTich; hs.MA_TD_VANHOA = hsuv.MaTrinhDoVH; hs.MA_TINHOC = hsuv.MaTrinhDoTinHoc; hs.MA_TINHTHANH = hsuv.MaTinhThanh; hs.MA_TONGIAO = hsuv.MaTonGiao; hs.MA_TRINHDO = hsuv.MaTrinhDoHocVan; hs.MA_TRUONG_DAOTAO = hsuv.MaTruongDaoTao; hs.MA_TT_HN = hsuv.MaTinhTrangHonNhan; hs.MA_TT_SUCKHOE = hsuv.MaTinhTrangSucKhoe; hs.NHOM_MAU = hsuv.NhomMau; hs.UU_DIEM = hsuv.UuDiem; hs.TEN_CB = hsuv.Ten; hs.SO_THICH = hsuv.SoThich; hs.SO_HOCHIEU = hsuv.SoHoChieu; hs.SO_CMND = hsuv.SoCMT; hs.SDTNguoiLienHe = hsuv.DienThoaiNguoiLienHe; hs.QueQuan = hsuv.NoiSinh; hs.QuanHeVoiCanBo = hsuv.QuanHeVoiUngVien; hs.PHOTO = hsuv.Anh; hs.NOI_SINH = hsuv.NoiSinh; hs.NHUOC_DIEM = hsuv.NhuocDiem; hs.NguoiLienHe = hsuv.NguoiLienHeTrongTruongHopKhanCap; hs.NGAY_SINH = hsuv.NgaySinh; hs.NGAY_TUYEN_DTIEN = ngayThuViec; hs.NGAYCAP_CMND = hsuv.NgayCapCMT; hs.NGAYCAP_HOCHIEU = hsuv.NgayCapHoChieu; hs.DATE_CREATE = DateTime.Now; hs.NgayDuyet = DateTime.Now; hs.HinhThucLamViec = int.Parse("0" + hsuv.HinhThucLamViec); dataContext.HOSOs.InsertOnSubmit(hs); hsuv.BlackListOrStore = "DaChuyenSangBangHOSO"; hsuv.DaTrungTuyen = false; Save(); //Insert bảng HOSO_UNGVIEN_CHUNGCHI //Kiểm tra nếu ứng viên có chứng chỉ thì mới insert DataTable dt = DataController.DataHandler.GetInstance().ExecuteDataTable("SELECT ID FROM TuyenDung.BangCapChungChi bccc WHERE bccc.FR_KEY = '" + MaUngVien + "'"); if (dt.Rows.Count > 0) { DataController.DataHandler.GetInstance().ExecuteNonQuery("TuyenDung_CopyChungChiUngVienToHOSO", "@MaUngVien", "@MaCB", MaUngVien, newMaCB); } //Insert bảng HOSO_UNGVIEN_KINHNGHIEMLAMVIEC //Kiểm tra nếu ứng viên có kinh nghiệm thì mới insert DataTable dt1 = DataController.DataHandler.GetInstance().ExecuteDataTable("SELECT * FROM TuyenDung.KinhNghiemLamViec knlv WHERE knlv.FR_KEY = '" + MaUngVien + "'"); if (dt1.Rows.Count > 0) { DataController.DataHandler.GetInstance().ExecuteNonQuery("TuyenDung_CopyKinhNghiemLamViecUngVienToHOSO", "@MaUngVien", "@MaCB", MaUngVien, newMaCB); } //Insert bảng HOSO_TepTinDinhKem //Kiểm tra ứng viên có tệp tin đính kèm mới insert DataTable dt2 = DataController.DataHandler.GetInstance().ExecuteDataTable("SELECT * FROM TuyenDung.TepTinDinhKem ttdk WHERE ttdk.FR_KEY = '" + MaUngVien + "'"); if (dt2.Rows.Count > 0) { DataController.DataHandler.GetInstance().ExecuteNonQuery("TuyenDung_CopyTepTinUngVienToHOSO", "@MaUngVien", "@MaCB", MaUngVien, newMaCB); } //Insert bảng HOSO_BANGCAP_UNGVIEN //Kiểm tra nếu ứng viên có bằng cấp thì mới insert DataTable dt3 = DataController.DataHandler.GetInstance().ExecuteDataTable("SELECT * FROM TuyenDung.BangCapUngVien bcuv WHERE bcuv.FR_KEY ='" + MaUngVien + "'"); if (dt3.Rows.Count > 0) { DataController.DataHandler.GetInstance().ExecuteNonQuery("TuyenDung_CopyBangCapUngVienToHOSO", "@MaUngVien", "@MaCB", MaUngVien, newMaCB); } DataController.DataHandler.GetInstance().ExecuteNonQuery("UPDATE TuyenDung.HoSoUngVien SET BlackListOrStore = N'DaChuyenSangBangHOSO' WHERE MaUngVien = " + int.Parse("0" + MaUngVien.ToString())); } catch (Exception ex) { throw ex; // Dialog.ShowError(ex.Message); } }
//sự kiện nhấn nút lưu sửa public void btnSuaThongTin_Click(object sender, DirectEventArgs e) { NhanVien_BaoHiemController nvc = new NhanVien_BaoHiemController(); DAL.BHNHANVIEN_BAOHIEM nvbh = nvc.GetNhanVien_BaoHiemByMaNhanVien(hdfIDNhanVienBaoHiem.Text); if (txtHoTenMoi.Text != "") { nvbh.HoTen = txtHoTenMoi.Text; nvbh.Ten = new CommonUtil().GetFirstNamFromFullName(txtHoTenMoi.Text); } if (!string.IsNullOrEmpty(nfNgayMoi.Text) && !string.IsNullOrEmpty(nfThangMoi.Text) && !string.IsNullOrEmpty(nfNamMoi.Text)) { nvbh.NgaySinh = new DateTime(int.Parse(nfNamMoi.Text), int.Parse(nfThangMoi.Text), int.Parse(nfNgayMoi.Text)); } if (cbbGioiTinhMoi.SelectedIndex > -1) { nvbh.GioiTinh = cbbGioiTinhMoi.Value.ToString() != "0"; } if (!string.IsNullOrEmpty(txtSoCMNDMoi.Text)) { nvbh.SoCMTND = txtSoCMNDMoi.Text; } if (!string.IsNullOrEmpty(nfNgayCapMoi.Text) && !string.IsNullOrEmpty(nfThangCapMoi.Text) && !string.IsNullOrEmpty(nfNamCapMoi.Text)) { nvbh.NgayCapCMTND = new DateTime(int.Parse(nfNamCapMoi.Text), int.Parse(nfThangCapMoi.Text), int.Parse(nfNgayCapMoi.Text)); } if (cbbNoiCapCMNDMoi.SelectedIndex > -1) { nvbh.NoiCapCMTND = cbbNoiCapCMNDMoi.Value.ToString(); } if (!string.IsNullOrEmpty(txtDiaChiMoi.Text)) { nvbh.DiaChiLienHe = txtDiaChiMoi.Text; } nvbh.NoiDangKyKCB = txtNoiDangKyKCBMoi.Value == null ? "" : txtNoiDangKyKCBMoi.Value.ToString(); nvbh.SoTheBHYT = txtSoTheBHYTSua.Text; nvbh.TuThangBHYT = bhc.SetValueDatetime(spinTuNamBHYTSua, cbbTuThangBHYTSua, 1); nvbh.DenThangBHYT = bhc.SetValueDatetime(spinDenNamBHYTSua, cbbDenThangBHYTSua, 1); nvbh.BHXHTrangThaiDangKyCQBH = chkDaDangKyCQBHSua.Checked; nvbh.NgayDangKyBHXH = bhc.SetValueDatetime(spinNamDangKyBHXHSua, cbbThangDangKyBHXHSua, 1); nvbh.DangDongBHXH = chkDongBHXH.Checked; nvbh.DangDongBHYT = chkDongBHYT.Checked; nvbh.DangDongBHTN = chkDongBHTN.Checked; //nvbh.TrangThaiCapSoBHXH = cbbTrangThaiCapSoSua.SelectedItem.Value; nvbh.TrangThaiCapSoBHXH = hdfTrangThaiCapSoSua.Text; //nvbh.TrangThaiCapTheBHYT = cboTrangThaiCapThe.SelectedItem.Value; nvbh.TrangThaiCapTheBHYT = hdfTrangThaiCapThe.Text; nvbh.NoiCapSoBHXH = hdfNoiCapSoBHXHSua.Text; nvbh.SoSoBHXH = txtSoSoBHXHSua.Text; if (!string.IsNullOrEmpty(txtLuongBaoHiemSua.Text)) { nvbh.LuongBaoHiem = decimal.Parse(txtLuongBaoHiemSua.Text); } if (!string.IsNullOrEmpty(txtPhuCapCVSua.Text)) { nvbh.PhuCapCV = decimal.Parse(txtPhuCapCVSua.Text); } if (!string.IsNullOrEmpty(txtPhuCapKhacSua.Text)) { nvbh.PhuCapKhac = decimal.Parse(txtPhuCapKhacSua.Text); } if (!string.IsNullOrEmpty(txtPhuCapTNNgheSua.Text)) { nvbh.PhuCapTNN = decimal.Parse(txtPhuCapTNNgheSua.Text); } if (!string.IsNullOrEmpty(txtPhuCapTNVKSua.Text)) { nvbh.PhuCapTNVK = decimal.Parse(txtPhuCapTNVKSua.Text); } //if (dfNgayCapSoBHXHSua.Value != null && !dfNgayCapSoBHXHSua.SelectedDate.ToString().Contains("0001")) // nvbh.NgayCapSoBHXH = dfNgayCapSoBHXHSua.SelectedDate; if (!Util.GetInstance().IsDateNull(dfNgayCapSoBHXHSua.SelectedDate)) { nvbh.NgayCapSoBHXH = dfNgayCapSoBHXHSua.SelectedDate; } int thangold = nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy; nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy = int.Parse(nfSoThangDongTruocSua.Text == "" ? "0" : nfSoThangDongTruocSua.Text) + int.Parse(nfSoNamDongTruocSua.Text == "" ? "0" : nfSoNamDongTruocSua.Text) * 12; nvbh.ThoiGianDongBaoHiem = (nvbh.ThoiGianDongBaoHiem - thangold) + nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy; nvc.UpdateNhanVien_BaoHiem(nvbh); #region update ngược lại bảng hồ sơ var hsc = new HoSoController(); DAL.HOSO hoso = hsc.GetByMaCB(hdfIDNhanVienBaoHiem.Text); if (!string.IsNullOrEmpty(txtHoTenMoi.Text)) { hoso.HO_TEN = txtHoTenMoi.Text; hoso.TEN_CB = new CommonUtil().GetFirstNamFromFullName(txtHoTenMoi.Text); } else { hoso.HO_TEN = txtHoTenCu.Text; } if (!string.IsNullOrEmpty(nfNgayMoi.Text) && !string.IsNullOrEmpty(nfThangMoi.Text) && !string.IsNullOrEmpty(nfNamMoi.Text)) { hoso.NGAY_SINH = new DateTime(int.Parse(nfNamMoi.Text), int.Parse(nfThangMoi.Text), int.Parse(nfNgayMoi.Text)); } else if (!string.IsNullOrEmpty(nfNgayCu.Text) && !string.IsNullOrEmpty(nfThangCu.Text) && !string.IsNullOrEmpty(nfNamCu.Text)) { hoso.NGAY_SINH = new DateTime(int.Parse(nfNamCu.Text), int.Parse(nfThangCu.Text), int.Parse(nfNgayCu.Text)); } if (cbbGioiTinhMoi.SelectedIndex > -1) { hoso.MA_GIOITINH = cbbGioiTinhMoi.Value.ToString() == "0" ? "F" : "M"; } else { hoso.MA_GIOITINH = cbbGioiTinhCu.Value.ToString() == "0" ? "F" : "M"; } if (!string.IsNullOrEmpty(txtSoCMNDMoi.Text)) { hoso.SO_CMND = txtSoCMNDMoi.Text; } else { hoso.SO_CMND = txtSoCMNDCu.Text; } if (!string.IsNullOrEmpty(nfNgayCapMoi.Text) && !string.IsNullOrEmpty(nfThangCapMoi.Text) && !string.IsNullOrEmpty(nfNamCapMoi.Text)) { hoso.NGAYCAP_CMND = new DateTime(int.Parse(nfNamCapMoi.Text), int.Parse(nfThangCapMoi.Text), int.Parse(nfNgayCapMoi.Text)); } else if (!string.IsNullOrEmpty(nfNgayCapCu.Text) && !string.IsNullOrEmpty(nfThangCapCu.Text) && !string.IsNullOrEmpty(nfNamCapCu.Text)) { hoso.NGAYCAP_CMND = new DateTime(int.Parse(nfNamCapCu.Text), int.Parse(nfThangCapCu.Text), int.Parse(nfNgayCapCu.Text)); } if (cbbNoiCapCMNDMoi.SelectedIndex > -1) { hoso.MA_NOICAP_CMND = cbbNoiCapCMNDMoi.Value.ToString(); } if (!string.IsNullOrEmpty(txtDiaChiMoi.Text)) { hoso.DIA_CHI_LH = txtDiaChiMoi.Text; } else { hoso.DIA_CHI_LH = txtDiaChiCu.Text; } if (!string.IsNullOrEmpty(hdfNoiDungKyKCBMoi.Text)) { hoso.MA_NOI_KCB = hdfNoiDungKyKCBMoi.Text; } if (!string.IsNullOrEmpty(txtSoTheBHYTSua.Text)) { hoso.SOTHE_BHYT = txtSoTheBHYTSua.Text; } if (cbbTuThangBHYTSua.SelectedIndex > -1 && !string.IsNullOrEmpty(spinTuNamBHYTSua.Value.ToString())) { hoso.NGAY_DONGBH = new DateTime(int.Parse(spinTuNamBHYTSua.Text), int.Parse(cbbTuThangBHYTSua.Value.ToString()), 1); } if (cbbDenThangBHYTSua.SelectedIndex > -1 && !string.IsNullOrEmpty(spinDenNamBHYTSua.Value.ToString())) { hoso.NGAY_HETHAN_BHYT = new DateTime(int.Parse(spinDenNamBHYTSua.Text), int.Parse(cbbDenThangBHYTSua.Value.ToString()), 1); } //nvbh.NoiCapSoBHXH = txtNoiCapSoBHXHSua.Text; if (!string.IsNullOrEmpty(txtSoSoBHXHSua.Text)) { hoso.SOTHE_BHXH = txtSoSoBHXHSua.Text; } hsc.UpDateHoSoBaoHiem(hoso); #endregion grpQuanLyThongTinBaoHiem.Reload(); wdThayDoiThongTin.Hide(); }
//lưu nhân viên đóng mới public void btnLuuThem_Click(object sender, DirectEventArgs e) { //Kiểm tra nhân viên này đã được lưu ở trên bảng BHNhanVien_BaoHiem chưa NhanVien_BaoHiemController nbc = new NhanVien_BaoHiemController(); if (new NhanVien_BaoHiemController().GetNhanVien_BaoHiemByMaNhanVien(txtMaCanBo.Text) != null) { RM.RegisterClientScriptBlock("relTrungCanBo", " alert('Cán bộ này đã được quản lý ở phân hệ bảo hiểm');"); return; } if (nfSoThangDongTruocThem.Text == "") { RM.RegisterClientScriptBlock("relChuaNhapThoiGian", " alert('Bạn chưa nhập thời gian đóng trước khi vào công ty cho cán bộ này');"); } // Lưu thông tin vào bảng bhNhanVien_BaoHiem NhanVien_BaoHiemController nvc = new NhanVien_BaoHiemController(); HoSoController hsc = new HoSoController(); DAL.HOSO hoso = hsc.GetByMaCB(txtMaCanBo.Text); DAL.BHNHANVIEN_BAOHIEM nvbh = new DAL.BHNHANVIEN_BAOHIEM(); nvbh.IDNhanVien_BaoHiem = int.Parse(hoso.PR_KEY.ToString()); nvbh.MaNhanVien = hoso.MA_CB; nvbh.HoTen = hoso.HO_TEN; nvbh.Ten = new CommonUtil().GetFirstNamFromFullName(hoso.HO_TEN); nvbh.GioiTinh = hoso.MA_GIOITINH != "F"; nvbh.NgaySinh = hoso.NGAY_SINH; nvbh.HoKhauThuongTruTamTru = hoso.HO_KHAU; nvbh.DiaChiLienHe = hoso.DIA_CHI_LH; nvbh.SoCMTND = hoso.SO_CMND; nvbh.NgayCapCMTND = new SoftCore.Util().IsDateNull(hoso.NGAYCAP_CMND) ? null : hoso.NGAYCAP_CMND; nvbh.NoiCapCMTND = hoso.MA_NOICAP_CMND ?? ""; nvbh.MaChucVu = hoso.MA_CHUCVU; nvbh.LuongBaoHiem = decimal.Parse(nfLuongBaoHiem.Value.ToString()); nvbh.LoaiBHYT = ""; string[] arr = hdfPhuCap.Text.Split(';'); nvbh.PhuCapCV = int.Parse(arr[0]); nvbh.PhuCapKhac = int.Parse(arr[3]); nvbh.PhuCapTNVK = int.Parse(arr[2]); nvbh.PhuCapTNN = int.Parse(arr[1]); // hdfPhuCap.Text = phucapcv.ToString() + ";" + phucaptnn.ToString() + ";" + phucaptnvk.ToString() + ";" + phucapkhac.ToString(); nvbh.NoiDangKyKCB = hoso.MA_NOI_KCB; nvbh.SoTheBHYT = txtSoTheBHYT.Text; nvbh.TuThangBHYT = new BaoHiemController().SetValueDatetime(spinTuNamBHYT, cbbTuThangBHYT, 1); nvbh.DenThangBHYT = new BaoHiemController().SetValueDatetime(spinDenNamBHYT, cbbDenThangBHYT, 1); nvbh.BHXHTrangThaiDangKyCQBH = chkTrangThaiDangKy.Checked; nvbh.NgayDangKyBHXH = new BaoHiemController().SetValueDatetime(spinNamBHXH, cbbThangBHXH, 1); //nvbh.TrangThaiCapSoBHXH = cbbTrangthaiCapSo.SelectedItem.Value ?? "ChuaCapSo"; nvbh.TrangThaiCapSoBHXH = hdfTrangThaiCapSo.Text; //nvbh.TrangThaiCapTheBHYT = cbbTrangThaiCapThe.SelectedItem.Value ?? "ChuaCapThe"; nvbh.TrangThaiCapTheBHYT = hdfTrangThaiCapThe.Text; nvbh.NoiCapSoBHXH = txtNoiCapSoBHXH.Text; nvbh.SoSoBHXH = txtSoSoBHXH.Text; if (!util.IsDateNull(dfNgayCapSo.SelectedDate)) { nvbh.NgayCapSoBHXH = dfNgayCapSo.SelectedDate; } nvbh.DangDongBHXH = chkBHXH.Checked; nvbh.DangDongBHYT = chkBHYT.Checked; nvbh.DangDongBHTN = chkBHTN.Checked; nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy = int.Parse(nfSoThangDongTruocThem.Text == "" ? "0" : nfSoThangDongTruocThem.Text) + int.Parse(nfSoNamDongTruocThem.Text == "" ? "0" : nfSoNamDongTruocThem.Text) * 12; //nvbh.ThoiGianDongBaoHiem = nvc.TinhSoThangDongBaoHiem(nvbh.IDNhanVien_BaoHiem, nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy); nvbh.ThoiGianDongBaoHiem = nvbh.ThoiGianDongBHXHTruocKhiVaoCongTy; nvbh.MaDonVi = Session["MaDonVi"].ToString(); nvbh.UserID = CurrentUser.ID; nvbh.DateCreate = DateTime.Now; QuanLyThongTinBaoHiemController qlc = new QuanLyThongTinBaoHiemController(); qlc.LuuNhanVienDongMoi(nvbh); Dialog.ShowNotification("Cập nhật dữ liệu thành công"); if (e.ExtraParams["Close"] == "True") { wdThongTinDongBHNhanVien.Hide(); RM.RegisterClientScriptBlock("rs30", "grpQuanLyThongTinBaoHiem_store.reload();"); } else { RM.RegisterClientScriptBlock("rs32", "grpQuanLyThongTinBaoHiem_store.reload();"); } RM.RegisterClientScriptBlock("rs31", "resetFormThem();"); }
public void UpdateHoSo(DAL.HOSO hs) { DAL.HOSO tmp = dataContext.HOSOs.Single(p => p.UserID == hs.UserID); tmp = hs; Save(); }
public void InsertHoSo(DAL.HOSO hs) { dataContext.HOSOs.InsertOnSubmit(hs); Save(); }