Ejemplo n.º 1
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            var deferral = taskInstance.GetDeferral();

            Debug.WriteLine("ClearPayment started");
            ExecutingPlatform.Current = AppPlatform.UWP;

            var settingsFacade = new SettingsFacade(new SettingsAdapter());

            try
            {
                var context = EfCoreContextFactory.Create();
                await new ClearPaymentAction(new ClearPaymentDbAccess(context))
                .ClearPayments();
                await context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                Debug.Write(ex);
                Debug.WriteLine("ClearPaymentTask stopped due to an error.");
            } finally
            {
                settingsFacade.LastExecutionTimeStampClearPayments = DateTime.Now;
                Debug.WriteLine("ClearPaymentTask finished.");
                deferral.Complete();
            }
        }
Ejemplo n.º 2
0
        private async Task ClearPaymentsAsync(JobParameters args)
        {
            var settingsManager = new SettingsFacade(new SettingsAdapter());

            try
            {
                ExecutingPlatform.Current = AppPlatform.Android;

                EfCoreContext context = EfCoreContextFactory.Create();
                await new ClearPaymentAction(new ClearPaymentDbAccess(context)).ClearPaymentsAsync();
                await context.SaveChangesAsync();

                JobFinished(args, false);
            }
            catch (Exception ex)
            {
                LogManager.GetCurrentClassLogger().Fatal(ex);

                throw;
            }
            finally
            {
                settingsManager.LastExecutionTimeStampClearPayments = DateTime.Now;
            }
        }
Ejemplo n.º 3
0
        private static async Task ClearPayments()
        {
            var settingsFacade = new SettingsFacade(new SettingsAdapter());

            try
            {
                Debug.WriteLine("ClearPayments Job started");

                var context = EfCoreContextFactory.Create();
                await new ClearPaymentAction(new ClearPaymentDbAccess(context)).ClearPayments();
                context.SaveChanges();

                Debug.WriteLine("ClearPayments Job finished.");
            } catch (Exception ex)
            {
                Crashes.TrackError(ex);
            } finally
            {
                settingsFacade.LastExecutionTimeStampClearPayments = DateTime.Now;
            }
        }