Exemplo n.º 1
0
        public void SendOldReceipt()
        {
            var Ldc   = db.GetConfig <DateTime>("LastDaySend");
            var today = DateTime.Now.Date;

            if (Ldc == default(DateTime))
            {
                Ldc = today.AddDays(-10);
            }

            while (Ldc < today)
            {
                var ldb = new WDB_SQLite(Ldc);
                var t   = SendAllReceipt(ldb);
                t.Wait();
                var res = ldb.GetIdReceiptbyState(eStateReceipt.Print);
                if (res.Count() == 0)
                {
                    db.SetConfig <DateTime>("LastDaySend", Ldc);
                }
                else
                {
                    Global.OnSyncInfoCollected?.Invoke(new SyncInformation {
                        Status = eSyncStatus.NoFatalError, StatusDescription = $"SendOldReceipt => ErrorSend Date:{Ldc} Not Send => {res.Count()}"
                    });
                    return;
                }
                Ldc = Ldc.AddDays(1);
            }
            //Перекидаємо лічильник на сьогодня.
            db.SetConfig <DateTime>("LastDaySend", Ldc);
        }