Appendix
Copy
The following example shows how to write a method that sets the value of the attribute to true from 8AM to 8PM server time, Monday through Friday:
//MethodTemplateName=CSharp:Aras.Server.Core.AccessControl.EnvironmentAttributeMethod;
var startWorkTime = new TimeSpan(8, 0, 0);
var endWorkTime = new TimeSpan(20, 0, 0);
var currentDateTime = DateTime.Now;
var isWorkDay = DayOfWeek.Monday <= currentDateTime.DayOfWeek && currentDateTime.DayOfWeek <= DayOfWeek.Friday;
var isWorkTime = startWorkTime <= currentDateTime.TimeOfDay && currentDateTime.TimeOfDay <= endWorkTime;
var isWorkHours = isWorkDay && isWorkTime;
attribute.SetValue(isWorkHours);
Note
It is recommended to make the Methods OS agnostic to use them with different operating systems. The main incompatibility issues in operating systems that need to be considered when implementing the Methods are related to file path case-sensitivity, path separators, OS-specific line-endings, OS-specific code. For more information about cross-platform development please see section “Cross-platform development” in “Aras Innovator 37 - Programmer’s Guide” document.