Пример #1
0
        public virtual OrderPhaseChange Update(XElement orderElement)
        {
            Debug.WriteLine("in order");
            OrderPhase?oldPhase = this.Phase;

            if (orderElement.Attribute("Phase") != null && !string.IsNullOrEmpty(orderElement.Attribute("Phase").Value))
            {
                OrderPhase phase = (OrderPhase)XmlConvert.ToInt32(orderElement.Attribute("Phase").Value);
                if (phase == oldPhase)
                {
                    return(this.CreateOrderChange(null));
                }
            }
            Debug.WriteLine(string.Format("old phase = {0}", oldPhase));
            int oldHitCount = this.HitCount;

            this.UpdateOrderProperties(orderElement);
            var result = this.CreateOrderChange(oldPhase);

            if (result == null && oldHitCount != this.HitCount)
            {
                return(this.CreateOrderChange(OrderChangeType.Hit, this));
            }
            return(result);
        }
Пример #2
0
        private Dictionary <Guid, Order> ParseOrders(DataSet ds, Dictionary <Guid, Transaction> trans)
        {
            var orders = new Dictionary <Guid, Order>(CAPACITY);

            SettingInitializer.InitializeWithException(ds, "Order", dr =>
            {
                Guid transactionID = (Guid)dr["TransactionID"];
                if (!trans.ContainsKey(transactionID))
                {
                    return;
                }
                var tran         = trans[transactionID];
                OrderPhase phase = (OrderPhase)(byte)dr["Phase"];
                if (phase == OrderPhase.Canceled)
                {
                    return;
                }
                this.ParseOrder(new DBRow(dr), tran, orders);
            });
            return(orders);
        }
Пример #3
0
 internal void InitializeOrder(IDataReader dr, Dictionary <Guid, Transaction> trans, Dictionary <Guid, Order> orders)
 {
     try
     {
         Guid transactionID = (Guid)dr["TransactionID"];
         if (!trans.ContainsKey(transactionID))
         {
             return;
         }
         var        tran  = trans[transactionID];
         OrderPhase phase = (OrderPhase)(byte)dr["Phase"];
         if (phase == OrderPhase.Canceled)
         {
             return;
         }
         this.ParseOrder(new DBReader(dr), tran, orders);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
 }