I have the following code that works but i would like to add an additional property so it too receives the same color coding that the new_state property receives. I am not familiar with C# coding so I would appreciate someone's help with this.
i want to add the property "affected_state" so that both properties "new_state" and "affected_state" get the color coding in the coding below:
for (int i=0; i < this.getItemCount(); i++){
string bg_color;
string myCss;
string text_color = "#000000";
Item thisItem = this.getItemByIndex(i);
string thisStatus = thisItem.getProperty("new_state","");
//------
switch (thisStatus){
case "Preliminary":
case "In Review":
bg_color = "#FFCC00"; // yellow
text_color = "#000000"; // black
break;
case "In Change":
case "Inactive":
bg_color = "#80EE80"; // light green
text_color = "#000000"; // black
break;
case "Released":
bg_color = "#55CC55"; // green
text_color = "#000000"; // black
break;
case "Superseded":
case "Obsolete":
bg_color = "#FF8888"; // light red
text_color = "#000000"; // black
break;
default:
bg_color = ""; // none
break;
}
if (bg_color != "" ){
myCss = ".new_state { background-color: " + bg_color + "; color: " + text_color + "; }";
thisItem.setProperty("css",myCss);
}
}
return this;