Пример #1
0
        //
        ///
        ////
        /////Login menu
        static void Login(BankAccounts accounts, List<Log> eventLog)
        {
            foreach (BankAccount c in accounts)
            {
                WriteLine(c.id);
                WriteLine(c.pass);
                WriteLine("---------");
            }

            bool valid = false;
            while (!valid)
            {
                Write("Please enter your id: ");
                string id = ReadLoginInfo("id");
                Write("Please enter your password: "******"pass");
                if (accounts.Any())
                {
                    foreach (BankAccount c in accounts.ToList())
                    {
                        if ((c.id == id) && (c.pass == password))
                        {
                            valid = true;
                            var account = c;
                            WriteLine("Logged in successfully!");
                            eventLog.Add(new Log { id = account.id, debugTime = DateTime.Now, debug = "Logged in" });
                            SystemTray(account, accounts, eventLog);
                        }
                    }
                }
                WriteLine("Wrong id or password!");
            }

            
        }
        public MainDashboardViewModel()
        {
            if (CurrentUserHouseholdId != 0)
            {
                Household = _db.Households.AsNoTracking().FirstOrDefault(h => h.Id == CurrentUserHouseholdId);

                BankAccounts.AddRange(_db.BankAccounts.AsNoTracking().Where(b => b.HouseholdId == CurrentUserHouseholdId).ToList());
                Budgets.AddRange(_db.Budgets.AsNoTracking().Where(b => b.HouseholdId == CurrentUserHouseholdId).ToList());

                BudgetItems.AddRange(Budgets.SelectMany(b => b.BudgetItems));

                var transactions = _db.Transactions.AsNoTracking();
                foreach (var transaction in transactions)
                {
                    if (BankAccounts.Any(ba => ba.Id == transaction.BankAccountId))
                    {
                        Transactions.Add(transaction);
                    }
                }
            }
        }