Exemple #1
0
        private static ProductType GetBallance(ProductType product)
        {
            ClassBallanceMAGELLAN_8400.Send(product.Price, product.Tare);

            try
            {
                var prix = ClassBallanceMAGELLAN_8400.Prix.ToDecimal() / 100;
                var qty  = ClassBallanceMAGELLAN_8400.Poinds.ToDecimal() / 1000;

                if (qty > 0)
                {
                    product.Contenance = qty;
                    product.Qty        = qty;
                    product.Price      = prix;
                }
            }
            catch (System.Exception e)
            {
                LogService.Log(TraceLevel.Error, 21, "Error ballance =" + ClassBallanceMAGELLAN_8400.Error + e.Message + ".");
                product = null;
            }

            if (ClassBallanceMAGELLAN_8400.Busy_0X15 || ClassBallanceMAGELLAN_8400.Error_0X15)
            {
                product = null;
            }
            return(product);
        }
Exemple #2
0
        private void GetBallance()
        {
            var f = false;

            if (_product.Price == 0.0m)
            {
                _product.Price = 1;
                f = true;
            }
            ClassBallanceMAGELLAN_8400.Send(_product.Price, _product.Tare);

            if (ClassBallanceMAGELLAN_8400.Busy_0X15)
            {
                FunctionsService.ShowMessageTime("Pour résoudre ce problème, il vous suffit de re-peser l'article");
            }
            if (ClassBallanceMAGELLAN_8400.Error_0X15)
            {
                FunctionsService.ShowMessageTime("Pour résoudre ce problème, il vous suffit de redémarrer la balance!");
            }

            var prix = 0.0m;

            try
            {
                prix = decimal.Parse(ClassBallanceMAGELLAN_8400.Prix) / 100;
                _qty = decimal.Parse(ClassBallanceMAGELLAN_8400.Poinds) / 1000;
                xBallance_kg.Text = _qty.ToString();
                xPrix_kg.Content  = prix.ToString();
            }
            catch (System.Exception e)
            {
                xBallance_kg.Text = "0";
                xPrix_kg.Content  = "0";

                LogService.Log(TraceLevel.Error, 22, "Error ballance.");
                xLog.Content = e.Message + Environment.NewLine;
            }
            xLog.Content += ClassBallanceMAGELLAN_8400.Error;
            try
            {
                if (!f)
                {
                    xTotal_kg.Content = (Math.Round(decimal.Parse(ClassBallanceMAGELLAN_8400.Montant) / 100, 2));
                }
                else
                {
                    xTotal_kg.Content = "0.0";
                }
            }
            catch
            {
                xTotal_kg.Content = "0";
            }
            if (_qty > 0)
            {
                _product.Contenance = _qty;
                _product.Price      = prix;
            }
        }
Exemple #3
0
        private void MainWindowLoaded(object sender, RoutedEventArgs e)
        {
            lnm.Content = Config.Name;
            lnt.Content = Config.NameTicket;
            lnu.Content = Config.User;

            if (Config.IsUseServer)
            {
                _dispatcherTimer          = new DispatcherTimer();
                _dispatcherTimer.Tick    += DispatcherTimerTick;
                _dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1, 0);
                _dispatcherTimer.Start();
            }

            ClassBallanceMAGELLAN_8400.Opn();
            //Windows 8 API to enable touch keyboard to monitor for focus tracking in this WPF application
            try
            {
                var cp  = new InputPanelConfiguration();
                var icp = cp as IInputPanelConfiguration;
                if (icp != null)
                {
                    icp.EnableFocusTracking();
                }
            }
            catch
            {
                // ignored
            }

            foreach (var bs in ClassEtcFun.FindVisualChildren <Button>(this))
            {
                bs.Click += ButtonClick;
            }

            xProduct.Focus();
            ClassCustomerDisplay.Hi();

            status_message.Text += Environment.NewLine + "--------------------------------" + Environment.NewLine +
                                   "Caisse : " + Config.NameTicket + Environment.NewLine +
                                   "Post : " + Config.NumberTicket + Environment.NewLine +
                                   "Nom d'usager : " + Config.User + Environment.NewLine + Environment.NewLine +
                                   "--------------------------------" + Environment.NewLine +
                                   "La clé d'ouverture générale : " + GlobalVar.TicketWindowG + Environment.NewLine +
                                   "La clé d'ouverture local : " + GlobalVar.TicketWindow + Environment.NewLine;

            foreach (var gs in ClassEtcFun.FindVisualChildren <GridSplitter>(this))
            {
                gs.IsEnabled = Config.GridModif;
            }
        }
Exemple #4
0
 private void WindowClosing(object sender, CancelEventArgs e)
 {
     ClassBallanceMAGELLAN_8400.Close();
     Application.Current.Shutdown();
 }