private void xuat_word() { if (m_us.dcID == -1) { BaseMessages.MsgBox_Infor("Phải lưu thông tin hợp đồng trước khi in."); return; } US_GD_HOP_DONG v_us_gd_hop_dong = new US_GD_HOP_DONG(m_us.dcID); US_DM_NHAN_SU v_us_dm_nhan_su = new US_DM_NHAN_SU(v_us_gd_hop_dong.dcID_NHAN_SU); US_CM_DM_TU_DIEN v_us_tu_dien = new US_CM_DM_TU_DIEN(v_us_gd_hop_dong.dcID_LOAI_HOP_DONG); m_sfd_in_hop_dong.Filter = "(*.doc)|*.doc|(*.docx)|*.docx"; m_sfd_in_hop_dong.Title = "Lưu Hợp Đồng Lao Động"; DialogResult result = m_sfd_in_hop_dong.ShowDialog(); if (result == DialogResult.OK) { CWordReport v_obj_word = new CWordReport("THR_Hopdonglaodong_KTH_v2_TU.docx", m_sfd_in_hop_dong.FileName); v_obj_word.AddFindAndReplace("<HO_TEN>", v_us_dm_nhan_su.strHO_DEM + " " + v_us_dm_nhan_su.strTEN); if (v_us_dm_nhan_su.datNGAY_SINH > DateTime.Parse("1/1/1900") && v_us_dm_nhan_su.datNGAY_SINH != null) { v_obj_word.AddFindAndReplace("<NGAY_SINH>", v_us_dm_nhan_su.datNGAY_SINH.ToShortDateString()); } else { v_obj_word.AddFindAndReplace("<NGAY_SINH>", ""); } v_obj_word.AddFindAndReplace("<CHO_O>", v_us_dm_nhan_su.strCHO_O); v_obj_word.AddFindAndReplace("<CMTND>", v_us_dm_nhan_su.strCMND); v_obj_word.AddFindAndReplace("<NGAY_CAP>", v_us_dm_nhan_su.datNGAY_CAP_CMND.ToShortDateString()); v_obj_word.AddFindAndReplace("<NOI_CAP>", v_us_dm_nhan_su.strNOI_CAP_CMND); v_obj_word.AddFindAndReplace("<MOBILE>", v_us_dm_nhan_su.strDI_DONG); v_obj_word.AddFindAndReplace("<LOAI_HOP_DONG>", v_us_tu_dien.strTEN); v_obj_word.AddFindAndReplace("<NGAY_KY>", v_us_gd_hop_dong.datNGAY_KY_HOP_DONG.ToShortDateString()); v_obj_word.AddFindAndReplace("<CHUYEN_NGANH>", v_us_dm_nhan_su.strCHUYEN_NGANH); v_obj_word.AddFindAndReplace("<MA_PHONG>", "..."); v_obj_word.AddFindAndReplace("<MA_BAN>", "..."); v_obj_word.AddFindAndReplace("<MA_NHAN_VIEN>", v_us_dm_nhan_su.strMA_NV); if (v_us_gd_hop_dong.datNGAY_KY_HOP_DONG > DateTime.Parse("1/1/1900") && v_us_gd_hop_dong.datNGAY_KY_HOP_DONG != null) { v_obj_word.AddFindAndReplace("<NGAY>", v_us_gd_hop_dong.datNGAY_KY_HOP_DONG.Day.ToString()); v_obj_word.AddFindAndReplace("<THANG>", v_us_gd_hop_dong.datNGAY_KY_HOP_DONG.Month.ToString()); v_obj_word.AddFindAndReplace("<NAM>", v_us_gd_hop_dong.datNGAY_KY_HOP_DONG.Year.ToString()); } else { v_obj_word.AddFindAndReplace("<NGAY>", "..."); v_obj_word.AddFindAndReplace("<THANG>", "..."); v_obj_word.AddFindAndReplace("<NAM>", "..."); v_obj_word.Export2Word("", false); } } }
public void display_for_update(US_GD_HOP_DONG ip_m_us_gd_hop_dong) { m_e_form_mode = DataEntryFormMode.UpdateDataState; us_object_2_form(ip_m_us_gd_hop_dong); m_txt_tim_kiem_nhan_vien.Enabled = false; m_e_file_mode = DataEntryFileMode.EditFile; m_str_link_old = m_lbl_file_name.Text; view_info_Nhan_Su(ip_m_us_gd_hop_dong.dcID_NHAN_SU); this.ShowDialog(); }
private void us_object_2_form(US_GD_HOP_DONG ip_us_gd_hop_dong) { m_str_id_hop_dong_old = ip_us_gd_hop_dong.dcID; m_us.dcID = ip_us_gd_hop_dong.dcID; m_txt_ma_hop_dong.Text = ip_us_gd_hop_dong.strMA_HOP_DONG; m_txt_nguoi_ky.Text = ip_us_gd_hop_dong.strNGUOI_KY; m_txt_chuc_vu_nguoi_ky.Text = ip_us_gd_hop_dong.strCHUC_VU_NGUOI_KY; m_dat_ngay_co_hieu_luc.Value = ip_us_gd_hop_dong.datNGAY_CO_HIEU_LUC; m_dat_ngay_ky_hop_dong.Value = ip_us_gd_hop_dong.datNGAY_KY_HOP_DONG; US_DM_NHAN_SU v_us_dm_nhan_su = new US_DM_NHAN_SU(ip_us_gd_hop_dong.dcID_NHAN_SU); m_lbl_ma_nhan_vien.Text = v_us_dm_nhan_su.strMA_NV; m_lbl_ho_va_ten.Text = v_us_dm_nhan_su.strHO_DEM + " " + v_us_dm_nhan_su.strTEN; // DucVT m_lbl_email_co_quan.Text = v_us_dm_nhan_su.strEMAIL_CQ; // Lấy chức vụ bằng Id nhân sự DS_V_GD_QUA_TRINH_LAM_VIEC v_ds_gd_qua_trinh_lam_viec = new DS_V_GD_QUA_TRINH_LAM_VIEC(); US_V_GD_QUA_TRINH_LAM_VIEC v_us_gd_qua_trinh_lam_viec = new US_V_GD_QUA_TRINH_LAM_VIEC(); v_us_gd_qua_trinh_lam_viec.FillDataSet_Now_By_Ma_NV_Id_PN(v_ds_gd_qua_trinh_lam_viec, v_us_dm_nhan_su.strMA_NV, CAppContext_201.getCurrentIDPhapnhan()); if (v_ds_gd_qua_trinh_lam_viec.V_GD_QUA_TRINH_LAM_VIEC.Rows.Count > 0) { m_lbl_ma_chuc_vu.Text = v_ds_gd_qua_trinh_lam_viec.V_GD_QUA_TRINH_LAM_VIEC.Rows[0][V_GD_QUA_TRINH_LAM_VIEC.TEN_CV].ToString(); m_lbl_ma_don_vi.Text = v_ds_gd_qua_trinh_lam_viec.V_GD_QUA_TRINH_LAM_VIEC.Rows[0][V_GD_QUA_TRINH_LAM_VIEC.TEN_DON_VI].ToString(); } // ~DucVT m_cbo_loai_hop_dong.SelectedValue = ip_us_gd_hop_dong.dcID_LOAI_HOP_DONG; m_cbo_trang_thai.SelectedIndex = (ip_us_gd_hop_dong.strTRANG_THAI_HOP_DONG.Equals("Y")) ? 0 : 1; m_lbl_phap_nhan.Text = new US_DM_PHAP_NHAN(ip_us_gd_hop_dong.dcID_PHAP_NHAN).strTEN_PHAP_NHAN; if (ip_us_gd_hop_dong.datNGAY_HET_HAN.Equals(DateTime.Parse("1/1/1900 12:00:00 AM"))) { m_dat_ngay_het_han.Checked = false; } else { m_dat_ngay_het_han.Value = ip_us_gd_hop_dong.datNGAY_HET_HAN; m_dat_ngay_het_han.Checked = true; } if (ip_us_gd_hop_dong.strLINK == "") { return; } m_lbl_file_name.Text = ip_us_gd_hop_dong.strLINK; }
private void view_hop_dong_saved() { f701_v_gd_hop_dong_lao_dong_View frm = new f701_v_gd_hop_dong_lao_dong_View(); if (m_us.dcID == -1) { return; } US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(m_us.dcID); if (string.IsNullOrEmpty(v_us.strLINK)) { return; } frm.display(ConfigurationSettings.AppSettings["DESTINATION_NAME"] + new US_GD_HOP_DONG(m_us.dcID).strLINK); }
private void grid2us_object(int i_grid_row) { DataRow v_dr = (DataRow)m_fg.Rows[i_grid_row].UserData; if (v_dr == null) { return; } DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG(); US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(); v_us.FillDatasetSearchByMaHopDong(v_ds, v_dr.ItemArray[4].ToString()); m_us_gd_hop_dong = new US_GD_HOP_DONG((decimal)v_ds.Tables[0].Rows[0]["ID"]); //m_obj_trans.GridRow2DataRow(i_grid_row,v_dr); //i_us.DataRow2Me(v_dr); }
private void save_data() { if (check_data_is_ok() == false) { return; } #region Xử lý file đính kèm switch (m_e_file_mode) { case DataEntryFileMode.UploadFile: // Kiểm tra file đã tồn tại trên server hay chưa if (FileExplorer.IsExistedFile(m_str_directory_to + FileExplorer.fileName)) { BaseMessages.MsgBox_Infor("Tên file đã tồn tại. Vui lòng đổi tên khác"); return; } // Nếu đã chọn file if (m_lbl_file_name.Text != "") { // Upload server có sử dụng user và pass if (m_str_user_name != "") { FileExplorer.UploadFile(m_str_domain, m_str_directory_to, m_str_user_name, m_str_password); } // Upload không sử dụng user và pass else { FileExplorer.UploadFile(m_str_domain, m_str_directory_to); } } break; case DataEntryFileMode.EditFile: // Nếu ko up lên file mới sẽ bỏ qua bước này if (m_str_link_old != m_lbl_file_name.Text) { // Kiểm tra file vừa upload đã tồn tại hay chưa if (FileExplorer.IsExistedFile(m_str_directory_to + FileExplorer.fileName)) { BaseMessages.MsgBox_Infor("Tên file đã tồn tại. Vui lòng đổi tên khác"); return; } // Xóa file cũ if (FileExplorer.IsExistedFile(m_str_directory_to + m_str_link_old)) { FileExplorer.DeleteFile(m_str_directory_to + m_str_link_old); } // Upload file mới lên if (m_str_user_name != "") { FileExplorer.UploadFile(m_str_domain, m_str_directory_to, m_str_user_name, m_str_password); } else { FileExplorer.UploadFile(m_str_domain, m_str_directory_to); } } break; case DataEntryFileMode.DeleteFile: // Kiểm tra file có tồn tại hay không if (FileExplorer.IsExistedFile(m_str_directory_to + m_str_link_old)) { FileExplorer.DeleteFile(m_str_directory_to + m_str_link_old); } break; } #endregion form_2_us_object(); switch (m_e_form_mode) { case DataEntryFormMode.InsertDataState: if (check_trung_ma_hop_dong(m_txt_ma_hop_dong.Text)) { BaseMessages.MsgBox_Error("Mã hợp đồng đã tồn tại."); m_txt_ma_hop_dong.Focus(); return; } DS_GD_HOP_DONG ds_gd_hd = new DS_GD_HOP_DONG(); US_GD_HOP_DONG us_gd_hd = new US_GD_HOP_DONG(); us_gd_hd.FillDataSet_Search_by_trang_thai_hop_dong(ds_gd_hd, "Y", m_us.dcID_NHAN_SU); var v_i_total_record = ds_gd_hd.Tables[0].Rows.Count; if (v_i_total_record > 0) { foreach (var item in ds_gd_hd.GD_HOP_DONG) { us_gd_hd.dcID = item.ID; us_gd_hd.Upload_trang_thai_hop_dong(us_gd_hd); } } m_us.Insert(); break; case DataEntryFormMode.UpdateDataState: US_GD_HOP_DONG v_us_gd_hop_dong = new US_GD_HOP_DONG(m_str_id_hop_dong_old); if (!m_txt_ma_hop_dong.Text.Equals(v_us_gd_hop_dong.strMA_HOP_DONG)) { if (check_trung_ma_hop_dong(m_txt_ma_hop_dong.Text)) { BaseMessages.MsgBox_Error("Mã hợp đồng đã tồn tại."); m_txt_ma_hop_dong.Focus(); return; } } m_us.Update(); break; } f701_v_hop_dong_lao_dong.m_str_ma_hop_dong = m_txt_ma_hop_dong.Text; BaseMessages.MsgBox_Infor("Dữ liệu đã được cập nhật"); this.Close(); }