Theme Wein - noi-techpark/odh-docs GitHub Wiki

If an accommodation has an altitude value below or equal to 900 and if the accommodation's DistrictIdexists in a predefined wine list the theme "Wein" is added to the ThemeIds. More detail below.


Altitude Check

The code checks the altitude of the accommodation, and if the value is less than or equal to 900, it proceeds to the next step.

Wine List Check

The code loads a predefined XML file, the "winelist," which contains data about wine-related districts. It then checks if the accommodation's DistrictId matches any entry in the "winelist."


The Code:

Is implemented here.

var weinaltitude = myacco.Altitude;

if (weinaltitude != null)
{
    int weinaltitudeint = Convert.ToInt32(weinaltitude);

    if (weinaltitudeint <= 900)
    {
        //XDocument mywinelist = XDocument.Load(xmldir + "Wine.xml");

        //In Weinliste schauen
        var isinwinelist = mywinelist.Root.Elements("Fraction").Where(x => x.Value == myacco.DistrictId).FirstOrDefault();

        if (isinwinelist != null)
        {
            myacco.ThemeIds.Add("Wein");
        }
    }
}