1. Script object OG.Utils

    Artikel: AN0002196Aktualisiert: 17.10.2018
    Die vorgegebene Sprachenversion vom Artikeltext wird angezeigt, weil es kein Text von der ausgewählten Sprache und Version gibt.

    This object offers functions for work with auxiliary objects.

    Script functions

    Name Description
    CalculateWorkTime CreateCalculateWorkTime(string calendarCode) Function returns instance for work time calculation.
    CalculateWorkTime GetSLACalculateWorkTime() Function returns instance for work time calculation for standard SLA settings.
    string InitScriptBlockCode Script block name for initialization of the object CalculateWorkTime.
    string InitScriptFunctionName Name of the script function for initialization of the object CalculateWorkTime.
    FileGenerator CreateFileGenerator() Function returns instance of the object FileGenerator .
    string SLACode Name of the configuration for standard settingof the object CalculateWorkTime.
    void ClearAllCalculateWorkTime() Method clears all the instances of the object CalculateWorkTime.
    void ClearCalculateWorkTime(string calendarCode) Method clears single particular instance of the object CalculateWorkTime.
    WorkTimeConfiguration CreateCalculateWorkTimeConfiguration() Function creates and returns instance of configuration for the object CalculateWorkTime.
    Stopwatch CreateStopwatch() Function returns instance of the objectStopWatch for accurate time measuring.
    JSImage CreateImage() Function creates object for work with pictures.
    string MapServerPath(string path) Function converts a relative path within web (starts with ~/) to a physical path.
    byte[] ReadFileToBytes( string fileName) Function reads file content and returns it as array bytes.
    string ReadFileToString(string fileName) Function reads file content (in UTF8 coding) and returns it as a text.
    string ReadFileToString(string fileName, Encoding encoding) Function reads file content and returns it as a text.
    string[] ReadFileToLines(string fileName) Function reads file content (in UTF8 coding) and returns it as a array of text.
    string[] ReadFileToLines(string fileName, Encoding encoding) Function reads file content and returns it as a array of text.

    Object call


    Calendar initialization

    By setting properties InitScriptBlockCode and InitScriptFunctionName you can define that will be always called after each calendar initialization (object CalculateWorkTime). In this function you can change default calendar setting, e.g. delete some properties or redirect them other models and classes and adapt calendar functionality to your needs.

    Perform this setting in the application event After application start. After creating script for the event ObjectGears system must be restarted in order initalization is performed.


    Add the script into the application event and enter your script block code and function name.

    OG.Utils.InitScriptBlockCode = 'my_init_calendar';
    OG.Utils.InitScriptFunctionName = 'my_Init_Calendar_Team';

    Create following function in the script block with code my_init_calendar and set new properties according to the needs:

    function Init_Calendar_Server_Team()
      var k = OGCalculateWorkTime.Configuration;

      k.Model_DayInWeek_Code= 'common_data';
      k.Column_DayInWeek_DayIndex_Code = 'day_number_type_2';