private void UpdateOtherComboBox()
        {
            ObservableCollection <Account> tempCollection = new ObservableCollection <Account>(ChargedAccounts);

            foreach (Account i in TargetAccounts)
            {
                if (!tempCollection.Contains(i))
                {
                    tempCollection.Add(i);
                }
            }
            foreach (Account i in tempCollection)
            {
                if (!TargetAccounts.Contains(i))//fills targetaccounts
                {
                    TargetAccounts.Add(i);
                }

                if (!ChargedAccounts.Contains(i))//fills chargedaccounts
                {
                    ChargedAccounts.Add(i);
                }
            }
            ChargedAccounts.Remove(selectedPayment.TargetAccount);
            TargetAccounts.Remove(selectedPayment.ChargedAccount);
        }
        private void UpdateOtherComboBox()
        {
            var tempCollection = new ObservableCollection <AccountViewModel>(ChargedAccounts);

            foreach (var account in TargetAccounts)
            {
                if (!tempCollection.Contains(account))
                {
                    tempCollection.Add(account);
                }
            }
            foreach (var account in tempCollection)
            {
                //fills targetaccounts
                if (!TargetAccounts.Contains(account))
                {
                    TargetAccounts.Add(account);
                }

                //fills chargedaccounts
                if (!ChargedAccounts.Contains(account))
                {
                    ChargedAccounts.Add(account);
                }
            }
            ChargedAccounts.Remove(selectedPayment.TargetAccount);
            TargetAccounts.Remove(selectedPayment.ChargedAccount);
        }
 private void PrepareDefault(PaymentType type)
 {
     SelectedPayment = new PaymentViewModel
     {
         Type           = type,
         Date           = DateTime.Now,
         ChargedAccount = ChargedAccounts.FirstOrDefault(),
     };
     IsTransfer = type == PaymentType.Transfer;
     EndDate    = DateTime.Now;
 }
Example #4
0
 private void SetDefaultPayment(PaymentType paymentType)
 {
     SelectedPayment = new Payment
     {
         Type = (int)paymentType,
         Date = DateTime.Now,
         // Assign empty category to reset the GUI
         Category       = new Category(),
         ChargedAccount = DefaultHelper.GetDefaultAccount(ChargedAccounts.ToList())
     };
 }
 private void SetDefaultPayment(PaymentType paymentType)
 {
     SelectedPayment = new PaymentViewModel
     {
         Type = paymentType,
         Date = DateTime.Now,
         // Assign empty CategoryViewModel to reset the GUI
         Category       = new CategoryViewModel(),
         ChargedAccount = ChargedAccounts.FirstOrDefault()
     };
 }
Example #6
0
        public override async Task Initialize()
        {
            await base.Initialize().ConfigureAwait(true);

            SelectedPayment.ChargedAccount = ChargedAccounts.FirstOrDefault();

            if (SelectedPayment.IsTransfer)
            {
                SelectedItemChangedCommand.Execute();
                SelectedPayment.TargetAccount = TargetAccounts.FirstOrDefault();
            }
        }
Example #7
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();
            }
        }
        private void PrepareEdit()
        {
            IsTransfer = SelectedPayment.IsTransfer;
            // set the private amount property. This will get properly formatted and then displayed.
            amount     = SelectedPayment.Amount;
            Recurrence = SelectedPayment.IsRecurring
                ? SelectedPayment.RecurringPayment.Recurrence
                : PaymentRecurrence.Daily;
            EndDate = SelectedPayment.IsRecurring
                ? SelectedPayment.RecurringPayment.EndDate
                : DateTime.Now;
            IsEndless = !SelectedPayment.IsRecurring || SelectedPayment.RecurringPayment.IsEndless;

            // we have to set the AccountViewModel objects here again to ensure that they are identical to the
            // objects in the AccountViewModel collections.
            selectedPayment.ChargedAccount =
                ChargedAccounts.FirstOrDefault(x => x.Id == selectedPayment.ChargedAccountId);
            selectedPayment.TargetAccount =
                TargetAccounts.FirstOrDefault(x => x.Id == selectedPayment.TargetAccountId);
        }
Example #9
0
        public new async Task InitializeAsync()
        {
            await base.InitializeAsync();

            SelectedPayment.ChargedAccount = ChargedAccounts.FirstOrDefault();
        }