Exemplo n.º 1
0
        public RecordTemplateDetailsView(IRecordTemplateService service, RecordTemplateModel entity, bool isNew, bool?allowSaveIfNoChanges = null)
            : base(service, entity, isNew, allowSaveIfNoChanges)
        {
            InitializeComponent();

            // load storages
            IStorageService storageService = ServiceManager.ConfigureService <StorageService>();

            _storages = storageService.GetVisible(GlobalVariables.UserId, entity.StorageId);
            comboStorage.ItemsSource = _storages;

            // load currencies
            ICurrencyService currencyService = ServiceManager.ConfigureService <CurrencyService>();

            _currencies = currencyService.GetActive(GlobalVariables.UserId, entity.CurrencyId, entity.Storage?.CurrencyId, entity.Debt?.CurrencyId);
            CurrencySelector.Currencies = _currencies;

            // load debts
            IDebtService debtService = ServiceManager.ConfigureService <DebtService>();

            _debts = debtService.GetActive(GlobalVariables.UserId, entity.DebtId);
            comboDebts.ItemsSource = _debts;

            // set currencies list
            compCurrencyExchangeRate.CurrencyIds =
                _storages.Select(_ => _.CurrencyId).Distinct().Concat(_currencies.Select(c => c.Id)).Distinct().ToList();

            // set header and commands panel context
            LabelHeader.Content       = ViewHeader;
            CommandsPanel.DataContext = Commands;
        }
Exemplo n.º 2
0
 public DebtController(IDebtService debtService,
                       ICreateCloseDebtService createCloseDebtService,
                       IAccountService accService)
 {
     _debtService            = debtService;
     _createCloseDebtService = createCloseDebtService;
     _accService             = accService;
 }
Exemplo n.º 3
0
 public DebtController(IMapper mapper, IUriService uriService, IIdentityService identityService, IBudgetService budgetService, IDebtService debtService, IDebtPaymentService debtPaymentService)
 {
     _mapper             = mapper;
     _uriService         = uriService;
     _identityService    = identityService;
     _budgetService      = budgetService;
     _debtService        = debtService;
     _debtPaymentService = debtPaymentService;
 }
Exemplo n.º 4
0
 public DebtController(ILogger <DebtController> logger,
                       IDebtService debtService,
                       IInterestTypeService interestTypeService,
                       IMapper iMapper)
 {
     _logger              = logger;
     _debtService         = debtService;
     _interestTypeService = interestTypeService;
     _iMapper             = iMapper;
 }
 public SyncController(
     ISyncService syncService,
     ICategoryService categoryService,
     IAccountService accountService,
     ITransactionService transactionService,
     IUpcomingExpenseService upcomingExpenseService,
     IDebtService debtService)
 {
     _syncService            = syncService;
     _categoryService        = categoryService;
     _accountService         = accountService;
     _transactionService     = transactionService;
     _upcomingExpenseService = upcomingExpenseService;
     _debtService            = debtService;
 }
Exemplo n.º 6
0
 public DebtController(
     IDebtService debtService,
     ICustomerService customerService,
     IAgreementService agreementService,
     IDebtStatusService debtStatus,
     IDebtPaidService debtPaid,
     IDebtStoreService debtStore,
     IDebtClaimService debtClaim,
     IMapper mapper)
 {
     this.debtService      = debtService ?? throw new ArgumentNullException(nameof(debtService));
     this.customerService  = customerService ?? throw new ArgumentNullException(nameof(customerService));
     this.agreementService = agreementService ?? throw new ArgumentNullException(nameof(agreementService));
     this.debtStatus       = debtStatus ?? throw new ArgumentNullException(nameof(debtStatus));
     this.debtPaid         = debtPaid ?? throw new ArgumentNullException(nameof(debtPaid));
     this.debtStore        = debtStore ?? throw new ArgumentNullException(nameof(debtStore));
     this.debtClaim        = debtClaim ?? throw new ArgumentNullException(nameof(debtClaim));
     this.mapper           = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
        public RepayDebtEventDetailsView(IRepayDebtEventService service, RepayDebtEventViewModel entity, bool isNew)
            : base(service, entity, isNew)
        {
            InitializeComponent();

            // init
            eventService = ServiceManager.ConfigureService <EventService>();

            // load debts
            IDebtService debtService = ServiceManager.ConfigureService <DebtService>();

            _debts = debtService.GetActive(GlobalVariables.UserId, entity.DebtId);
            comboDebts.ItemsSource = _debts;

            // load storages
            IStorageService storageService = ServiceManager.ConfigureService <StorageService>();

            _storages = storageService.GetVisible(GlobalVariables.UserId, entity.StorageId);
            comboStorage.ItemsSource = _storages;

            // load currencies
            ICurrencyService currencyService = ServiceManager.ConfigureService <CurrencyService>();

            _currencies = currencyService.GetActive(GlobalVariables.UserId, entity.Debt?.CurrencyId, entity.Storage?.CurrencyId);

            if (isNew)
            {
                comboCurrencies.ItemsSource = _currencies;
            }
            else
            {
                UpdateCurrenciesList();
            }

            // set currencies list
            compCurrencyExchangeRate.CurrencyIds = _storages.Select(_ => _.CurrencyId)
                                                   .Concat(_currencies.Select(c => c.Id)).Concat(_debts.Select(c => c.CurrencyId)).Distinct().ToList();

            // set header and commands panel context
            LabelHeader.Content       = ViewHeader;
            CommandsPanel.DataContext = Commands;
        }
Exemplo n.º 8
0
        public DebtDetailsView(IDebtService service, DebtViewModel entity, bool isNew) : base(service, entity, isNew)
        {
            InitializeComponent();

            // load storages
            IStorageService storageService = ServiceManager.ConfigureService <StorageService>();

            _storages = storageService.GetVisible(GlobalVariables.UserId, entity.StorageId ?? 0);

            // add empty storage
            var storages = new List <StorageModel>();

            storages.Add(new StorageModel()
            {
                Id = -1, Name = MultiLangResourceManager.Instance[MultiLangResourceName.None]
            });
            storages.AddRange(_storages);
            comboStorage.ItemsSource = storages;
            if (IsNew)
            {
                entity.StorageId = -1;
            }

            // load currencies
            ICurrencyService currencyService = ServiceManager.ConfigureService <CurrencyService>();
            var currencies = currencyService.GetActive(GlobalVariables.UserId, entity.CurrencyId, entity.Storage?.CurrencyId);

            FillPenalties();

            // set currencies list
            compCurrencyExchangeRate.CurrencyIds = _storages.Select(_ => _.CurrencyId).Concat(currencies.Select(c => c.Id))
                                                   .Distinct().ToList();

            // set header and commands panel context
            LabelHeader.Content       = ViewHeader;
            CommandsPanel.DataContext = Commands;
        }
Exemplo n.º 9
0
 public DebtServiceTest()
 {
     installmentService = new InstallmentService(null);
     debtService        = new DebtService(null, installmentService);
 }
Exemplo n.º 10
0
 public DebtServiceTests()
 {
     _debtRepoMock = new Mock <IRepository <Debt> >();
     _accRepoMock  = new Mock <IRepository <Account> >();
     _service      = new DebtService(_debtRepoMock.Object, _accRepoMock.Object);
 }
Exemplo n.º 11
0
 public DebtController(IDebtService debtService, IAccountService accService)
 {
     _debtService = debtService;
     _accService  = accService;
 }
 public DebtsSummaryCalculator(IDebtService debtSevice, int userId)
 {
     _debtSevice = debtSevice;
     _userId     = userId;
 }
Exemplo n.º 13
0
 public YouOweMeController(IDebtService debtService, IReferenceUserService referenceUserService)
 {
     ReferenceUserService = referenceUserService;
     DebtService = debtService;
 }
Exemplo n.º 14
0
 protected override void InitializationComplete()
 {
     // init
     _service = ServiceManager.ConfigureService <DebtService>();
     InitializeViewModel();
 }
Exemplo n.º 15
0
 public DebtController(IDebtService service)
 {
     _service = service;
 }
Exemplo n.º 16
0
 public DebtController(IDebtService debtService)
     : base(debtService)
 {
     _debtService = debtService;
 }
 public DebtController(IReadRepository <Debt> repository, IDebtService service)
 {
     _repository = repository ?? throw new ArgumentNullException(nameof(repository));
     _service    = service ?? throw new ArgumentNullException(nameof(service));
 }
Exemplo n.º 18
0
 public DebtController(IDebtService debtService, AuthenticatedUser user)
 {
     _debtService = debtService;
     _user        = user;
 }
Exemplo n.º 19
0
 public DebtsController(IRepository repository, IDebtService debtService, SessionActionsProvider actionsProvider)
 {
     _repository      = repository;
     _debtService     = debtService;
     _actionsProvider = actionsProvider;
 }
Exemplo n.º 20
0
        async Task IJob.Execute(IJobExecutionContext context)
        {
            try
            {
                using (IServiceScope scope = _serviceProvider.CreateScope())
                {
                    IIdentityService _identityService = scope.ServiceProvider.GetRequiredService <IIdentityService>();
                    IDebtService     _debtService     = scope.ServiceProvider.GetRequiredService <IDebtService>();
                    var users = await _identityService.GetUsers();


                    foreach (var user in users)
                    {
                        var          fromAddress  = new MailAddress("*****@*****.**", "Speedlight Money");
                        var          toAddress    = new MailAddress(user.Email, user.FirstName + " " + user.LastName);
                        const string fromPassword = "******";
                        const string subject      = "[Speedlight Money] Due date alert";


                        var debtsForUser = await _debtService.GetDebtsForUser(user.Id);

                        foreach (var debt in debtsForUser)
                        {
                            string body = "<div>Hi, " + user.FirstName + "! </div> <br/>" +
                                          "<div>We are sending this email to remind you of your debt to " + debt.LenderName + ". You have 2 days until the the due date of the debt.</div><br/>" +
                                          "<div>Here are some details about your debt: </div>" +
                                          "<div>Owed amount: " + debt.LenderName + "</div>" +
                                          "<div>Owed amount: " + debt.LoanAmount + " " + debt.CurrencyName + "</div>" +
                                          "<div>Due date: " + debt.DueDate + "</div><br/>" +
                                          "<div>You can go to the Debts tab on the application and send the money to " + debt.LenderName + " by clicking on the Return loan column corresponding to " + debt.LenderName + ". If you can't return the loan right now, don't forget you can defer the debt with 14 days from the Debts tab in the Speedlight Money App.</div>" +
                                          "<div>Please make sure you don't forget to pursue the changes and don't hesitate to contact us if you have any questions or concerns!</div><br/>" +
                                          "<div>Thank you for using our app and have a great week!</div><br/>" +
                                          "<div>Speedlight Money Team</div>" +
                                          "<div>Phone: 0771345665</div>" +
                                          "<div>More info: speedlightmoney.com</div>";

                            if (debt.ReturnDate == null && debt.DueDate != null && DateTime.Now.Date == debt.DueDate.Value.Date.AddDays(-2))
                            {
                                using var smtp = new System.Net.Mail.SmtpClient
                                      {
                                          Host                  = "smtp.gmail.com",
                                          Port                  = 587,
                                          EnableSsl             = true,
                                          DeliveryMethod        = SmtpDeliveryMethod.Network,
                                          UseDefaultCredentials = false,
                                          Credentials           = new NetworkCredential(fromAddress.Address, fromPassword)
                                      };
                                using var message = new MailMessage(fromAddress, toAddress)
                                      {
                                          Subject    = subject,
                                          Body       = body,
                                          IsBodyHtml = true
                                      };
                                smtp.Send(message);
                            }
                        }
                    }


                    //if(debt)
                    //prepare email
                    //MimeMessage message = new MimeMessage();

                    //MailboxAddress from = new MailboxAddress("Speedlight Money",
                    //"*****@*****.**");
                    //message.From.Add(from);

                    //MailboxAddress to = new MailboxAddress("User",
                    //"*****@*****.**");
                    //message.To.Add(to);

                    //message.Subject = "This is email subject";

                    //add email body
                    //BodyBuilder bodyBuilder = new BodyBuilder();
                    //bodyBuilder.HtmlBody = "<h1>Hello World!</h1>";
                    //bodyBuilder.TextBody = "Hello World!";

                    //message.Body = bodyBuilder.ToMessageBody();

                    //SmtpClient client = new SmtpClient();
                    //client.Connect("smtp_address_here", 8080, true);
                    //client.Authenticate("user_name_here", "pwd_here");
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
 public DebtController(IStaffService staffService, IDebtService debtService, IDistributorService distributorService)
 {
     this._debtService   = debtService;
     _distributorService = distributorService;
     _staffService       = staffService;
 }
Exemplo n.º 22
0
 public DebtsController(IDebtService debtService)
 {
     _debtService = debtService;
 }