private bool validate_ma_update(string ip_str_ma, decimal ip_dc_id) { US_DM_CO_SO v_us = new US_DM_CO_SO(); DS_DM_CO_SO v_ds = new DS_DM_CO_SO(); v_us.FillDataset(v_ds, "where ma='" + ip_str_ma + "' or id=" + ip_dc_id); if (v_ds.DM_CO_SO.Count != 1) return false; return true; }
private bool validate_ma_insert(string v_str_ma) { US_DM_CO_SO v_us = new US_DM_CO_SO(); DS_DM_CO_SO v_ds = new DS_DM_CO_SO(); v_us.FillDataset(v_ds, "where ma='" + v_str_ma + "'"); if (v_ds.DM_CO_SO.Count != 0 && m_e_form_mode == DataEntryFormMode.InsertDataState) return false; return true; }
} private void dm_grid2us_object(US_DM_CO_SO i_us , int i_grid_row) { DataRow v_dr; v_dr = (DataRow)m_grv_dm_co_so.Rows[i_grid_row].UserData; m_obj_trans.GridRow2DataRow(i_grid_row, v_dr);
private void load_cbo_dm_co_co() { US_DM_CO_SO v_us = new US_DM_CO_SO(); DS_DM_CO_SO v_ds = new DS_DM_CO_SO(); v_us.FillDataset(v_ds); m_cbo_tinh_theo_co_so.DataSource = v_ds.DM_CO_SO; m_cbo_tinh_theo_co_so.ValueMember = DM_CO_SO.ID; m_cbo_tinh_theo_co_so.DisplayMember = DM_CO_SO.MA; //DataRow v_dr = v_ds.DM_CO_SO.NewRow(); //v_dr[DM_CO_SO.ID] = -1; //v_dr[DM_CO_SO.MA] = "Tất cả"; //v_dr[DM_CO_SO.ID_LOAI_CO_SO] = -1; //v_ds.DM_CO_SO.Rows.InsertAt(v_dr, 0); m_cbo_tinh_theo_co_so.SelectedIndex = 0; }
} private void delete_v_dm_co_so() { if (!CGridUtils.IsThere_Any_NonFixed_Row(m_grv_dm_co_so)) return; if (!CGridUtils.isValid_NonFixed_RowIndex(m_grv_dm_co_so, m_grv_dm_co_so.Row)) return; if (BaseMessages.askUser_DataCouldBeDeleted(8) != BaseMessages.IsDataCouldBeDeleted.CouldBeDeleted) return; US_DM_CO_SO v_us = new US_DM_CO_SO(); dm_grid2us_object(v_us, m_grv_dm_co_so.Row); try { v_us.BeginTransaction(); v_us.Delete(); v_us.CommitTransaction(); m_grv_dm_co_so.Rows.Remove(m_grv_dm_co_so.Row); } catch (Exception v_e) { v_us.Rollback(); CDBExceptionHandler v_objErrHandler = new CDBExceptionHandler(v_e, new CDBClientDBExceptionInterpret()); v_objErrHandler.showErrorMessage();