private void cap_nhat_gd_cong_tac()
 {
     US_GD_CONG_TAC v_us = new US_GD_CONG_TAC();
     v_us.dcID_NHAN_VIEN = CIPConvert.ToDecimal(m_sle_chon_nhan_vien.EditValue);
     v_us.dcID_DON_VI = CIPConvert.ToDecimal(m_sle_don_vi.EditValue);
     v_us.datNGAY_BAT_DAU = m_dat_ngay_bat_dau.DateTime;
     if (m_dat_ngay_ket_thuc.DateTime != DateTime.MinValue)
         v_us.datNGAY_KET_THUC = m_dat_ngay_ket_thuc.DateTime;
     v_us.datNGAY_LAP = DateTime.Now;
     v_us.strNGUOI_LAP = CAppContext_201.getCurrentUserName();
     v_us.strDA_XOA = "N";
     v_us.dcID_LOAI_CONG_TAC = 157;
     v_us.dcID_VI_TRI = CIPConvert.ToDecimal(m_sle_chuc_vu.EditValue);
     v_us.dcSO_HO_SO = BKI_DichVuMatDat.COMMON.ExecuteFuntion.GetSoHoSoNext(v_us.dcID_DON_VI, v_us.dcID_VI_TRI, v_us.dcID_NHAN_VIEN);
     v_us.UseTransOfUSObject(m_us_gd_hd);
     v_us.Insert();
     v_us.CommitTransaction();
 }
        private void save_data()
        {
            if(m_grv_cong_tac.RowCount < 1)
            {
                XtraMessageBox.Show("Chưa có dữ liệu để lưu!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if(!check_all_is_ok())
            {
                return;
            }
            SplashScreenManager.ShowForm(this, typeof(SplashScreen1), true, true, false);
            US_GD_CONG_TAC v_us_gd_ct = new US_GD_CONG_TAC();
            int v_i_row = 0;
            try
            {

                for(v_i_row = 0; v_i_row < m_grv_cong_tac.RowCount; v_i_row++)
                {
                    v_us_gd_ct.BeginTransaction();
                    v_us_gd_ct.ClearAllFields();
                    var data = m_grv_cong_tac.GetDataRow(v_i_row);
                    grid_to_us_gd_cong_tac(v_us_gd_ct, data);
                    v_us_gd_ct.Insert();
                    v_us_gd_ct.CommitTransaction();
                    SplashScreenManager.Default.SendCommand(SplashScreen1.SplashScreenCommand.SetProgress, (int)((decimal)v_i_row / (decimal)m_grv_cong_tac.RowCount * 100));
                }

                //Sau do phai cap nhat lai so ho so, chua biet lam

                CHRM_BaseMessages.MsgBox_Infor("Đã lưu dữ liệu thành công");
            }
            catch(Exception)
            {
                if(v_us_gd_ct.is_having_transaction())
                {
                    v_us_gd_ct.Rollback();
                }
                if(v_i_row >= 1)
                {
                    throw new Exception("Có lỗi xảy ra. Dữ liệu lưu chưa thành công!\nĐã lưu thành công đến dòng thứ " + v_i_row + " với mã nhân viên " + m_grv_cong_tac.GetRowCellValue(v_i_row - 1, ExcelCongTac.MA_NHAN_VIEN).ToString());
                }
                else
                {
                    throw new Exception("Có lỗi xảy ra. Dữ liệu lưu chưa được lưu!");
                }
                throw;
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
 private void save_for_lam_thoi_cong_tac(US_GD_CONG_TAC ip_us_ct_lam_thoi)
 {
     try
     {
         ip_us_ct_lam_thoi.BeginTransaction();
         ip_us_ct_lam_thoi.CapNhatHetHieuLucCongTacChinhThucHoacLamThoi(ip_us_ct_lam_thoi.dcID_NHAN_VIEN, ip_us_ct_lam_thoi.datNGAY_BAT_DAU.AddDays(-1));
         ip_us_ct_lam_thoi.Insert();
         ip_us_ct_lam_thoi.CommitTransaction();
         CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_LUU_DU_LIEU_THANH_CONG);
         Close();
     }
     catch(Exception)
     {
         if(ip_us_ct_lam_thoi.is_having_transaction())
         {
             ip_us_ct_lam_thoi.Rollback();
         }
         throw;
     }
 }
 private void save_for_kiem_nhiem_cong_tac(US_GD_CONG_TAC ip_us_ct_lam_thoi)
 {
     try
     {
         ip_us_ct_lam_thoi.BeginTransaction();
         ip_us_ct_lam_thoi.Insert();
         ip_us_ct_lam_thoi.CommitTransaction();
         CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_LUU_DU_LIEU_THANH_CONG);
         Close();
     }
     catch(Exception)
     {
         if(ip_us_ct_lam_thoi.is_having_transaction())
         {
             ip_us_ct_lam_thoi.Rollback();
         }
         throw;
     }
 }
 private void save_for_chuyen_cong_tac(US_GD_CONG_TAC ip_us_ct_hien_tai)
 {
     try
     {
         if(ip_us_ct_hien_tai.KiemTraNhanVienCoCongTacChua(ip_us_ct_hien_tai.dcID_NHAN_VIEN, ip_us_ct_hien_tai.dcID_DON_VI))
         {
             XtraMessageBox.Show("Nhân viên đang làm việc ở đơn vị này rồi!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         ip_us_ct_hien_tai.BeginTransaction();
         ip_us_ct_hien_tai.CapNhatHetHieuLucCongTacChinhThucHoacLamThoi(ip_us_ct_hien_tai.dcID_NHAN_VIEN, ip_us_ct_hien_tai.datNGAY_BAT_DAU.AddDays(-1));
         ip_us_ct_hien_tai.Insert();
         ip_us_ct_hien_tai.CommitTransaction();
         CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_LUU_DU_LIEU_THANH_CONG);
         Close();
     }
     catch(Exception)
     {
         if(ip_us_ct_hien_tai.is_having_transaction())
         {
             ip_us_ct_hien_tai.Rollback();
         }
         throw;
     }
 }
        private void save_data()
        {
            US_GD_CONG_TAC v_us_gd_ct = new US_GD_CONG_TAC();
            form_2_us_gd_cong_tac(v_us_gd_ct);
            try
            {
                switch (m_e_form_mode)
                {
                    case DataEntryFormMode.InsertDataState:
                        if (m_id_gd_ct != -1)
                        {
                            //Nhan vien da co GD cong tac
                            if (m_loai_ctac_cthuc == true && CIPConvert.ToDecimal(m_sle_chon_loai_cong_tac.EditValue) == CONST_ID_LOAI_CONG_TAC.CHINH_THUC)
                            {
                                cho_gd_ct_da_xoa_Y();
                            }
                        }

                        v_us_gd_ct.BeginTransaction();
                        v_us_gd_ct.Insert();
                        v_us_gd_ct.CommitTransaction();
                        break;
                    case DataEntryFormMode.UpdateDataState:
                        v_us_gd_ct.BeginTransaction();
                        v_us_gd_ct.Update();
                        v_us_gd_ct.CommitTransaction();
                        break;
                    default:
                        break;
                }
            }
            catch (Exception v_e)
            {
                CSystemLog_301.ExceptionHandle(v_e);
            }
        }
        private void m_cmd_huy_kiem_nhiem_Click(object sender, EventArgs e)
        {
            try
            {
                if (CHRM_BaseMessages.MsgBox_Confirm(CONST_ID_MSGBOX.QUESTION_XAC_NHAN_HUY_KIEM_NHIEM_CUA_NHAN_VIEN) == true)
                {
                    decimal v_id_gd_loai_ct = 0;

                    v_id_gd_loai_ct = CIPConvert.ToDecimal(m_grv_v_gd_cong_tac.GetRowCellValue(m_grv_v_gd_cong_tac.FocusedRowHandle, "ID"));

                    US_GD_CONG_TAC v_us = new US_GD_CONG_TAC(v_id_gd_loai_ct);
                    v_us.strDA_XOA = "Y";
                    v_us.BeginTransaction();
                    v_us.Update();
                    v_us.CommitTransaction();
                    load_data_2_grid(CIPConvert.ToDecimal(m_sle_chon_nhan_vien.EditValue), CIPConvert.ToDecimal(m_sle_chon_loai_cong_tac.EditValue));
                }

            }
            catch (Exception v_e)
            {
                CSystemLog_301.ExceptionHandle(v_e);
            }
        }
 private void cho_gd_ct_da_xoa_Y()
 {
     US_GD_CONG_TAC v_us = new US_GD_CONG_TAC(m_id_gd_ct);
     v_us.strDA_XOA = "Y";
     v_us.BeginTransaction();
     v_us.Update();
     v_us.CommitTransaction();
 }
 private void cho_gd_ct_da_xoa_Y()
 {
     US_GD_CONG_TAC v_us = new US_GD_CONG_TAC(m_id_gd_ct);
     v_us.datNGAY_KET_THUC = m_dat_ngay_bat_dau.Value.AddDays(-1);
     v_us.strDA_XOA = "Y";
     v_us.BeginTransaction();
     v_us.Update();
     v_us.CommitTransaction();
 }