コード例 #1
0
        void AddAccountEntry(object parameter)
        {
            Account accountFields = new Account()
            {
                StartingBalance = openingBalance,
                EntryDate       = entryDate,
                Amount          = amount,
                AmountType      = SelectedItem.Amount,
                Description     = description,
                ClosingBalance  = closingBalance
            };

            if (openingBalance < 0 || closingBalance <= 0 || closingBalance == null || amount <= 0 || amount == null ||
                openingBalance == null || SelectedItem.Amount == null || AmountType == null || description.IsVoid())
            {
                MessageBox.Show("Fill in all the mandatory fields");
            }
            else
            {
                if (financeModel == null)
                {
                    financeModel = new FinanceApplicationModel();
                }
                financeModel.AddAccountEntry(accountFields);
                ClearFields();
            }
        }
コード例 #2
0
 public FinanceApplicationMainWindowViewModel()
 {
     _children = new ObservableCollection <object>();
     _children.Add(new UserCollectionViewModel());
     _children.Add(new ViewCollectionLogViewModel());
     _children.Add(new AccountViewModel());
     _children.Add(new MasterAccountViewModel());
     financeModel = new FinanceApplicationModel();
     // _userFieldsList = new ObservableCollection<User>(financeModel.GetUserList());
     dateOfJoining = DateTime.Today;
 }
コード例 #3
0
 public void GetMasterLog()
 {
     if (financeModel == null)
     {
         financeModel = new FinanceApplicationModel();
     }
     MasterLogList = financeModel.GetMasterLog(start, itemCount, ascending, out totalItems);
     // userList = new ObservableCollection<User>(userCollectionModel.GetUserList(), start, itemCount, sortColumn, ascending, out totalItems);
     NotifyPropertyChanged("Start");
     NotifyPropertyChanged("End");
     NotifyPropertyChanged("TotalItems");
 }
コード例 #4
0
        public AccountViewModel()
        {
            financeModel = new FinanceApplicationModel();
            int openingBalanceFromDB = GetOpeningBalance();

            OpeningBalance = openingBalanceFromDB;
            EntryDate      = DateTime.Today;
            GetAccountsLog();
            AmountType.Add(new AccountCmbList()
            {
                Amount = "Add"
            });
            AmountType.Add(new AccountCmbList()
            {
                Amount = "Sub"
            });
            //AmountType.Add(new AccountCmbList() { Month = 4, Year = 2013 });
        }