/// <summary>
 /// Show input window
 /// </summary>
 public DreamInputWindow(MainWindow _mainWindow, DreamPage _dreamPage)
 {
     InitializeComponent();
     controller = _mainWindow;
     dreamPage  = _dreamPage;
     dbContext  = new MonnyDbContext();
 }
        public InputCategoryWindow(MainWindow _mainWindow, ExpensePage _expensePage, DateTime _date)
        {
            InitializeComponent();
            dbContext   = new MonnyDbContext();
            controller  = _mainWindow;
            expensePage = _expensePage;
            date        = _date;

            // Set ComboBox list Item with user's custom categories
            ExpenseRepository repository = new ExpenseRepository();
            // List where used custom categories ids are being saved
            List <int> usedId = new List <int>();

            foreach (Expense e in repository.GetItems())
            {
                // Checks if e is current user expense
                // e.CategoryId > 7 because custom categories have id greater than 7
                if (e.UserId == controller.user.Id && e.CategoryId > 7)
                {
                    // Check if category hasn't been used already
                    if (!usedId.Exists(i => i == e.CategoryId))
                    {
                        CategoryRepository categories = new CategoryRepository();
                        // Add category to ComboBox Items
                        customCategories.Items.Add(categories.GetItem(e.CategoryId).Name);

                        usedId.Add(e.CategoryId);
                    }
                }
            }
        }
示例#3
0
 public InputWindow(MainWindow _mainWindow, ExpensePage _expensePage, string _category, DateTime _date)
 {
     InitializeComponent();
     //controller = _mainWindow;
     dbContext      = new MonnyDbContext();
     title.Content += _category;
     category       = _category;
     controller     = _mainWindow;
     expensePage    = _expensePage;
     date           = _date;
 }
示例#4
0
        public DreamPage(MainWindow _mainWindow)
        {
            InitializeComponent();
            controller = _mainWindow;
            dbContext  = new MonnyDbContext();

            /// <summary>
            /// Array phrases
            /// </summary>
            phrases     = new string[13];
            phrases[0]  = "The best things in life are free.";
            phrases[1]  = "There are things more important than money, \n but you don't buy them without money.";
            phrases[2]  = "Money is a holiday that is always with you.";
            phrases[3]  = "Money doesn't grow on trees.";
            phrases[4]  = "The happiness is in the purchases rather than \n the actual money.";
            phrases[5]  = "Wealth is the ability to spend less than you earn.";
            phrases[6]  = "Wealth is the ability to invest.";
            phrases[7]  = "A rich one is not the one who earns a lot, \n rather the one who spends a little.";
            phrases[8]  = "The poor is not the one who has no money \n but the one who has no dream.";
            phrases[9]  = " The ability to properly manage money \n is one of  the main qualities of rich people.";
            phrases[10] = " Wealth does not come from desires. \n It comes from a thoughtful plan of action \n and from hard work.";
            phrases[11] = "You shouldnt bring the topic of money, \n with people who earn either much more \n or much less.";
            phrases[12] = "It's not about the money, but rather \n the amount.";
            generatePhrase();


            /// <summary>
            /// show page
            /// </summary>
            Dream dreamCheck = dbContext.Set <Dream>().ToList().Find(d => d.UserId == controller.user.Id);

            if (dreamCheck != null)
            {
                dreamNameLabel.Content = dreamCheck.Name;
                dreamNameLabel.Content = dreamNameLabel.Content + " " + dreamCheck.Price.ToString();
                UpdateProgressBar();
            }
        }
示例#5
0
 public ExpenseRepository()
 {
     dbContext = new MonnyDbContext();
 }
示例#6
0
 public LimitationRepository()
 {
     dbContext = new MonnyDbContext();
 }
示例#7
0
 public IncomeRepository()
 {
     dbContext = new MonnyDbContext();
 }
示例#8
0
 public UserRepository()
 {
     dbContext = new MonnyDbContext();
 }
示例#9
0
 public CategoryRepository()
 {
     dbContext = new MonnyDbContext();
 }