Пример #1
0
        private void setQTY(int c)
        {
            if (_ProductsGrid.SelectedItem != null)
            {
                var elm = (XElement)_ProductsGrid.SelectedItem;

                //   ClassProducts.updQTYProduct(c,elm, tbcb.IsChecked?? false);

                int indx = shelfProducts.FindIndex(l => l == elm);

                if (indx == -1)
                {
                    shelfProducts.Insert(0, elm);

                    ClassProducts.updQTYProduct(c, elm, tbcb.IsChecked ?? false, typefind);
                }
                else
                {
                    ClassProducts.updQTYProduct(c, elm, tbcb.IsChecked ?? false, typefind);

                    shelfProducts.Remove(elm);

                    shelfProducts.Insert(0, elm);
                }
            }
            calcTotal();
        }
Пример #2
0
        private void mod(string number)
        {
            XElement elm = (XElement)_ProductsGrid.SelectedItem;

            if (elm != null)
            {
                string s = (tbcb.IsChecked ?? false ? elm.Element("QTY_box").Value : elm.Element("QTY").Value).Replace('.', ',');

                decimal a = 0.0m;

                decimal.TryParse(s, out a);

                decimal c = 0.0m;

                if (!comma)
                {
                    if (s.IndexOf(',') != -1)
                    {
                        string[] comma_ = s.Split(',');

                        comma_[0] += number;

                        decimal.TryParse(comma_[0] + "," + comma_[1], out c);
                    }

                    else
                    {
                        decimal.TryParse(s + number, out c);
                    }

                    //   ClassProducts.updQTYProduct(c - a, elm, tbcb.IsChecked ?? false);
                }

                else
                {
                    if (s.IndexOf(',') == -1)
                    {
                        s += ",";
                    }

                    string[] comma_ = s.Split(',');

                    comma_[1] += number;

                    decimal.TryParse(comma_[0] + "," + comma_[1], out c);
                }

                ClassProducts.updQTYProduct(c - a, elm, tbcb.IsChecked ?? false, typefind);

                _ProductsGrid.Items.Refresh();

                calcTotal();
            }
        }
Пример #3
0
        private void modeStandart(KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                string item = text.Text.TrimEnd().TrimStart().ToUpper();

                long digital;

                bool f = long.TryParse(item, out digital);

                text.Text = "";
                if (f)
                {
                    XElement elm = find(item);

                    if (elm == null)
                    {
                        var w = new B.messageDlgTime();

                        w.message.Text = "not found";



                        w.Show();

                        _ProductsGrid.Items.Refresh();
                    }
                    else
                    {
                        int indx = shelfProducts.FindIndex(l => l == elm);

                        string qtys = qty_label.Text.Replace(" box ", "").Replace(" pièces ", "").Replace('_', ' ').Replace('.', ',').Trim();

                        qty_label.Text = "__";

                        decimal qty_ = 0.0m;

                        decimal.TryParse(qtys == "0,0" || qtys == string.Empty ? "1,00" : qtys, out qty_);

                        if (indx == -1)
                        {
                            shelfProducts.Insert(0, elm);

                            ClassProducts.updQTYProduct(qty_, elm, tbcb.IsChecked ?? false, typefind);
                        }
                        else
                        {
                            ClassProducts.updQTYProduct(qty_, elm, tbcb.IsChecked ?? false, typefind);

                            shelfProducts.Remove(elm);

                            shelfProducts.Insert(0, elm);
                        }


                        _ProductsGrid.SelectedItem = elm;



                        _ProductsGrid.Items.Refresh();


                        _ProductsGrid.ScrollIntoView(_ProductsGrid.SelectedItem);

                        ClassF.wm_sound(@"Data\Beep.wav");

                        //   tbcb.IsChecked = true;

                        calcTotal();
                    }
                }
            }
        }