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_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_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_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; } }