Ejemplo n.º 1
0
        private static Store createStore(IDataReader dbReader)
        {
            Store store = new Store();

            store.StoreId = Convert.ToInt32(dbReader["storeId"].ToString());
            store.DistrictId = Convert.ToInt32(dbReader["districtId"].ToString());
            store.Name = dbReader["name"].ToString();

            return store;
        }
Ejemplo n.º 2
0
        //Get all district Stores
        public List<Store> getStoresOnDistrict(int districtId)
        {
            List<Store> returnList = new List<Store>();

            dbCmd = new SqlCommand();
            string sqlQuery = "SELECT * FROM Store WHERE districtId = @districtId";
            dbCmd = DbConnection.GetDbCommand(sqlQuery);

            parmDistrictId.Value = districtId;
            dbCmd.Parameters.Add(parmDistrictId);

            IDataReader dbReader;
            dbReader = dbCmd.ExecuteReader();

            while (dbReader.Read())
            {
                Store store = new Store();
                store.StoreId = Convert.ToInt32(dbReader["storeId"].ToString());
                store.DistrictId = Convert.ToInt32(dbReader["districtId"].ToString());
                store.Name = dbReader["name"].ToString();

                returnList.Add(store);
            }

            dbCmd.Parameters.Clear();
            DbConnection.Close();

            return returnList;
        }