public string SaveProduct(Product aProduct)
        {
            connection.Open();
            string query = string.Format("INSERT INTO t_product VALUES('{0}','{1}',{2})", aProduct.Code, aProduct.Name,
                aProduct.Quantity);
            SqlCommand command = new SqlCommand(query, connection);

            int affectedRows = command.ExecuteNonQuery();
            connection.Close();
            if (affectedRows > 0)
                return "insert success";
            return "Product Code must be will in 3 Character and name in 5 Character!";
        }
        public string SaveProduct(Product aProduct)
        {
            if (aProduct.Code == string.Empty || aProduct.Name == string.Empty )
            {
                return "Fill up all fields first.";
            }
            if (aProduct.Code.Length > 3 && aProduct.Code.Length < 3)
            {
                return "Need 3 Characters Only";
            }

            if (aProduct.Name.Length < 10 && aProduct.Name.Length > 5)
            {
                return "Need 5 Characters Only";
            }
            if (HasThisCode(aProduct.Code) || HasThisName(aProduct.Name))
            {
                return "Code Or Name already included.";
            }
            return aProductGateway.SaveProduct(aProduct);
        }
        public List<Product> ShowProducts()
        {
            connection.Open();
            string query = string.Format("SELECT * FROM t_product");
            SqlCommand command = new SqlCommand(query, connection);
            SqlDataReader aReader = command.ExecuteReader();
            List<Product> products = new List<Product>();
            if (aReader.HasRows)
            {
                while (aReader.Read())
                {
                    Product aProduct = new Product();
                    aProduct.Code = (string) aReader[0];
                    aProduct.Name = (string) aReader[1];
                    aProduct.Quantity = (int) aReader[2];
                    products.Add(aProduct);
                }

            }
            connection.Close();
                return products;
        }