Beispiel #1
0
 public void SaveOrder(OrderObject order)
 {
     lock (locker)
     {
         order.Id = orders.Any() ? orders.Max(m => m.Id) + 1 : 1;
         orders.Add(order);
     }
 }
        public TradeEntryViewModel(IReferenceDataRepo refRepo, ITradeRepo tradeRepo)
        {
            BuySell = new ObservableCollection<string> { "B", "S" };
            Products = new ObservableCollection<ProductObject>(refRepo.GetProducts());
            Instruments = new ObservableCollection<InstrumentObject>();
            Order = new OrderObject();

            TradeRepo = tradeRepo;
            RefRepo = refRepo;

            AddTradeCommand = new RelayCommand(OnAddTrade, CanAddTrade);
            ProductChangedEvent = new RelayCommand<ProductObject>(OnProductChanged);
        }
Beispiel #3
0
 public OrderViewModel(OrderObject o)
 {
     Order = o;
     Fills = new ObservableCollection<FillObject>();
 }
        private void OnAddTrade()
        {
            var v = ValidateOrder();

            if (v.Passed)
            {
                Order.AddedBy = Environment.UserName;
                Order.DateAdded = DateTime.Now;

                TradeRepo.SaveOrder(Order);
                MessageBus.Send(Order);

                Order = new OrderObject();

                MessageBus.Send(new AppMessage("Trade Added", "Trade Added Successfully", true));
            }
            else
            {
                MessageBus.Send(new AppMessage("Trade Add Failed", v.Errors, false));
            }
        }
Beispiel #5
0
 public void OrderAdded(OrderObject order)
 {
     Orders.Add(new OrderViewModel(order));
 }