Example #1
0
        private void Ent_Closed(object sender, EventArgs e)
        {
            bool ok = true;

            if ((sender as EnterCartBarcodeWindow).barcode.Length < 13)
            {
                wind.IsEnabled = true;
                return;
            }

            foreach (CartBarcodeBorder cbb in Children.OfType <CartBarcodeBorder>())
            {
                if (cbb.Barcode == (sender as EnterCartBarcodeWindow).barcode)
                {
                    ok = false;
                    break;
                }
            }

            if (ok)
            {
                wind.IsEnabled = true;
                AddCart((sender as EnterCartBarcodeWindow).barcode);
            }
            else
            {
                MessageBox.Show("Такая корзина уже присутствует!");
                EnterCartBarcodeWindow ent = new EnterCartBarcodeWindow(wind, baskets_all);
                ent.Show();
                ent.Closed += Ent_Closed;
            }
        }
Example #2
0
 public void Open()
 {
     this.Show();
     if (listBox.Items.Count == 0)
     {
         EnterCartBarcodeWindow ent = new EnterCartBarcodeWindow(this);
         ent.Closed += (sen, e) =>
         {
             if (!IsEnabled)
             {
                 HideMe?.Invoke(this, new EventArgs());
             }
             else
             {
                 if (!Start())
                 {
                     HideMe?.Invoke(this, new EventArgs());
                 }
             }
         };
         ent.Show();
     }
     else
     {
         this.IsEnabled = true;
         if (!Start())
         {
             HideMe?.Invoke(this, new EventArgs());
         }
     }
 }
Example #3
0
        private void add_cart_Click(object sender, RoutedEventArgs e)
        {
            EnterCartBarcodeWindow ent = new EnterCartBarcodeWindow(this);

            ent.Show();
            ent.Closed += (se, ev) =>
            {
                IsEnabled = true;
            };
        }
Example #4
0
        public CartBarcodesWrapPanel(OrderWindow window, bool addVisible, DataTable baskets)
        {
            baskets_all = baskets;
            wind        = window;
            id          = 1;

            Grid buttonGrid = new Grid();

            buttonGrid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            buttonGrid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });

            Image plusImage = new Image()
            {
                Source = new BitmapImage(new Uri("pack://application:,,,/add.png"))
            };

            Grid.SetColumn(plusImage, 0);
            buttonGrid.Children.Add(plusImage);

            TextBlock dobavit = new TextBlock()
            {
                Text = "Добавить", VerticalAlignment = VerticalAlignment.Center
            };

            if (!addVisible)
            {
                dobavit.Visibility = Visibility.Collapsed;
            }
            Grid.SetColumn(dobavit, 1);
            buttonGrid.Children.Add(dobavit);

            Button addCart = new Button()
            {
                Content   = buttonGrid,
                Height    = 45,
                Focusable = false,
                Margin    = new Thickness(2)
            };

            addCart.Click += (se, ev) =>
            {
                EnterCartBarcodeWindow ent = new EnterCartBarcodeWindow(window, baskets_all);
                ent.Show();
                ent.Closed += Ent_Closed;
            };
            Children.Add(addCart);
        }
Example #5
0
        /// <summary>
        /// The border element associated with this order displayed on the stack panel in the main window
        /// </summary>

        /*public OrderBorder myBorder
         * {
         *  get
         *  {
         *      return my_border;
         *  }
         *  set
         *  {
         *      my_border = value;
         *      my_border.orderName = "Заказ " + orders.TableName;
         *      my_border.quantity = ItemCount;
         *  }
         * }*/

        /*public DataTable existingCarts
         * {
         *  set
         *  {
         *      foreach (DataRow s in value.Rows)
         *      {
         *          listBox.Items.Add(new TextBlock() { Text = s[1].ToString() });
         *      }
         *  }
         * }*/

        public void Open()
        {
            this.Show();
            if (listBox.Items.Count == 0)
            {
                EnterCartBarcodeWindow ent = new EnterCartBarcodeWindow(this);
                ent.Closed += (sen, e) =>
                {
                    if (!IsEnabled)
                    {
                        Close();
                    }
                    //HideMe?.Invoke(this, new EventArgs());
                    else
                    {
                        if (!Start())
                        {
                            Close();
                        }
                        //HideMe?.Invoke(this, new EventArgs());
                        else
                        {
                            (Owner as MainWindow).sqlQueriesToSend.Add("INSERT INTO "
                                                                       + "ptl_database.order_baskets (basket_barcode, order_id, comp_id) VALUES ('" + ((EnterCartBarcodeWindow)sen).barcode
                                                                       + "', " + orders.order_id + ", " + (Owner as MainWindow).myID + ");");
                        }
                    }
                };
                ent.Show();
            }
            else
            {
                this.IsEnabled = true;
                if (!Start())
                {
                    Close();
                }
                //HideMe?.Invoke(this, new EventArgs());
            }
        }
Example #6
0
        /// <summary>
        /// The border element associated with this order displayed on the stack panel in the main window
        /// </summary>

        /*public OrderBorder myBorder
         * {
         *  get
         *  {
         *      return my_border;
         *  }
         *  set
         *  {
         *      my_border = value;
         *      my_border.orderName = "Заказ " + orders.TableName;
         *      my_border.quantity = ItemCount;
         *  }
         * }*/

        /*public DataTable existingCarts
         * {
         *  set
         *  {
         *      foreach (DataRow s in value.Rows)
         *      {
         *          listBox.Items.Add(new TextBlock() { Text = s[1].ToString() });
         *      }
         *  }
         * }*/

        public void Open()
        {
            this.Show();

            if (Convert.ToInt32(orders.Rows[0]["zone_dest"]) == -1)
            {
                if (Convert.ToInt32(orders.Rows[0]["Palletized"]) == 0)
                {
                    if ((mainGrid.Child as CartBarcodesWrapPanel).Children.Count == 1)
                    {
                        EnterCartBarcodeWindow ent = new EnterCartBarcodeWindow(this, baskets);
                        ent.Closed += (sen, e) =>
                        {
                            if (!IsEnabled)
                            {
                                Close();
                            }
                            //HideMe?.Invoke(this, new EventArgs());
                            else
                            {
                                if (!Start())
                                {
                                    Close();
                                }
                                //HideMe?.Invoke(this, new EventArgs());
                                else
                                {
                                    (mainGrid.Child as CartBarcodesWrapPanel).AddCart((sen as EnterCartBarcodeWindow).barcode);         // тут происходит добавление корзины по ее штрих-коду (barcode)

                                    //(Owner as MainWindow).sqlQueriesToSend.Add("INSERT INTO "
                                    //  + "ptl_database.order_baskets (basket_barcode, order_id, comp_id) VALUES ('" + ((EnterCartBarcodeWindow)sen).barcode
                                    //+ "', " + orders.order_id + ", " + (Owner as MainWindow).myID + ");");
                                }
                            }
                        };

                        ent.Show();
                    }
                    else
                    {
                        this.IsEnabled = true;
                        if (!Start())
                        {
                            Close();
                        }
                        //HideMe?.Invoke(this, new EventArgs());
                    }
                }
                else
                {
                    {
                        if (!IsEnabled)
                        {
                            Close();
                        }

                        else
                        {
                            if (!Start())
                            {
                                Close();
                            }
                        }
                    };
                }
            }
            else
            {
                if ((mainGrid.Child as CartBarcodesWrapPanel).Children.Count == 1)
                {
                    EnterCartBarcodeWindow ent = new EnterCartBarcodeWindow(this, baskets);
                    ent.Closed += (sen, e) =>
                    {
                        if (!IsEnabled)
                        {
                            Close();
                        }
                        //HideMe?.Invoke(this, new EventArgs());
                        else
                        {
                            if (!Start())
                            {
                                Close();
                            }
                            //HideMe?.Invoke(this, new EventArgs());
                            else
                            {
                                (mainGrid.Child as CartBarcodesWrapPanel).AddCart((sen as EnterCartBarcodeWindow).barcode);         // тут происходит добавление корзины по ее штрих-коду (barcode)

                                //(Owner as MainWindow).sqlQueriesToSend.Add("INSERT INTO "
                                //  + "ptl_database.order_baskets (basket_barcode, order_id, comp_id) VALUES ('" + ((EnterCartBarcodeWindow)sen).barcode
                                //+ "', " + orders.order_id + ", " + (Owner as MainWindow).myID + ");");
                            }
                        }
                    };

                    ent.Show();
                }
                else
                {
                    this.IsEnabled = true;
                    if (!Start())
                    {
                        Close();
                    }
                    //HideMe?.Invoke(this, new EventArgs());
                }
            }
        }