Article: AN0001855Updated:
There are planned activities (releases from projects, server patching etc.) or important information (team standby duty...) stored in class Work schedule. Each record contains besides other properties name, description, starting date and end date, work type, reference to release.
Functionality description
We want to display records also in a visual form in a calender.
Solution description
We check option Enable calendar display in the class definition on tab Time and select columns for calendar configuration. (Alternatively, we can use webpart Calendar, that we place into a special page. We configure webpart so it takes over data from the class Work schedule. Then we insert a button into the class Work schedule, that will display the page with Calendar. And we place another button into the page with webpart that will contain link to the list of Work schedule records in order user can switch between both views.)
In the webpart Calender we can determine colour of the bar representing activity in the calender. Therefore, we insert a new column of the colour type into the class Work schedule and take care of filling it in by means of rules before saving a new record and before saving an existing record. We use this column in class/webpart configuration as Column with colour.
Rule set_colour_new on class Work schedule:
/*
The rule will find out value in columns type and release and sets the value in column colour in this way:
If type = 1, then column colour will contain pink colour - #ff99cc, (RGB: 255,153,204)
If type = 1, then column colour will contain green colour - #99cc00, (RGB: 153,204,0)
If type = 1, then column colour will contain orange colour - #ff6600, (RGB: 255,102,0)
If type = 1, then column colour will contain blue colour - #99ccff, (RGB: 153,204,255)
However, if column release is not null, then column colour will contain red colour - #ff0000, (RGB: 255,0,0)
*/
var dTy = OGActualDataRow['type'];
var dRe = OGActualDataRow['release'];
if ( dRe != null)
{
OGActualDataRow['colour'] = OG.Color.ToInt( 255, 0, 0);
}
else if ( dTy != null)
{
if (dTy == 1)
{
OGActualDataRow['colour'] = OG.Color.ToInt( 255, 153, 204);
}
else if (dTy == 2)
{
OGActualDataRow['colour'] = OG.Color.ToInt( 153, 204, 0);
}
else if (dTy == 3)
{
OGActualDataRow['colour'] = OG.Color.ToInt( 255, 102, 0);
}
else if (dTy == 4)
{
OGActualDataRow['colour'] = OG.Color.ToInt( 153, 204, 255);
}
}