Exemplo n.º 1
0
        /// <summary>
        /// Instantiates mProps and mOldProps as new Props objects.
        /// Instantiates mbdReadable and mdbWriteable as new DB objects.
        /// </summary>
        protected override void SetUp()
        {
            mProps    = new ProductProps();
            mOldProps = new ProductProps();

            if (this.mConnectionString == "")
            {
                mdbReadable  = new ProductDB();
                mdbWriteable = new ProductDB();
            }

            else
            {
                mdbReadable  = new ProductDB(this.mConnectionString);
                mdbWriteable = new ProductDB(this.mConnectionString);
            }
        }
Exemplo n.º 2
0
        public void Setup()
        {
            db = new ProductDB(dataSource);
            p  = new ProductProps();

            DBCommand command = new DBCommand();

            command.CommandText = "usp_testingResetData";
            command.CommandType = CommandType.StoredProcedure;
            db.RunNonQueryProcedure(command);

            p.productID      = 100;
            p.productCode    = "xxx";
            p.description    = "my test product";
            p.onHandQuantity = 2;
            p.unitPrice      = 99;
        }
Exemplo n.º 3
0
        public static List <Product> GetList(string cnString)
        {
            ProductDB           db       = new ProductDB(cnString);
            List <Product>      products = new List <Product>();
            List <ProductProps> props    = new List <ProductProps>();

            // *** methods in the textdb and sqldb classes don't match
            // Ideally, I should go back and fix the IReadDB interface!
            props = (List <ProductProps>)db.RetrieveAll(props.GetType());
            foreach (ProductProps prop in props)
            {
                // *** creates the business object from the props objet
                Product p = new Product(prop, cnString);
                products.Add(p);
            }

            return(products);
        }
Exemplo n.º 4
0
        public static DataTable GetTable()
        {
            ProductDB db = new ProductDB();

            return(db.RetrieveTable());
        }
Exemplo n.º 5
0
        // *** this is new
        public static DataTable GetTable(string cnString)
        {
            ProductDB db = new ProductDB(cnString);

            return(db.RetrieveTable());
        }