Exemple #1
0
        public static void Initialize()
        {
            // this line is to make sure that fix db conn is already created
            CmdOnPoolGenerator gen = new CmdOnPoolGenerator("FixOrdersDBConnectionString");
            DatabaseMethods    db  = new DatabaseMethods();

            m_orderID_ordersDetails = new Dictionary <long, SingleOrder>();
            m_ReqOrdID_OrdID        = new Dictionary <Guid, long>();
            m_sessionKey_ReqOrdIDs  = new Dictionary <Guid, List <Guid> >();
            //m_ReqOrdID_subIDs = new Dictionary<Guid, List<Guid>>();
            m_OrdID_sessionKey    = new Dictionary <long, Guid>();
            m_handledExecutionIDs = new List <string>();
            // Fill the data
            DataTable dtOrders = db.FillOrdersData();

            PropertiesColumnsSchemaItem[] schema = PropColMapper.GetTableSchema(SingleOrderProperties.TableName);

            foreach (DataRow row in dtOrders.Rows)
            {
                Guid sessionKey = ((Guid)row["SessionID"]);
                long ordID      = (long)row["OrderID"];
                Guid ReqOrdID   = (Guid)row["RequesterOrderID"];

                // prepare order object
                SingleOrder order = new SingleOrder();
                foreach (PropertiesColumnsSchemaItem item in schema)
                {
                    order.Data[item.ColumnName] = row[item.ColumnName];
                }

                m_orderID_ordersDetails.Add((long)row["OrderID"], order);
                m_ReqOrdID_OrdID.Add((Guid)row["RequesterOrderID"], (long)row["OrderID"]);
                if (!m_sessionKey_ReqOrdIDs.ContainsKey(sessionKey))
                {
                    m_sessionKey_ReqOrdIDs.Add(sessionKey, new List <Guid>());
                }
                m_sessionKey_ReqOrdIDs[sessionKey].Add(ReqOrdID);
                m_OrdID_sessionKey.Add(ordID, sessionKey);
            }


            foreach (string execID in db.GetExecutionIDs())
            {
                m_handledExecutionIDs.Add(execID);
            }
        }