JobCTRL® custom reports API help

Can't find what you need? Ask from JobCTRL® support.

Functions
AddCustomLocalization
Description:
Adds a report specific localized text for the given key in the given language (culture).
Signature:
public void AddCustomLocalization(string key, string value, string cultureName)
Return values:

      N/A
    
Arguments:
Type Name Direction Description
string key In The key of the text. Cannot be empty, otherwise the function throws an exception.
string value In The text itself defined in the given language. Cannot be empty, otherwise the function throws an exception.
string cultureName In The language the text should be localized to. Cannot be empty, otherwise the function throws an exception. Use the CultureNames class for defining the culture name.
Example code (C#):

      public void Execute()
      {
         var customResxKey = "MyCustomKey";
          AddCustomLocalization(customResxKey, "MyCustomValue_eng", CultureNames.English);
          AddCustomLocalization(customResxKey, "MyCustomValue_kor", CultureNames.Korean);

          Log(String.Format("exists: {0}", GetLocalizedText(customResxKey, CultureNames.English)));
          Log(String.Format("exists: {0}", GetLocalizedText(customResxKey, CultureNames.Korean)));
          Log(String.Format("not exists in Japanese, fallback to English: {0}", GetLocalizedText(customResxKey, CultureNames.Japanese)));
      }
    
AddMessage
Description:
Adds a message for the specified user
Signature:
public void AddMessage(Message message)
Return values:

      None
    
Arguments:
Type Name Direction Description
Message message In This parameter contains the message to be sent. For more information check the Message class itself.
Example code (C#):

      public void Execute()
      {
        var message = new Message()
        {
          TargetUserId = 1,
          Type = "customType",
          Content = "customContent",
          Target = MessageTargets.PC | MessageTargets.Mobile,
          ExpiryInHours = 24
        }
        
        AddMessage(message);
      }
    
CreateAttachmentFromChart
Description:
Creates a ReportEmailAttachment object from the given Microsoft Chart object. You can use this attachment to embed images into the scheduled email report's HTML part. To create a chart check Microsoft's official website.
Signature:
public ReportEmailAttachment CreateAttachmentFromChart(Chart chart)
Return values:

      ReportEmailAttachment object
    
Arguments:
Type Name Direction Description
System.Web.UI.DataVisualization.Charting.Chart chart In It is a chart object created by the Microsoft's Charting framework. For examples see the link in the description.
Example code (C#):

      public void Execute()
      {
        var chart = CreateCustomChart();
        var attachment = CreateAttachmentFromChart(chart);
        var htmlContent = GetCustomHtmlContent(attachment.ContentId);
        var emailSettings = new ReportEmailSettings
        {
            AttachDefaultExcelDocument = false,
            HtmlContent = htmlContent,
            Attachments = new List<ReportEmailAttachment>{attachment}
        };
        SetEmailSettings(emailSettings);
      }
      
      public Chart CreateCustomChart()
      {
         /******
           For more examples check out Microsoft's official website: https://code.msdn.microsoft.com/Samples-Environments-for-b01e9c61
         ******/
  
        var chart1 = new Chart { Width = 500, Height = 400 };
         chart1.ChartAreas.Add(new ChartArea("ChartArea1"));
  
          var series1 = new System.Web.UI.DataVisualization.Charting.Series
          {
            Name = "Series1",
            ChartType = SeriesChartType.Column
          };
          chart1.Series.Add(series1);

        series1.Points.AddXY("John Doe", 1000);
          series1.Points.AddXY("Jane Doe", 1500);
  
         return chart1;
      }
      
      public string GetCustomHtmlContent(string contentId)
      {
        var sb = new StringBuilder();
          sb.Append("<p>The average performance is: 95%</p>");
          sb.Append("<img src=\"cid:" + contentId + "\" />");
  
         return sb.ToString();
      }
    
FilterLocations
Description:
Returns a filtered list of mobile locations for the given list of locations. It runs some custom algorithms (loop checking; distance checking; allowed speed checking) on the input and returns the same output that website uses.
Signature:
public List<FilteredMobileLocation> FilterLocations(List<MobileLocation> locations, double minDistanceInMeters, int maxTimeBetweenLocationsInMins)
Return values:

      List of FilteredMobileLocation.
    
Arguments:
Type Name Direction Description
List<MobileLocation> locations In The raw locations recorded by the mobile client.
double minDistanceInMeters In Minimum distance between "unmerged" locations. This is the radius of a circle given in meters. You can omit this value, in that case its default is 500 meters.
int maxTimeBetweenLocationsInMins In Maximum allowed time between the creation dates of 2 consecutive mobile locations before checking if they can be merged. If the time between locations is greater than the given parameter then the locations never get merged. The parameter is given in minutes. You can omit this value, in that case its default is 30 minutes.
Example code (C#):

      public void Execute()
      {
         var userId = 123;
          var locations = GetMobileLocationsOfUser(userId);
          foreach(var location in FilterLocations(locations))
          {
              Log(String.Format("Id: {0} | UserId: {1} | TaskId: {2} | Longitude: {3} | Latitude: {4} | Accuracy: {5} | Date: {6} | HiddenLocations.Count: {7}", location.Id, location.UserId, location.TaskId, location.Longitude, location.Latitude, location.Accuracy, location.Date.ToString("yyyy-MM-dd HH:mm:ss"), location.HiddenLocations.Count));
              foreach(var hiddenLocation in location.GetHiddenLocations())
              {
                  Log(String.Format("Hidden | Id: {0} | UserId: {1} | TaskId: {2} | Longitude: {3} | Latitude: {4} | Accuracy: {5} | Date: {6}", hiddenLocation.Id, hiddenLocation.UserId, hiddenLocation.TaskId, hiddenLocation.Longitude, hiddenLocation.Latitude, hiddenLocation.Accuracy, hiddenLocation.Date.ToString("yyyy-MM-dd HH:mm:ss")));
              }
          }
      }
    
GetActivitesForUser
Description:
Get the list of computer activities for the given user.
Signature:
public List<ComputerActivity> GetActivitesForUser(int userId)
Return values:

      A list of ComputerActivity objects.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 123456;
        var activities = GetActivitesForUser(userId);
        foreach(var activity in activities)
        {
          Log(String.Format("UserId: {0} | KeyboardActivity: {1} | MouseActivity: {2} | StartDate: {3} | EndDate: {4}", activity.UserId, activity.KeyboardActivity, activity.MouseActivity, activity.StartDate, activity.EndDate));
        }
      }
    
GetAddressByPosition
Description:
Returns the address for a given mobile location. First of all, method tries to get address from cache, then when not found it tries to get from Google. This method might return null when Google is flooded, report code should handle it.
Signature:
public string GetAddressByPosition(double latitude, double longitude)
Return values:

      The address formatted in the report user's culture.
    
Arguments:
Type Name Direction Description
double latitude In Latitude part of the location.
double longitude In Longitude part of the location.
Example code (C#):

      public void Execute()
      {
        Log(GetAddressByPosition(37.4188514, -122.0874526);
      }
    
GetAllHolidayCategories
Description:
Returns the information of all (holiday categories) of the company.
Signature:
public List<HolidayCategory> GetAllHolidayCategories()
Return values:

      list of HolidayCategory objects
    
Arguments:
Type Name Direction Description
Example code (C#):

      public void Execute()
      {
        foreach(var category in GetAllHolidayCategories())
        {
            Log(String.Format("category: Id: {0}, Name: {1}, Rank: {2}, Requestable: {3}, ColorCode: {4}, Paid: {5}", category.Id, category.Name, category.Rank, category.Requestable, category.ColorCode, category.Paid));
        }
      }
    
GetAllIssues
Description:
Returns the list of issues of the company which were opened in the queried interval.
Signature:
public List<Issue> GetAllIssues()
Return values:

      List of Issues
    
Arguments:
Type Name Direction Description
Example code (C#):

      public void Execute()
      {
        var allIssues = GetAllIssues();
        foreach(var issue in allIssues)
            Log(String.Format("Issue: IssueCode: {0}, State: {1}, Subject: {2}, Company: {3}", issue.IssueCode, issue.State, issue.Subject, issue.Company));
      }
    
GetAllScheduleCategories
Description:
Returns the list of (schedule categories) existing for the company.
Signature:
public List<ScheduleCategory> GetAllScheduleCategories()
Return values:

      List of ScheduleCategory.
    
Arguments:
Type Name Direction Description
Example code (C#):

      public void Execute()
      {
          var allCategories = GetAllScheduleCategories();
         foreach(var item in allCategories)
            LogCategory(item);
      }

      public void LogCategory(ScheduleCategory category)
      {
      Log(String.Format("Id: {0} | Name: {1} | ColorCode: {2} | DeletedAt: {3}", category.Id, category.Name, category.ColorCode, category.DeletedAt.HasValue ? category.DeletedAt.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""));
      }
    
GetAllTodoListsForUser
Description:
Returns a list of to-do list of the given user. Returns empty list when user has no to-do list at all.
Signature:
public List<TodoList> GetAllTodoListsForUser(int userId)
Return values:

      List of TodoList objects
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
          var userId = 1234;
          var todoLists = GetAllTodoListsForUser(userId);
          foreach(var todoList in todoLists)
          {
              Log(String.Format("UserId: {0} | Day: {1}", todoList.UserId, todoList.Day.ToString("yyyy-MM-dd")));
              foreach(var item in todoList.Items)
                  Log(String.Format("Name: {0} | Status: {1} | Priority: {2}", item.Name, item.Status, item.Priority));
          }
      }
    
GetAudioFilesForUser
Description:
Returns a list of audio files of the given user. Returns empty list when user has no recorded audio files.
Signature:
public List<AudioFile> GetAudioFilesForUser(int userId)
Return values:

      List of AudioFile objects
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
          var userId = 12345678;
          foreach(var item in GetAudioFilesForUser(userId))
           Log(String.Format("Id: {0} | UserId: {1} | TaskId: {2} | ClientId: {3} | StartDate: {4} | EndDate: {5} | LengthInMs: {6} | Name: {7} | Extension: {8} | ReceiveDate: {9} | DeleteDate: {10}", item.Id, item.UserId, item.TaskId, item.ClientId, item.StartDate.ToString("yyyy-MM-dd HH:mm:ss"), item.EndDate.HasValue ? item.EndDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", item.LengthInMs, item.Name, item.Extension, item.ReceiveDate, item.DeleteDate.HasValue ? item.DeleteDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""));
      }
    
GetClientComputerKicksForUser
Description:
Client computer kicks contain information about forcing the client to go offline which is performed by a user. Returns the client computer kicks for the given user. Returns empty list when user was not found.
Signature:
public List<ClientComputerKick> GetClientComputerKicksForUser(int userId)
Return values:

      List of ClientComputerKicks.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var user1ComputerKicks = GetClientComputerKicksForUser(userId);

        foreach (var computerKick in user1ComputerKicks)
        {
         Log(String.Format("Id: {0}, UserId: {1}, ComputerId: {2}, Reason: {3}, CreatedBy: {4}, CreateDate: {5}, ExpirationDate: {6}, SendDate: {7}, ConfirmDate: {8}, Result: {9}", computerKick.Id, computerKick.UserId, computerKick.ComputerId, computerKick.Reason, computerKick.CreatedBy, computerKick.CreateDate, computerKick.ExpirationDate, computerKick.SendDate, computerKick.ConfirmDate, computerKick.Result));
        }
      }
    
GetComputerIpAddressesForUser
Description:
Returns the list of Computer Ip addresses for the given userId. Can return null.
Signature:
public List<ComputerIpAddress> GetComputerIpAddressesForUser(int userId)
Return values:

      List of ComputerIpAddresses
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 123;
        foreach (var item in GetComputerIpAddressesForUser(userId))
        {
          Log(string.Format("Id: {0} | UserId: {1} | ComputerId: {2} | IpAddress: {3} | IsCurrent: {4} | FirstReceiveDate: {5} | LastReceiveDate: {6} | LocalIpAddresses: {7}",
            item.Id, item.UserId, item.ComputerId, item.IpAddress.ToString(), item.IsCurrent, item.FirstReceiveDate.ToString("yyyy-MM-dd HH:mm:ss"), item.LastReceiveDate.ToString("yyyy-MM-dd HH:mm:ss"), string.Join(", ", item.LocalIpAddresses.Select(x => x.ToString()))));
        }
      }
    
GetCoreTimeExceptionsForUser
Description:
Returns a lookup containing all core time exceptions of the given user by day. Returns empty lookup when user has no exceptions.
Signature:
public Dictionary<DateTime, CoreTimeException> GetCoreTimeExceptionsForUser(int userId)
Return values:

      Dictionary
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
          var userId = 12345678;
          var userExceptionsByDay = GetCoreTimeExceptionsForUser(userId);
          foreach(var exc in userExceptionsByDay.Values)
          {
            Log(String.Format("UserId: {0} | Day: {1} | ViolateStartRule: {2} | ViolateEndRule: {3} | ViolateMinimumWorkTimeRule: {4}", exc.UserId, exc.Day, exc.ViolateStartRule, exc.ViolateEndRule, exc.ViolateMinimumWorkTimeRule));
          }
      }
    
GetCoreTimeExceptionsForUserDay
Description:
Returns the core time exception for the given user and day. Returns null when exception does not exist.
Signature:
public CoreTimeException GetCoreTimeExceptionsForUserDay(int userId, DateTime day)
Return values:

      CoreTimeException
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
DateTime day In Day of the exception (no time part allowed).
Example code (C#):

      public void Execute()
      {
          var userId = 12345678;
          var day = new DateTime(2018, 5, 3);
          var exception = GetCoreTimeExceptionsForUserDay(userId, day);
          if (exception != null)
              Log(String.Format("UserId: {0} | Day: {1} | ViolateStartRule: {2} | ViolateEndRule: {3} | ViolateMinimumWorkTimeRule: {4}", exception.UserId, exception.Day, exception.ViolateStartRule, exception.ViolateEndRule, exception.ViolateMinimumWorkTimeRule));
      }
    
GetDailySchedulesForUser
Description:
Returns the schedules of the user for the given day. Returns empty list when user or day was not found.
Signature:
public List<Schedule> GetDailySchedulesForUser(int userId, DateTime day)
Return values:
User's schedule for the given day.
Arguments:
Type Name Direction Description
int userId In Id of the user.
DateTime day In Day of the schedule.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var date = new DateTime(2015, 10, 15);
        var schedules = GetDailySchedulesForUser(userId, date);
        foreach(var schedule in schedules)
        {
          Log(String.Format("UserId:{0}|Day:{1}|IsInOffice:{2}|IsWorkDay:{3}", schedule.UserId, schedule.Day, schedule.IsInOffice, schedule.IsWorkDay));
          foreach(var item in schedule.Items)
          {
            Log(String.Format("Start:{0}|End:{1}|TaskId:{2}|IsOvertime:{3}", item.Start, item.End, item.TaskId, item.IsOvertime));
          }
        }
      }
    
GetDistanceOfLocations
Description:
Returns the distance between the 2 given locations.
Signature:
public double GetDistanceOfLocations(MobileLocation location1, MobileLocation location2)
Return values:

      double
    
Arguments:
Type Name Direction Description
MobileLocation location1 In First location (can be FilteredMobileLocation type too)
MobileLocation location2 In Second location (can be FilteredMobileLocation type too)
Example code (C#):

      public void Execute()
      {
        var location1 = new MobileLocation { Id = 1, Longitude = 15.0, Latitude = 30.0 };
        var location2 = new MobileLocation { Id = 2, Longitude = 15.0, Latitude = 30.0 };
        var location3 = new MobileLocation { Id = 3, Longitude = 15.0, Latitude = 31.0 };
        Log(String.Format("{0} meters", GetDistanceOfLocations(location1, location2)));   // 0 meters
        Log(String.Format("{0} meters", (int)GetDistanceOfLocations(location1, location3)));   // 111194 meters
      }
    
GetFriendlyNamesForProcess
Description:
Get the list of friendly names for the given processName. Returns empty list when no friendly names exist for the given processName.
Signature:
public List<string> GetFriendlyNamesForProcess(string processName)
Return values:

      A list of strings.
    
Arguments:
Type Name Direction Description
string processName In Name of the process (the EXE name).
Example code (C#):

      public void Execute()
      {
        Log(GetFriendlyNamesForProcess("OUTLooK.ExE").First());
        Log(GetFriendlyNamesForProcess("outlook.exe").First());
        Log(GetFriendlyNamesForProcess("notExisting.ExE").FirstOrDefault() ?? "Not found");
      }
    
GetGroupsOfUser
Description:
Returns the names of the parent groups of the user. The order is bottom-to-top, so the closest parent is the first while the root group (not company root!) is the last element in the result list. Returns empty list when user was not found.
Signature:
public List<string> GetGroupsOfUser(int userId)
Return values:

      List of group names.
    
Arguments:
Type Name Direction Description
int userId In Id for the user.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var groups = GetGroupsOfUser(userId);
        var groupPath = "";
        foreach(var group in groups)
        {
          groupPath += group + " >> ";
        }
        Log(groupPath);
      }
    
GetHolidayCategoryById
Description:
Returns the information for the given (holiday category). Returns null when category does not exist.
Signature:
public HolidayCategory GetHolidayCategoryById(int categoryId)
Return values:

      HolidayCategory
    
Arguments:
Type Name Direction Description
int categoryId In Id of the holiday category.
Example code (C#):

      public void Execute()
      {
       var userId = 12345;
        var holidays = GetHolidaysForUser(userId);
  
        foreach(var holiday in holidays)
        {
            if (holiday.HolidayCategoryId.HasValue)
            {
                var category = GetHolidayCategoryById(holiday.HolidayCategoryId.Value);
                Log(String.Format("category: Id: {0}, Name: {1}, Rank: {2}, Requestable: {3}, ColorCode: {4}, Paid: {5}", category.Id, category.Name, category.Rank, category.Requestable, category.ColorCode, category.Paid));
            }
        }
      }
    
GetHolidayLimitsForUser
Description:
Returns a list of holiday limits of the given user. Returns empty list when user has no holiday limits specified.
Signature:
public List<HolidayLimit> GetHolidayLimitsForUser(int userId)
Return values:

      List of HolidayLimit objects
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
          var userId = 12345;
          var limits = GetHolidayLimitsForUser(userId);
          foreach(var holidayLimit in limits)
              foreach(var limit in holidayLimit.CategoryLimits)
                  Log(String.Format("UserId: {0} | Year: {1} | CategoryId: {2} | LimitInMins: {3}", holidayLimit.UserId, holidayLimit.Year, limit.CategoryId, limit.LimitInMins));
      }
    
GetHolidaysForUser
Description:
Returns the holidays for the given user. Returns empty list when user was not found.
Signature:
public List<Holiday> GetHolidaysForUser(int userId)
Return values:

      List of Holidays.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var holidays = GetHolidaysForUser(userId);
  
        foreach(var holiday in holidays)
        {
          Log(String.Format("holiday: UserId: {0}, StartDay: {1}, EndDay: {2}, DailyDurationInMins: {3}, NumberOfWorkDays: {4}, HolidayCategoryName: {5}, ApprovedBy: {6}", holiday.UserId, holiday.StartDay.ToString("yyyy-MM-dd"), holiday.EndDay.ToString("yyyy-MM-dd"), holiday.DailyDurationInMins, holiday.NumberOfWorkDays, holiday.HolidayCategoryName, holiday.ApprovedBy));
        }
      }
    
GetIssueByCode
Description:
Returns the issue for the given issueCode. Returns NULL when no issue was found.
Signature:
public Issue GetIssueByCode(string issueCode)
Return values:

      Issue
    
Arguments:
Type Name Direction Description
string issueCode In This field is the unique identifier of the issue. Maximum 1 issue can exist for an issueCode.
Example code (C#):

      public void Execute()
      {
        var issueCode = "ABCDEFGH";
        var issue1 = GetIssueByCode(issueCode);
        Log(String.Format("Issue1: IssueCode: {0}, State: {1}, Subject: {2}, Company: {3}", issue1.IssueCode, issue1.State, issue1.Subject, issue1.Company));
      }
    
GetLocalizedText
Description:
Returns the localized text for the given key in the given language (culture).
Signature:
public string GetLocalizedText(string key, string cultureName)
Return values:

      String.
    
Arguments:
Type Name Direction Description
string key In The key of the text. Keys might be existing in the website resource files, or could be manually added by using the AddCustomLocalization() function.
string cultureName In The language the text should be localized to. This parameter is optional, if omitted the text will be returned in the report's language. Use the CultureNames class for defining the culture name.
Example code (C#):

      public void Execute()
      {
         var customResxKey = "MyCustomKey";
          AddCustomLocalization(customResxKey, "MyCustomValue_eng", CultureNames.English);
          AddCustomLocalization(customResxKey, "MyCustomValue_kor", CultureNames.Korean);

          // existing resx key
          Log(String.Format("reportLanguage: {0}", GetLocalizedText("AdminAccessLevel")));
          Log(String.Format("specific language: {0}", GetLocalizedText("AdminAccessLevel", CultureNames.English)));

          Log(String.Format("exists: {0}", GetLocalizedText(customResxKey, CultureNames.English)));
          Log(String.Format("exists: {0}", GetLocalizedText(customResxKey, CultureNames.Korean)));
          Log(String.Format("not exists in Japanese, fallback to English: {0}", GetLocalizedText(customResxKey, CultureNames.Japanese)));
      }
    
GetMessagesOfUser
Description:
Gets all messages sent to the specified user.
Signature:
public List<Message> GetMessagesOfUser(int userId)
Return values:

      List of Messages
    
Arguments:
Type Name Direction Description
int userId In Represents the id of the user.
Example code (C#):

      public void Execute()
      {
      var messagesOfUser = GetMessagesOfUser(123);

      foreach(var message in messagesOfUser)
      Log(String.Format("Message: Id: {0}, TargetUserId: {1}, Type: {2}, Content: {3}, Target: {4}, CreatedAt: {5}, LastUpdatedAt: {6}, PCSentLastAt: {7}, MobileLastSentAt: {8}, PCLastReadAt: {9}, MobileLastReadAt: {10}, DeletedAt: {11}",
      message.Id, message.TargetUserId, message.Type, message.Content, message.Target, message.CreatedAt, message.LastUpdatedAt, message.PCSentLastAt, message.MobileLastSentAt, message.PCLastReadAt, message.MobileLastReadAt, message.DeletedAt));
      }
    
GetMobileFileUploadById
Description:
Returns the MobileFileUpload object for the given fileId. Returns null when no item was found.
Signature:
public MobileFileUpload GetMobileFileUploadById(int fileId)
Return values:

      A MobileFileUpload object.
    
Arguments:
Type Name Direction Description
int fileId In Id of the uploaded file.
Example code (C#):

      public void Execute()
      {
          var fileId = 12345;
          var item = GetMobileFileUploadById(fileId);
          Log(String.Format("Id: {0} | UserId: {1} | TaskId: {2} | Date: {3} | Note: {4} | Extension: {5} | ContentLengthInBytes: {6}", file.Id, file.UserId, file.TaskId, file.Date.ToString("yyyy-MM-dd HH:mm:ss"), file.Note, file.Extension, file.Content.Length));
      }
    
GetMobileFileUploadsOfUser
Description:
Returns the list of MobileFileUpload for the given userId. Returns an empty list when no items are found.
Signature:
public List<MobileFileUpload> GetMobileFileUploadsOfUser(int userId)
Return values:

      List of MobileFileUpload objects.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
          var userId = 12345;
          var fileUploads = GetMobileFileUploadsOfUser(userId);
          foreach(var file in fileUploads)
          {
            Log(String.Format("Id: {0} | UserId: {1} | TaskId: {2} | Date: {3} | Note: {4} | Extension: {5} | ContentLengthInBytes: {6}", file.Id, file.UserId, file.TaskId, file.Date.ToString("yyyy-MM-dd HH:mm:ss"), file.Note, file.Extension, file.Content.Length));
          }
      }
    
GetMobileLocationsOfUser
Description:
Returns the mobile locations for the given user. Returns empty list when user does not exist.
Signature:
public List<MobileLocation> GetMobileLocationsOfUser(int userId)
Return values:

      List of MobileLocation.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
         var userId = 123;
          var locations = GetMobileLocationsOfUser(userId);
         foreach (var location in locations)
          {
           Log(String.Format("Id: {0} | UserId: {1} | TaskId: {2} | Longitude: {3} | Latitude: {4} | Accuracy: {5} | Date: {6} ", location.Id, location.UserId, location.TaskId, location.Longitude, location.Latitude, location.Accuracy, location.Date.ToString("yyyy-MM-dd HH:mm:ss")));
          }
      }
    
GetMobilePhoneCallByCallId
Description:
Returns the mobile phone call related to the given callId or NULL when callId was not found.
Signature:
public MobilePhoneCall GetMobilePhoneCallByCallId(long callId)
Return values:

      MobilePhoneCall for the given callId
    
Arguments:
Type Name Direction Description
long callId In Id for the phone call.
Example code (C#):

      public void Execute()
      {
          var callId = 123456;
          var call = GetMobilePhoneCallByCallId(callId);
          Log(String.Format("CallId: {0} | UserId: {1} | PhoneNumber: {2} | IsInbound: {3} | MobileContactFirstName: {4} | MobileContactLastName: {5} | StartDate: {6} | EndDate: {7}", call.CallId, call.UserId, call.PhoneNumber, call.IsInbound, call.MobileContactFirstName, call.MobileContactLastName, call.StartDate, call.EndDate));
      }
    
GetMobilePhoneCallsOfUser
Description:
Returns the list of User's mobile phone calls for the given userId.
Signature:
public List<MobilePhoneCall> GetMobilePhoneCallsOfUser(int userId)
Return values:

      List of MobilePhoneCall for the given userId
    
Arguments:
Type Name Direction Description
int userId In Id for the user.
Example code (C#):

      public void Execute()
      {
          var userId = 1234;
          var allCalls = GetMobilePhoneCallsOfUser(userId);
          foreach(var item in allCalls)
          {
              Log(String.Format("CallId: {0} | UserId: {1} | PhoneNumber: {2} | IsInbound: {3} | MobileContactFirstName: {4} | MobileContactLastName: {5} | StartDate: {6} | EndDate: {7}", item.CallId, item.UserId, item.PhoneNumber, item.IsInbound, item.MobileContactFirstName, item.MobileContactLastName, item.StartDate, item.EndDate));
          }
      }
    
GetMobileZoneGroupById
Description:
Returns the information for the given (mobile zone group). Returns null when zone group does not exist.
Signature:
public MobileZoneGroup GetMobileZoneGroupById(int zoneGroupId)
Return values:

      List of MobileZoneGroup.
    
Arguments:
Type Name Direction Description
int zoneGroupId In Id of the zone group.
Example code (C#):

      public void Execute()
      {
         var zoneGroupId = 111;
          var zoneGroup = GetMobileZoneGroupById(zoneGroupId);
  
         Log(String.Format("zoneGroup: Name: {0}, SiteId: {1}", zoneGroup.Name, zoneGroup.SiteId));
      }
    
GetMobileZoneSiteById
Description:
Returns the information for the given (mobile zone site). Returns null when site does not exist.
Signature:
public MobileZoneSite GetMobileZoneSiteById(int siteId)
Return values:

      MobileZoneSite.
    
Arguments:
Type Name Direction Description
int siteId In Id of the site.
Example code (C#):

      public void Execute()
      {
         var siteId = 222;
         var zoneSite = GetMobileZoneSiteById(siteId);
  
          Log(String.Format("zoneSite: Name: {0}, Address: {1}, Longitude: {2}, Latitude: {3}, Radius: {4}", zoneSite.Name, zoneSite.Address, zoneSite.Longitude, zoneSite.Latitude, zoneSite.Radius));
      }
    
GetNextTup
Description:
This function returns the list of WorkItems (a.k.a. tups). Due to its internal "yield return" implementation it can return the tup when it is already pre-processed, you don't need to wait for the whole list to be pre-processed. Can be used only when Streaming capability is turned on. When currently no pre-processed tup is available, the thread waits (gets blocked). When all the tups are pre-processed and no more will be available the List (foreach) ends and the script continues.
Signature:
public IEnumerable<WorkItem> GetNextTup()
Return values:

      List of pre-processed workitems.
    
Arguments:
Type Name Direction Description
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          // process the tups the way you want
        }
      }
    
GetParentTask
Description:
Returns the closest parent task of the Task for the given taskId. Returns NULL when the task was not found.
Signature:
public Task GetParentTask(int taskId)
Return values:

      The closest parent of the task.
    
Arguments:
Type Name Direction Description
int taskId In Id for the Task.
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          var parentProject = GetParentTask(tup.WorkId);
          Log(String.Format("Id: {0} | ParentId: {1} | Name: {2} | TemplateTaskId: {3}", parentProject.Id, parentProject.ParentId, parentProject.Name, parentProject.TemplateTaskId));
        }
      }
    
GetParentTasks
Description:
Returns the parent tasks of the Task for the given taskId. The order of tasks are bottom to top, so the closest parent is the first while the company root is the last element in the result list. Returns an empty list when the task was not found.
Signature:
public List<Task> GetParentTasks(int taskId)
Return values:

      List of parent tasks.
    
Arguments:
Type Name Direction Description
int taskId In Id for the Task.
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          var tasks = GetParentTasks(tup.WorkId);
          foreach(var task in tasks)
          {
              Log(String.Format("Id: {0} | ParentId: {1} | Name: {2} | TemplateTaskId: {3}", task.Id, task.ParentId, task.Name, task.TemplateTaskId));
          }
        }
      }
    
GetParticipantsOfProject
Description:
Returns the project membership information (project participants) for the given project. Returns empty list when project was not found.
Signature:
public List<ProjectParticipant> GetParticipantsOfProject(int projectId)
Return values:

      List of ProjectParticipant.
    
Arguments:
Type Name Direction Description
int projectId In Id of the project.
Example code (C#):

      public void Execute()
      {
          var projectId = 222;
          var projectParticipants = GetParticipantsOfProject(projectId);
  
         foreach(var item in projectParticipants)
          {
           Log(String.Format("projectParticipants: UserId: {0}, ProjectId: {1}, IsLeader: {2}", item.UserId, item.ProjectId, item.IsLeader));
          }
      }
    
GetPOIForLocation
Description:
Gets the POI (if exists) based on a location (MobileLocation, FilteredLocation). If there is no POI associated with the submitted location, the method returns null.
Signature:
public ProductivityCategory GetPOIForLocation(ILocation location)
Return values:

      POI class
    
Arguments:
Type Name Direction Description
ILocation (MobileLocation, FilteredLocation) location In A MobileLocation or FilteredLocation type data.
Example code (C#):

      public void Execute()
      {        
        var userId = 1; 
        var taskId = 5785548;
        var myLocation = new MobileLocation {
            Id = 1,
            UserId = userId,
            TaskId = taskId,
            Date = DateTime.Now,
            Longitude = 19.4258,
            Latitude = 47.589,
            Accuracy = 200
        };
        var poi = GetPOIForLocation(myLocation);
        if (poi != null)
        {
            Log(GetProductivityCategoryForPOI(poi.Id, userId).ToString());
        }
        else
        {
            Log("No POI for the given location, productivity can not be calculated");
        }
      }
    
GetProductivityCategoryForEmail
Description:
Gets the productivity category for the given email address. A ProductivityCategory can be: Productive, Unproductive, Neutral and Unknown. Returns Unknown when email's category has not been defined yet.
Signature:
public ProductivityCategory GetProductivityCategoryForEmail(string email, int userId)
Return values:

      ProductivityCategory enum.
    
Arguments:
Type Name Direction Description
string email In Email address to be queried
int userId In The Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 111;
        Log(GetProductivityCategoryForEmail("info@jobctrl.com", userId).ToString());      
        Log(GetProductivityCategoryForEmail("", userId).ToString());
      }
    
GetProductivityCategoryForPath
Description:
Gets the productivity category for the given path and userId. A ProductivityCategory can be: Productive, Unproductive, Neutral and Unknown. Returns Unknown when path is invalid or it's category has not been defined yet.
Signature:
public ProductivityCategory GetProductivityCategoryForPath(string path, int userId)
Return values:

      ProductivityCategory enum.
    
Arguments:
Type Name Direction Description
string path In Path retrieved by the client.
int userId In The Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 111;
        Log(GetProductivityCategoryForPath("c:\Users\myUser\Documents", userId).ToString());
        Log(GetProductivityCategoryForPath("file://sharepoint/myDocumentList/official.xls", userId).ToString());
        Log(GetProductivityCategoryForPath("Customers", userId).ToString());
      }
    
GetProductivityCategoryForPOI
Description:
Gets the productivity category for the given POIId and UserId. The POI can be calculated based on the location information with the GetPOIForLocation method.
Signature:
public ProductivityCategory GetProductivityCategoryForPOI(int poiId, int userId)
Return values:

      ProductivityCategory enum.
    
Arguments:
Type Name Direction Description
int poiId In Id of the POI.
int userId In The Id of the user.
Example code (C#):

      public void Execute()
      {        
        var userId = 1; 
        var taskId = 5785548;
        var myLocation = new MobileLocation {
            Id = 1,
            UserId = userId,
            TaskId = taskId,
            Date = DateTime.Now,
            Longitude = 19.4258,
            Latitude = 47.589,
            Accuracy = 200
        };
        var poi = GetPOIForLocation(myLocation);
        if (poi != null)
        {
            Log(GetProductivityCategoryForPOI(poi.Id, userId).ToString());
        }
        else
        {
            Log("No POI for the given location, productivity can not be calculated");
        }
      }
    
GetProductivityCategoryForProcess
Description:
Gets the productivity category for the given process name and userId. A ProductivityCategory can be: Productive, Unproductive, Neutral and Unknown. Returns Unknown when process name is invalid or it's category has not been defined yet.
Signature:
public ProductivityCategory GetProductivityCategoryForProcess(string processName, int userId)
Return values:

      ProductivityCategory enum.
    
Arguments:
Type Name Direction Description
string processName In Name of the process (the EXE name).
int userId In The Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 111;
        Log(GetProductivityCategoryForProcess("OUTLooK.ExE", userId).ToString());
        Log(GetProductivityCategoryForProcess("outlook.exe", userId).ToString());
        Log(GetProductivityCategoryForProcess("notExisting.ExE", userId).ToString());
        Log(GetProductivityCategoryForProcess("", userId).ToString());
      }
    
GetProductivityCategoryForTask
Description:
Gets the productivity category for the given taskId and userId. A ProductivityCategory can be: Productive, Nonproductive, Neutral and Unknown. Returns Unknown when taskId is invalid or it's category has not been defined yet. This function omits the restrictions for ItemTypes.
Signature:
public ProductivityCategory GetProductivityCategoryForTask(int taskId, int userId)
Return values:

      ProductivityCategory enum.
    
Arguments:
Type Name Direction Description
int taskId In Id of the task retrieved by the client.
int userId In The Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 111;
        var taskId = 5785548;
        Log(GetProductivityCategoryForTask(taskId, userId).ToString());
      }
    
GetProductivityCategoryForTask (with ItemType)
Description:
Gets the productivity category for the given taskId, userId and workitem type. A ProductivityCategory can be: Productive, Nonproductive, Neutral and Unknown. Returns Unknown when taskId is invalid or it's category has not been defined yet. Only returns the productivity type when the productivity setting is not restricted at all or restricted for the given type. Otherwise it returns Unknown.
Signature:
public ProductivityCategory GetProductivityCategoryForTask(int taskId, int userId, ItemType type)
Return values:

      ProductivityCategory enum.
    
Arguments:
Type Name Direction Description
int taskId In Id of the task retrieved by the client.
int userId In The Id of the user.
ItemType type In Type of the work item (enum). Possible values are: Pc, Mobile, Manual, AdhocMeeting, CalendarMeeting. Any other types are considered non productive.
Example code (C#):

      public void Execute()
      {
        var userId = 111;
        var taskId = 5785548;
        var type = ItemType.Pc;
        Log(GetProductivityCategoryForTask(taskId, userId, type).ToString());
      }
    
GetProductivityCategoryForTask (with TaskItemType)
Description:
Gets the productivity category for the given taskId, userId and task item type. A ProductivityCategory can be: Productive, Nonproductive, Neutral and Unknown. Returns Unknown when taskId is invalid or it's category has not been defined yet. Only returns the productivity type when the productivity setting is not restricted at all or restricted for the given type. Otherwise it returns Unknown.
Signature:
public ProductivityCategory GetProductivityCategoryForTask(int taskId, int userId, TaskItemType type)
Return values:

    ProductivityCategory enum.
  
Arguments:
Type Name Direction Description
int taskId In Id of the task retrieved by the client.
int userId In The Id of the user.
TaskItemType type In Type of the work item (enum). Possible values are: Pc, Mobile, MobileCall, Manual, AdhocMeeting, CalendarMeeting. Any other types are considered non productive.
Example code (C#):

    public void Execute()
    {
          var userId = 111;
          var taskId = 5785548;
          var type = TaskItemType.Pc;
          Log(GetProductivityCategoryForTask(taskId, userId, type).ToString());
    }
  
GetProductivityCategoryForUrl
Description:
Gets the productivity category for the given url and userId. A ProductivityCategory can be: Productive, Unproductive, Neutral and Unknown. Only the Host-part of the Url counts, other parts are discarded. Returns Unknown when url is invalid or it's category has not been defined yet.
Signature:
public ProductivityCategory GetProductivityCategoryForUrl(string url, int userId)
Return values:

      ProductivityCategory enum.
    
Arguments:
Type Name Direction Description
string url In URL retrieved by the client.
int userId In The Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 111;
        Log(GetProductivityCategoryForUrl("http://localHOST/", userId).ToString());
        Log(GetProductivityCategoryForUrl("http://index.hu/not_Host_parts_are_discarded/", userId).ToString());
        Log(GetProductivityCategoryForUrl("http://nonExistingUrl.com", userId).ToString());
        Log(GetProductivityCategoryForUrl("InvalidSiteUrl", userId).ToString());
        Log(GetProductivityCategoryForUrl("", userId).ToString());
      }
    
GetProfilePictureForUser
Description:
Returns a the user's profile picture which is also shown on the website, in 64x64 pixel size. When user doesn't have any pictures uploaded then the default is returned.
Signature:
public byte[] GetProfilePictureForUser(int userId)
Return values:

      Binary of user profile picture
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
          var userId = 12345678;
         var profilePicture = GetProfilePictureForUser(userId);
          if (profilePicture != null && profilePicture.Length > 0)
           Log("Picture is not empty.");  
      }
    
GetProjectsOfUser
Description:
Returns the project membership information (project participants) for the given user. Returns empty list when user was not found.
Signature:
public List<ProjectParticipant> GetProjectsOfUser(int userId)
Return values:

      List of ProjectParticipant.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
         var userId = 111;
         var projectParticipants = GetProjectsOfUser(userId);
  
         foreach(var item in projectParticipants)
          {
           Log(String.Format("projectParticipants: UserId: {0}, ProjectId: {1}, IsLeader: {2}", item.UserId, item.ProjectId, item.IsLeader));
          }
      }
    
GetRatingsForTaskAssignment
Description:
Returns the ratings for a given user-task assignment. Returns empty list when user or task was not found.
Signature:
public List<Rating> GetRatingsForTaskAssignment(int userId, int taskId)
Return values:

      List of Rating.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
int taskId In Id of the task.
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          var userId = tup.UserId;
          var taskId = tup.WorkId;
          var ratings = GetRatingsForTaskAssignment(userId, taskId);
          foreach(var rating in ratings)
          {
              Log(String.Format("UserId: {0} | TaskId: {1} | RatedByUserId: {2} | Score: {3} | CreateDate: {4} | Description: {5}", rating.UserId, rating.TaskId, rating.RatedByUserId, rating.Score, rating.CreateDate, rating.Description));
          }
        }
      }
    
GetReasonTreeItemById
Description:
Reasons are a hierarchical structure where we can add text to the items. Reasons can be created and assigned to a user on the website and be used in the client to create user reasons. Returns the reason tree item for the given reason tree item id.
Signature:
public ReasonTreeItem GetReasonTreeItemById(int reasonTreeItemId)
Return values:

      Reason tree item given to the reason tree item id.
    
Arguments:
Type Name Direction Description
int reasonTreeItemId In Id of the reason tree item.
Example code (C#):

      public void Execute()
      {
        var reasonTreeItemId = 12345;
        var reasonTreeItem1 = GetReasonTreeItemById(reasonTreeItemId);

        Log(String.Format("Id: {0}, | ParentId: {1}, | Name: {2}",  reasonTreeItem1.Id, reasonTreeItem1.ParentId, reasonTreeItem1.Name));
      }
    
GetReportContext
Description:
Get the report parameters (report context) for the current query.
Signature:
public ReportContext GetReportContext()
Return values:

      The report's parameters.
    
Arguments:
Type Name Direction Description
Example code (C#):

      public void Execute()
      {
        var ctx = GetReportContext();
       Log(ctx.ReportUserId);
        Log(ctx.LocalStartDate.ToString("yyyy-MM-dd"));
        Log(ctx.LocalEndDate.ToString("yyyy-MM-dd"));
        Log(ctx.DefinitionName);
        Log(ctx.CompanyName);
        Log(ctx.ReportCultureName);
        Log(ctx.CompanyDefaultEmailDomain);
        Log(String.Join(" | ", ctx.CapturedKeys));
        Log(String.Join(" | ", ctx.UserIds.Select(t => t.ToString()).ToList()));
      }
    
GetReporterUser
Description:
Gets the User who is querying the report.
Signature:
public User GetReporterUser()
Return values:

      The user who is querying the report.
    
Arguments:
Type Name Direction Description
Example code (C#):

      public void Execute()
      {
        var user1 = GetReporterUser();
        Log(String.Format("Id: {0} | FN: {1} | LN: {2} | Email: {3} | ExternalId: {4} | AccessLevel: {5} | IsRegistrator: {6} | DeletedAt: {7}", user1.Id, user1.FirstName, user1.LastName, user1.Email, user1.ExternalId, user1.AccessLevel, user1.IsRegistrator, user1.DeletedAt));
      }
    
GetRoleById
Description:
Returns the Role for the given roleId or NULL when roleId was not found.
Signature:
public Role GetRoleById(int roleId)
Return values:

      Role for the given roleId
    
Arguments:
Type Name Direction Description
int roleId In Id for the role.
Example code (C#):

      public void Execute()
      {
          var roleId = 12345;
          var role1 = GetUserById(roleId);
          if (role1 != null)
              Log(String.Format("Id: {0} | Name: {1} | Priority: {2} | Type: {3} | GroupId: {4}", role1.Id, role1.Name, role1.Priority, role1.Type, role1.GroupId));
      }
    
GetRoles
Description:
Returns the list of Roles for the whole company.
Signature:
public List<Role> GetRoles()
Return values:

      List of roles.
    
Arguments:
Type Name Direction Description
Example code (C#):

      public void Execute()
      {
          var allRoles = GetRoles();
          foreach(var item in allRoles)
          {
              Log(String.Format("Id: {0} | Name: {1} | Priority: {2} | Type: {3} | GroupId: {4}", item.Id, item.Name, item.Priority, item.Type, item.GroupId));
          }
      }
    
GetScheduleCategoryById
Description:
Returns the information for the given (schedule category). Returns null when the category does not exist.
Signature:
public ScheduleCategory GetScheduleCategoryById(int categoryId)
Return values:

      ScheduleCategory object
    
Arguments:
Type Name Direction Description
int categoryId In Id of the category.
Example code (C#):

      public void Execute()
      {
          var categoryId = 1234;
          var category = GetScheduleCategoryById(categoryId);
          LogCategory(category);
      }

      public void LogCategory(ScheduleCategory category)
      {
      Log(String.Format("Id: {0} | Name: {1} | ColorCode: {2} | DeletedAt: {3}", category.Id, category.Name, category.ColorCode, category.DeletedAt.HasValue ? category.DeletedAt.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""));
      }
    
GetSickLeavesForUser
Description:
Returns the sick leaves for the given user. Returns empty list when user was not found.
Signature:
public List<SickLeave> GetSickLeavesForUser(int userId)
Return values:

      List of SickLeaves.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var sickLeaves = GetSickLeavesForUser(userId);
  
        foreach(var sickLeave in sickLeaves)
        {
            Log(String.Format("UserId: {0}, StartDay: {1}, EndDay: {2}, DailyDurationInMins: {3}, NumberOfWorkDays: {4}", sickLeave.UserId, sickLeave.StartDay.ToString("yyyy-MM-dd"), sickLeave.EndDay.ToString("yyyy-MM-dd"), sickLeave.DailyDurationInMins, sickLeave.NumberOfWorkDays));
        }
      }
    
GetTableFromFile
Description:
Returns the data stored on a separate data source's excel sheet with the given file and sheet names used by the current definition. The result is a DataTable class with column names and rows, what you can traverse and process. Returns null if the filename is null/empty/whitespace, or if the file was not found.
Signature:
public DataTable GetTableFromFile(string fileName, string sheetName)
Return values:

      Semi-structured data from the given sheet.
    
Arguments:
Type Name Direction Description
string fileName In Name of the data source file.
string sheetName In Name of the sheet that contains the data.
Example code (C#):

      public void Execute()
      {
        var sheet = GetTableFromFile("dataSourceFileName","sheetName");
        foreach (var row in sheet.Rows)
        {
            Log(row[0].ToString() + " " + row[1].ToString());
        }
      }
    
GetTableFromTemplate
Description:
Returns the data stored on the sheet with the given name in the excel template used by the current definition. The result is a DataTable class with column names and rows, what you can traverse and process. Returns empty DataTable when sheet was not found.
Signature:
public DataTable GetTableFromTemplate(string sheetName)
Return values:

      Semi-structured data from the given sheet.
    
Arguments:
Type Name Direction Description
string sheetName In Name of the sheet that contains the data.
Example code (C#):

      public void Execute()
      {
        var sheet = GetTableFromTemplate("sheetName");
        foreach (var row in sheet.Rows)
        {
            Log(row[0].ToString() + " " + row[1].ToString());
        }
      }
    
GetTablesFromFile
Description:
Returns the data stored on all of the sheets of a data source used by the current difinition. The result is a List of DataTable class with column names and rows, what you can traverse and process. Returns null if the filename is null/empty/whitespace, or if the file was not found.
Signature:
public List<DataTable> GetTablesFromFile(string fileName)
Return values:

      List of semi-structured data from all of the sheets of the file.
    
Arguments:
Type Name Direction Description
string fileName In Name of the data source file.
Example code (C#):

      public void Execute()
      {
        var tables = GetTablesFromFile("dataSourceFileName");
        foreach(var table in tables)
        {
          foreach (var row in table.Rows)
          {
            Log(row[0].ToString() + " " + row[1].ToString());
          }  
        }
      }
    
GetTaskAssignmentForUserAndTask
Description:
Returns the TaskAssignment for the given task and user. Returns NULL when task or user was not found.
Signature:
public TaskAssignment GetTaskAssignmentForUserAndTask(int userId, int taskId)
Return values:

      A TaskAssignment object representing a user-task assignment.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
int taskId In Id of the task.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var taskId = 12345;
        var assignment = GetTaskAssignmentForUserAndTask(userId, taskId);
        var nonExistingAssignment = GetTaskAssignmentForUserAndTask(userId, 999999999);
        
        Log(String.Format("UserId: {0} | TaskId: {1} | StartDate: {2} | EndDate: {3} | PlannedWorktimeInMinutes: {4} | Status: {5} | DeletedAt: {6}", assignment.UserId, assignment.TaskId, assignment.StartDate, assignment.EndDate, assignment.PlannedWorktimeInMinutes, assignment.Status, assignment.DeletedAt));
        Log("nonExistingAssignment is " + (nonExistingAssignment == null ? "" : "NOT") + " null");
      }
    
GetTaskAssignmentHistories
Description:
Returns the history of a user-task assignment for the given user and task. Returns empty list when user or task was not found.
Signature:
public List<TaskAssignmentHistory> GetTaskAssignmentHistories(int userId, int taskId)
Return values:

      List of TaskAssignmentHistory.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
int taskId In Id of the task.
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
         var userId = tup.UserId;
          var taskId = tup.WorkId;
         var historyItems = GetTaskAssignmentHistories(userId, taskId);
         foreach(var history in historyItems)
          {
            Log(String.Format("UserId: {0} | TaskId: {1} | ChangedByUserId: {2} | ChangedAt: {3} | Status: {4} | StartDate: {5} | EndDate: {6} | PlannedWorktimeInMinutes: {7}", history.UserId, history.TaskId, history.ChangedByUserId, history.ChangedAt, history.Status, history.StartDate, history.EndDate, history.PlannedWorktimeInMinutes));
          }
        }
      }
    
GetTaskAssignmentsForTask
Description:
Returns the TaskAssignments for the given task. Returns empty list when task was not found.
Signature:
public List<TaskAssignment> GetTaskAssignmentsForTask(int taskId)
Return values:

      List of TaskAssignments.
    
Arguments:
Type Name Direction Description
int taskId In Id of the task.
Example code (C#):

      public void Execute()
      {
        var taskId = 12345;
        var list1 = GetTaskAssignmentsForTask(taskId);
        
        foreach(var item in list1)  
          Log(String.Format("UserId: {0} | TaskId: {1} | StartDate: {2} | EndDate: {3} | PlannedWorktimeInMinutes: {4} | Status: {5} | DeletedAt: {6}", item.UserId, item.TaskId, item.StartDate, item.EndDate, item.PlannedWorktimeInMinutes, item.Status, item.DeletedAt));
      }
    
GetTaskAssignmentsForUser
Description:
Returns the TaskAssignments for the given user. Returns empty list when user was not found.
Signature:
public List<TaskAssignment> GetTaskAssignmentsForUser(int userId)
Return values:

      List of TaskAssignments.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var list1 = GetTaskAssignmentsForUser(userId);
        
        foreach(var item in list1)  
          Log(String.Format("UserId: {0} | TaskId: {1} | StartDate: {2} | EndDate: {3} | PlannedWorktimeInMinutes: {4} | Status: {5} | DeletedAt: {6}", item.UserId, item.TaskId, item.StartDate, item.EndDate, item.PlannedWorktimeInMinutes, item.Status, item.DeletedAt));
      }
    
GetTaskById
Description:
Returns the Task for the given taskId. Returns NULL when task was not found. Only tasks in tup collection are contained in the internal TaskCollection.
Signature:
public Task GetTaskById(int taskId)
Return values:

      Task for the given taskId.
    
Arguments:
Type Name Direction Description
int taskId In Id for the Task.
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          var task1 = GetTaskById(tup.WorkId);
          if (task1 == null)
            Log("Task was not found which should be impossible.");
          else
            Log(String.Format("Id: {0} | ParentId: {1} | Name: {2} | TemplateTaskId: {3} | CategoryName: {4} | CategoryId: {5} | ExtId: {6} | TaxId: {7} | TargetStartDate: {8} | TargetEndDate: {9} | TargetCost: {10} | Description: {11} | Priority: {12} | TargetPlannedWorkTimeInMinutes: {13}", task1.Id, task1.ParentId, task1.Name, task1.TemplateTaskId, task1.CategoryName, task1.CategoryId, task1.ExtId, task1.TaxId, task1.TargetStartDate, task1.TargetEndDate, task1.TargetCost, task1.Description, task1.Priority, task1.TargetPlannedWorkTimeInMinutes));
        }
      }
    
GetTaskGroupById
Description:
Returns the task group for the given groupId. Returns NULL when groupId was not found.
Signature:
public TaskGroup GetTaskGroupById(int groupId)
Return values:

      Task group for the groupId.
    
Arguments:
Type Name Direction Description
int groupId In Id of the task group.
Example code (C#):

      public void Execute()
      {
        var groupId = 12345;
        var group1 = GetTaskGroupById(groupId);
        var nonExistingGroup = GetTaskGroupById(999999999);

        Log(String.Format("Id: {0} | Name: {1}", group1.Id, group1.Name));
        foreach(var containedTaskId in group1.ContainedTaskIds)
          Log(String.Format("TaskId: {0}", containedTaskId));

        Log("nonExistingGroup is" + (nonExistingGroup == null ? "" : "NOT") + " null");
      }
    
GetTaskHistories
Description:
Returns of the History of the given Task. Returns empty list when task was not found.
Signature:
public List<TaskHistory> GetTaskHistories(int taskId)
Return values:

      History of the given task.
    
Arguments:
Type Name Direction Description
int taskId In Id of the task.
Example code (C#):

      public void Execute()
      {
        var taskIds = new HashSet<int>();
        foreach (var tup in GetNextTup())
        {
           taskIds.Add(tup.WorkId);
        }
      
        foreach(var taskId in taskIds)
        {
            var historyItems = GetTaskHistories(taskId);
           foreach(var history in historyItems)
            {
              Log(String.Format("TaskId: {0} | ChangedByUserId: {1} | Name: {2} | ChangedAt: {3} | Status: {4} | Priority: {5}", history.TaskId, history.ChangedByUserId, history.Name, history.ChangedAt, history.Status, history.Priority));
            }
        }
      }
    
GetTodoListForUserDay
Description:
Returns the to-do list for the given user's given day. Returns NULL when user has no to-do list for the day.
Signature:
public TodoList GetTodoListForUserDay(int userId, DateTime day)
Return values:

      TodoList object
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
DateTime day In A day from the calendar (without TimeOfDay part).
Example code (C#):

      public void Execute()
      {
          var userId = 1234;
          var day = new DateTime(2020, 3, 10);
          var todoList = GetTodoListForUserDay(userId, day);
          Log(String.Format("UserId: {0} | Day: {1}", todoList.UserId, todoList.Day.ToString("yyyy-MM-dd")));
          foreach(var item in todoList.Items)
              Log(String.Format("Name: {0} | Status: {1} | Priority: {2}", item.Name, item.Status, item.Priority));
      }
    
GetUserByExternalId
Description:
Returns the User for the given externalId. Returns NULL when user was not found.
Signature:
public User GetUserByExternalId(string extId)
Return values:

      User for the given userId
    
Arguments:
Type Name Direction Description
string extId In Unique identifier for the user from an external system/source (e.g. SAP, MsProject, CRM, etc...).
Example code (C#):

      public void Execute()
      {
        var user1 = GetUserByExternalId("Company_Unique_Identifier_For_User1");
        if (user1 != null)
          Log(String.Format("Id: {0} | FN: {1} | LN: {2} | Email: {3} | ExternalId: {4} | AccessLevel: {5} | IsRegistrator: {6} | DeletedAt: {7}", user1.Id, user1.FirstName, user1.LastName, user1.Email, user1.ExternalId, user1.AccessLevel, user1.IsRegistrator, user1.DeletedAt));
      }
    
GetUserById
Description:
Returns the User for the given userId or NULL when userId was not found.
Signature:
public User GetUserById(int userId)
Return values:

      User for the given userId
    
Arguments:
Type Name Direction Description
int userId In Id for the user.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var user1 = GetUserById(userId);
        if (user1 != null)
          Log(String.Format("Id: {0} | FN: {1} | LN: {2} | Email: {3} | ExternalId: {4} | AccessLevel: {5} | IsRegistrator: {6} | DeletedAt: {7}", user1.Id, user1.FirstName, user1.LastName, user1.Email, user1.ExternalId, user1.AccessLevel, user1.IsRegistrator, user1.DeletedAt));
      }
    
GetUserEffectiveSettingForUser
Description:
Returns the User's effective settings for the given userId or NULL when userId was not found.
Signature:
public UserEffectiveSetting GetUserEffectiveSettingForUser(int userId)
Return values:

      UserEffectiveSetting for the given userId
    
Arguments:
Type Name Direction Description
int userId In Id for the user.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var setting = GetUserEffectiveSettingForUser(userId);
        if (setting != null)
         Log(String.Format("WorktimeStartInMins: {0} | WorktimeEndInMins: {1}", setting.Client.WorktimeStartInMins, setting.Client.WorktimeEndInMins));
      }
    
GetUserGroupHistory
Description:
Returns the list of UserGroupHistoryItem for the given groupId returns an empty list when no items are found.
Signature:
public List<UserGroupHistoryItem> GetUserGroupHistory(int groupId)
Return values:

      List of UserGroupHistoryItems.
    
Arguments:
Type Name Direction Description
int groupId In Id of the group.
Example code (C#):

      public void Execute()
      {
            var groupId = 12345;
            foreach (var item in GetUserGroupHistory(groupId))
            {
                  Log(string.Format("Id: {0} | Name: {1} | ParentId: {2} | Status: {3} | ExternalId: {4} | ChangedBy: {5} | ChangedAt: {6}",
                  item.Id, item.Name, item.ParentId, item.Status, item.ExternalId, item.ChangedBy, item.ChangedAt.ToString("yyyy-MM-dd HH:mm:ss")));
            }
      }
    
GetUserHistory
Description:
Returns the list of UserHistoryItem for the given userId returns an empty list when no items are found.
Signature:
public List<UserHistoryItem> GetUserHistory()
Return values:

      List of UserHistoryItems.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
            var userId = 12345;
            foreach (var item in GetUserHistory(userId))
            {
                  Log(string.Format("Id: {0} | Email: {1} | Status: {2} | IsRegistrator: {3} | Culture: {4} | FirstName: {5} | LastName: {6} | ExternalId: {7} | ParentId: {8} | CreatedAt: {9} | CreatedBy: {10} | AccessLevel: {11}",
                  item.Id, item.Email, item.Status.ToString(), item.IsRegistrator, item.Culture.Name, item.FirstName, item.LastName, item.ExternalId, item.ParentId, item.CreatedAt.ToString("yyyy-MM-dd HH:mm:ss"), item.CreatedBy, item.AccessLevel));
            }
      }
    
GetUserName
Description:
Returns the user's full name for the given userId. The first name and last name parts are ordered regarding to the language of report. Returns empty string when user was not found.
Signature:
public string GetUserName(int userId)
Return values:

      A string containing the user's name.
    
Arguments:
Type Name Direction Description
int userId In Id for the user.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        Log(GetUserName(userId));
      }
    
GetUserReasonsByUserId
Description:
While editing a task in the client you can create user reasons. These user reasons can be assigned to a task only where only Text is filled, or to a task and a selected reason tree item.
Signature:
public List<UserReason> GetUserReasonsByUserId(int userId)
Return values:

      List of user reasons assigned to the given userId.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var user1Reasons = GetUserReasonsByUserId(userId);

        foreach(var user1Reason in user1Reasons)
        {
          Log(String.Format("UserId: {0}, | TaskId: {1}, | ReasonItemId: {2}, | Date: {3}, | Text: {4}",  user1Reason.UserId, user1Reason.TaskId, user1Reason.ReasonTreeItemId, user1Reason.Date, user1Reason.Text));
        }
      }
    
GetUsers
Description:
Returns the list of Users for the whole company, including deleted users.
Signature:
public List<User> GetUsers()
Return values:

      List of users.
    
Arguments:
Type Name Direction Description
Example code (C#):

      public void Execute()
      {
      var allUsers = GetUsers();
      foreach(var item in allUsers)
      {
      Log(String.Format("Id: {0} | FirstName: {1} | LastName: {2} | Email: {3} | ExternalId: {4} | AccessLevel: {5} | IsRegistrator: {6} | DeletedAt: {7} | LastLoginDate: {8} | UserCreatedAt: {9} | PasswordLastChangedAt: {10} | FirstWorktime: {11} | LastWorktime: {12}", item.Id, item.FirstName, item.LastName, item.Email, item.ExternalId, item.AccessLevel, item.IsRegistrator, item.DeletedAt, item.LastLoginDate, item.UserCreatedAt, item.PasswordLastChangedAt, item.FirstWorktime, item.LastWorktime));
      }
      }
    
GetUsersByName
Description:
Returns the list of Users with the given full name. Returns empty list when parameter is empty/null or when no user was found for the given name.
Signature:
public List<User> GetUsersByName(string name)
Return values:

      List of users.
    
Arguments:
Type Name Direction Description
string name In Full name of user(s).
Example code (C#):

      public void Execute()
      {
        var allUsers = GetUsersByName("John Doe");
        foreach(var item in allUsers)
        {
          Log(String.Format("Id: {0} | FN: {1} | LN: {2} | Email: {3} | ExternalId: {4} | AccessLevel: {5} | IsRegistrator: {6} | DeletedAt: {7}", item.Id, item.FirstName, item.LastName, item.Email, item.ExternalId, item.AccessLevel, item.IsRegistrator, item.DeletedAt));
        }
      }
    
GetValueOrDefault
Description:
Returns the value for the given key. Useful for getting collected values from tup.Values collection.
Signature:
public string GetValueOrDefault(Dictionary<string, string> dict, string key)
Return values:

      The value for the given key or NULL when key does not exist in the dictionary or when the dictionary itself is null.
    
Arguments:
Type Name Direction Description
Dictionary<string, string> dict In The dictionary to search in. Tipically the tup.Values collection.
string key In The key which holds the value in the dictionary.
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          var processName = GetValueOrDefault(tup.Values, "ProcessName");
          if (processName != null)
            Log("The returned processName is: " + processName);
          else
            Log("Value not found for the key 'ProcessName'");
        }
      }
    
GetWagesByUserId
Description:
Returns the hourly wages for the user. Returns emply list when user was not found.
Signature:
public List<HourlyWage> GetWagesByUserId(int userId)
Return values:

      List of hourly wages.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var wagesOfUser = GetWagesByUserId(userId);
  
        foreach(var hourlyWage in wagesOfUser)
        {
         Log(String.Format("StartDate: {0} | EndDate: {1} | Amount: {2}", hourlyWage.StartDate, hourlyWage.EndDate, hourlyWage.Amount));
        }
      }
    
GetWorkerGroupById
Description:
Returns the worker group for the given Id. Returns NULL when the group was not found.
Signature:
public WorkerGroup GetWorkerGroupById(int groupId)
Return values:

      Worker group for the given Id.
    
Arguments:
Type Name Direction Description
int groupId In Id of the group.
Example code (C#):

      public void Execute()
      {
        var user = GetReporterUser();
        var parentGroup = GetWorkerGroupById(user.GroupId);
 
        Log(String.Format("Id: {0} | Name: {1} | ParentId: {2}", parentGroup.Id, parentGroup.Name, parentGroup.ParentId));
      }
    
GetWorkerGroups
Description:
Returns all worker groups of the company.
Signature:
public List<WorkerGroup> GetWorkerGroups()
Return values:

      List of worker groups.
    
Arguments:
Type Name Direction Description
Example code (C#):

      public void Execute()
      {
        var allGroups = GetWorkerGroups();
        foreach(var group in allGroups)
        {
         Log(String.Format("Id: {0} | Name: {1} | ParentId: {2}", group.Id, group.Name, group.ParentId));
        } 
      }
    
GetWorkerGroupsOfUser
Description:
Returns the parent worker groups of the given user. The order is bottom-to-top, so the closest parent is the first while the company root (!) is the last element in the result list. Returns empty list when user was not found.
Signature:
public List<WorkerGroup> GetWorkerGroupsOfUser(int userId)
Return values:

      List of worker groups.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
Example code (C#):

      public void Execute()
      {
        var user = GetReporterUser();
        var groups = GetWorkerGroupsOfUser(user.Id);
        foreach(var group in groups)
        {
         Log(String.Format("Id: {0} | Name: {1} | ParentId: {2}", group.Id, group.Name, group.ParentId));
        }
      }
    
GetWorkName
Description:
Returns the name of the task for the given taskId. Returns empty string when task was not found. Only tasks in tup collection are contained in the internal TaskCollection.
Signature:
public string GetWorkName(int taskId)
Return values:

      Name of the task.
    
Arguments:
Type Name Direction Description
int taskId In Id for the Task.
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          Log(GetWorkName(tup.WorkId));
        }
      }
    
GetWorktimeSettingsForDay
Description:
Returns the work time settings for the given user's day. Returns NULL when user was not found.
Signature:
public WorktimeSetting GetWorktimeSettingsForDay(int userId, DateTime day)
Return values:

      Work time setting for user's day.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
DateTime day In Day of the setting.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var startDay = new DateTime(2015, 12, 1);
        var settingsForDec1 = GetWorktimeSettingsForDay(userId, startDay);
       Log(String.Format("day: {0} | IsWorkDay: {1} | DailyWorkTimeInMinutes: {2} | CoreTimeStartInMinutes: {3} | CoreTimeEndInMinutes: {4} | MinimumWorkTimeInCoreTimeInMinutes: {5}", startDay, settingsForDec1.IsWorkDay, settingsForDec1.DailyWorkTimeInMinutes, settingsForDec1.CoreTimeStartInMinutes, settingsForDec1.CoreTimeEndInMinutes, settingsForDec1.MinimumWorkTimeInCoreTimeInMinutes));
      }
    
GetWorktimeSettingsForDays
Description:
Returns the work time settings for the given user for a given period. Returns empty dictionary when user was not found.
Signature:
public Dictionary<DateTime, WorktimeSetting> GetWorktimeSettingsForDays(int userId, DateTime startDay, DateTime endDay)
Return values:

      User's Work time settings by day.
    
Arguments:
Type Name Direction Description
int userId In Id of the user.
DateTime startDay In Start day of the period.
DateTime endDay In End day of the period.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var startDay = new DateTime(2015, 12, 1);
       var endDay = new DateTime(2015, 12, 31);
        var settingsByDay = GetWorktimeSettingsForDays(userId, startDay, endDay);

       foreach (var settingOfDay in settingsByDay)
        {
          var day = settingOfDay.Key;
          var setting = settingOfDay.Value;
          Log(String.Format("day: {0} | IsWorkDay: {1} | DailyWorkTimeInMinutes: {2} | CoreTimeStartInMinutes: {3} | CoreTimeEndInMinutes: {4} | MinimumWorkTimeInCoreTimeInMinutes: {5}", day, setting.IsWorkDay, setting.DailyWorkTimeInMinutes, setting.CoreTimeStartInMinutes, setting.CoreTimeEndInMinutes, setting.MinimumWorkTimeInCoreTimeInMinutes));
        }
      }
    
LocalToUtcDate
Description:
Converts the time from local to utc time zone. By default the local time zone is the time zone of the user running the query. However this target timezone can be explicitly set.
Signature:

      public DateTime LocalToUtcDate(DateTime localDate)
      public DateTime LocalToUtcDate(DateTime localDate, TimeZoneInfo tzi)
    
Return values:

      Date in utc time zone.
    
Arguments:
Type Name Direction Description
DateTime localDate In Date to convert in local time zone.
TimeZoneInfo tzi In Optional. Local time zone (by default the current user's time zone).
Example code (C#):

      public void Execute()
      {
        var usaTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
        var now = new DateTime(2015, 10, 1, 10, 0, 0);

        Log(LocalToUtcDate(now));
        Log(LocalToUtcDate(now, usaTimeZone));
      }
    
Log
Description:
Creates a new sheet named 'Log' (for the first call only) and adds/appends the message to the end of it. Has overloads for whole numbers (long) and decimal numbers (double)
Signature:
public void Log(string message, bool addToDatabase = false)
Return values:

      None
    
Arguments:
Type Name Direction Description
string message In The message to log. Whole numbers and decimals are accepted too (without conversion), for all other types you have to call ToString().
bool addToDatabase In Determines whether the message is logged to the database as well (beside the Log sheet). Only the first 10 messages are logged to database, other messages are discarded to prevent flooding our own infrastructure. Discarded messages are added to the log sheet so they can be checked there. By default the value is false, so it won't log to database, only to the Log sheet.
Example code (C#):

      public void Execute()
      {
        Log("The current time is: " + DateTime.Now.ToString());
        Log(15);
        Log(15.5);
        Log("Log to database", true);
      }
    
ResizeImageFile
Description:
Returns the resized version of the given image.
Signature:
public byte[] ResizeImageFile(byte[] imageFile, int targetSize)
Return values:

      The resized image
    
Arguments:
Type Name Direction Description
byte[] imageFile In Id of the user.
int targetSize In The size of the longer side of the resulting image. The image is resized proportionally. The size unit is given in pixels.
Example code (C#):

      public void Execute()
      {
          var fileId = 12345;
          var item = GetMobileFileUploadById(fileId);
          var resizedImage = ResizeImageFile(item.Content, 150);
          
          Log("Resized length: " + resizedImage.Length);
      }
    
RevokeMessage
Description:
Revokes a message by id.
Signature:
public void RevokeMessage(Message message)
Return values:

      None
    
Arguments:
Type Name Direction Description
Message message In This parameter contains the unsent message to be revoked. For more information check the Message class itself.
Example code (C#):

      public void Execute()
      {
        var message = GetMessagesOfUser(123)[0];
        
        RevokeMessage(message);
      }
    
SaveTableToFile
Description:
Creates or updates the sheet of the datasource file. When file/sheet does not exist it creates a new one, while existing sheets are overridden with the given content. All other sheets in file are kept untouched. Function throws when parameters are empty or the DataTable has no TableName defined.
Signature:
public void SaveTableToFile(string fileName, DataTable sheet)
Return values:

      None
    
Arguments:
Type Name Direction Description
string fileName In Name of the datasource file. Function creates a new one when it doesn't exist.
DataTable sheet In The sheet in the excel file. It is just a simple DataTable object (same as used upon creating the result set) with a TableName property, columns and rows.
Example code (C#):

      public void Execute()
      {
        var sheet = new DataTable("TestSheet1");
        sheet.Columns.Add("Colname1");

        var row = sheet.NewRow();
        row[0] = 100;
        sheet.Rows.Add(row);

        var sheet2 = new DataTable("TestSheet2");
        sheet2.Columns.Add("Colname2");

        row = sheet2.NewRow();
        row[0] = 123;
        sheet2.Rows.Add(row);

        var myFileName = "MyFile";
        SaveTableToFile(myFileName, sheet);
        SaveTableToFile(myFileName, sheet2);
        SaveTableToFile("MyFile2", sheet2);
      }
    
SetEmailSettings
Description:
Sets the email settings related to the scheduled email sending.
Signature:
public void SetEmailSettings(ReportEmailSettings reportEmailSettings)
Return values:

      None
    
Arguments:
Type Name Direction Description
ReportEmailSettings reportEmailSettings In This field holds all the settings to be set. For more information check the ReportEmailSettings class itself.
Example code (C#):

      public void Execute()
      {
        var chart = CreateCustomChart();
        var attachment = CreateAttachmentFromChart(chart);
        var htmlContent = GetCustomHtmlContent(attachment.ContentId);
        var emailSettings = new ReportEmailSettings
        {
            AttachDefaultExcelDocument = false,
            HtmlContent = htmlContent,
            Attachments = new List<ReportEmailAttachment>{attachment}
        };
        SetEmailSettings(emailSettings);
      }
      
      public Chart CreateCustomChart()
      {
         /******
           For more examples check out Microsoft's official website: https://code.msdn.microsoft.com/Samples-Environments-for-b01e9c61
         ******/
  
        var chart1 = new Chart { Width = 500, Height = 400 };
         chart1.ChartAreas.Add(new ChartArea("ChartArea1"));
  
          var series1 = new System.Web.UI.DataVisualization.Charting.Series
          {
            Name = "Series1",
            ChartType = SeriesChartType.Column
          };
          chart1.Series.Add(series1);

        series1.Points.AddXY("John Doe", 1000);
          series1.Points.AddXY("Jane Doe", 1500);
  
         return chart1;
      }
      
      public string GetCustomHtmlContent(string contentId)
      {
        var sb = new StringBuilder();
          sb.Append("<p>The average performance is: 95%</p>");
          sb.Append("<img src=\"cid:" + contentId + "\" />");
  
         return sb.ToString();
      }
    
SetFileName
Description:
Set the file name for the downloaded excel document without extension (use the default when not set). The given name is sanitized: invalid characters are replaced by their ascii representative and the [space] is replaced by an underscore (_).
Signature:
public void SetFileName(string filename)
Return values:

      None
    
Arguments:
Type Name Direction Description
string filename In The name of the downloaded file (without extension).
Example code (C#):

      public void Execute()
      {
        Log("This line is needed only to have an existing sheet");
        SetFileName("FileNametest öüóűőúéáí");    // Output: "FileNametest_ouououeai"
      }
    
SetReportResult
Description:
Set report result to a unique text which is shown on Report Statistics page. Any value except the default "OK" is treated as an error.
Signature:
public void SetReportResult(string reportResult)
Return values:

      None
    
Arguments:
Type Name Direction Description
string reportResult In This unique text describes how the report resulted. Possible values are: "OK", "Runtime error", "Compile error", "Definition does not exist", "Has no access for report", "Report runtime exceeded". When nothing is set it is "OK". Maximum length of this text is 40 characters. When result is set multiple times the last one is used, others are discarded.
Example code (C#):

      public void Execute()
      {
        Log("This line is needed only to have an existing sheet");
        SetReportResult("Business issue");
      }
    
SetShowReport
Description:
Sets whether the report should be shown or not. Not shown reports cannot be downloaded, html format cannot be shown, and cannot be sent to the users in emails. For example set it to false if report is empty, else set it to true. By default it is always true.
Signature:
public void SetShowReport(bool showreport)
Return values:

      None
    
Arguments:
Type Name Direction Description
bool showreport In State of the report visibility
Example code (C#):

      public void Execute()
      {
        bool showReport = GetReportVisibility(); //custom method written by report team
        SetShowReport(showReport);
        if (!showReport) //if false stop the execution (do not write data)
          return;
      }
    
UpdateMessage
Description:
Updates a message by id.
Signature:
public void UpdateMessage(Message message)
Return values:

      None
    
Arguments:
Type Name Direction Description
Message message In This parameter contains the unsent message with the updated content. For more information check the Message class itself.
Example code (C#):

      public void Execute()
      {
        var message = GetMessagesOfUser(123)[0];
        message.Content = "newContent";
        
        UpdateMessage(message);
      }
    
UtcToLocalDate
Description:
Converts the time from utc to local time zone. By default the local time zone is the time zone of the user running the query. However this target timezone can be explicitly set.
Signature:

      public DateTime UtcToLocalDate(DateTime utcDate)
      public DateTime UtcToLocalDate(DateTime utcDate, TimeZoneInfo tzi)
    
Return values:

      Date in local time zone.
    
Arguments:
Type Name Direction Description
DateTime utcDate In Date to convert in UTC.
TimeZoneInfo tzi In Optional. Local time zone (by default the current user's time zone).
Example code (C#):

      public void Execute()
      {
        var usaTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
        var utcnow = new DateTime(2015, 10, 1, 9, 0, 0);

        Log(UtcToLocalDate(utcnow));
        Log(UtcToLocalDate(utcnow, usaTimeZone));
      }
    

Classes, enums
AdhocMeetingWorkItem
Description:
Manually or automatically started meeting for a period of time. Inherits from WorkItem.
Members:
Type Name Description
string Description Description of the meeting
string Participants Participants of the meeting
string Title Title of the meeting
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
           if (tup.Type == ItemType.AdhocMeeting)
            {
              var item = (AdhocMeetingWorkItem)tup;
              Log(String.Format("Adhoc | Title: {0} | Description: {1} | Participants: {2}", item.Title, item.Description, item.Participants));
            }
        }
      }
    
AudioFile
Description:
Describes a recorded audio file created by a user using the VoxCTRL client.
Members:
Type Name Description
int Id This is the unique Id of the AudioFile.
int UserId Id of the user who created the audio file using VoxCTRL client.
int? TaskId Id of the task the audio file is assigned to. This value is optional.
Guid ClientId The unique Id of the VoxCTRL client that created the audio file.
DateTime StartDate Start time of audio file creation.
DateTime? EndDate End time of audio file. Only filled when the recording ended and all of its parts have already been uploaded.
DateTime ReceiveDate Time when the file was uploaded.
DateTime? DeleteDate Time when the recorded file was deleted. Only filled when the file is deleted.
int LengthInMs Length of the recorded audio file in milliseconds.
int FileSizeInBytes Size of the recorded audio file in bytes.
string Name Name of the recorded audio file which was given in VoxCTRL client.
string Extension The extension of the audio file.
Example code (C#):

      public void Execute()
      {
          var userId = 12345678;
          foreach(var item in GetAudioFilesForUser(userId))
           Log(String.Format("Id: {0} | UserId: {1} | TaskId: {2} | ClientId: {3} | StartDate: {4} | EndDate: {5} | LengthInMs: {6} | Name: {7} | Extension: {8} | ReceiveDate: {9} | DeleteDate: {10}", item.Id, item.UserId, item.TaskId, item.ClientId, item.StartDate.ToString("yyyy-MM-dd HH:mm:ss"), item.EndDate.HasValue ? item.EndDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", item.LengthInMs, item.Name, item.Extension, item.ReceiveDate, item.DeleteDate.HasValue ? item.DeleteDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""));
      }
    
CalendarMeetingWorkItem
Description:
Outlook generated workitems for a period of time. Inherits from WorkItem.
Members:
Type Name Description
string Description Description of the meeting
string Participants Participants of the meeting
string Title Title of the meeting
string Location Location of the meeting
string OrganizerEmail Meeting organizer's email address
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          if (tup.Type == ItemType.CalendarMeeting)
          {
            var item = (CalendarMeetingWorkItem)tup;
            Log(String.Format("Calendar | Title: {0} | Description: {1} | Participants: {2} | Location: {3} | OrganizerEmail: {4}", item.Title, item.Description, item.Participants, item.Location, item.OrganizerEmail));
          }
        }
      }
    
ClientComputerKick
Description:
Client computer kicks contains information about forcing the client to go offline which is performed by a user. Kicking is possible on online monitoring page.
Members:
Type Name Description
int Id Id of the kick
int UserId UserId of the user who will be kicked
long ComputerId Id of the device of the user who is kicking.
string Reason Reason of the kick
int CreatedBy Id of the user who performs the kick. In DB it can be -1 (here not), meaning not a user but a device kicked the user (already logged in with mobile client, but we log into the same account with pc client)
DateTime CreateDate Date of kick creation request (not sent yet). Will be always earlier than SendDate.
DateTime ExpirationDate Expiration date of the kick, meaning after this time the kick cannot happen. Always will be CreateDate +15 minutes.
DateTime? SendDate Date of kick action request sending. Confirm date will be the response for it. Can be null (not sent yet or never sent).
DateTime? ConfirmDate Date of response (confirm) for kick action send date. Can be null (send date is null or no response(confirm) arrived for the kick).
int? Result Result of the kick action. Null if confirm date is null, 0 if success, 1 if already offline
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var user1ComputerKicks = GetClientComputerKicksForUser(userId);

        foreach (var computerKick in user1ComputerKicks)
        {
          Log(String.Format("Id: {0}, UserId: {1}, ComputerId: {2}, Reason: {3}, CreatedBy: {4}, CreateDate: {5}, ExpirationDate: {6}, SendDate: {7}, ConfirmDate: {8}, Result: {9}", computerKick.Id, computerKick.UserId, computerKick.ComputerId, computerKick.Reason, computerKick.CreatedBy, computerKick.CreateDate, computerKick.ExpirationDate, computerKick.SendDate, computerKick.ConfirmDate, computerKick.Result));
        }
      }
    
ClientEffectiveSetting
Description:
Describes the client related system settings of a user.
Members:
Type Name Description
int WorktimeStartInMins Start time of business hours in minutes.
int WorktimeEndInMins End time of business hours in minutes.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var setting = GetUserEffectiveSettingForUser(userId);
        if (setting != null)
         Log(String.Format("WorktimeStartInMins: {0} | WorktimeEndInMins: {1}", setting.Client.WorktimeStartInMins, setting.Client.WorktimeEndInMins));
      }
    
CollectionInitType
Description:
Describes the requirement of certain collections in FeatureRequirementSettings
Members:
Type Name Description
Example code (C#):

      public enum CollectionInitType
      {
        None = 0,
        ReportRelated = 1,
        EntireCompany = 2
      }
    
ComputerActivity
Description:
Contains the keyboard and mouse activity information for a short period of the user's working time.
Members:
Type Name Description
int UserId Id of the user.
int KeyboardActivity The number of keystrokes in the period.
int MouseActivity The number of events generated by the mouse.
bool IsRemoteDesktop Returns if the client is running in a remote session. Detected environments: Windows Remote Desktop, Teamviewer.
bool IsVirtualMachine Returns if the client is running on a virtual machine. Detected environments: VMware, Microsoft Hyper-V, Parallels Desktop, Oracle VM VirtualBox.
DateTime StartDate Start date of the sampling period.
DateTime EndDate End date of the sampling period.
Example code (C#):

      public void Execute()
      {
        var userId = 123456;
        var activities = GetActivitesForUser(userId);
        foreach(var activity in activities)
        {
          Log(String.Format("UserId: {0} | KeyboardActivity: {1} | MouseActivity: {2} | StartDate: {3} | EndDate: {4}", activity.UserId, activity.KeyboardActivity, activity.MouseActivity, activity.StartDate, activity.EndDate));
        }
      }
    
ComputerIpAddress
Description:
Describes a user's Computer Ip Address related data
Members:
Type Name Description
int Id Id of the Computer Ip Address
int UserId Id of the user whom the Computer Ip Address belongs to
int ComputerId Unique Id of a computer where the WorkItem was created
IPAddress IpAddress IP address of a user computer
bool IsCurrent Defines the current IP address of user computer (UserId-IsCurrent is not unique but UserId-ComputerId-IsCurrent is)
DateTime FirstReceiveDate Db insert time (FirstReceiveDate == LastReceiveDate if the row is inserted)
DateTime LastReceiveDate Last db update time (FirstReceiveDate != LastReceiveDate if the row is updated)
List<IPAddress> LocalIpAddresses List of local IP addresses
Example code (C#):

      public void Execute()
      {
        var userId = 123;
        foreach (var item in GetComputerIpAddressesForUser(userId))
        {
          Log(string.Format("Id: {0} | UserId: {1} | ComputerId: {2} | IpAddress: {3} | IsCurrent: {4} | FirstReceiveDate: {5} | LastReceiveDate: {6} | LocalIpAddresses: {7}",
            item.Id, item.UserId, item.ComputerId, item.IpAddress.ToString(), item.IsCurrent, item.FirstReceiveDate.ToString("yyyy-MM-dd HH:mm:ss"), item.LastReceiveDate.ToString("yyyy-MM-dd HH:mm:ss"), string.Join(", ", item.LocalIpAddresses.Select(x => x.ToString()))));
        }
      }
    
CoreTimeEffectiveSetting
Description:
Describes the core time related system settings of a user.
Members:
Type Name Description
int StartTime Start time of core time in minutes.
int EndTime End time of core time in minutes.
int StartOffset Number of minutes a user can start work later than core time starts.
int EndOffset Number of minutes a user can leave earlier before core time ends.
int MinimumWorkTime Minimum time to work between core time start and end.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var setting = GetUserEffectiveSettingForUser(userId);
        if (setting != null)
          Log(String.Format("StartTime: {0} | EndTime: {1}", setting.CoreTime.StartTime, setting.CoreTime.EndTime));
      }
    
CoreTimeException
Description:
Describes an exception for user on which day it is allowed to late from work, end it before the shift ends, etc...
Members:
Type Name Description
int Id This is the unique Id of the CoreTimeException.
int UserId User allowed the violate regulations.
DateTime Day Day when the user is allowed the violate regulations.
bool ViolateStartRule Shows if a user is allowed to start work after shift starts.
bool ViolateMinimumWorkTimeRule Shows if a user is allowed to work less than the minimum working time required in the shift.
bool ViolateEndRule Shows if a user is allowed to end work before shift ends.
Example code (C#):

      public void Execute()
      {
          var userId = 12345678;
          var day = new DateTime(2018, 5, 3);
          var exception = GetCoreTimeExceptionsForUserDay(userId, day);
          if (exception != null)
              Log(String.Format("UserId: {0} | Day: {1} | ViolateStartRule: {2} | ViolateEndRule: {3} | ViolateMinimumWorkTimeRule: {4}", exception.UserId, exception.Day, exception.ViolateStartRule, exception.ViolateEndRule, exception.ViolateMinimumWorkTimeRule));
      }
    
CultureNames
Description:
This is a just a static class holding constants for each existing language.
Members:
Type Name Description
string English It represents the English language and its value is "en-us".
string Hungarian It represents the Hungarian language and its value is "hu-hu".
string Brazil It represents the Brazil language and its value is "pt-br".
string Japanese It represents the Japanese language and its value is "ja-jp".
string Korean It represents the Korean language and its value is "ko-kr".
string SpanishMexican It represents the Spanish (Mexican) language and its value is "es-mx".
Example code (C#):

      public void Execute()
      {
         var customResxKey = "MyCustomKey";
          AddCustomLocalization(customResxKey, "MyCustomValue_eng", CultureNames.English);
          AddCustomLocalization(customResxKey, "MyCustomValue_kor", CultureNames.Korean);
      }
    
DataCollectorDefinitionFeatureRequirementSettings
Description:
Defines the features that will be accessible in the C# SourceScript
Members:
Type Name Description
List<string> RequiredCustomDataSourceNames Filenames of the Custom DataSources that are required (all of their sheets will be accessible)
CollectionInitType TaskCollectionRequirement Defines the requirement of Tasks. If set to None, Task histories, Task ratings, Task assignment histories cannot be required.
bool AreTaskRatingsRequired Defines whether Task Ratings are required or not. Cannot be true if no tasks are required. Cannot be required, if no Tasks are required.
bool AreAssignedTaskHistoriesRequired Defines whether the History of Assigned Tasks are required or not. Cannot be true if no tasks are required.
bool AreTaskHistoriesRequired Defines whether the History of Tasks are required or not. Cannot be true if no tasks are required.
CollectionInitType DailySchedulesRequirement Defines the requirement of Daily Schedules.
bool AreDailyScheduleHistoriesRequiredForReportUsers Defines whether the Daily Schedule History are required or not.
bool AreAssignedTasksRequiredForReportUsers Defines whether the Assigned Tasks are required or not.
bool AreHourlyWagesRequiredForReportUsers Defines whether the Hourly Wages are required or not.
bool AreProjectParticipantsRequiredForCompany Defines whether the Project Participants are required or not.
CollectionInitType WorkTimeSettingRequirement Defines the requirement of Worktime Settings.
bool AreTaskGroupsRequiredForCompany Defines whether the Task Groups are required or not.
CollectionInitType MissingCollectionRequirement Defines the requirement of Missings.
bool AreMobileZonesRequiredForCompany Defines whether the Mobile Zones are required or not.
bool AreReasonsRequiredForCompany Defines whether the Reasons are required or not.
bool AreComputerKicksRequiredForCompany Defines whether the Computer Kicks are required or not.
bool AreMobileLocationsRequiredForReportUsers Defines whether the Mobile Locations are required or not.
CollectionInitType UserEffectiveSettingRequirement Defines the requirement of User's Effective System Settings.
bool IsTupGenerationRequired Defines whether the Tup Generation is required or not.
bool AreIssuesRequiredForReportUsers Defines whether the Email tickets/issues are required or not.
bool IsUserProfilePictureInitRequiredForReportUsers Defines whether the Profile Pictures are required or not.
bool IsComputerIpAddressCollectionInitRequiredForReportUsers Defines whether the Computer Ip Addresses are required or not.
Example code (C#):

      public void Execute()
      {
        var ctx = GetReportContext();

        if (ctx.FeatureRequirementSettings.TaskCollectionRequirement == CollectionInitType.EntireCompany)
          Log("All tasks are required");
        if (ctx.FeatureRequirementSettings.AreMobileLocationsRequiredForReportUsers)
          Log("Mobile Locations are required");
      }
    
FilteredMobileLocation
Description:
This class is inherited from MobileLocation class and represents a location after the filtering process (using the FilterLocations() function). It has a specific collection containing all the "filtered-out" locations and also some time related properties to ease the use of the hidden location's data
Members:
Type Name Description
List<MobileLocation> GetHiddenLocations() Function for getting locations filtered out by the filtering process and "hidden behind" this FilteredMobileLocation item.
DateTime Start The Date of the first hidden location item, if there is no hidden location item, the Date of the filtered location item
DateTime Finish The Date of the last hidden location item, if there is no hidden location item, the Date of the filtered location item
TimeSpan Duration The time between the Start and Finish, if there is no hidden location item, the value is 0
Example code (C#):

      public void Execute()
      {
         var userId = 123;
          var locations = GetMobileLocationsOfUser(userId);
          foreach(var location in FilterLocations(locations))
          {
              Log(String.Format("Id: {0} | UserId: {1} | TaskId: {2} | Longitude: {3} | Latitude: {4} | Accuracy: {5} | Date: {6} | HiddenLocations.Count: {7} | Start: {8} | Finish: {9} | Duration: {10}", 
                location.Id, location.UserId, location.TaskId, location.Longitude, location.Latitude, location.Accuracy, location.Date.ToString("yyyy-MM-dd HH:mm:ss"), 
                location.HiddenLocations.Count, location.Start, location.Finish, location.Duration));
              foreach(var hiddenLocation in location.GetHiddenLocations())
              {
                  Log(String.Format("Hidden | Id: {0} | UserId: {1} | TaskId: {2} | Longitude: {3} | Latitude: {4} | Accuracy: {5} | Date: {6}", 
                    hiddenLocation.Id, hiddenLocation.UserId, hiddenLocation.TaskId, hiddenLocation.Longitude, hiddenLocation.Latitude, hiddenLocation.Accuracy, 
                    hiddenLocation.Date.ToString("yyyy-MM-dd HH:mm:ss")));
              }
          }
      }
    
Holiday
Description:
Holiday is an interval in the past or in the future. Holidays can be approved by supervisors or approved automatically (based on system setting). Holidays can have category defined which can be managed on the website's Holiday categories page. By default the "Annual leave" category exists, which cannot be deleted.
Members:
Type Name Description
int UserId Id of the user who requested the holiday.
DateTime StartDay First day of the holiday. This day is not neccessarily a workday, it might be a day of weekend. StartDay and EndDay are equal when holiday was requested only for a single day.
DateTime EndDay Last day of the holiday. This day is not neccessarily a workday, it might be a day of weekend. StartDay and EndDay are equal when holiday was requested only for a single day.
int DailyDurationInMins Worktime received for a single workday.
int NumberOfWorkDays Number of workdays existing between StartDay and EndDay (including them).
int? ApprovedBy Id of the user who approved the holiday. This value is null when the holiday has not been approved yet.
string HolidayCategoryName Name of the holiday's category.
int? HolidayCategoryId Id of the holiday's category. It is NULL for the default "Annual leave" category, otherwise is has a value.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var holidays = GetHolidaysForUser(userId);
  
        foreach(var holiday in holidays)
        {
          Log(String.Format("holiday: UserId: {0}, StartDay: {1}, EndDay: {2}, DailyDurationInMins: {3}, NumberOfWorkDays: {4}, HolidayCategoryName: {5}, ApprovedBy: {6}", holiday.UserId, holiday.StartDay.ToString("yyyy-MM-dd"), holiday.EndDay.ToString("yyyy-MM-dd"), holiday.DailyDurationInMins, holiday.NumberOfWorkDays, holiday.HolidayCategoryName, holiday.ApprovedBy));
        }
      }
    
HolidayCategory
Description:
HolidayCategory is a mandatory parameter to be set when user wants to request a holiday. Users can classify holidays by using categories. By default the "Annual leave" category exists, which cannot be deleted, its Id is NULL, so it cannot be retrieved from script.
Members:
Type Name Description
int Id Id of the category.
string Name Name of the category.
byte Rank Rank defines the order of company's categories. It is only important when you want to calculate the number of used holidays with exact "Annual leave" subtypes.
bool Requestable Shows if it is part of the "Annual leave" (i.e. the user can select it from the list upon requesting).
bool Paid Defines if user receives working time for holiday or not.
string ColorCode HTML color code assigned to category. This color is used on the website in the calendar.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var holidays = GetHolidaysForUser(userId);
  
        foreach(var holiday in holidays)
        {
            if (holiday.HolidayCategoryId.HasValue)
            {
                var category = GetHolidayCategoryById(holiday.HolidayCategoryId.Value);
                Log(String.Format("category: Id: {0}, Name: {1}, Rank: {2}, Requestable: {3}, ColorCode: {4}, Paid: {5}", category.Id, category.Name, category.Rank, category.Requestable, category.ColorCode, category.Paid));
            }
        }
      }
    
HolidayCategoryLimit
Description:
Describes a user's holiday limit for each category for a given year.
Members:
Type Name Description
int? CategoryId The category the limit is set for.
int LimitInMins The limit for the specified category given in minutes.
Example code (C#):

      public void Execute()
      {
          var userId = 12345;
          var limits = GetHolidayLimitsForUser(userId);
          foreach(var holidayLimit in limits)
              foreach(var limit in holidayLimit.CategoryLimits)
                  Log(String.Format("UserId: {0} | Year: {1} | CategoryId: {2} | LimitInMins: {3}", holidayLimit.UserId, holidayLimit.Year, limit.CategoryId, limit.LimitInMins));
      }
    
HolidayLimit
Description:
Describes a user's holiday limit for each category for a given year.
Members:
Type Name Description
int UserId The user's identifier.
int Year Calendar year the limits are set for.
List<HolidayCategoryLimit> CategoryLimits The list of limits for each category.
Example code (C#):

      public void Execute()
      {
          var userId = 12345;
          var limits = GetHolidayLimitsForUser(userId);
          foreach(var holidayLimit in limits)
              foreach(var limit in holidayLimit.CategoryLimits)
                  Log(String.Format("UserId: {0} | Year: {1} | CategoryId: {2} | LimitInMins: {3}", holidayLimit.UserId, holidayLimit.Year, limit.CategoryId, limit.LimitInMins));
      }
    
HourlyWage
Description:
The hourly wage of the user in a period. Wage does not contain currency, only the number. When wage changes, a new period starts. These periods are disjoint.
Members:
Type Name Description
DateTime StartDate Start date of the period.
DateTime EndDate End date of the period.
decimal Amount Amount of the hourly wage.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var wagesOfUser = GetWagesByUserId(userId);
  
        foreach(var hourlyWage in wagesOfUser)
        {
         Log(String.Format("StartDate: {0} | EndDate: {1} | Amount: {2}", hourlyWage.StartDate, hourlyWage.EndDate, hourlyWage.Amount));
        }
      }
    
Issue
Description:
Describes an issue generated by the JobControl's Issue Manager.
Members:
Type Name Description
string IssueCode This is the unique Id of the issue.
string Subject Subject field shown in Issue Manager.
string Company Company field shown in Issue Manager.
IssueState State The state of the issue. Possible values are: Opened, Closed, WaitingForCustomer.
DateTime CreatedAt The exact time when the issue was created (given in UTC).
int? CreatedBy The userId who opened the issue. It is NULL when ticket was automatically opened by the Issue Manager's server part.
DateTime ModifiedAt The exact time when the issue was changed last time (given in UTC).
int? ModifiedBy The userId who modified the issue last time. It is NULL when ticket was automatically opened by the Issue Manager's server part.
Example code (C#):

      public void Execute()
      {
         var issueCode = "ABCDEFGH";
          var issue1 = GetIssueByCode(issueCode);
          Log(String.Format("Issue1: IssueCode: {0}, State: {1}, Subject: {2}, Company: {3}", issue1.IssueCode, issue1.State, issue1.Subject, issue1.Company));

          var allIssues = GetAllIssues();
          foreach(var issue in allIssues)
              Log(String.Format("Issue: IssueCode: {0}, State: {1}, Subject: {2}, Company: {3}", issue.IssueCode, issue.State, issue.Subject, issue.Company));
      }
    
ManualWorkItem
Description:
Manually added workitems via pc client or website for a period of time. Inherits from WorkItem.
Members:
Type Name Description
string Description Description of the manually added workitem
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          if (tup.Type == ItemType.Manual)
          {
            var item = (ManualWorkItem)tup;
            Log(String.Format("Manual | Description: {0}", item.Description));
          }
        }
      }
    
MeetingEffectiveSetting
Description:
Describes meeting system settings of a user
Members:
Type Name Description
bool AllowApprovalOfMeetingsLongerOrEqualThan24Hours Shows whether the user is allowed to approve meetings longer than 24 hours.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var setting = GetUserEffectiveSettingForUser(userId);
        if (setting != null)
          Log(String.Format("AllowApprovalOfMeetingsLongerOrEqualThan24Hours: {0}", setting.Meeting.AllowApprovalOfMeetingsLongerOrEqualThan24Hours? "Yes" : "No" ));
      }
    
Message
Description:
Describes a message that are to sent for users via any client application.
Members:
Type Name Description
int Id This is the unique Id of the message.
int TargetUserId The id of the user whom the message should be sent to.
string Type Any arbitrary value that identifies the message type.
string Content The content of the message. Use xml format.
MessageTargets Target The target of the message. Possible values are: PC, Mobile.
short ExpiryInHours The value in hours after which the message is no longer displayed as new in client application. Defaults to 72 hours if not provided.
Datetime CreatedAt The exact time when the message is persisted in database (given in UTC).
Datetime? LastUpdatedAt The exact time when the message is last updated in database (given in UTC).
DateTime? PCLastSentAt The exact time when the message was last sent to a PC client (given in UTC). When this is NULL, then either the message was not sent yet, or it was never intended to send to PC.
DateTime? MobileLastSentAt The exact time when the message was last sent to a mobile client (given in UTC). When this is NULL, then either the message was not sent yet, or it was never intended to send to mobile.
DateTime? PCLastReadAt The exact time when the message was read on a PC client (given in UTC). When this is NULL, then either the message was not read yet, or it was never intended to send to PC.
DateTime? MobileLastReadAt The exact time when the message was read on a mobile client (given in UTC). When this is NULL, then either the message was not read yet, or it was never intended to send to mobile.
DateTime? DeletedAt The exact time when the message was revoked by the message provider (given in UTC).
Example code (C#):

      public void Execute()
      {
      var messagesOfUser = GetMessagesOfUser(123);

      foreach(var message in messagesOfUser)
      Log(String.Format("Message: Id: {0}, TargetUserId: {1}, Type: {2}, Content: {3}, Target: {4}, ExpiryInHours: {5}, CreatedAt: {6}, LastUpdatedAt: {7}, PCSentLastAt: {8}, MobileLastSentAt: {9}, PCLastReadAt: {10}, MobileLastReadAt: {11}, DeletedAt: {12}",
      message.Id, message.TargetUserId, message.Type, message.Content, message.Target, message.ExpiryInHours, message.CreatedAt, message.LastUpdatedAt, message.PCSentLastAt, message.MobileLastSentAt, message.PCLastReadAt, message.MobileLastReadAt, message.DeletedAt));
      }
    
MobileEffectiveSetting
Description:
Describes mobile system settings of a user.
Members:
Type Name Description
int MinimumDurationOfStayInMins The minimum duration that should be treated in reports as productive.
int LocationRefreshPeriod This setting shows how often the mobile client refreshes its location information. The value is given in seconds.
Example code (C#):

      public void Execute()
      {
      var userId = 12345;
      var setting = GetUserEffectiveSettingForUser(userId);
      if (setting != null)
      Log(String.Format("MinimumDurationOfStayInMins: {0}", setting.Mobile.MinimumDurationOfStayInMins));
      }
    
MobileFileUpload
Description:
Describes a file uploded by a JobCTRL user's mobile device.
Members:
Type Name Description
int Id This is the unique Id of the uploaded file.
int UserId The user's id whose mobile device uploaded the file.
int TaskId The task's id that the user assigned to the uploaded file.
DateTime Date The date and time when the file was uploaded.
string Note The note or description the user entered for the uploaded file.
string Extension The extension of the uploaded file (e.g. jpg, png, gif, txt, zip, etc...). There is no limitation for the uploaded file's extension.
byte[] Content This field contains the file itself as a byte array. Only filled up when the extension is one of the following: jpg, png, gif, bmp.
Example code (C#):

      public void Execute()
      {
        var ctx = GetReportContext();
        foreach(var userId in ctx.UserIds)
        {
          var fileUploads = GetMobileFileUploadsOfUser(userId);
          foreach(var file in fileUploads)
          {
            LogFileUpload(file);
          }
        }

        var fileId = 54;
        var item = GetMobileFileUploadById(fileId);
        LogFileUpload(item);

        var resizedImage = ResizeImageFile(item.Content, 150);
        Log("Resized length: " + resizedImage.Length);
      }
      
      private void LogFileUpload(MobileFileUpload file)
      {
      Log(String.Format("Id: {0} | UserId: {1} | TaskId: {2} | Date: {3} | Note: {4} | Extension: {5} | ContentLengthInBytes: {6}", file.Id, file.UserId, file.TaskId, file.Date.ToString("yyyy-MM-dd HH:mm:ss"), file.Note, file.Extension, file.Content.Length));
      }
    
MobileLocation
Description:
Describes a recorded GPS coordinate of a user at a point in time.
Members:
Type Name Description
long Id Id of the location item.
double Longitude Longitude part of the GPS location.
double Latitude Latitude part of the GPS location.
double Accuracy Accuracy part of the GPS location (in meters).
DateTime Date Date of recording.
int UserId Id of the user.
int TaskId Id of the task at the time of recording.
Example code (C#):

      public void Execute()
      {
         var userId = 123;
          var locations = GetMobileLocationsOfUser(userId);
         foreach (var location in locations)
          {
           Log(String.Format("Id: {0} | UserId: {1} | TaskId: {2} | Longitude: {3} | Latitude: {4} | Accuracy: {5} | Date: {6} ", location.Id, location.UserId, location.TaskId, location.Longitude, location.Latitude, location.Accuracy, location.Date.ToString("yyyy-MM-dd HH:mm:ss")));
          }
      }
    
MobilePhoneCall
Description:
Describes a phone call recorded by a JobCTRL user's mobile device. The duration of this call is not necessarily converted to working time.
Members:
Type Name Description
Int64 CallId This is the unique Id of the phone call.
int UserId The user's id whose mobile device recorded this phone call.
DateTime StartDate The start time of the call.
DateTime EndDate The end time of the call.
string PhoneNumber The phone number the call was arranged with.
bool IsInbound Specifies whether it was an incoming call or not.
string MobileContactFirstName The first name of the user retrieved from the mobile device's contact list.
string MobileContactLastName The last name of the user retrieved from the mobile device's contact list.
int? TaskId The task's id the phone call was assigned to. It can be NULL when no mobile worktime exists for the call (e.g. call was too short or simultaneous PC worktime exists).
int TalkDuration The length of the call given in seconds.
Example code (C#):

      public void Execute()
      {
          var userId = 1234;
          var allCalls = GetMobilePhoneCallsOfUser(userId);
          foreach(var item in allCalls)
          {
              Log(String.Format("CallId: {0} | UserId: {1} | PhoneNumber: {2} | IsInbound: {3} | MobileContactFirstName: {4} | MobileContactLastName: {5} | StartDate: {6} | EndDate: {7}", item.CallId, item.UserId, item.PhoneNumber, item.IsInbound, item.MobileContactFirstName, item.MobileContactLastName, item.StartDate, item.EndDate));
          }

          var callId = allCalls[0].CallId;
          var call = GetMobilePhoneCallByCallId(callId);
          Log(String.Format("CallId: {0} | UserId: {1} | PhoneNumber: {2} | IsInbound: {3} | MobileContactFirstName: {4} | MobileContactLastName: {5} | StartDate: {6} | EndDate: {7}", call.CallId, call.UserId, call.PhoneNumber, call.IsInbound, call.MobileContactFirstName, call.MobileContactLastName, call.StartDate, call.EndDate));
      }
    
MobileWorkItem
Description:
Mobile devices generated workitems for a period of time. Inherits from WorkItem.
Members:
Type Name Description
long Imei Unique identifier of mobile equipments
MobileWorkitemType MobileWorkitemType This field defines the type of the mobile work item. It is an enum having the following values: Normal, CallBased, Beacon, Ivr.
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          if (tup.Type == ItemType.Mobile)
          {
            var item = (MobileWorkItem)tup;
            Log("Mobile");
          }
        }
      }
    
MobileZoneGroup
Description:
Describes a zone group where the user was detected by the Sensor technology.
Members:
Type Name Description
int Id Id of the zone group.
string Name Friendly name of the zone group.
int SiteId Id of the site which contains the given zone group.
Example code (C#):

      public void Execute()
      {
         var zoneGroupId = 111;
          var zoneGroup = GetMobileZoneGroupById(zoneGroupId);
  
         Log(String.Format("zoneGroup: Name: {0}, SiteId: {1}", zoneGroup.Name, zoneGroup.SiteId));
      }
    
MobileZoneSite
Description:
Describes a site where the Sensor technology is used.
Members:
Type Name Description
int Id Id of the site.
string Name Friendly name of the site.
string Address The physical address of the site.
decimal Longitude The longitude part of GPS position of the physical address.
decimal Latitude The latitude part of GPS position of the physical address.
int Radius The radius (in meters) around the GPS position showing the physical extension of the site.
Example code (C#):

      public void Execute()
      {
         var siteId = 222;
         var zoneSite = GetMobileZoneSiteById(siteId);
  
          Log(String.Format("zoneSite: Name: {0}, Address: {1}, Longitude: {2}, Latitude: {3}, Radius: {4}", zoneSite.Name, zoneSite.Address, zoneSite.Longitude, zoneSite.Latitude, zoneSite.Radius));
      }
    
OtherEffectiveSetting
Description:
Describes other system settings of a user.
Members:
Type Name Description
int CalendarId Id of the user's calendar.
int DailyWorkTimeInMinutes Number of minutes a user has to work each working day (in DB this property is DefaultTargetWorkTimeInMinutes).
CutOffInactiveWorkingTime CutOffInactiveWorkingTime Defines if inactive working times should be cut off. Possible values are: Never, OnlyStart, OnlyEnd, Both.
List<KeyValuePair<DateTime, int>> TargetWorkTimeIntervals List of StartDate-DailyWorkTimeInMinutes pairs. Can be null!
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var setting = GetUserEffectiveSettingForUser(userId);
        if (setting != null)
          Log(String.Format("CalendarId: {0} | DailyWorkTimeInMinutes: {1}", setting.Other.CalendarId, setting.Other.DailyWorkTimeInMinutes));
      }
    
PcWorkItem
Description:
Personal computer generated workitems for a period of time. Inherits from WorkItem.
Members:
Type Name Description
int ComputerId Unique Id of a computer where the WorkItem was created
double KeyboardActivity Number of keyboard keypresses of a user in a given time period
double MouseActivity Number of non-moving mouse events of a user in a given time period
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          if (tup.Type == ItemType.Pc)
          {
            var item = (PcWorkItem)tup;
            Log(String.Format("Pc | ComputerId : {0} | KeyboardActivity : {1} | MouseActivity : {2}", item.ComputerId, item.KeyboardActivity , item.MouseActivity));
          }
        }
      }
    
PermissionEffectiveSetting
Description:
Describes permission system settings of a user.
Members:
Type Name Description
RawDataVisibilitySettings RawDataVisibilitySettings Shows whether the reportuser is allowed to view some specific raw data. This enum is a "flag"-enum (i.e. it can have multiple values selected simultaneously) and has the following values: None, ProcessName, Title, Url, KeyBoardAndMouseActivity, GPSPositions.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var setting = GetUserEffectiveSettingForUser(userId);
        if (setting != null)
          Log(String.Format("Is Url visible: {0}", (setting.Permission.RawDataVisibilitySettings & RawDataVisibilitySettings.Url) != 0 ? "Yes" : "No" ));
      }
    
POI
Description:
Data container class for a POI item
Members:
Type Name Description
int Id Unique Id of the POI
string Name Name of the POI item
double Latitude Latitude value of the POI's GPS coordinate
double Longitude Latitude value of the POI's GPS coordinate
int Radius Radius of the circle around the given location which items should be considered as a part of the POI
List<string> Tags Name of the POI tags
bool IsOffice Defines if the POI is office work or not.
Example code (C#):

      public void Execute()
      {
        var userId = 1; 
        var taskId = 5785548;
        var myLocation = new MobileLocation {
          Id = 1,
          UserId = userId,
          TaskId = taskId,
          Date = DateTime.Now,
          Longitude = 19.4258,
          Latitude = 47.589,
          Accuracy = 200
        };
        var poi = GetPOIForLocation(myLocation);
        if (poi != null)
        {
          foreach(var tag in poi.Tags)
         Log("Tag: " + tag);
        }
        else
        {
         Log("No poi found");
        }
      }
    
ProjectParticipant
Description:
Describes whether the given user is the Leader or a Member of the given project.
Members:
Type Name Description
int UserId Id of the user.
int ProjectId Id of the project.
bool IsLeader Shows whether the user is the Leader of the project or only a member of it.
Example code (C#):

      public void Execute()
      {
         var userId = 111;
          var projectId = 222;
          var projectParticipants1 = GetParticipantsOfProject(projectId);
         var projectParticipants2 = GetProjectsOfUser(userId);
  
         foreach(var item in projectParticipants1)
          {
           Log(String.Format("projectParticipants1: UserId: {0}, ProjectId: {1}, IsLeader: {2}", item.UserId, item.ProjectId, item.IsLeader));
          }

          foreach(var item in projectParticipants2)
          {
           Log(String.Format("projectParticipants2: UserId: {0}, ProjectId: {1}, IsLeader: {2}", item.UserId, item.ProjectId, item.IsLeader));
          }
      }
    
Rating
Description:
Contains the rating of a user's task.
Members:
Type Name Description
int TaskId Id of the task.
int UserId Id of the user.
int RatedByUserId Id of the user who rated someone's task.
int Score Score given for the task.
DateTime CreateDate Date of the rating in UTC.
string Description Description entered for the rating.
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          var userId = tup.UserId;
          var taskId = tup.WorkId;
          var ratings = GetRatingsForTaskAssignment(userId, taskId);
          foreach(var rating in ratings)
          {
              Log(String.Format("UserId: {0} | TaskId: {1} | RatedByUserId: {2} | Score: {3} | CreateDate: {4} | Description: {5}", rating.UserId, rating.TaskId, rating.RatedByUserId, rating.Score, rating.CreateDate, rating.Description));
          }
        }
      }
    
ReasonTreeItem
Description:
Reason tree items are the items of a reason that can be created and assigned to a user on the website. Furthermore these reason tree items will be selectable in the client of these users to assign user reasons to it while editing a task.
Members:
Type Name Description
int Id Id of the reason tree item.
int? ParentId Reason tree item pointing to a parent reason tree item. Will be null if root.
string Name Name of the reason tree item
Example code (C#):

      public void Execute()
      {
        var reasonTreeItemId = 12345;
        var reasonTreeItem1 =  GetReasonTreeItemById(reasonTreeItemId);

        Log(String.Format("Id: {0} | ParentId: {1} | Name: {2}", reasonTreeItem1.Id, reasonTreeItem1.ParentId, reasonTreeItem1.Name));
      }
    
ReportContext
Description:
Contains all the parameters of the report being queried.
Members:
Type Name Description
int ReportUserId Id of the user querying the report.
List<int> UserIds List of User Ids set for the report.
DateTime LocalStartDate Start day of the period the report was queried.
DateTime LocalEndDate End day of the period the report was queried.
string DefinitionName Name of the task.
List<string> CapturedKeys List of capturing keys requested in definition.
bool KeyInvariantQuery Shows if capturing keys were specified for the report or the report is key-invariant. When report was queried in "key-invariant" mode then CapturedKeys list is empty and keys should be read from each tup's (ProcessedItem's) Values collection by iterating through it.
string CompanyName Name of the company.
string ReportCultureName Language of the report.
string CompanyDefaultEmailDomain Default email domain given for the company.
string GetExtendedParameter(string key) Function. Returns the report specific parameters by key. Returns null when no value exists with the key.
DataCollectorDefinitionFeatureRequirementSettings FeatureRequirementSettings Defines the features that will be accessible in the C# SourceScript
string WebsiteUrl The URL of the website the report is running on (e.g. https://jobctrl.com). By using it, you can build absolute URLs.
bool QueryingPeriodForTargetUsers This field shows what period was the report data queried for. When the field is false (the default) it means the TUPs and all other user-related collections are queried for the reportUser's period, otherwise these are queried individually for each user's own period.
int? FavoriteReportId This field stores the id of the saved favorite report for the currently running report. This field is null when report is not saved but queried for an arbitrary interval and for users.
Example code (C#):

      public void Execute()
      {
        var ctx = GetReportContext();
        Log(ctx.ReportUserId);
        Log(ctx.LocalStartDate.ToString("yyyy-MM-dd"));
        Log(ctx.LocalEndDate.ToString("yyyy-MM-dd"));
        Log(ctx.DefinitionName);
        Log(ctx.CompanyName);
        Log(ctx.ReportCultureName);
        Log(ctx.CompanyDefaultEmailDomain);
        Log(String.Join(" | ", ctx.CapturedKeys));
        Log(String.Join(" | ", ctx.UserIds.Select(t => t.ToString()).ToList()));
        if (ctx.FeatureRequirementSettings.TaskCollectionRequirement == CollectionInitType.EntireCompany)
          Log("All tasks are required");
      }
    
ReportEmailAttachment
Description:
This class represents the embedded content (always a PNG image at the moment). You can create one by calling the CreateAttachmentFromChart() function and passing a Chart object to it. Its ContentId is automatically generated. To embed the image the ContentId should be used in the desired HTML fragment as the source attribute of an image.
Members:
Type Name Description
string ContentId This is the unique identifier of the embedded image. Its ContentId is automatically generated. To embed the image the ContentId should be used in the desired HTML fragment as the source attribute of an image.
byte[] Content This field contains the embedded .PNG image as a byte array. This field is automatically populated upon using the CreateAttachmentFromChart() function.
Example code (C#):

      public void Execute()
      {
        var chart = CreateCustomChart();
        var attachment = CreateAttachmentFromChart(chart);
        var htmlContent = GetCustomHtmlContent(attachment.ContentId);
        var emailSettings = new ReportEmailSettings
        {
            AttachDefaultExcelDocument = false,
            HtmlContent = htmlContent,
            Attachments = new List<ReportEmailAttachment>{attachment}
        };
        SetEmailSettings(emailSettings);
      }
      
      public Chart CreateCustomChart()
      {
         /******
           For more examples check out Microsoft's official website: https://code.msdn.microsoft.com/Samples-Environments-for-b01e9c61
         ******/
  
        var chart1 = new Chart { Width = 500, Height = 400 };
         chart1.ChartAreas.Add(new ChartArea("ChartArea1"));
  
          var series1 = new System.Web.UI.DataVisualization.Charting.Series
          {
            Name = "Series1",
            ChartType = SeriesChartType.Column
          };
          chart1.Series.Add(series1);

        series1.Points.AddXY("John Doe", 1000);
          series1.Points.AddXY("Jane Doe", 1500);
  
         return chart1;
      }
      
      public string GetCustomHtmlContent(string contentId)
      {
        var sb = new StringBuilder();
          sb.Append("<p>The average performance is: 95%</p>");
          sb.Append("<img src=\"cid:" + contentId + "\" />");
  
         return sb.ToString();
      }

    
ReportEmailSettings
Description:
This class contains the settings related to the scheduled email sending. Using this class you can add custom content to the email's HTML part (e.g. charts, tables, etc...). You can save the settings by using the built-in SetEmailSettings() function.
Members:
Type Name Description
bool AttachDefaultExcelDocument Defines whether excel document is attached to the HTML email or not. By default it is true when not defined.
bool OverrideDefaultEmailTemplate Defines whether the given HtmlContent is embedded into the default HTML email temlate or not. By default it is false which means the given content is embedded.
string HtmlContent This field contains the HTML fragment which is going to be inserted into the bottom of the HTML email.
List<ReportEmailAttachment> Attachments This list contains the charts embedded to the HTML email body.
Example code (C#):

      public void Execute()
      {
        var chart = CreateCustomChart();
        var attachment = CreateAttachmentFromChart(chart);
        var htmlContent = GetCustomHtmlContent(attachment.ContentId);
        var emailSettings = new ReportEmailSettings
        {
            AttachDefaultExcelDocument = false,
            HtmlContent = htmlContent,
            Attachments = new List<ReportEmailAttachment>{attachment}
        };
        SetEmailSettings(emailSettings);
      }
      
      public Chart CreateCustomChart()
      {
         /******
           For more examples check out Microsoft's official website: https://code.msdn.microsoft.com/Samples-Environments-for-b01e9c61
         ******/
  
        var chart1 = new Chart { Width = 500, Height = 400 };
         chart1.ChartAreas.Add(new ChartArea("ChartArea1"));
  
          var series1 = new System.Web.UI.DataVisualization.Charting.Series
          {
            Name = "Series1",
            ChartType = SeriesChartType.Column
          };
          chart1.Series.Add(series1);

        series1.Points.AddXY("John Doe", 1000);
          series1.Points.AddXY("Jane Doe", 1500);
  
         return chart1;
      }
      
      public string GetCustomHtmlContent(string contentId)
      {
        var sb = new StringBuilder();
          sb.Append("<p>The average performance is: 95%</p>");
          sb.Append("<img src=\"cid:" + contentId + "\" />");
  
         return sb.ToString();
      }

    
Role
Description:
This is the representation of a role in JobCTRL.
Members:
Type Name Description
int Id Id of the role.
string Name Name of the role.
int Priority Priority of the role. The larger the more significant.
RoleType Type Type of the role. This enum can have the following values: UserCreated, UserGroupDefault, CompanyDefault, Administrators, Supervisors, Workers
int? GroupId Id of the WorkerGroup that the role corresponds, if any.
Example code (C#):

      public void Execute()
      {
          var roleId = 12345;
          var role1 = GetRoleById(roleId);
          if (role1 != null)
              Log(String.Format("Id: {0} | Name: {1} | Priority: {2} | Type: {3} | GroupId: {4}", role1.Id, role1.Name, role1.Priority, role1.Type, role1.GroupId));
      }
    
Schedule
Description:
Contains the information about the user's daily schedule.
Members:
Type Name Description
int UserId Id of the user.
List<ScheduleItem> Items List of the details of the schedule. Each disjoint period is a single ScheduleItem.
DateTime Day Day of the schedule (has only date part).
bool IsInOffice Shows whether the user should work at home or in the office this day.
bool IsWorkDay Shows whether this day is workday for the user or not.
string GetExtendedProperty(string name) Function. Returns the extended property for the schedule if that exists, otherwise null.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var date = new DateTime(2015, 10, 15);
        var schedules = GetDailySchedulesForUser(userId, date);
        foreach(var schedule in schedules)
        {
          Log(String.Format("UserId:{0}|Day:{1}|IsInOffice:{2}|IsWorkDay:{3}", schedule.UserId, schedule.Day, schedule.IsInOffice, schedule.IsWorkDay));
          foreach(var item in schedule.Items)
          {
            Log(String.Format("Start:{0}|End:{1}|TaskId:{2}|IsOvertime:{3}", item.Start, item.End, item.TaskId, item.IsOvertime));
          }
        }
      }
    
ScheduleCategory
Description:
Contains the information about the working time schedule categories.
Members:
Type Name Description
int Id This is the unique identifier of the category.
DateTime? DeletedAt This field shows when the category was deleted. If the category is still open then this field is NULL.
string Name Name of the category.
string ColorCode HTML color code assigned to category. This color is used on the website in the calendar (e.g. FF33EE).
Example code (C#):

      public void Execute()
      {
          var allCategories = GetAllScheduleCategories();
         foreach(var item in allCategories)
            LogCategory(item);

          var categoryId = 1234;
          var category = GetScheduleCategoryById(categoryId);
          LogCategory(category);
      }

      public void LogCategory(ScheduleCategory category)
      {
      Log(String.Format("Id: {0} | Name: {1} | ColorCode: {2} | DeletedAt: {3}", category.Id, category.Name, category.ColorCode, category.DeletedAt.HasValue ? category.DeletedAt.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""));
      }
    
ScheduleItem
Description:
Contains the information about the user's daily schedule.
Members:
Type Name Description
DateTime Start Start time of the schedule item.
DateTime End End time of the schedule item.
int? TaskId Task the user should work during this interval.
bool IsOvertime Shows whether this period counts as overtime or not.
int? CategoryId Category of the schedule item.
string GetExtendedProperty(string name) Function. Returns the extended property for the schedule item if that exists, otherwise null.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var date = new DateTime(2015, 10, 15);
        var schedules = GetDailySchedulesForUser(userId, date);
        foreach(var schedule in schedules)
        {
          Log(String.Format("UserId:{0}|Day:{1}|IsInOffice:{2}|IsWorkDay:{3}", schedule.UserId, schedule.Day, schedule.IsInOffice, schedule.IsWorkDay));
          foreach(var item in schedule.Items)
          {
            Log(String.Format("Start:{0}|End:{1}|TaskId:{2}|IsOvertime:{3}", item.Start, item.End, item.TaskId, item.IsOvertime));
          }
        }
      }
    
SickLeave
Description:
Sick leave is an interval in the past. Sick leaves cannot be approved they are just defined and they even don't have categories.
Members:
Type Name Description
int UserId Id of the user who requested the holiday.
DateTime StartDay First day of the holiday. This day is not neccessarily a workday, it might be a day of weekend. StartDay and EndDay are equal when holiday was requested only for a single day.
DateTime EndDay Last day of the holiday. This day is not neccessarily a workday, it might be a day of weekend. StartDay and EndDay are equal when holiday was requested only for a single day.
int DailyDurationInMins Worktime received for a single workday.
int NumberOfWorkDays Number of workdays existing between StartDay and EndDay (including them).
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var sickLeaves = GetSickLeavesForUser(userId);
  
        foreach(var sickLeave in sickLeaves)
        {
            Log(String.Format("UserId: {0}, StartDay: {1}, EndDay: {2}, DailyDurationInMins: {3}, NumberOfWorkDays: {4}", sickLeave.UserId, sickLeave.StartDay.ToString("yyyy-MM-dd"), sickLeave.EndDay.ToString("yyyy-MM-dd"), sickLeave.DailyDurationInMins, sickLeave.NumberOfWorkDays));
        }
      }
    
Task
Description:
This is the representation of a task in JobCTRL. Tasks are ordered in a hierarchy. Each task has exactly one parent project, while the root's parent is NULL.
Members:
Type Name Description
int Id Id of the task.
int? ParentId Id of the parent project. NULL only for the root task in the hierarchy.
string Name Name of the task.
int? TemplateTaskId Id of the Template the task is created by. Has value only when the task was created by a template, else it is null.
string CategoryName Name of the task's category. NULL when no category was set for the task.
int? CategoryId Id of the task's category. NULL when no category was set for the task.
string ExtId External Identifier of the task.
string TaxId This is a generic text for tasks. Available only for projects.
string Description This is multiline text for tasks. Maximum allowed length is 1000 characters.
DateTime? TargetStartDate This is an optional parameter and contains the target (or estimated) start date for the work or project.
DateTime? TargetEndDate This is an optional parameter and contains the target (or estimated) start date for the work or project.
decimal? TargetCost This is an optional parameter and contains the target (or estimated) cost for the work or project. Currency cannot be defined, it is globally set for the company.
int? TargetPlannedWorkTimeInMinutes This is an optional parameter and contains the target (or estimated) worktime for the work or project in minutes.
short? Priority This is an optional parameter and contains the priority of the work or project. It's value is (exclusively) between 0 and 10000.
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
          var task1 = GetTaskById(tup.WorkId);
          if (task1 == null)
            Log("Task was not found which should be impossible.");
          else
            Log(String.Format("Id: {0} | ParentId: {1} | Name: {2} | TemplateTaskId: {3} | CategoryName: {4} | CategoryId: {5} | ExtId: {6} | TaxId: {7} | TargetStartDate: {8} | TargetEndDate: {9} | TargetCost: {10} | Description: {11} | Priority: {12} | TargetPlannedWorkTimeInMinutes: {13}", task1.Id, task1.ParentId, task1.Name, task1.TemplateTaskId, task1.CategoryName, task1.CategoryId, task1.ExtId, task1.TaxId, task1.TargetStartDate, task1.TargetEndDate, task1.TargetCost, task1.Description, task1.Priority, task1.TargetPlannedWorkTimeInMinutes));
        }
      }
    
TaskAssignment
Description:
Contains the user-specific information about user's task (his task assignment).
Members:
Type Name Description
int TaskId Id of the task.
int UserId Id of the user.
DateTime? StartDate Start date of the period of the assignment.
DateTime? EndDate End date of the period of the assignment.
int? PlannedWorktimeInMinutes Number of minutes estimated for this task as target worktime.
TimeSpan TotalWorkTime Total work time user spent on this specific task regardless the queried report period (i.e. end time is always "now" even if report is about "last year"). It is costly to populate this field so we only do this when "Total work time for assigned tasks" feature is turned on at the custom report's definition page. Important: This value is cached for 1 hour so this value might not be precise for tasks on which user was working in the last 1 hour.
TaskAssignmentStatus Status Status of the assignment. Possible values are: Open, Closed
DateTime? DeletedAt Shows when the assignment was closed. NULL if the assignment is still opened.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var taskId = 12345;
        var assignment = GetTaskAssignmentForUserAndTask(userId, taskId);
        
        Log(String.Format("UserId: {0} | TaskId: {1} | StartDate: {2} | EndDate: {3} | PlannedWorktimeInMinutes: {4} | Status: {5} | DeletedAt: {6}", assignment.UserId, assignment.TaskId, assignment.StartDate, assignment.EndDate, assignment.PlannedWorktimeInMinutes, assignment.Status, assignment.DeletedAt));
      }
    
TaskAssignmentHistory
Description:
Contains the history of the user-specific information about user's task (his task assignment).
Members:
Type Name Description
int TaskId Id of the task.
int UserId Id of the user.
int? ChangedByUserId Id of the user who made the change. In very rare cases the system closes the task and at these times the UserId is NULL.
DateTime ChangedAt Date of the change in UTC.
DateTime? StartDate Start date of the period of the assignment.
DateTime? EndDate End date of the period of the assignment.
int? PlannedWorktimeInMinutes Number of minutes estimated for this task as target worktime.
TaskAssignmentStatus Status Status of the assignment. Possible values are: Open, Closed
Example code (C#):

      public void Execute()
      {
        foreach (var tup in GetNextTup())
        {
         var userId = tup.UserId;
          var taskId = tup.WorkId;
         var historyItems = GetTaskAssignmentHistories(userId, taskId);
         foreach(var history in historyItems)
          {
            Log(String.Format("UserId: {0} | TaskId: {1} | ChangedByUserId: {2} | ChangedAt: {3} | Status: {4} | StartDate: {5} | EndDate: {6} | PlannedWorktimeInMinutes: {7}", history.UserId, history.TaskId, history.ChangedByUserId, history.ChangedAt, history.Status, history.StartDate, history.EndDate, history.PlannedWorktimeInMinutes));
          }
        }
      }
    
TaskGroup
Description:
This is a representation of task grouping. Gives a different way to group tasks besides the hierarchical task/project approach.
Members:
Type Name Description
int Id Id of the task group.
string Name Name of the group.
HashSet<int> ContainedTaskIds Set of taskIds contained by the task group. To search for a specific TaskId, use HashSet's effective Contains() method which searchs in O(1) time.
Example code (C#):

      public void Execute()
      {
        var groupId = 12345;
        var group1 = GetTaskGroupById(groupId);

        Log(String.Format("Id: {0} | Name: {1}", group1.Id, group1.Name));
        foreach(var containedTaskId in group1.ContainedTaskIds)
          Log(String.Format("TaskId: {0}", containedTaskId));
      }
    
TaskHistory
Description:
History of a task. Contains all the information about the task, plus some additional about the change action itself (Id of the user who changed it, plus the time of it).
Members:
Type Name Description
int TaskId Id of the task.
int ChangedByUserId Id of the user who made the change.
DateTime ChangedAt Time of the change was made (in UTC).
string Name Name of the task.
TaskStatus Status Status of the task. This enum has the following values: Open, Closed
int? Priority Priority of the task.
Example code (C#):

      public void Execute()
      {
        var taskIds = new HashSet<int>();
        foreach (var tup in GetNextTup())
        {
           taskIds.Add(tup.WorkId);
        }
      
        foreach(var taskId in taskIds)
        {
            var historyItems = GetTaskHistories(taskId);
           foreach(var history in historyItems)
            {
              Log(String.Format("TaskId: {0} | ChangedByUserId: {1} | Name: {2} | ChangedAt: {3} | Status: {4} | Priority: {5}", history.TaskId, history.ChangedByUserId, history.Name, history.ChangedAt, history.Status, history.Priority));
            }
        }
      }
    
TodoList
Description:
Data container class for a To-do list.
Members:
Type Name Description
int UserId The user's identifier to whom the to-do list belongs.
DateTime Day Day of the to-do list
DateTime CreatedAt Defines since when the to-do list exists.
List<TodoListItem> Items A list of to-do list items for the given day. These items have names and statuses.
Example code (C#):

      public void Execute()
      {
          var userId = 1234;
          var day = new DateTime(2020, 3, 10);
          var todoList = GetTodoListForUserDay(userId, day);
          Log(String.Format("UserId: {0} | Day: {1}", todoList.UserId, todoList.Day.ToString("yyyy-MM-dd")));
          foreach(var item in todoList.Items)
              Log(String.Format("Name: {0} | Status: {1} | Priority: {2}", item.Name, item.Status, item.Priority));
      }
    
TodoListItem
Description:
Data container class for a To-do list items.
Members:
Type Name Description
string Name The to-do item's name.
int Priority Priority defines the order of the items in the to-do list.
TodoListItemStatus Status The status of the item. It's values can be: Opened, Finished, Postponed, Canceled.
DateTime CreatedAt Defines since when the item exists.
Example code (C#):

      public void Execute()
      {
          var userId = 1234;
          var day = new DateTime(2020, 3, 10);
          var todoList = GetTodoListForUserDay(userId, day);
          Log(String.Format("UserId: {0} | Day: {1}", todoList.UserId, todoList.Day.ToString("yyyy-MM-dd")));
          foreach(var item in todoList.Items)
              Log(String.Format("Name: {0} | Status: {1} | Priority: {2}", item.Name, item.Status, item.Priority));
      }
    
User
Description:
This is the representation of a user in JobCTRL. Users are ordered in a hierarchy. Each user has exactly one parent worker group.
Members:
Type Name Description
int Id Id of the user.
int GroupId Id of the WorkerGroup containing the user.
string FirstName First name of the user.
string LastName Last name of the user.
string Email Email of the user.
string ExternalId External identifier of the user. This is an Id of the user in an external system (e.g. SAP, MsProject, etc...), by default it is null.
List<string> ParentNames List of the names of the container parent WorkerGroups
AccessLevel AccessLevel Access level of the user. This enum can have the following values: Worker, Supervisor, Administrator
bool IsRegistrator Returns whether the user is the company's only registrator or not.
DateTime? DeletedAt Contains the date when the user was deleted. Contains value only when the user is deleted, else it is null.
int EndOfDayInMinutes End of the user's day in minutes (local time NOT in UTC). E.g. value "180" means that each day starts and ends at 3:00, so for example user's 2015-10-10 day starts at 2015-10-10 3:00 and ends at 2015-10-11 3:00 (local time)
string CultureName Name of the culture set for the user.
CultureInfo Culture Culture with additional information by using .NET's CultureInfo class.
string TimeZoneId Time zone (.NET) identifier of the user.
TimeZoneInfo TimeZone Time zone with additional information by using .NET's TimeZoneInfo class.
DateTime? LastLoginDate Contains the date of the latest login of the user.
DateTime UserCreatedAt Contains the date when the user was created.
DateTime? PasswordLastChangedAt Contains the date of the last password change of the user.
DateTime? FirstWorktime Contains the utc date of the first worktime of the user.
DateTime? LastWorktime Contains the utc date of the last worktime of the user.
UserStatus Status This enum defines if the user is suspended, deleted or active. The possible enum values are the following: Inactive, Active, Deleted
string ActiveDirectoryUserPrincipalName Contains the user's Active Directory UserPrincipalName field. This field is hidden and available only in environments where domain authentication is set. By default this field is empty.
string GetCultureSpecificUserName(string cultureName) Function. It can be used to get the localized (!) full name of the user.
Example code (C#):

      public void Execute()
      {
      var userId = 12345;
      var user1 = GetUserById(userId);
      if (user1 != null)
      Log(String.Format("Id: {0} | FirstName: {1} | LastName: {2} | Email: {3} | ExternalId: {4} | AccessLevel: {5} | IsRegistrator: {6} | DeletedAt: {7} | LastLoginDate: {8} | UserCreatedAt: {9} | PasswordLastChangedAt: {10} | FirstWorktime: {11} | LastWorktime: {12} | Status: {13}", user1.Id, user1.FirstName, user1.LastName, user1.Email, user1.ExternalId, user1.AccessLevel, user1.IsRegistrator, user1.DeletedAt, user1.LastLoginDate, user1.UserCreatedAt, user1.PasswordLastChangedAt, user1.FirstWorktime, user1.LastWorktime, user1.Status));
      }
    
UserEffectiveSetting
Description:
Describes the system settings currently effective for the given user.
Members:
Type Name Description
int UserId Id of the user.
ClientEffectiveSetting Client Client related settings.
CoreTimeEffectiveSetting CoreTime CoreTime related settings.
MeetingEffectiveSetting Meeting Meeting related settings.
OtherEffectiveSetting Other Other settings.
MobileEffectiveSetting Mobile Mobile settings.
PermissionEffectiveSetting Permission user's permissions.
Example code (C#):

      public void Execute()
      {
        var userId = 12345;
        var setting = GetUserEffectiveSettingForUser(userId);
        if (setting != null)
         Log(String.Format("WorktimeStartInMins: {0} | WorktimeEndInMins: {1}", setting.Client.WorktimeStartInMins, setting.Client.WorktimeEndInMins));
      }
    
UserGroupHistoryItem
Description:
This is the representation of a UserGroup's past state in JobCTRL.
Members:
Type Name Description
int Id Id of the WorkerkGroup.
string Name Name of the WorkerkGroup.
int ParentId Id of the WorkerkGroup's parent group.
UserStatus Status Status of the WorkerGroup.
string ExternalId External Id of the WorkerGroup.
int ChangedBy Contains the id of the user who created the UserGroupHistoryItem.
DateTime ChangedAt Contains the date when the UserGroupHistoryItem was created.
Example code (C#):

      public void Execute()
      {
            var groupId = 12345;
            foreach (var item in GetUserGroupHistory(groupId))
            {
                  Log(string.Format("Id: {0} | Name: {1} | ParentId: {2} | Status: {3} | ExternalId: {4} | ChangedBy: {5} | ChangedAt: {6}",
                  item.Id, item.Name, item.ParentId, item.Status, item.ExternalId, item.ChangedBy, item.ChangedAt.ToString("yyyy-MM-dd HH:mm:ss")));
            }
      }

    
UserHistoryItem
Description:
This is the representation of a User's past state in JobCTRL.
Members:
Type Name Description
int Id Id of the user.
string Email Email of the user.
UserStatus Status This enum defines if the user is suspended, deleted or active. The possible enum values are the following: Inactive, Active, Deleted
bool IsRegistrator Returns whether the user is the company's only registrator or not.
string CultureName Name of the culture set for the user.
CultureInfo Culture Culture with additional information by using .NET's CultureInfo class.
string FirstName First name of the user.
string LastName Last name of the user.
int ParentId Id of the WorkerGroup containing the user.
DateTime CreatedAt Contains the date when the UserHistoryItem was created.
int CreatedBy Contains the id of the user who created the UserHistoryItem.
string GetCultureSpecificUserName(string cultureName) Function. It can be used to get the localized (!) full name of the user.
AccessLevel AccessLevel Access level of the User(Worker, Supervisor, Administrator).
Example code (C#):

      public void Execute()
      {
            var userId = 12345;
            foreach (var item in GetUserHistory(userId))
            {
                  Log(string.Format("Id: {0} | Email: {1} | Status: {2