//Save private void save_insert_lns() { try { m_us_save = new US_GD_HE_SO_LNS(); // m_us_save.dcID_LY_DO_CHINH_SUA = Convert.ToDecimal(m_le_ly_do_chinh_sua.EditValue); m_us_save.datNGAY_BAT_DAU = m_dat_tu_ngay.DateTime.Date; m_us_save.datNGAY_KET_THUC = m_dat_den_ngay.DateTime.Date; m_us_save.datNGAY_LAP = DateTime.Now.Date; //m_us_save.dcID_HS_LNS_LCD = ExecuteFuntion.GetID_GD_HS_LNS_LCDByID_HOP_DONG(Convert.ToDecimal(m_sle_hop_dong.EditValue)); m_us_save.dcHE_SO = Convert.ToDecimal(m_txt_gia_tri_thay_doi.EditValue); //m_us_save.strDA_XOA = "N"; m_us_save.strGHI_CHU = m_txt_ghi_chu.Text; m_us_save.strNGUOI_LAP = CAppContext_201.getCurrentUserName(); m_us_save.BeginTransaction(); //m_us_save.SetHetHieuLucTruocKhiThemMoi(m_us_save.dcID_HS_LNS_LCD, m_dat_tu_ngay.DateTime.AddDays(-1).Date); m_us_save.Insert(); m_us_save.CommitTransaction(); XtraMessageBox.Show("Thêm mới dữ liệu thành công!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } catch(Exception) { if(m_us_save.is_having_transaction()) { m_us_save.Rollback(); } throw; } }
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_HE_SO_LNS v_us_gd_ct = new US_GD_HE_SO_LNS(); try { v_us_gd_ct.BeginTransaction(); for(int i = 0; i < m_grv_cong_tac.RowCount; i++) { v_us_gd_ct.ClearAllFields(); var data = m_grv_cong_tac.GetDataRow(i); grid_to_us_gd_cong_tac(v_us_gd_ct, data); v_us_gd_ct.Insert(); SplashScreenManager.Default.SendCommand(SplashScreen1.SplashScreenCommand.SetProgress, (int)((decimal)i / (decimal)m_grv_cong_tac.RowCount * 100)); } v_us_gd_ct.CommitTransaction(); 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(); } throw; } 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(); form_2_us_gd_hs_lns_lcd(v_us_gd_hs_lns_lcd); form_2_us_gd_hs_lns(v_us_gd_hs_lns); form_2_us_gd_lcd(v_us_gd_lcd); try { switch (m_e_form_mode) { case DataEntryFormMode.InsertDataState: //Cho gd_hs_lns_lcd da xoa = Y cho_gd_hs_lns_lcd_da_co_da_xoa_Y(); //insert 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 cho_gd_hs_lns_da_co_da_xoa_Y(); v_us_gd_hs_lns.BeginTransaction(); v_us_gd_hs_lns.Insert(); v_us_gd_hs_lns.CommitTransaction(); //insert gd_lcd cho_gd_lcd_da_co_da_xoa_Y(); v_us_gd_lcd.BeginTransaction(); v_us_gd_lcd.Insert(); v_us_gd_lcd.CommitTransaction(); break; case DataEntryFormMode.UpdateDataState: break; default: break; } } catch (Exception v_e) { v_us_gd_hs_lns.Rollback(); v_us_gd_lcd.Rollback(); v_us_gd_hs_lns_lcd.Rollback(); CSystemLog_301.ExceptionHandle(v_e); } }