Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }