private void save_data(ref decimal v_id_gd_thu_nhap_khac) { US_GD_THU_NHAP_KHAC v_us_gd_thu_nhap_khac = new US_GD_THU_NHAP_KHAC(); form_2_us_obj(v_us_gd_thu_nhap_khac); try { switch (m_e_form_mode) { case DataEntryFormMode.InsertDataState: v_us_gd_thu_nhap_khac.BeginTransaction(); v_us_gd_thu_nhap_khac.Insert(); v_us_gd_thu_nhap_khac.CommitTransaction(); v_id_gd_thu_nhap_khac = v_us_gd_thu_nhap_khac.dcID; CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_LUU_DU_LIEU_THANH_CONG); break; case DataEntryFormMode.UpdateDataState: v_us_gd_thu_nhap_khac.BeginTransaction(); v_us_gd_thu_nhap_khac.dcID = CIPConvert.ToDecimal(m_grv_quan_ly_thu_nhap_khac.GetRowCellValue(m_grv_quan_ly_thu_nhap_khac.FocusedRowHandle, "ID").ToString()); v_us_gd_thu_nhap_khac.Update(); v_us_gd_thu_nhap_khac.CommitTransaction(); CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_DU_LIEU_DA_DUOC_CAP_NHAT); break; default: break; } } catch (Exception v_e) { throw v_e; } }
private void kiem_tra_va_thuc_hien_nhap_du_lieu(ref decimal v_count, ref int v_int_khong_nhap_duoc, decimal v_selectedRowCount) { if (CHRMCommon.thang_da_chot_bang_luong(CIPConvert.ToDecimal(m_txt_chon_thang.Text.Trim()), CIPConvert.ToDecimal(m_txt_chon_nam.Text.Trim()))) { CHRM_BaseMessages.MsgBox_Error(CONST_ID_MSGBOX.ERROR_THANG_DA_CHOT_BANG_LUONG); return; } else { for (int i = 0; i < v_selectedRowCount; i++) { decimal v_id_nv = 0; US_DUNG_CHUNG v_us_dc = new US_DUNG_CHUNG(); US_GD_THU_NHAP_KHAC v_us_gd_thu_nhap_khac = new US_GD_THU_NHAP_KHAC(); var v_data_row = m_grv_quan_ly_thu_nhap_khac.GetDataRow(m_grv_quan_ly_thu_nhap_khac.GetSelectedRows()[i]); try { get_id_nhan_vien_tu_data_row(v_us_dc, v_data_row, ref v_id_nv); } catch (Exception) { CHRM_BaseMessages.MsgBox_Error("Mã nhân viên " + v_data_row[1].ToString() + " không tồn tại trong hệ thống. Vui lòng kiểm tra lại thông tin!"); v_int_khong_nhap_duoc++; continue; } form_2_us_gd_thu_nhap_khac(v_us_gd_thu_nhap_khac, v_id_nv, v_data_row); try { delete_gd_da_co_trong_thang_cua_nhan_vien(v_us_dc, v_data_row, v_id_nv); v_us_gd_thu_nhap_khac.BeginTransaction(); v_us_gd_thu_nhap_khac.Insert(); v_us_gd_thu_nhap_khac.CommitTransaction(); v_count++; } catch (Exception) { CHRM_BaseMessages.MsgBox_Error(CONST_ID_MSGBOX.ERROR_DA_CO_LOI_XAY_RA); v_int_khong_nhap_duoc++; } } } }
private void save_data() { for (int i = 0; i < m_grv.RowCount; i++) { var v_dr = m_grv.GetDataRow(i); US_GD_THU_NHAP_KHAC v_us = new US_GD_THU_NHAP_KHAC(); v_us.dcID_NHAN_VIEN = get_id_nhan_vien_by_ma_nv(v_dr[1].ToString()); v_us.dcTHANG = m_dat_thang.DateTime.Month; v_us.dcNAM = m_dat_thang.DateTime.Year; v_us.dcHE_SO = 0; v_us.dcSO_TIEN = return_so_tien(v_dr[4].ToString()); v_us.dcSO_TIEN_NOP_THUE = return_so_tien(v_dr[5].ToString()); v_us.dcSO_TIEN_THUC_LINH = return_so_tien(v_dr[6].ToString()); v_us.dcID_LOAI_THU_NHAP_KHAC = 756; v_us.dcID_QUY_THU_NHAP_KHAC = decimal.Parse(m_sle_quy_tien.EditValue.ToString()); if (i == 0) v_us.BeginTransaction(); else { v_us.UseTransOfUSObject(m_us); } m_us = v_us; v_us.Insert(); } m_us.CommitTransaction(); }