//вставка записи void StreamDataInserted(CP2DataStream stream, String tableName, CP2Record rec) { try { LogWriteLine(DateTime.Now.ToString() + " Insert " + tableName + " StreamName: " + stream.StreamName + "; TableSet.Count = " + stream.TableSet.Count.ToString()); // Пришел поток FORTS_FUTAGGR20_REPL if (stream.StreamName == streamAggregatesID) { SaveRev(rec.GetValAsVariantByIndex(1)); curr_rev = rec.GetValAsLongByIndex(1); uint count = rec.Count; for (uint i = 0; i < count; ++i) { if (i != count - 1) { LogWrite(rec.GetValAsStringByIndex(i) + ";"); } else { LogWriteLine(rec.GetValAsStringByIndex(i)); } } } // Пришел поток FORTS_FUTTRADE_REPL if (stream.StreamName == streamTradesID) { string Fields = m_streamTrades.TableSet.get_FieldList("deal"); curr_rev_deal = rec.GetValAsLongByIndex(1); for (uint i = 0; i < Fields.Split(',').Length; i++) { string Field = Fields.Split(',')[i]; string Value = ""; try { Value = rec.GetValAsString(Field); SaveDeal(DateTime.Now.ToString() + " " + Fields.Split(',')[i], Value); } catch (System.Exception e) { } } m_saveDealFile.WriteLine(""); m_saveDealFile.Flush(); } } catch (System.Exception e) { LogWriteLine("!!!" + e.Message + "!!!" + e.Source); } }
//вставка записи void StreamDataInserted(CP2DataStream stream, String tableName, CP2Record rec) { try { LogWriteLine("Insert " + tableName); // Пришел поток FORTS_FUTAGGR20_REPL if (stream.StreamName == streamAggregatesID) { SaveRev(rec.GetValAsVariantByIndex(1)); curr_rev = rec.GetValAsLongByIndex(1); uint count = rec.Count; for (uint i = 0; i < count; ++i) { if (i != count - 1) { LogWrite(rec.GetValAsStringByIndex(i) + ";"); } else { LogWriteLine(rec.GetValAsStringByIndex(i)); } } } // Пришел поток FORTS_FUTTRADE_REPL if (stream.StreamName == streamTradesID) { string Fields = m_streamTrades.TableSet.get_FieldList("deal"); curr_rev_deal = rec.GetValAsLongByIndex(1); for (uint i = 0; i < Fields.Split(',').Length; i++) { string Field = Fields.Split(',')[i]; string Value = ""; try { Value = rec.GetValAsString(Field); SaveDeal(Fields.Split(',')[i], Value); } catch (System.Exception e) { } } m_saveDealFile.WriteLine(""); m_saveDealFile.Flush(); } } catch (System.Exception e) { LogWriteLine("!!!" + e.Message + "!!!" + e.Source); } }
//удаление записи void StreamDataDeleted(CP2DataStream stream, String tableName, Int64 Id, CP2Record rec) { SaveRev(rec.GetValAsVariantByIndex(1)); LogWriteLine("Delete " + tableName + " " + Id); }
//апдейт записи void StreamDataUpdated(CP2DataStream stream, String tableName, Int64 Id, CP2Record rec) { LogWriteLine("Update " + tableName + " " + Id); try { uint count = rec.Count; for( uint i = 0; i < count; ++i ) { if( i != count - 1) { LogWrite(rec.GetValAsStringByIndex(i) + ";"); } else { LogWriteLine(rec.GetValAsStringByIndex(i)); } } } catch (System.Exception e) { LogWriteLine("!!!" + e.Message + "!!!" + e.Source); } }
//удаление записи void StreamDataDeleted(CP2DataStream stream, String tableName, Int64 Id, CP2Record rec) { LogWriteLine("Delete " + tableName + " " + Id); }
void StreamDataDeleted(CP2DataStream stream, String tableName, Int64 Id, CP2Record rec) { SaveRev(rec.GetValAsVariantByIndex(1)); LogWriteLine(DateTime.Now.ToString() + " Delete " + tableName + " " + Id); }
private void DU(CP2DataStream stream, string tableName, long id, CP2Record rec) { Hashtable hashtable = new Hashtable(); TableBaseInfo tb = (this.buffer.tables[tableName] as TableBaseInfo); if (tb != null) { for (int i = 0; i < tb.fieldsArr.Length; i++) { hashtable.Add(tb.fieldsArr[i],rec.GetValAsString(tb.fieldsArr[i])); } recordContainer r = new recordContainer(tableName, hashtable, "update", id); buffer.insertRecord(r); } }
private void DI(CP2DataStream stream, string tableName, CP2Record rec) { /*if (tableName == "common") { string t = rec.GetValAsVariant("isin_id").ToString(); if (t == "194834") parent.parent.logMsg("to queue :" + rec.GetValAsVariant("best_buy").ToString()); }*/ Hashtable hashtable = new Hashtable(); TableBaseInfo tb = (this.buffer.tables[tableName] as TableBaseInfo); if (tb != null) { for (int i = 0; i < tb.fieldsArr.Length; i++) { hashtable.Add(tb.fieldsArr[i],rec.GetValAsString(tb.fieldsArr[i])); } recordContainer r = new recordContainer(tableName, hashtable, "insert", 0); this.buffer.insertRecord(r); } }