Example #1
0
        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();
        }
Example #2
0
        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();
        }
Example #3
0
        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);
        }
Example #4
0
        //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);
        }