Skip to content

Theme Sustainability

lukmay edited this page Oct 17, 2023 · 3 revisions

Theme Assignment Logic in UpdateThemes()

The UpdateThemes() function is integral for managing the theme assignments for accommodations. Besides other Themes, it is also assigning the theme "Sustainability" based on specific criteria related to marketing groups and tags.

Assignment of ThemeIds based on odhtags

If an accommodation has the MarketingGroupId 3EA6116A6103498799B642C9C56D8301 or if any of the following tags are assigned:

  • "bio hotels südtirol"
  • "ecolabel hotels"
  • "gstc hotels"
  • "klimahotel"

The theme "Sustainability" is added to the ThemeIds.


The Code:

List<string> sustainabilityodhtagtocheck = new List<string>();
sustainabilityodhtagtocheck.Add("bio hotels südtirol"); //Bozen
sustainabilityodhtagtocheck.Add("ecolabel hotels"); //Brixen
sustainabilityodhtagtocheck.Add("gstc hotels"); //Bruneck            
sustainabilityodhtagtocheck.Add("klimahotel"); //Sterzing

//check if one of this odhtags is assigned

var sustainabilityfeaturecheck = myacco.MarketingGroupIds != null ? myacco.MarketingGroupIds.Where(x => x == "3EA6116A6103498799B642C9C56D8301").Count() : 0;
var sustainabilitytagintersection = myacco.SmgTags != null && myacco.SmgTags.Count > 0 ? sustainabilityodhtagtocheck.Intersect(myacco.SmgTags).Count() : 0;

if (sustainabilityfeaturecheck > 0 || sustainabilitytagintersection > 0)
    myacco.ThemeIds.Add("Sustainability");
Clone this wiki locally