Esempio n. 1
0
        private void NewOrderClick(object sender, RoutedEventArgs e)
        {
            var newOrder = new OrderWindow
            {
                Order = new Order {
                    Security = SecurityPicker.SelectedSecurity
                },
                SecurityProvider   = MainWindow.Instance.Trader,
                MarketDataProvider = MainWindow.Instance.Trader,
                Portfolios         = new PortfolioDataSource(MainWindow.Instance.Trader),
            };

            if (newOrder.ShowModal(this))
            {
                MainWindow.Instance.Trader.RegisterOrder(newOrder.Order);
            }
        }
Esempio n. 2
0
        private void OrderGrid_OrderRegistering()
        {
            var newOrder = new OrderWindow
            {
                Order = new Order {
                    Security = _security
                },
                SecurityProvider   = _connector,
                MarketDataProvider = _connector,
                Portfolios         = new PortfolioDataSource(_connector),
            };

            if (newOrder.ShowModal(this))
            {
                _connector.RegisterOrder(newOrder.Order);
            }
        }
        private void NewOrderClick(object sender, RoutedEventArgs e)
        {
            var connector = Connector;

            var newOrder = new OrderWindow
            {
                Order = new Order
                {
                    Security  = SecurityPicker.SelectedSecurity,
                    Portfolio = connector.Portfolios.FirstOrDefault(),
                },
            }.Init(connector);

            if (newOrder.ShowModal(this))
            {
                connector.RegisterOrder(newOrder.Order);
            }
        }
Esempio n. 4
0
        private void OrderGrid_OrderReRegistering(Order order)
        {
            var window = new OrderWindow
            {
                Title            = LocalizedStrings.Str2976Params.Put(order.TransactionId),
                Order            = order.ReRegisterClone(newVolume: order.Balance),
                SecurityEnabled  = false,
                PortfolioEnabled = false,
                OrderTypeEnabled = false,
            }.Init(Connector);

            if (!window.ShowModal(this))
            {
                return;
            }

            Connector.EditOrder(order, window.Order);
        }
Esempio n. 5
0
        private void NewOrderClick(object sender, RoutedEventArgs e)
        {
            var connector = Connector;

            var newOrder = new OrderWindow
            {
                Order = new Order {
                    Security = SecurityPicker.SelectedSecurity
                },
                SecurityProvider   = connector,
                MarketDataProvider = connector,
                Portfolios         = new PortfolioDataSource(connector),
            };

            if (newOrder.ShowModal(this))
            {
                connector.RegisterOrder(newOrder.Order);
            }
        }
Esempio n. 6
0
        private void BuyProducts(object obj)
        {
            if (productsName.Count == 0)
            {
                MessageBox.Show("Nu aveti nimic in cos.");
                return;
            }

            Window currentWindow = App.Current.MainWindow;

            OrderWindow orderWindow = new OrderWindow(productsName, ActualUser);

            App.Current.MainWindow = orderWindow;
            App.Current.MainWindow.ShowDialog();

            App.Current.MainWindow = currentWindow;

            productsName.Clear();
        }
Esempio n. 7
0
        private void DepthCtrl_RegisteringOrder(Sides side, decimal price)
        {
            var connector = Connector;

            var wnd = new OrderWindow
            {
                Order = new Order
                {
                    Direction = side,
                    Price     = price,
                    Security  = Security,
                    Portfolio = connector.Portfolios.FirstOrDefault(),
                },
            }.Init(connector);

            if (wnd.ShowModal(this))
            {
                connector.RegisterOrder(wnd.Order);
            }
        }
Esempio n. 8
0
        private void FillCombobox()
        {
            var comboSide = OrderWindow.GetSide();

            comboBuySell.DataSource    = comboSide;
            comboBuySell.DisplayMember = "Value";
            comboBuySell.ValueMember   = "Value";

            var comboType = OrderWindow.GetOrderType();

            comboBoxOrderType.DataSource    = comboType;
            comboBoxOrderType.DisplayMember = "Value";
            comboBoxOrderType.ValueMember   = "Value";

            var comboExchange = OrderWindow.GetExchange();

            comboBoxExchange.DataSource    = comboExchange;
            comboBoxExchange.DisplayMember = "Value";
            comboBoxExchange.ValueMember   = "Value";
        }
Esempio n. 9
0
        private void editCurrentOrder()
        {
            if (lvOrders.SelectedIndex == -1)
            {
                return;
            }
            ListOrderItem loi = (ListOrderItem)lvOrders.SelectedItem;
            Order         o   = new Order {
                id = loi.id
            };
            OrderWindow dlg = new OrderWindow(o);

            if (dlg.ShowDialog() == true)
            {
                refreshOrderWindow();
            }
            else
            {
                refreshOrderWindow();
            }
        }
Esempio n. 10
0
        private void LoginBtnClick(object sender, RoutedEventArgs e)
        {
            AccountProcess account = new AccountProcess();

            if (accountText.Text == "" | passwordText.Password == "")
            {
                DialogShow.ShowOkDialog("warning", "Have item empty!");
                return;
            }
            else if (account.Login(accountText.Text, passwordText.Password))
            {
                this.Hide();
                OrderWindow a = new OrderWindow();
                a.ShowDialog();
                this.Close();
            }
            else
            {
                DialogShow.ShowOkDialog("Error", "Not match account or password");
            }
        }
Esempio n. 11
0
 /// <summary>
 /// event handler for the back button chooses to change the screen to sides menu, drinks customizion, or flavor
 /// customization based on the private variable sideOrd drink
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void SizeBackButton(object sender, RoutedEventArgs e)
 {
     if (sideOrDrinkType == 5 || sideOrDrinkType == 6 || sideOrDrinkType == 7 || sideOrDrinkType == 8)// if it's a side
     {
         SidesMenu   swap  = new SidesMenu();
         OrderWindow order = this.FindAncestor <OrderWindow>();
         order.Swap(swap);
     }
     else if (sideOrDrinkType == 0)// if its a drink and a soda
     {
         FlavorCustomization swap  = new FlavorCustomization((SailorSoda)obj);
         OrderWindow         order = this.FindAncestor <OrderWindow>();
         order.Swap(swap);
     }
     else // if its any other drink type
     {
         DrinkCustomizations swap  = new DrinkCustomizations(obj, sideOrDrinkType);
         OrderWindow         order = this.FindAncestor <OrderWindow>();
         order.Swap(swap);
     }
 }
Esempio n. 12
0
        /// <summary>
        /// 订单管理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsbOrder_Click(object sender, EventArgs e)
        {
            if (null == orderWindow || orderWindow.IsDisposed)
            {
                orderWindow            = new OrderWindow();
                orderWindow.MdiParent  = this;
                orderWindow.StartLoad += (obj, ev) =>
                {
                    StartLoad(obj);
                };
                orderWindow.StopLoad += (obj, ev) =>
                {
                    StopLoad(obj);
                };


                orderWindow.Show();
            }

            SetSelect(tsbOrder, tsmiOrder);
            orderWindow.Activate();
        }
Esempio n. 13
0
        private void DepthCtrl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 2)
            {
                var connector = Connector;

                var quote = DepthCtrl.SelectedQuote;

                var wnd = new OrderWindow
                {
                    Order = new Order
                    {
                        Price     = quote?.Price ?? 0,
                        Security  = Security,
                        Portfolio = connector.Portfolios.FirstOrDefault(),
                    },
                }.Init(connector);

                if (wnd.ShowModal(this))
                {
                    connector.RegisterOrder(wnd.Order);
                }
            }
        }
Esempio n. 14
0
 private void OpenOrderWindow()
 {
     _orderWindowViewModel = new OrderWindowViewModel();
     _orderWindow          = new OrderWindow(_orderWindowViewModel);
     _orderWindow.Show();
 }
Esempio n. 15
0
        private void miOrder_Click(object sender, RoutedEventArgs e)
        {
            OrderWindow window = new OrderWindow();

            window.Show();
        }
Esempio n. 16
0
        /// <summary>
        /// SELECT * FROM `order` O, `driver` D, `destination` DD, `destination` DDD, `truck` T WHERE O.driver_id=D.id AND O.start_destination_id=DD.id AND O.end_destination_id=DDD.id AND O.truck_id=T.id
        /// </summary>
        /// <param name="mw"></param>
        public static async void loadTripDB(MainWindow mw, OrderWindow ow, long order_no)
        {
            try
            {
                var client = new HttpClient();

                var pairs = new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("trip", Encryption.encrypt("acbatripacba")),
                    new KeyValuePair <string, string>("user_id", mw.user_id.ToString()),
                    new KeyValuePair <string, string>("order_number", order_no.ToString()),
                    new KeyValuePair <string, string>("company_name", "ftntransport")// Company.Name)
                };

                var content = new FormUrlEncodedContent(pairs);

                HttpResponseMessage response = await client.PostAsync("http://www.acbasoftware.com/ftntransport/trip.php", content);

                response.EnsureSuccessStatusCode();
                if (response.IsSuccessStatusCode)
                {
                    string json = await response.Content.ReadAsStringAsync();

                    // MessageBox.Show(json);
                    JArray a = JArray.Parse(json);
                    for (int i = 0; i < a.Count; ++i)
                    {
                        var  item          = (JObject)a[i];
                        long order_number  = long.Parse(item.GetValue("order_number").ToString());
                        long driver_id     = long.Parse(item.GetValue("driver_id").ToString());
                        long start_dest_id = long.Parse(item.GetValue("start_destination_id").ToString());
                        long end_dest_id   = long.Parse(item.GetValue("end_destination_id").ToString());

                        DateTime pickup_datetime = DateTime.Parse(item.GetValue("pickup_datetime").ToString());

                        string isshipped = item.GetValue("start_datetime").ToString();

                        DateTime?shipped = null;
                        if (isshipped != null && isshipped.Length > 0 && !isshipped.Contains("0000-00-00 00:00:00"))
                        {
                            shipped = DateTime.Parse(isshipped);//, "yyyy-MM-dd HH:mm:ss", CultureInfo.CreateSpecificCulture("en-US"));
                        }
                        //out for delivery
                        string delivered_date = item.GetValue("end_datetime").ToString();

                        DateTime?delivered = null;
                        if (delivered_date != null && delivered_date.Length > 0 && !delivered_date.Contains("0000-00-00 00:00:00"))
                        {
                            delivered = DateTime.Parse(delivered_date);//, "yyyy-MM-dd HH:mm:ss", CultureInfo.CreateSpecificCulture("en-US"));
                        }
                        decimal comm         = decimal.Parse(item.GetValue("driver_commission").ToString());
                        long    truck_id     = long.Parse(item.GetValue("truck_id").ToString());
                        string  status       = item.GetValue("status").ToString();
                        string  cargo        = item.GetValue("cargo").ToString();
                        string  pickup_sku   = (item.GetValue("pickup_sku").ToString());
                        string  delivery_sku = (item.GetValue("delivery_sku").ToString());

                        Trip t = new Trip(mw, order_number, mw.user_id, start_dest_id, end_dest_id, pickup_datetime, shipped, delivered, driver_id, comm, truck_id, cargo, status, delivery_sku, pickup_sku);
                        //MessageBox.Show(o.container);


                        ow.listView_leg.Items.Add(t);
                    }
                    //loadTripDB(mw);
                }///////response from server was good
            }
            catch (Exception eee)
            {
                Console.WriteLine("HEREEEEEEEEE:: " + eee.ToString());
                Error();
            }
        }
Esempio n. 17
0
 private void Start()
 {
     _customerSelect = LevelManager.Instance.CustomerSelectSwiper;
     _orderWindow    = LevelManager.Instance.OrderWindow;
 }
Esempio n. 18
0
        private void OrderButton_Click(object sender, RoutedEventArgs e)
        {
            OrderWindow ow = new OrderWindow();

            ow.Show();
        }
Esempio n. 19
0
 protected override void Awake()
 {
     base.Awake();
     _orderWindow = GetComponent <OrderWindow>();
 }
Esempio n. 20
0
        /// <summary>
        /// Создать <see cref="OrdersPanel"/>.
        /// </summary>
        public OrdersPanel()
        {
            InitializeComponent();

            Security  prevSecurity  = null;
            Portfolio prevPortfolio = null;
            var       prevType      = OrderTypes.Limit;

            Func <OrderTypes, Order> createOrder = type => new Order
            {
                Type      = type,
                Security  = prevSecurity,
                Portfolio = prevPortfolio,
            };

            OrderGrid.OrderRegistering += () =>
            {
                var wnd = new OrderWindow
                {
                    SecurityProvider   = ConfigManager.GetService <ISecurityProvider>(),
                    MarketDataProvider = ConfigManager.GetService <IMarketDataProvider>(),
                    Order      = createOrder(prevType),
                    Portfolios = ConfigManager.GetService <PortfolioDataSource>()
                };

                if (!wnd.ShowModal(this))
                {
                    return;
                }

                var order = wnd.Order;

                prevType      = order.Type;
                prevSecurity  = order.Security;
                prevPortfolio = order.Portfolio;

                new RegisterOrderCommand(order).Process(this);
            };
            OrderGrid.OrderReRegistering += order =>
            {
                var window = new OrderWindow
                {
                    Title = LocalizedStrings.Str2976Params.Put(order.TransactionId),
                    Order = order.ReRegisterClone(newVolume: order.Balance),
                };

                if (window.ShowModal(this))
                {
                    new ReRegisterOrderCommand(order, window.Order).Process(this);
                }
            };
            OrderGrid.OrderCanceling   += orders => new CancelOrderCommand(orders).Process(this);
            OrderGrid.SelectionChanged += (s, e) => new SelectCommand <Order>(OrderGrid.SelectedOrder, false).Process(this);
            OrderGrid.PropertyChanged  += (s, e) => new ControlChangedCommand(this).Process(this);

            GotFocus += (s, e) => new SelectCommand <Order>(OrderGrid.SelectedOrder, false).Process(this);

            var cmdSvc = ConfigManager.GetService <IStudioCommandService>();

            cmdSvc.Register <ResetedCommand>(this, false, cmd => OrderGrid.Orders.Clear());
            cmdSvc.Register <OrderCommand>(this, false, cmd =>
            {
                if (cmd.Action == OrderActions.Registering && cmd.Order.Type != OrderTypes.Conditional)
                {
                    OrderGrid.Orders.Add(cmd.Order);
                }
            });
            cmdSvc.Register <ReRegisterOrderCommand>(this, false, cmd => OrderGrid.Orders.Add(cmd.NewOrder));
            cmdSvc.Register <OrderFailCommand>(this, false, cmd =>
            {
                if (cmd.Action == OrderActions.Registering)
                {
                    OrderGrid.AddRegistrationFail(cmd.Fail);
                }
            });
            cmdSvc.Register <BindStrategyCommand>(this, false, cmd =>
            {
                prevSecurity  = cmd.Source.Security;
                prevPortfolio = cmd.Source.Portfolio;
            });

            WhenLoaded(() => new RequestBindSource(this).SyncProcess(this));
        }
Esempio n. 21
0
        public static void OpenOrderWindow(object sender, RoutedEventArgs e, ObservableCollection <ItemModel> items)
        {
            OrderWindow window = new OrderWindow(items);

            createAndShow(sender, window);
        }