static void PrepareTables() { const int NDX_LABEL = 0; const int NDX_SPOT_VALUE = 1; IDatumProvider dp = AppContext.AccessPath.GetDataProvider(InternalTablesID.TRANSACTION); List <RowAction>[] actions = { new List <RowAction>(), new List <RowAction>() }; using (var pump = new DataPump(dp)) { pump.Connect(); DataPump.Item item = pump.NextItem; while (item != null) { var trans = item.Row as Transaction; int ndx = trans.TableID == InternalTablesID.TR_LABEL ? NDX_LABEL : trans.TableID == InternalTablesID.TR_SPOT_VALUE ? NDX_SPOT_VALUE : -1; if (ndx != -1) { RowAction ra = actions[ndx].Find(a => a.RowID == trans.RowID); if (ra == null) { actions[ndx].Add(new RowAction(trans.RowID, trans.Action)); } else if (ra.ActionCode == ActionCode_t.AddRow && trans.Action == ActionCode_t.DeleteRow) { actions[ndx].Remove(ra); } else { ra.ActionCode = SelectAction(ra.ActionCode, trans.Action); } dp.Delete(item.Index); } item = pump.NextItem; } } foreach (RowAction ra in actions[NDX_LABEL]) { UpdateTextTable(ra.RowID, ra.ActionCode); } foreach (RowAction ra in actions[NDX_SPOT_VALUE]) { UpdateSpotTable(ra.RowID, ra.ActionCode); } }