예제 #1
0
        private void switchToSelectedAccount(ListCollectionView view)
        {
            this.currentAccount  = (AccountDRM)view.CurrentItem;
            this.currentEnvelope = null;

            if (this.currentAccount != null)
            {
                RegistryLineModel.CurrentAccountID = this.currentAccount.ID;

                this.currentLineItems = new ObservableCollection <RegistryLineModel>(this.currentAccount.getTransactionLines());
                //this.currentLineItems.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(currentLineItems_CollectionChanged);

                this.RegistryLinesView            = new ListCollectionView(this.currentLineItems);
                this.RegistryLinesView.Filter     = new Predicate <Object>(RegistryFilter);
                this.RegistryLinesView.CustomSort = new RegistryLinesComparer();
            }
            else
            {
            }



            this.updateBalanceValues();
            this.reportSummaryPropertiesChanged();
            this.reportPropertyChangedWithName("RegistryLinesView");
        }
예제 #2
0
        ///////////////////////////////////////////////////////////
        // Public functions
        ///////////////////////////////////////////////////////////
        public RegistryVM()
        {
            this.setupViews();

            this.currentAccount  = (AccountDRM)this.AccountsView.CurrentItem;
            this.currentEnvelope = null;
        }
        private void appendDestinationWithNewAccount(OldFFDBDataSet.AccountRow sourceAccount)
        {
            if (sourceAccount.id <= 0)
            {
                handleSpecialAccount(sourceAccount);
            }

            else
            {
                AccountDRM newAccount = new AccountDRM();

                newAccount.Name          = sourceAccount.name;
                newAccount.TypeID        = accountTypeMerger.getDestinationIdFromSourceId(sourceAccount.typeID);
                newAccount.Catagory      = FamilyFinance.Data.CatagoryCON.getCatagory(sourceAccount.catagory);
                newAccount.Closed        = sourceAccount.closed;
                newAccount.UsesEnvelopes = sourceAccount.envelopes;

                if (newAccount.Catagory == FamilyFinance.Data.CatagoryCON.ACCOUNT)
                {
                    newAccount.HasBankInfo   = true;
                    newAccount.AccountNormal = FamilyFinance.Data.PolarityCON.GetPlolartiy(sourceAccount.creditDebit);
                }

                sourceToDestinationID.Add(sourceAccount.id, newAccount.ID);
            }
        }
        private int sortBySpecialCase(AccountDRM xAcc, AccountDRM yAcc)
        {
            int result;

            if (xAcc.IsSpecial() && yAcc.IsSpecial())
            {
                result = xAcc.ID.CompareTo(yAcc.ID);
            }

            else if (xAcc.IsSpecial())
            {
                result = -1;
            }

            else if (yAcc.IsSpecial())
            {
                result = 1;
            }

            else
            {
                result = compareByCategory(xAcc, yAcc);
            }

            return(result);
        }
예제 #5
0
        public void switchToSelectedEnvelope()
        {
            this.currentEnvelope = (EnvelopeDRM)this.EnvelopesView.CurrentItem;
            this.currentAccount  = null;

            //this.updateBalanceValues();
            //this.reportSummaryPropertiesChanged();
        }
        public int Compare(object x, object y)
        {
            AccountDRM xAcc = (AccountDRM)x;
            AccountDRM yAcc = (AccountDRM)y;

            int result;

            result = sortBySpecialCase(xAcc, yAcc);

            return(result);
        }
        private static int compareByCategory(AccountDRM xAcc, AccountDRM yAcc)
        {
            int result = xAcc.CatagoryName.CompareTo(yAcc.CatagoryName);

            if (result == 0)
            {
                result = compareByName(xAcc, yAcc);
            }

            return(result);
        }
        private bool AccountsFilter(object item)
        {
            AccountDRM account  = (AccountDRM)item;
            bool       keepItem = true;

            if (account.ID == AccountCON.MULTIPLE.ID)
            {
                keepItem = false;
            }

            return(keepItem);
        }
예제 #9
0
        private bool ExpencesFilter(object item)
        {
            AccountDRM row  = (AccountDRM)item;
            bool       keep = false;

            if (row.Catagory == CatagoryCON.EXPENSE && row.Closed == false)
            {
                keep = true;
            }

            return(keep);
        }
예제 #10
0
        private bool IncomesFilter(object item)
        {
            AccountDRM row  = (AccountDRM)item;
            bool       keep = false;

            if (row.Catagory == CatagoryCON.INCOME && row.Closed == false)
            {
                keep = true;
            }

            return(keep);
        }
        private bool FavoriteAccountsFilter(object item)
        {
            AccountDRM accRow   = (AccountDRM)item;
            bool       keepItem = false; // Assume the item will NOT be in the list

            if (accRow.Catagory == CatagoryCON.ACCOUNT)
            {
                keepItem = true;
            }

            return(keepItem);
        }
예제 #12
0
        ///////////////////////////////////////////////////////////
        // View Filters
        ///////////////////////////////////////////////////////////
        private bool AccountsFilter(object item)
        {
            AccountDRM row  = (AccountDRM)item;
            bool       keep = false;

            if (row.Catagory == CatagoryCON.ACCOUNT)
            {
                if (row.Closed == false || row.getEndingBalance() != 0)
                {
                    keep = true;
                }
            }

            return(keep);
        }
        ///////////////////////////////////////////////////////////
        // Private functions
        private bool EditableAccountsFilter(object item)
        {
            AccountDRM accRow   = (AccountDRM)item;
            bool       keepItem = true; // Assume the item will be shown in the list

            // Remove the item if we don't want to see incomes, accounts, expenses, closed, or not in the search.
            if (accRow.Catagory == CatagoryCON.NULL)
            {
                keepItem = false;
            }

            else if (!this._ShowIncomes && accRow.Catagory == CatagoryCON.INCOME)
            {
                keepItem = false;
            }

            else if (!this._ShowAccounts && accRow.Catagory == CatagoryCON.ACCOUNT)
            {
                keepItem = false;
            }

            else if (!this._ShowExpenses && accRow.Catagory == CatagoryCON.EXPENSE)
            {
                keepItem = false;
            }

            else if (!this._ShowClosed && accRow.Closed)
            {
                keepItem = false;
            }

            else if (!String.IsNullOrEmpty(this._SearchText) && !accRow.Name.ToLower().Contains(this.SearchText.ToLower()))
            {
                keepItem = false;
            }

            return(keepItem);
        }
 private static int compareByName(AccountDRM xAcc, AccountDRM yAcc)
 {
     return(xAcc.Name.CompareTo(yAcc.Name));
 }