Beispiel #1
0
        //вставка записи
        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);
            }
        }
Beispiel #2
0
        //вставка записи
        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);
            }
        }
Beispiel #3
0
 //удаление записи
 void StreamDataDeleted(CP2DataStream stream, String tableName, Int64 Id, CP2Record rec)
 {
     SaveRev(rec.GetValAsVariantByIndex(1));
     LogWriteLine("Delete " + tableName + " " + Id);
 }
Beispiel #4
0
 //апдейт записи
 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);
     }
 }
Beispiel #5
0
 //удаление записи
 void StreamDataDeleted(CP2DataStream stream, String tableName, Int64 Id, CP2Record rec)
 {
     LogWriteLine("Delete " + tableName + " " + Id);
 }
Beispiel #6
0
 void StreamDataDeleted(CP2DataStream stream, String tableName, Int64 Id, CP2Record rec)
 {
     SaveRev(rec.GetValAsVariantByIndex(1));
     LogWriteLine(DateTime.Now.ToString() + " Delete " + tableName + " " + Id);
 }
Beispiel #7
0
 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);
     }
 }
Beispiel #8
0
        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);
            }
        }