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