コード例 #1
0
        public static void delProductCheck(string barcode)
        {
            int si = (ClassETC_fun.findWindow("MainWindow_") as MainWindow).dataGrid1.SelectedIndex;
            IEnumerable <XElement> elm = b.Element("check").Elements("product").
                                         Where(l => l.Element("barcode").Value.Replace(" ", "") == barcode.Replace(" ", ""));

            if (elm.Count() > 0)
            {
                decimal d = decimal.Parse(elm.First().Element("qty").Value);

                if ((ClassProducts.listProducts.Find(l => l.CustumerId == Guid.Parse(elm.First().Element("id").Value)).balance) || (d == 0))
                {
                    elm.First().Remove();
                }
                else
                {
                    elm.First().Element("qty").Value = (d - 1).ToString();
                }
            }
            else
            {
                ClassDiscounts.restoreDiscount();
            }
            new ClassFunctuon().writeToatl(si);
            b.Save(path_b);
        }
コード例 #2
0
        public static void move(bool devis)
        {
            new ClassFunctuon().showMessage(null, " please  waite....");

            var mw = ClassETC_fun.findWindow("MainWindow_");

            if (mw != null)
            {
                mw.IsEnabled = false;
            }
            worker = new System.ComponentModel.BackgroundWorker();

            if (devis)
            {
                worker.DoWork             += new System.ComponentModel.DoWorkEventHandler(worker_DoWorkDevis);
                worker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
            }
            else
            {
                worker.DoWork             += new System.ComponentModel.DoWorkEventHandler(worker_DoWorkFact);
                worker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
            }

            worker.RunWorkerAsync();
        }
コード例 #3
0
        public static void delProductCheck(int id)
        {
            c = null;
            int si = (ClassETC_fun.findWindow("MainWindow_") as MainWindow).dataGrid1.SelectedIndex;
            IEnumerable <XElement> elms = b.Element("check").Elements("product");
            XElement elm = elms.
                           Where(l => int.Parse(l.Element("ii").Value) == id).FirstOrDefault();

            if (elm != null)
            {
                elm.Remove();
            }
            if (elms.Count() == 0)
            {
                ClassDiscounts.restoreDiscount();
            }
            new ClassFunctuon().writeToatl(si);
            b.Save(path_b);
        }
コード例 #4
0
        private static void worker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            ClassSync.sync = false;

            new ClassPrintCheck(ClassCheck.b, false);

            ClassCheck.b = null;

            ClassCheck.openProductsCheck();

            pro = null;

            ndevis = -1;

            nfact = -1;

            ClassProMode.check = null;

            ClassProMode.devis = false;

            ClassProMode.modePro = false;

            ClassDiscounts.restoreDiscount();

            var de = ClassETC_fun.findWindow("_W_Message");

            if (de != null)
            {
                de.Close();
            }

            var mw = ClassETC_fun.findWindow("MainWindow_");

            if (mw != null)
            {
                mw.IsEnabled = true;
            }
        }