Ejemplo n.º 1
0
 private void OnOrderReturn(object sender, RspEventArgs e)
 {
     switch (sender.ToString())
     {
     case "ProgramTradeApi.XTradeSpi":
         var odr = OrderDetail.CreateDetail((e as TypedRspEventArgs <CLRDFITCOrderRtnField, object>).Data);
         Orders.AddOrUpdate(odr.OrderSysID, odr, (k, v) => odr);
         eventOrderChanged?.Invoke(this, null);
         break;
     }
 }
Ejemplo n.º 2
0
        public static void AddOrder(OrderApiRequest request)
        {
            try
            {
                Order order = new Order
                {
                    Name      = request.Name,
                    Phone     = request.Phone,
                    Date      = DateTime.Now,
                    ProductId = request.ProductId,
                    Adress    = request.Adress,
                };

                Orders.AddOrUpdate(order);
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 3
0
 private void OnRspQryOrder(object sender, RspEventArgs e)
 {
     switch (sender.ToString())
     {
     case "ProgramTradeApi.XTradeSpi":
         if (e.ErrorID == 0)
         {
             var odr = OrderDetail.CreateDetail((e as TypedRspEventArgs <CLRDFITCOrderCommRtnField, CLRDFITCErrorRtnField>).Data);
             if (odr.OrderSysID > 0)
             {
                 Orders.AddOrUpdate(odr.OrderSysID, odr, (k, v) => v);
                 if (e.IsLast)
                 {
                     eventOrderChanged?.Invoke(this, null);
                 }
             }
         }
         else
         {
             var err = (e as TypedRspEventArgs <CLRDFITCOrderCommRtnField, CLRDFITCErrorRtnField>).Error;
         }
         break;
     }
 }