Exemple #1
0
        public static void SaveToDb(string path, XDocument document)
        {
            var fileName = Path.GetFileName(path);

            if (SyncData.IsConnect)
            {
                var worker = new BackgroundWorker();
                worker.DoWork +=
                    (s, e) =>
                {
                    SyncData.SetSunc(true);
                    var xmlFile = GetFromDb(fileName, Config.User);

                    if (xmlFile == null)
                    {
                        InsertToDb(new XmlFile(Guid.NewGuid(), fileName, DateTime.Now, true, Config.User,
                                               document.ToString(), Config.IdEstablishment));
                    }
                    else
                    {
                        xmlFile.Upd      = true;
                        xmlFile.FileName = fileName;
                        xmlFile.Date     = DateTime.Now;
                        xmlFile.Data     = document.ToString();
                        UpdateFromDb(xmlFile);
                    }
                };
                worker.RunWorkerCompleted += (s, e) => SyncData.SetSunc(false);
                worker.RunWorkerAsync();
            }
        }
Exemple #2
0
        private static void WorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            SyncData.SetSunc(false);
            new ClassPrintCheck(RepositoryCheck.DocumentProductCheck, false);
            RepositoryCheck.DocumentProductCheck = null;
            CassieService.OpenProductsCheck();
            Pro     = null;
            Ndevis  = -1;
            Nfact   = -1;
            Check   = null;
            Devis   = false;
            ModePro = false;

            RepositoryDiscount.RestoreDiscount();
            CheckService.DiscountCalc();
            FunctionsService.WriteTotal();

            var de = ClassEtcFun.FindWindow("_W_Message");

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

            var mw = ClassEtcFun.FindWindow("MainWindow_");

            if (mw != null)
            {
                mw.IsEnabled = true;
            }
        }
Exemple #3
0
 private static void WorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     SyncData.SetSunc(false);
     TmpPoints  = 0;
     TmpBarcode = null;
 }
Exemple #4
0
 private static void WorkerDoWork(object sender, DoWorkEventArgs e)
 {
     SyncData.SetSunc(true);
     CassieService.RemoveProductCountFromStockReal(RepositoryCheck.GetCloseTicketTmp());
 }
Exemple #5
0
 private static void WorkerDoWorkDevis(object sender, DoWorkEventArgs e)
 {
     SyncData.SetSunc(true);
     XmlToDbSaveD(RepositoryCheck.DocumentProductCheck);
 }