예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 private void PrepareDefault(PaymentType type)
 {
     SelectedPayment = new PaymentViewModel
     {
         Type           = type,
         Date           = DateTime.Now,
         ChargedAccount = ChargedAccounts.FirstOrDefault(),
     };
     IsTransfer = type == PaymentType.Transfer;
     EndDate    = DateTime.Now;
 }
예제 #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())
     };
 }
예제 #5
0
 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()
     };
 }
예제 #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();
            }
        }
예제 #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();
            }
        }
예제 #8
0
        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);
        }
예제 #9
0
        public new async Task InitializeAsync()
        {
            await base.InitializeAsync();

            SelectedPayment.ChargedAccount = ChargedAccounts.FirstOrDefault();
        }