public Task Execute(IJobExecutionContext context)
        {
            Console.WriteLine($"Running the {context.JobDetail.Description}");

            using var dmlTransaction = CashSchedulerContext.Database.BeginTransaction();
            try
            {
                var updatedWallets = GetUpdatedWallets(GetTodayTransactions());

                CashSchedulerContext.Wallets.UpdateRange(updatedWallets);
                CashSchedulerContext.SaveChanges();

                dmlTransaction.Commit();
                SalesforceService.UpsertSObjects(updatedWallets.Select(w => new SfWallet(w, w.Id)).ToList <SfObject>());

                Console.WriteLine($"{updatedWallets.Count} wallets were updated");
            }
            catch (Exception error)
            {
                dmlTransaction.Rollback();
                Console.WriteLine($"Error while running the {context.JobDetail.Description}: {error.Message}: \n{error.StackTrace}");
            }

            return(Task.CompletedTask);
        }
 public UserRepository(CashSchedulerContext context)
 {
     Context = context;
 }
Exemplo n.º 3
0
 public WalletRepository(CashSchedulerContext context, IUserContext userContext)
 {
     Context = context;
     UserId  = userContext.GetUserId();
 }
 public RecurringTransactionsJob(CashSchedulerContext cashSchedulerContext, IServiceProvider serviceProvider)
 {
     CashSchedulerContext = cashSchedulerContext;
     NotificationService  = serviceProvider.GetService <IUserNotificationService>();
     SalesforceService    = serviceProvider.GetService <ISalesforceApiWebService>();
 }
 public RegularTransactionRepository(CashSchedulerContext context, IUserContext userContext)
 {
     Context = context;
     UserId  = userContext.GetUserId();
 }
Exemplo n.º 6
0
 public UserSettingRepository(CashSchedulerContext context, IUserContext userContext)
 {
     Context = context;
     UserId  = userContext.GetUserId();
 }
 public CurrencyExchangeRateRepository(CashSchedulerContext context, IUserContext userContext)
 {
     Context = context;
     UserId  = userContext.GetUserId();
 }
 public UserNotificationRepository(CashSchedulerContext context, IUserContext userContext)
 {
     Context = context;
     UserId  = userContext.GetUserId();
 }
 public UserEmailVerificationCodeRepository(CashSchedulerContext context)
 {
     Context = context;
 }
Exemplo n.º 10
0
 public LanguageRepository(CashSchedulerContext context)
 {
     Context = context;
 }
 public CurrencyRepository(CashSchedulerContext context)
 {
     Context = context;
 }
 public SettingRepository(CashSchedulerContext context)
 {
     Context = context;
 }
Exemplo n.º 13
0
 public TransactionTypeRepository(CashSchedulerContext context)
 {
     Context = context;
 }