void LogAction(IDataRow row, uint idTable, ActionCode_t actionCode) { uint id = AppContext.TableManager.Transactions.CreateUniqID(); var datum = new Transaction(id, idTable, row.ID, actionCode); m_dataProvider.Insert(datum); }
static private void UpdateTextTable(uint rowID, ActionCode_t code) { var lbl = AppContext.AccessPath.GetKeyIndexer(InternalTablesID.TR_LABEL).Get(rowID) as TR.TRLabel; switch (code) { case ActionCode_t.ReplaceRow: { // TRLabel.ID == TR.LabelMapping.ID var trLabelMapping = AppContext.AccessPath.GetKeyIndexer(InternalTablesID.TR_LABEL_MAPPING).Get(lbl.ID) as TR.LabelMapping; if (trLabelMapping != null) { int ndxTxt = AppContext.AccessPath.GetKeyIndexer(TablesID.SHARED_TEXT).IndexOf(trLabelMapping.SharedTextID); var txtNew = new Strings.SharedText(trLabelMapping.SharedTextID, lbl.Label); AppContext.AccessPath.GetDataProvider(TablesID.SHARED_TEXT).Replace(ndxTxt, txtNew); } } break; default: Assert(code == ActionCode_t.AddRow); //ce cas est traité dans UpdateSpotTable() break; } }
ActionInfo BuildAction(uint idTable, uint rowID, ActionCode_t code) { switch (code) { case ActionCode_t.DeleteRow: return(new ActionInfo(new DeleteRow(rowID), 0)); case ActionCode_t.ReplaceRow: { DatumInfo di = ReadDatum(idTable, rowID); return(new ActionInfo(new ReplaceRow(di.Datum), di.Size)); } case ActionCode_t.AddRow: { DatumInfo di = ReadDatum(idTable, rowID); return(new ActionInfo(new AddRow(di.Datum), di.Size)); } default: Assert(false); break; } return(new ActionInfo()); }
public Transaction(uint id, uint idTable, uint idRow, ActionCode_t action, DateTime actionTime) : base(id) { Assert(idTable > 0); Assert(idRow > 0); TableID = idTable; RowID = idRow; Action = action; ActionTime = actionTime; }
public Transaction(uint id, uint idTable, uint idRow, ActionCode_t action) : this(id, idTable, idRow, action, DateTime.Now) { }
static void UpdateSpotTable(uint rowID, ActionCode_t code) { switch (code) { case ActionCode_t.DeleteRow: { var trSpot = AppContext.AccessPath.GetKeyIndexer(InternalTablesID.TR_SPOT_VALUE).Get(rowID) as TR.SpotValue; int ndx = AppContext.AccessPath.GetKeyIndexer(TablesID.SPOT_VALUE).IndexOf(trSpot.PublishedValueID); AppContext.AccessPath.GetDataProvider(TablesID.SPOT_VALUE).Delete(ndx); } break; case ActionCode_t.ReplaceRow: { var trSpot = AppContext.AccessPath.GetKeyIndexer(InternalTablesID.TR_SPOT_VALUE).Get(rowID) as TR.SpotValue; var trProdMapping = AppContext.AccessPath.GetKeyIndexer( InternalTablesID.TR_PRODUCT_MAPPING).Get(trSpot.ProductMappingID) as TR.ProductMapping; var trLabel = AppContext.AccessPath.GetKeyIndexer(InternalTablesID.TR_LABEL).Get(trSpot.LabelID) as TR.TRLabel; //LabelMapping.ID == TRLabel.ID var trLabelMapping = AppContext.AccessPath.GetKeyIndexer(InternalTablesID.TR_LABEL_MAPPING).Get(trLabel.ID) as TR.LabelMapping; if (trLabelMapping == null) { var sharedText = new SharedText(AppContext.TableManager.SharedTexts.CreateUniqID(), trLabel.Label); AppContext.AccessPath.GetDataProvider(TablesID.SHARED_TEXT).Insert(sharedText); trLabelMapping = new TR.LabelMapping(trLabel.ID, sharedText.ID); AppContext.AccessPath.GetDataProvider(InternalTablesID.TR_LABEL_MAPPING).Insert(trLabelMapping); } var pubValue = new Spots.SpotValue( trSpot.PublishedValueID, trSpot.Price, trSpot.Time, trProdMapping.ProductID, trProdMapping.ContextID, SuppliersID.TR, trLabelMapping.SharedTextID); int ndx = AppContext.AccessPath.GetKeyIndexer(TablesID.SPOT_VALUE).IndexOf(trSpot.PublishedValueID); AppContext.AccessPath.GetDataProvider(TablesID.SPOT_VALUE).Replace(ndx, pubValue); } break; case ActionCode_t.AddRow: { var trSpot = AppContext.AccessPath.GetKeyIndexer(InternalTablesID.TR_SPOT_VALUE).Get(rowID) as TR.SpotValue; var trProdMapping = AppContext.AccessPath.GetKeyIndexer( InternalTablesID.TR_PRODUCT_MAPPING).Get(trSpot.ProductMappingID) as TR.ProductMapping; var trLabel = AppContext.AccessPath.GetKeyIndexer(InternalTablesID.TR_LABEL).Get(trSpot.LabelID) as TR.TRLabel; //LabelMapping.ID == TRLabel.ID var trLabelMapping = AppContext.AccessPath.GetKeyIndexer(InternalTablesID.TR_LABEL_MAPPING).Get(trLabel.ID) as TR.LabelMapping; if (trLabelMapping == null) { var sharedText = new SharedText(AppContext.TableManager.SharedTexts.CreateUniqID(), trLabel.Label); AppContext.AccessPath.GetDataProvider(TablesID.SHARED_TEXT).Insert(sharedText); trLabelMapping = new TR.LabelMapping(trLabel.ID, sharedText.ID); AppContext.AccessPath.GetDataProvider(InternalTablesID.TR_LABEL_MAPPING).Insert(trLabelMapping); } var pubValue = new Spots.SpotValue( AppContext.TableManager.SpotValues.CreateUniqID(), trSpot.Price, trSpot.Time, trProdMapping.ProductID, trProdMapping.ContextID, SuppliersID.TR, trLabelMapping.SharedTextID); AppContext.AccessPath.GetDataProvider(TablesID.SPOT_VALUE).Insert(pubValue); trSpot.PublishedValueID = pubValue.ID; int ndx = AppContext.AccessPath.GetKeyIndexer(InternalTablesID.TR_SPOT_VALUE).IndexOf(trSpot.ID); AppContext.TransactionListener.Disabled = true; AppContext.AccessPath.GetDataProvider(InternalTablesID.TR_SPOT_VALUE).Replace(ndx, trSpot); AppContext.TransactionListener.Disabled = false; } break; default: break; } }
public RowAction(uint rowID, ActionCode_t code) { RowID = rowID; ActionCode = code; }
static ActionCode_t SelectAction(ActionCode_t code1, ActionCode_t code2) { return(m_actionPriority[code1] < m_actionPriority[code2] ? code1 : code2); }