public ResponseStoreList GetStoresForCDC(string aCDCID)
        {
            ResponseStoreList theResponse = new ResponseStoreList();

            if (aCDCID == null || aCDCID.Equals(""))
            {
                theResponse.statusCode = 1;
                theResponse.statusDescription = "CDC ID is missing";
            }
            else
            {
                openDataConnection();

                SqlCommand cmdGet = new SqlCommand("GetStoresForCDC", theConnection);
                cmdGet.Parameters.AddWithValue("@cdcID", aCDCID);
                cmdGet.CommandType = System.Data.CommandType.StoredProcedure;

                try
                {
                    theReader = cmdGet.ExecuteReader();

                    if (theReader.HasRows)
                    {
                        theResponse.stores = new List<Store>();

                        while (theReader.Read())
                        {
                            Store thisStore = new Store();

                            thisStore.storeID = (int)theReader["StoreID"];
                            thisStore.storeName = theReader["StoreName"].ToString();
                            thisStore.storeAddress = theReader["StoreAddress"].ToString();
                            thisStore.storeCity = theReader["StoreCity"].ToString();
                            thisStore.storeZip = theReader["StoreZip"].ToString();
                            thisStore.storeState = theReader["StoreState"].ToString();
                            thisStore.storePhone = theReader["StorePhone"].ToString();
                            thisStore.storeManagerName = theReader["StoreManagerName"].ToString();
                            thisStore.storeEmailAddress = theReader["StoreEmail"].ToString();
                            thisStore.storeNumber = theReader["StoreNumber"].ToString();
                            thisStore.storeOwnershipType = theReader["StoreOwnershipType"].ToString();

                            theResponse.stores.Add(thisStore);
                        }

                        theResponse.statusCode = 0;
                        theResponse.statusDescription = "";
                    }
                    else
                    {
                        theResponse.statusCode = 4;
                        theResponse.statusDescription = "There are no stores for CDC ID " + aCDCID;
                    }

                    theReader.Close();
                }
                catch (Exception _exception)
                {
                    theResponse.statusCode = 6;
                    theResponse.statusDescription = _exception.Message;
                }

                closeDataConnection();
            }

            return theResponse;
        }
        public ResponseStoreList GetAllStoresWithRange(string startingIndex, string endingIndex)
        {
            ResponseStoreList theResponse = new ResponseStoreList();

            openDataConnection();

            SqlCommand cmdGetAllUsers = new SqlCommand("SELECT * FROM Store", theConnection);
            theReader = cmdGetAllUsers.ExecuteReader();

            if (theReader.HasRows)
            {
                List<Store> listOfStores = new List<Store>();

                int numRecords = 0;

                while (theReader.Read())
                {
                    Store thisStore = new Store();

                    thisStore.storeID = (int)theReader["StoreID"];
                    thisStore.storeName = theReader["StoreName"].ToString();
                    thisStore.storeAddress = theReader["StoreAddress"].ToString();
                    thisStore.storeCity = theReader["StoreCity"].ToString();
                    thisStore.storeZip = theReader["StoreZip"].ToString();
                    thisStore.storeState = theReader["StoreState"].ToString();
                    thisStore.storePhone = theReader["StorePhone"].ToString();
                    thisStore.storeManagerName = theReader["StoreManagerName"].ToString();
                    thisStore.storeEmailAddress = theReader["StoreEmail"].ToString();
                    thisStore.storeNumber = theReader["StoreNumber"].ToString();
                    thisStore.storeOwnershipType = theReader["StoreOwnershipType"].ToString();

                    listOfStores.Add(thisStore);

                    numRecords++;
                }

                theResponse.stores = new List<Store>();

                int startIndex = Int32.Parse(startingIndex);
                int endIndex = Int32.Parse(endingIndex);
                endIndex = startIndex + endIndex;

                if (startIndex <= 0)
                {
                    startIndex = 1;
                }

                if (startIndex > 0 && endIndex >= startIndex)
                {
                    if (endIndex > numRecords)
                    {
                        endIndex = numRecords;
                    }

                    for (int i = startIndex; i <= endIndex; i++)
                    {
                        theResponse.stores.Add(listOfStores[i - 1]);
                    }

                    theResponse.numberOfRecords = numRecords;

                    theResponse.statusCode = 0;
                    theResponse.statusDescription = "";
                }
                else
                {
                    theResponse.statusCode = 6;
                    theResponse.statusDescription = "The starting or ending index did not fall within the data range";
                }
            }
            else
            {
                theResponse.statusCode = 4;
                theResponse.statusDescription = "There are no stores in the database";
            }

            theReader.Close();

            closeDataConnection();

            return theResponse;
        }
        public ResponseStoreList GetStoreDetail(string aStoreID)
        {
            ResponseStoreList theResponse = new ResponseStoreList();

            if (aStoreID.Equals(""))
            {
                theResponse.statusCode = 1;
                theResponse.statusDescription = "Store ID not provided";

                return theResponse;
            }

            openDataConnection();

            SqlCommand cmdUserDetail = new SqlCommand("SELECT * FROM Store WHERE StoreID = " + aStoreID + " OR StoreName = '" + aStoreID + "'", theConnection);
            theReader = cmdUserDetail.ExecuteReader();

            if (theReader.HasRows)
            {
                theResponse.stores = new List<Store>();

                while (theReader.Read())
                {
                    Store thisStore = new Store();

                    thisStore.storeID = (int)theReader["StoreID"];
                    thisStore.storeName = theReader["StoreName"].ToString();
                    thisStore.storeAddress = theReader["StoreAddress"].ToString();
                    thisStore.storeCity = theReader["StoreCity"].ToString();
                    thisStore.storeZip = theReader["StoreZip"].ToString();
                    thisStore.storeState = theReader["StoreState"].ToString();
                    thisStore.storePhone = theReader["StorePhone"].ToString();
                    thisStore.storeManagerName = theReader["StoreManagerName"].ToString();
                    thisStore.storeEmailAddress = theReader["StoreEmail"].ToString();
                    thisStore.storeNumber = theReader["StoreNumber"].ToString();
                    thisStore.storeOwnershipType = theReader["StoreOwnershipType"].ToString();

                    theResponse.stores.Add(thisStore);
                }

                theResponse.statusCode = 0;
            }
            else
            {
                theResponse.statusCode = 4;
                theResponse.statusDescription = "The store " + aStoreID + " could not be found";
            }

            theReader.Close();

            closeDataConnection();

            return theResponse;
        }
        public ResponseStoreList GetAllStores()
        {
            ResponseStoreList theResponse = new ResponseStoreList();

            openDataConnection();

            SqlCommand cmdGetAllUsers = new SqlCommand("SELECT * FROM Store", theConnection);
            theReader = cmdGetAllUsers.ExecuteReader();

            if (theReader.HasRows)
            {
                List<Store> listOfStores = new List<Store>();

                int numRecords = 0;

                while (theReader.Read())
                {
                    Store thisStore = new Store();

                    thisStore.storeID = (int)theReader["StoreID"];
                    thisStore.storeName = theReader["StoreName"].ToString();
                    thisStore.storeAddress = theReader["StoreAddress"].ToString();
                    thisStore.storeCity = theReader["StoreCity"].ToString();
                    thisStore.storeZip = theReader["StoreZip"].ToString();
                    thisStore.storeState = theReader["StoreState"].ToString();
                    thisStore.storePhone = theReader["StorePhone"].ToString();
                    thisStore.storeManagerName = theReader["StoreManagerName"].ToString();
                    thisStore.storeEmailAddress = theReader["StoreEmail"].ToString();
                    thisStore.storeNumber = theReader["StoreNumber"].ToString();
                    thisStore.storeOwnershipType = theReader["StoreOwnershipType"].ToString();

                    listOfStores.Add(thisStore);

                    numRecords++;
                }

                theResponse.stores = listOfStores;

                theResponse.numberOfRecords = numRecords;

                theResponse.statusCode = 0;
                theResponse.statusDescription = "";
            }
            else
            {
                theResponse.statusCode = 4;
                theResponse.statusDescription = "There are no stores in the database";
            }

            theReader.Close();

            closeDataConnection();

            return theResponse;
        }