Beispiel #1
0
        public string GetCafeTradeName(Location location)
        {
            string tradeName = "Unknown";

            for (int i = 0; i < Cafes.Count(); i++)
            {
                if (Cafes[i].Latitude == location.Latitude && Cafes[i].Longitude == location.Longitude)
                {
                    tradeName = Cafes[i].TradeName;
                    //if null or empty string return 'Unknown'.
                    if (tradeName != null)
                    {
                        if (tradeName != "")
                        {
                            return(tradeName);
                        }
                        else
                        {
                            tradeName = "Unknown"; return(tradeName);
                        }
                    }
                    else
                    {
                        tradeName = "Unknown"; return(tradeName);
                    }
                }
            }
            return(tradeName);
        }
Beispiel #2
0
        public string GetCafePhone(Location location)
        {
            string phone = "Unknown";

            for (int i = 0; i < Cafes.Count(); i++)
            {
                if (Cafes[i].Latitude == location.Latitude && Cafes[i].Longitude == location.Longitude)
                {
                    phone = Cafes[i].PhoneNumber;
                    if (phone != null)
                    {
                        return(phone);
                    }
                    else
                    {
                        phone = "Unknown"; return(phone);
                    }
                }
            }
            return(phone);
        }
Beispiel #3
0
        public string GetCafeName(Location location)
        {
            string name = "Unknown";

            for (int i = 0; i < Cafes.Count(); i++)
            {
                if (Cafes[i].Latitude == location.Latitude && Cafes[i].Longitude == location.Longitude)
                {
                    name = Cafes[i].Name;
                    if (name != null)
                    {
                        return(name);
                    }
                    else
                    {
                        name = "Unknown"; return(name);
                    }
                }
            }
            return(name);
        }
Beispiel #4
0
        //The next few methods Get information from the Cafes and returns them to the InfoBox.

        //this takes the location of the pushpin and compares that with the location of the cafe (longitude, latitude)
        public string GetCafeStreet(Location location)
        {
            string street = "Unknown"; //default value should the for/if fail.

            //loop thought all cafe (not very efficient, could loop through 1 time or 1000 times before/if it finds a match)
            for (int i = 0; i < Cafes.Count(); i++)
            {
                if (Cafes[i].Latitude == location.Latitude && Cafes[i].Longitude == location.Longitude)
                {
                    //if it finds a match then we have found the coresponding cafe.
                    street = Cafes[i].StreetAddress;
                    //if null then return 'Unknown'.
                    if (street != null)
                    {
                        return(street);
                    }
                    else
                    {
                        street = "Unknown"; return(street);
                    }
                }
            }
            return(street);
        }