Exemplo n.º 1
0
 public override void Prepare(ModifyPaymentParameter parameter)
 {
     SelectedPayment = new PaymentViewModel
     {
         Type = parameter.PaymentType
     };
     Title = PaymentTypeHelper.GetViewTitleForType(parameter.PaymentType, false);
     base.Prepare(parameter);
 }
        public override void Prepare(ModifyPaymentParameter parameter)
        {
            SelectedPayment = crudServices.ReadSingleAsync <PaymentViewModel>(parameter.PaymentId).Result;

            // We have to set this here since otherwise the end date is null. This causes a crash on android.
            // Also it's user unfriendly if you the default end date is the 1.1.0001.
            if (SelectedPayment.IsRecurring && SelectedPayment.RecurringPayment.IsEndless)
            {
                SelectedPayment.RecurringPayment.EndDate = DateTime.Today;
            }

            Title = PaymentTypeHelper.GetViewTitleForType(parameter.PaymentType, true);
            base.Prepare(parameter);
        }
Exemplo n.º 3
0
        protected override async Task Initialize()
        {
            Title = PaymentTypeHelper.GetViewTitleForType(PaymentType, false);
            SelectedPayment.Type = PaymentType;

            await base.Initialize();

            SelectedPayment.ChargedAccount = ChargedAccounts.FirstOrDefault();

            if (SelectedPayment.IsTransfer)
            {
                SelectedItemChangedCommand.Execute(null);
                SelectedPayment.TargetAccount = TargetAccounts.FirstOrDefault();
            }
        }
Exemplo n.º 4
0
        protected override async Task Initialize()
        {
            await base.Initialize();

            SelectedPayment = await crudServices.ReadSingleAsync <PaymentViewModel>(PaymentId);

            // We have to set this here since otherwise the end date is null. This causes a crash on android.
            // Also it's user unfriendly if you the default end date is the 1.1.0001.
            if (SelectedPayment.IsRecurring && SelectedPayment.RecurringPayment.IsEndless)
            {
                SelectedPayment.RecurringPayment.EndDate = DateTime.Today;
            }

            Title = PaymentTypeHelper.GetViewTitleForType(SelectedPayment.Type, true);
        }
Exemplo n.º 5
0
        protected override async Task Initialize()
        {
            await base.Initialize();

            SelectedPayment = mapper.Map <PaymentViewModel>(await mediator.Send(new GetPaymentByIdQuery(PaymentId)));

            // We have to set this here since otherwise the end date is null. This causes a crash on android.
            // Also it's user unfriendly if you the default end date is the 1.1.0001.
            if (SelectedPayment.IsRecurring && SelectedPayment.RecurringPayment.IsEndless)
            {
                SelectedPayment.RecurringPayment.EndDate = DateTime.Today;
            }

            Title = PaymentTypeHelper.GetViewTitleForType(SelectedPayment.Type, true);
        }
Exemplo n.º 6
0
        protected async Task InitializeAsync(int paymentId)
        {
            try
            {
                await base.InitializeAsync();

                SelectedPayment = mapper.Map <PaymentViewModel>(await mediator.Send(new GetPaymentByIdQuery(paymentId)));
                AmountString    = HelperFunctions.FormatLargeNumbers(SelectedPayment.Amount);

                // We have to set this here since otherwise the end date is null. This causes a crash on android.
                // Also it's user unfriendly if you the default end date is the 1.1.0001.
                if (SelectedPayment.IsRecurring && SelectedPayment.RecurringPayment != null && SelectedPayment.RecurringPayment.IsEndless)
                {
                    SelectedPayment.RecurringPayment.EndDate = DateTime.Today;
                }

                Title = PaymentTypeHelper.GetViewTitleForType(SelectedPayment.Type, true);
            }
            catch (PaymentNotFoundException ex)
            {
                Crashes.TrackError(ex);
            }
        }
Exemplo n.º 7
0
 public void GetEnumFrostring_TransferIntEditTrue_Titel()
 {
     Assert.AreEqual(Strings.EditTransferTitle, PaymentTypeHelper.GetViewTitleForType(2, true));
 }
Exemplo n.º 8
0
 public void GetEnumFrostring_IncomeIntEditTrue_Titel()
 {
     Assert.AreEqual(Strings.EditIncomeTitle, PaymentTypeHelper.GetViewTitleForType(1, true));
 }
Exemplo n.º 9
0
 public void GetEnumFrostring_IncomeEnumEditFalse_Titel()
 {
     Assert.AreEqual(Strings.AddIncomeTitle, PaymentTypeHelper.GetViewTitleForType(PaymentType.Income, false));
 }
Exemplo n.º 10
0
 public void GetEnumFromString_TransferEnumEditTrue_Title() => Assert.Equal(Strings.EditTransferTitle, PaymentTypeHelper.GetViewTitleForType(PaymentType.Transfer, true));
Exemplo n.º 11
0
 public void GetEnumFromString_IncomeEnumEditTrue_Title() => Assert.Equal(Strings.EditIncomeTitle, PaymentTypeHelper.GetViewTitleForType(PaymentType.Income, true));
Exemplo n.º 12
0
 public void GetEnumFromString_TransferIntEditFalse_Title() => Assert.Equal(Strings.AddTransferTitle, PaymentTypeHelper.GetViewTitleForType(2, false));
Exemplo n.º 13
0
 public void GetEnumFromString_IncomeIntEditFalse_Title() => Assert.Equal(Strings.AddIncomeTitle, PaymentTypeHelper.GetViewTitleForType(1, false));
Exemplo n.º 14
0
 public void GetEnumFromString_ExpenseIntEditTrue_Title() => Assert.Equal(Strings.EditSpendingTitle, PaymentTypeHelper.GetViewTitleForType(0, true));
Exemplo n.º 15
0
 public void GetEnumFrostring_ExpenseIntEditFalse_Titel()
 {
     Assert.AreEqual(Strings.AddExpenseTitle, PaymentTypeHelper.GetViewTitleForType(0, false));
 }
Exemplo n.º 16
0
 public void GetEnumFrostring_ExpenseEnumEditTrue_Titel()
 {
     Assert.AreEqual(Strings.EditSpendingTitle, PaymentTypeHelper.GetViewTitleForType(PaymentType.Expense, true));
 }
Exemplo n.º 17
0
 public void GetEnumFromString_ExpenseEnumEditFalse_Title() => Assert.Equal(Strings.AddExpenseTitle, PaymentTypeHelper.GetViewTitleForType(PaymentType.Expense, false));
Exemplo n.º 18
0
 public void GetEnumFrostring_TransferEnumEditFalse_Titel()
 {
     Assert.AreEqual(Strings.AddTransferTitle, PaymentTypeHelper.GetViewTitleForType(PaymentType.Transfer, false));
 }
Exemplo n.º 19
0
 public override void Prepare(ModifyPaymentParameter parameter)
 {
     SelectedPayment = crudServices.ReadSingleAsync <PaymentViewModel>(parameter.PaymentId).Result;
     Title           = PaymentTypeHelper.GetViewTitleForType(parameter.PaymentType, true);
     base.Prepare(parameter);
 }