Exemple #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 CustomerProps();
            mOldProps = new CustomerProps();

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

            else
            {
                mdbReadable  = new CustomerDB(this.mConnectionString);
                mdbWriteable = new CustomerDB(this.mConnectionString);
            }
        }
        public void Setup()
        {
            db = new CustomerDB(dataSource);
            c  = new CustomerProps();

            DBCommand command = new DBCommand();

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

            c.customerID = 100;
            c.name       = "Mickey Mouse";
            c.address    = "101 Disney Land Lane";
            c.city       = "California";
            c.state      = "CA";
            c.zipCode    = "99999";
        }
Exemple #3
0
        public static List <Customer> GetList(string cnString)
        {
            CustomerDB           db        = new CustomerDB(cnString);
            List <Customer>      customers = new List <Customer>();
            List <CustomerProps> props     = new List <CustomerProps>();

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

            return(customers);
        }
Exemple #4
0
        public static DataTable GetTable()
        {
            CustomerDB db = new CustomerDB();

            return(db.RetrieveTable());
        }
Exemple #5
0
        // *** this is new
        public static DataTable GetTable(string cnString)
        {
            CustomerDB db = new CustomerDB(cnString);

            return(db.RetrieveTable());
        }