Example #1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     _typesPay.Content   = typesPay.Name;
     tbS.Text            = ClassBond.residue().ToString();
     this.numPad.textBox = tbS;
     this.numPad.bEnter  = xEnter;
     if (this.Owner is MainWindow)
     {
         (this.Owner as MainWindow).qty_label.Text = "__";
     }
 }
Example #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            TypePay = this.Owner as W_TypePay;

            cb.ItemsSource = ClassSync.TypesPayDB.t;

            string name = sub + "_" + this.xName.Content + "x" + this.yName.Content;

            b = (Button)(TypePay.FindName(name));

            if (b != null)
            {
                int indx = -1;

                if (int.TryParse(b.ToolTip == null ? "-1" : b.ToolTip.ToString().Replace("TypesPay", ""), out indx))
                {
                    cb.SelectedItem = ClassBond.getTypesPayDBFromId(indx);
                }
            }
        }
Example #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            gridLoad("m", ClassGridGroup.gridCurrencyPath_get_path(typesPay));
            foreach (Button bs in ClassETC_fun.FindVisualChildren <Button>(this))
            {
                bs.Click += Button_Click;
            }

            if (this.Owner is MainWindow)
            {
                List <ClassBond.count_Currency> cc = ClassBond.transform(new ClassFunctuon().getMoney((this.Owner as MainWindow).qty_label), this.typesPay);

                foreach (var h in cc)
                {
                    new ClassFunctuon().add_Currency(h.currency, h.count, this);
                }



                (this.Owner as MainWindow).qty_label.Text = "__";
            }
        }
Example #4
0
        public void setSelected(GroupBox grpBox, string textSelector)
        {
            bool flgrbt = false;
            //    Grid grd = (Grid)grpBox.Content;
            UIElementCollection uiec = panelA.Children;

            foreach (UIElement uelement in uiec)
            {
                if (typeof(RadioButton) == uelement.GetType())
                {
                    RadioButton rbtn = (RadioButton)uelement;
                    rbtn.IsChecked = false;
                    if (rbtn.Content.ToString() == textSelector)
                    {
                        rbtn.IsChecked = true;
                        flgrbt         = true;
                    }
                }
            }
            uiec = panelB.Children;

            foreach (UIElement uelement in uiec)
            {
                if (typeof(RadioButton) == uelement.GetType())
                {
                    RadioButton rbtn = (RadioButton)uelement;
                    rbtn.IsChecked = false;
                    if (rbtn.Content.ToString() == textSelector)
                    {
                        rbtn.IsChecked = true;
                        flgrbt         = true;
                    }
                }
            }
            if ((!flgrbt) && (textSelector.Substring(0, textSelector.Length > 15 ? 15 : 0) == "_TypesPayDynamic"))
            {
                int indx = -1;
                if (int.TryParse(textSelector == null ? "-1" : textSelector.Replace("_TypesPayDynamic", ""), out indx))
                {
                    cb.SelectedItem = ClassBond.getTypesPayDBFromId(indx);
                }
            }

            if ((!flgrbt) && (textSelector.Substring(0, textSelector.Length > 13 ? 13 : 0) == "Products id=["))
            {
                string sd = textSelector.Substring(textSelector.IndexOf("[") + 1, textSelector.IndexOf("]") - textSelector.IndexOf("[") - 1);

                Guid g = Guid.Parse(sd);

                List <Class.ClassProducts.product> lp = Class.ClassProducts.listProducts.FindAll(l => l.CustumerId == g);

                switch (lp.Count)
                {
                case 0: statusMes.Content = ("С таким именем продукт не найден "); this.xtbc.SelectedIndex = 3; _expander.IsExpanded = true; break;

                case 1: statusMes.Content = (""); xDescription.Text = lp[0].Name; break;

                default:
                    Class.ClassProducts.product pe = list.SelectedItem as Class.ClassProducts.product;
                    if (pe == null)
                    {
                        this.xtbc.SelectedIndex = 3;
                        _expander.IsExpanded    = true;
                    }

                    //    else

                    xDescription.Text = lp[0].Name;

                    break;
                }
            }
        }
Example #5
0
        public void keyReturn()
        {
            string barcode = xProduct.Text.TrimEnd().TrimStart().Trim();

            if (barcode.Length > 0)
            {
                //1234-1234-1234-1234
                //01-12-08-09-30-45-00-22-16-00
                int count__ = barcode.Split('-').Length;

                lrendu.Content = "Rendu: " + ClassBond.residue().ToString("0.00") + " €";

                if (count__ != 4)
                {
                    XElement xP  = null;
                    decimal  qty = 1;
                    try
                    {
                        xP = ClassProducts.findCodeBar(barcode);

                        string cb = xP.Element("CodeBare").Value;


                        string[] cbm = cb.Split('[');

                        foreach (var s in cbm)
                        {
                            int indx = s.IndexOf(barcode + "]");

                            if (indx != -1)
                            {
                                string sqty = s.Replace(barcode + "]", "").Replace("^", "");

                                if (sqty.Length > 0)
                                {
                                    qty = decimal.Parse(sqty);
                                }
                            }
                        }
                    }

                    catch (Exception ex)
                    {
                        new ClassLog("  code 0002 barcode :" + barcode + " " + ex.Message);
                    }
                    if (xP != null)
                    {
                        try
                        {
                            ClassCheck.addProductCheck(xP, qty != 1 ? qty : new ClassFunctuon().getQTY(qty_label));
                            xProduct.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 255, 0));
                            xProduct.Text       = "";
                        }
                        catch (Exception ex)
                        {
                            new ClassLog("  code 0003 barcode :" + barcode + " " + ex.Message);
                        }
                    }
                    else
                    {
                        if (count__ == 10)
                        {
                            int    cent = int.Parse(barcode.Substring(barcode.Length - 2, 2));
                            string sd   = barcode.Substring(barcode.Length - 11, 8).Replace("-", "");
                            int    euro = int.Parse(sd);

                            decimal m = ((decimal)(euro * 100 + cent)) / 100;

                            //   new ClassFunctuon().showMessageTime(m.ToString());

                            qty_label.Text = m.ToString();
                        }
                        else
                        {
                            if (barcode.Length == 13)
                            {
                                xP = Class.ClassProducts.findCodeBar(barcode.Substring(0, 7));

                                if (xP != null)
                                {
                                    decimal qty_ = decimal.Parse(barcode.Substring(7, 5)) / 1000;

                                    ClassCheck.addProductCheck(xP, qty_);
                                    xProduct.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 255, 0));
                                    xProduct.Text       = "";
                                }
                            }

                            if (xP == null && barcode.Length == 13)
                            {
                                //  2386999903842
                                xP = Class.ClassProducts.findCodeBar(barcode.Substring(0, 8));

                                if (xP != null)
                                {
                                    decimal qty_ = decimal.Parse(barcode.Substring(8, 4)) / 1000;

                                    ClassCheck.addProductCheck(xP, qty_);
                                    xProduct.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 255, 0));
                                    xProduct.Text       = "";
                                }
                            }

                            if (xP == null)
                            {
                                try
                                {
                                    xProduct.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 0, 0));
                                    xProduct.Text       = "";
                                    ClassETC_fun.wm_sound(@"Data\Computer_Error.wav");
                                    //  new ClassFunctuon().showMessage("Add Product", "Cet article n'existe pas! Ajouter un article?");

                                    new ClassFunctuon().showMessageSB("Cet article n'existe pas! Ajouter un article?");
                                }
                                catch (Exception ex)
                                {
                                    new ClassLog("  code 0004 barcode :" + barcode + " " + ex.Message);
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (ClassDiscounts.client.barcode == barcode)
                    {
                        ClassDiscounts.restoreDiscount();
                    }
                    else
                    {
                        ClassDiscounts.getDiscount(barcode);

                        ClassDiscounts.getInfClt(ClassDiscounts.client.InfoClients_customerId);
                    }

                    xProduct.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 255, 0));

                    xProduct.Text = "";
                }
            }
        }