private void save_data()
        {
            US_GD_HOP_DONG v_us_gd_hd = new US_GD_HOP_DONG();
            US_GD_CONG_TAC v_us_gd_cong_tac = new US_GD_CONG_TAC();
            US_GD_HE_SO_LNS v_us_gd_hs_lns = new US_GD_HE_SO_LNS();
            try
            {
                for (int i = 0; i < m_grv_hop_dong.RowCount; i++)
                {
                    var data = m_grv_hop_dong.GetDataRow(i);
                    //
                    grid_to_us_gd_hop_dong(v_us_gd_hd, data);
                    grid_to_us_gd_cong_tac(v_us_gd_cong_tac, data);
                    grid_to_us_gd_lns(v_us_gd_hs_lns, data);

                    //decimal v_id_hop_dong = get_id_hop_dong_hien_tai(v_us_gd_hd.dcID_NHAN_VIEN.ToString());

                    //
                    v_us_gd_hd.BeginTransaction();
                    //if (v_id_hop_dong != 0)
                    //{
                    //    ket_thuc_hop_dong_cu(v_id_hop_dong, v_us_gd_hd.datNGAY_BAT_DAU);
                    //}
                    v_us_gd_cong_tac.UseTransOfUSObject(v_us_gd_hd);
                    //v_us_gd_cong_tac.CapNhatHetHieuLucCongTac(v_us_gd_hd.dcID_NHAN_VIEN, v_us_gd_hd.datNGAY_BAT_DAU);
                    v_us_gd_hs_lns.UseTransOfUSObject(v_us_gd_hd);
                    //v_us_gd_hs_lns.KetThucLuongNangSuatNhanVien(v_us_gd_hd.dcID_NHAN_VIEN, v_us_gd_hd.datNGAY_BAT_DAU);
                    v_us_gd_hs_lns.Insert();
                    v_us_gd_hd.Insert();
                    v_us_gd_cong_tac.Insert();
                    v_us_gd_hd.CommitTransaction();
                }
                CHRM_BaseMessages.MsgBox_Infor("Đã lưu dữu liệu thành công");
            }
            catch (Exception)
            {
                if (v_us_gd_hd.is_having_transaction())
                {
                    v_us_gd_hd.Rollback();
                }
                throw;
            }
        }
 private void cho_hop_dong_da_co_ve_trang_thai_delete_Y()
 {
     US_GD_HOP_DONG v_us = new US_GD_HOP_DONG(m_id_gd_hd);
     v_us.datNGAY_SUA = DateTime.Now.Date;
     //nguoi sua
     v_us.BeginTransaction();
     v_us.Update();
     v_us.CommitTransaction();
 }
        private void save_data()
        {
            if(m_grv_hop_dong.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_HOP_DONG v_us_gd_hd = new US_GD_HOP_DONG();
            int v_i_row = 0;
            try
            {
                for(v_i_row = 0; v_i_row < m_grv_hop_dong.RowCount; v_i_row++)
                {
                    v_us_gd_hd.ClearAllFields();
                    var data = m_grv_hop_dong.GetDataRow(v_i_row);
                    grid_to_us_gd_hop_dong(v_us_gd_hd, data);
                    v_us_gd_hd.BeginTransaction();
                    v_us_gd_hd.Insert();
                    if(!ExecuteFuntion.KiemTraNhanVienCoCongTac(v_us_gd_hd.dcID_NHAN_VIEN))
                    {
                        US_GD_CONG_TAC v_us = new US_GD_CONG_TAC();
                        v_us.dcID_DON_VI = v_us_gd_hd.dcID_DON_VI;
                        v_us.dcID_LOAI_CONG_TAC = CONST_ID_LOAI_CONG_TAC.CHINH_THUC;
                        v_us.dcID_NHAN_VIEN = v_us_gd_hd.dcID_NHAN_VIEN;
                        v_us.dcID_VI_TRI = v_us_gd_hd.dcID_CHUC_VU;
                        v_us.dcSO_HO_SO = ExecuteFuntion.GetSoHoSoNext(v_us_gd_hd.dcID_DON_VI, v_us_gd_hd.dcID_CHUC_VU, v_us_gd_hd.dcID_NHAN_VIEN);
                        v_us.strDA_XOA = "N";
                        v_us.strNGUOI_LAP = CAppContext_201.getCurrentUserName();
                        v_us.datNGAY_LAP = DateTime.Now.Date;
                        v_us.datNGAY_BAT_DAU = v_us_gd_hd.datNGAY_BAT_DAU;
                        v_us.UseTransOfUSObject(v_us_gd_hd);
                        v_us.Insert();
                    }
                    v_us_gd_hd.CommitTransaction();
                    SplashScreenManager.Default.SendCommand(SplashScreen1.SplashScreenCommand.SetProgress, (int)((decimal)v_i_row / (decimal)m_grv_hop_dong.RowCount * 100));
                }

                CHRM_BaseMessages.MsgBox_Infor("Đã lưu dữ liệu thành công");
            }
            catch(Exception)
            {
                if(v_us_gd_hd.is_having_transaction())
                {
                    v_us_gd_hd.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_hop_dong.GetRowCellValue(v_i_row - 1, ExcelHopDong.MA_NHAN_VIEN).ToString());
                }
                else
                {
                    throw new Exception("Có lỗi xảy ra. Dữ liệu lưu chưa được lưu!");
                }
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
        private void save_data()
        {
            US_GD_HS_LNS_LCD v_us_gd_hs_lns_lcd = new US_GD_HS_LNS_LCD();
            US_GD_HE_SO_LNS v_us_gd_hs_lns = new US_GD_HE_SO_LNS();
            US_GD_LUONG_CHE_DO v_us_gd_lcd = new US_GD_LUONG_CHE_DO();
            US_GD_TRANG_THAI_LAO_DONG v_us_gd_trang_thai_lao_dong = new US_GD_TRANG_THAI_LAO_DONG();
            US_GD_HOP_DONG v_us_gd_hd = new US_GD_HOP_DONG();
            form_2_us_gd_hop_dong(v_us_gd_hd);
            US_GD_HOP_DONG v_us = new US_GD_HOP_DONG();
            switch (m_e_form_mode)
            {
                case DataEntryFormMode.UpdateDataState:
                    v_us_gd_hd.BeginTransaction();
                    v_us_gd_hd.dcID = CIPConvert.ToDecimal(m_grv_lap_hd.GetRowCellValue(m_grv_lap_hd.FocusedRowHandle, "ID"));
                    v_us_gd_hd.Update();
                    v_us_gd_hd.CommitTransaction();

                    //
                    form_2_us_gd_hs_lns_lcd(v_us_gd_hs_lns_lcd);
                    v_us_gd_hs_lns_lcd.BeginTransaction();
                    v_us_gd_hs_lns_lcd.dcID = find_id_gd_lns_lcd(CIPConvert.ToDecimal(m_grv_lap_hd.GetRowCellValue(m_grv_lap_hd.FocusedRowHandle, "ID")));
                    v_us_gd_hs_lns_lcd.Update();
                    v_us_gd_hs_lns_lcd.CommitTransaction();
                    break;
                case DataEntryFormMode.InsertDataState:
                    v_us.lap_hop_dong_moi_cho_nhan_vien(CIPConvert.ToDecimal(m_sle_chon_nhan_vien.EditValue)
                                                        , CIPConvert.ToDecimal(m_sle_loai_hop_dong.EditValue)
                                                        , m_txt_ma_hd.Text.Trim()
                                                        , m_dat_ngay_bat_dau.Value.Date
                                                        , m_dat_ngay_ket_thuc.Value.Date
                                                        , m_dat_ngay_ky.Value.Date
                                                        , DateTime.Now.Date
                                                        , CAppContext_201.getCurrentUserName()
                                                        , "N"
                                                        , CIPConvert.ToDecimal(m_sle_chuc_danh_lcd.EditValue)
                                                        , CIPConvert.ToDecimal(m_sle_muc_lcd.EditValue)
                                                        , CIPConvert.ToDecimal(m_sle_chuc_danh_lns.EditValue)
                                                        , CIPConvert.ToDecimal(m_sle_muc_lns.EditValue)
                                                        , ref op_str_mess);
                    break;
                case DataEntryFormMode.ViewDataState:
                    break;
                case DataEntryFormMode.SelectDataState:
                    break;
                default:
                    break;
            }

            //US_GD_HS_LNS_LCD v_us_gd_hs_lns_lcd = new US_GD_HS_LNS_LCD();
            //US_GD_HE_SO_LNS v_us_gd_hs_lns = new US_GD_HE_SO_LNS();
            //US_GD_LUONG_CHE_DO v_us_gd_lcd = new US_GD_LUONG_CHE_DO();
            //US_GD_TRANG_THAI_LAO_DONG v_us_gd_trang_thai_lao_dong = new US_GD_TRANG_THAI_LAO_DONG();
            //US_GD_HOP_DONG v_us_gd_hd = new US_GD_HOP_DONG();
            //form_2_us_gd_hop_dong(v_us_gd_hd);
            //try
            //{
            //    switch (m_e_form_mode)
            //    {
            //        case DataEntryFormMode.InsertDataState:
            //            if (m_id_gd_hd != -1)
            //            {
            //                cho_hop_dong_da_co_ve_trang_thai_delete_Y();
            //                cho_gd_hs_lns_lcd_da_xoa_Y();
            //                cho_gd_hs_lns_da_xoa_Y();
            //                cho_gd_lcd_da_xoa_Y();
            //            }

            //            //lap hop dong moi
            //            v_us_gd_hd.BeginTransaction();
            //            v_us_gd_hd.Insert();
            //            v_us_gd_hd.CommitTransaction();

            //            //insert gd_hs_lns_lcd
            //            form_2_us_gd_hs_lns_lcd(v_us_gd_hs_lns_lcd);
            //            v_us_gd_hs_lns_lcd.BeginTransaction();
            //            v_us_gd_hs_lns_lcd.Insert();
            //            v_us_gd_hs_lns_lcd.CommitTransaction();

            //            //insert gd_hs_lns
            //            form_2_us_gd_hs_lns(v_us_gd_hs_lns);
            //            v_us_gd_hs_lns.BeginTransaction();
            //            v_us_gd_hs_lns.Insert();
            //            v_us_gd_hs_lns.CommitTransaction();

            //            //insert gd_lcd
            //            form_2_us_gd_lcd(v_us_gd_lcd);
            //            v_us_gd_lcd.BeginTransaction();
            //            v_us_gd_lcd.Insert();
            //            v_us_gd_lcd.CommitTransaction();

            //            //insert gd_trang_thai_ld
            //            decimal v_id_gd_trang_thai_lao_dong_da_co = 0;

            //            v_id_gd_trang_thai_lao_dong_da_co = find_id_trang_thai_lao_dong_da_co(decimal.Parse(m_sle_chon_nhan_vien.EditValue.ToString())); //sai o day

            //            if (v_id_gd_trang_thai_lao_dong_da_co == -1)
            //            {
            //                form_2_us_gd_trang_thai_lao_dong(v_us_gd_trang_thai_lao_dong);
            //                v_us_gd_trang_thai_lao_dong.BeginTransaction();
            //                v_us_gd_trang_thai_lao_dong.Insert();
            //                v_us_gd_trang_thai_lao_dong.CommitTransaction();
            //            }
            //            break;
            //        case DataEntryFormMode.UpdateDataState:
            //            v_us_gd_hd.BeginTransaction();
            //            v_us_gd_hd.dcID = CIPConvert.ToDecimal(m_grv_lap_hd.GetRowCellValue(m_grv_lap_hd.FocusedRowHandle, "ID"));
            //            v_us_gd_hd.Update();
            //            v_us_gd_hd.CommitTransaction();

            //            //
            //            form_2_us_gd_hs_lns_lcd(v_us_gd_hs_lns_lcd);
            //            v_us_gd_hs_lns_lcd.BeginTransaction();
            //            v_us_gd_hs_lns_lcd.dcID = find_id_gd_lns_lcd(CIPConvert.ToDecimal(m_grv_lap_hd.GetRowCellValue(m_grv_lap_hd.FocusedRowHandle, "ID")));
            //            v_us_gd_hs_lns_lcd.Update();
            //            v_us_gd_hs_lns_lcd.CommitTransaction();
            //            break;
            //        default:
            //            break;
            //    }
            //}
            //catch (Exception v_e)
            //{

            //    throw v_e;
            //}
        }
        private void save_data()
        {
            US_GD_HOP_DONG v_us_gd_hd = new US_GD_HOP_DONG();
            US_GD_CONG_TAC v_us_gd_cong_tac = new US_GD_CONG_TAC();
            US_GD_HE_SO_LNS v_us_gd_hs_lns = new US_GD_HE_SO_LNS();
            try
            {
                for(int i = 0; i < m_grv_hop_dong.RowCount; i++)
                {
                    var data = m_grv_hop_dong.GetDataRow(i);
                    //
                    grid_to_us_gd_hop_dong(v_us_gd_hd, data);
                    grid_to_us_gd_cong_tac(v_us_gd_cong_tac, data);
                    grid_to_us_gd_lns(v_us_gd_hs_lns, data);

                    v_us_gd_hd.BeginTransaction();
                    v_us_gd_cong_tac.UseTransOfUSObject(v_us_gd_hd);
                    v_us_gd_cong_tac.Insert();
                    v_us_gd_hs_lns.UseTransOfUSObject(v_us_gd_hd);
                    v_us_gd_hs_lns.Insert();
                    v_us_gd_hd.Insert();

                    v_us_gd_hd.CommitTransaction();
                }
                CHRM_BaseMessages.MsgBox_Infor("Đã lưu dữu liệu thành công");
            }
            catch(Exception)
            {
                if(v_us_gd_hd.is_having_transaction())
                {
                    v_us_gd_hd.Rollback();
                }
                throw;
            }
        }