public void LoadList() { TransactionsList transactionsList = new TransactionsList(this); UsersList usersList = new UsersList(); ProductCatalog productCatalog = new ProductCatalog(); SeasonProductCatalog seasonalProductCatalog = new SeasonProductCatalog(); UserList = usersList.GetList(); ProductList = productCatalog.GetList(); SeasonalProductList = seasonalProductCatalog.GetList(); BTransactionList = transactionsList.GetBuyList(); CTransactionList = transactionsList.GetCashList(); }
private bool UsernameValidation(string username) { UsersList check = new UsersList(); string OnlyNumbersLettersUnderscore = @"^[a-zA-Z0-9_æøå]+$"; if (check.UsernameExistValidation(username)) { throw new UsernameExistException(); } if (Regex.IsMatch(username, OnlyNumbersLettersUnderscore)) { Username = username; return(true); } throw new UsernameIncorrectlyException(); }
public override bool Execute(Stregsystem CS) { TransactionsList transactionList = new TransactionsList(CS); UsersList usersList = new UsersList(); User.Balance = User.Balance + Amount * 100; Date = DateTime.Now; if (transactionList.AddCashTransaction(this)) { if (usersList.UpdateUser(User)) { return(true); } return(false); } return(false); }
//Algorithm for Execute, just that it filled to much - seems unreadable private bool SaveTransaction(BuyTransaction transaction, Stregsystem CS) { TransactionsList transactionList = new TransactionsList(CS); UsersList usersList = new UsersList(); User.Balance = User.Balance - Product.Price; Price = Product.Price; Date = DateTime.Now; if (transactionList.AddBuyTransaction(transaction)) { if (usersList.UpdateUser(User)) { return(true); } return(false); } return(false); }