Skip to content

Theme Städtisches Flair

lukmay edited this page Dec 16, 2023 · 2 revisions

If an accommodation has an altitude value below or equal to 1100 and if the accommodation's DistrictId exists in a predefined city list, the theme "Städtisches Flair" is added to the ThemeIds.

Conditions for Adding the "Städtisches Flair" Theme

  • Altitude Check: The code checks the altitude of the accommodation, and if the value is less than or equal to 1100, it proceeds to the next step.

  • City List Check: The code loads a predefined XML file, the "citylist," which contains data about city-related districts. It then checks if the accommodation's DistrictId matches any entry in the "citylist."

Code

Is implemented here.

var cityaltitude = myacco.Altitude;

if (cityaltitude != null)
{
    int cityaltitudeint = Convert.ToInt32(cityaltitude);

    if (cityaltitudeint <= 1100)
    {
        // Uncomment this line to load the city list from an XML file
        // XDocument mycitylist = XDocument.Load(xmldir + "City.xml");

        // Check if the accommodation's DistrictId is in the city list
        var isincitieslist = mycitylist.Root.Elements("Fraction").Where(x => x.Value == myacco.DistrictId).FirstOrDefault();

        if (isincitieslist != null)
        {
            myacco.ThemeIds.Add("Städtisches Flair");
        }
    }
}
Clone this wiki locally