Select Git revision
-
Marcel Nellesen authoredMarcel Nellesen authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
AnalyticsLogObject.cs 6.85 KiB
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Logging
{
[Serializable]
public class AnalyticsLogObject
{
private string _type = "";
public string Type {
get
{
return _type;
}
set
{
if (value == null)
{
_type = "";
}
else
{
_type = value;
}
}
}
private string _operation = "";
public string Operation {
get
{
return _operation;
}
set
{
if (value == null)
{
_operation = "";
}
else
{
_operation = value;
}
}
}
// Default is the current time
private string _timestamp = FormatTimestamp(DateTime.UtcNow);
public string Timestamp
{
get
{
return _timestamp;
}
set
{
if (value == null)
{
_timestamp = FormatTimestamp(DateTime.UtcNow);
}
else
{
_timestamp = value;
}
}
}
private string _userId = "";
public string UserId
{
get
{
return _userId;
}
set
{
if (value == null)
{
_userId = "";
}
else
{
_userId = value;
}
}
}
private string _roleId = "";
public string RoleId
{
get
{
return _roleId;
}
set
{
if (value == null)
{
_roleId = "";
}
else
{
_roleId = value;
}
}
}
private string _sessionId = "";
public string SessionId
{
get
{
return _sessionId;
}
set
{
if (value == null)
{
_sessionId = "";
}
else
{
_sessionId = value;
}
}
}
private string _clientCorrolationId = "";
public string ClientCorrolationId
{
get
{
return _clientCorrolationId;
}
set
{
if (value == null)
{
_clientCorrolationId = "";
}
else
{
_clientCorrolationId = value;
}
}
}
private string _projectId = "";
public string ProjectId
{
get
{
return _projectId;
}
set
{
if (value == null)
{
_projectId = "";
}
else
{
_projectId = value;
}
}
}
private string _resourceId = "";
public string ResourceId
{
get
{
return _resourceId;
}
set
{
if (value == null)
{
_resourceId = "";
}
else
{
_resourceId = value;
}
}
}
private string _fileId = "";
public string FileId
{
get
{
return _fileId;
}
set
{
if (value == null)
{
_fileId = "";
}
else
{
_fileId = value;
}
}
}
private List<string> _projectList = new List<string>();
public List<string> ProjectList
{
get
{
return _projectList;
}
set
{
if (value == null)
{
_projectList = new List<string>();
}
else
{
_projectList = value;
}
}
}
private List<string> _resourceList = new List<string>();
public List<string> ResourceList
{
get
{
return _resourceList;
}
set
{
if (value == null)
{
_resourceList = new List<string>();
}
else
{
_resourceList = value;
}
}
}
private List<string> _userList = new List<string>();
public List<string> UserList
{
get
{
return _userList;
}
set
{
if (value == null)
{
_userList = new List<string>();
}
else
{
_userList = value;
}
}
}
public AnalyticsLogObject (string type, string operation, DateTime timestamp, string userId, string roleId, string sessionId, string clientCorrolationId, string projectId, string resourceId, string fileId, List<string> projectList, List<string> resourceList, List<string> userList)
{
Type = type;
Operation = operation;
Timestamp = FormatTimestamp(timestamp);
UserId = userId;
RoleId = roleId;
SessionId = sessionId;
ClientCorrolationId = clientCorrolationId;
ProjectId = projectId;
ResourceId = resourceId;
FileId = fileId;
ProjectList = projectList;
ResourceList = resourceList;
UserList = userList;
}
public AnalyticsLogObject()
{
}
private static string FormatTimestamp(DateTime timestamp)
{
string formattedDateTime = String.Format("{0:yyyy-MM-dd hh:mm:ss.fff}", timestamp);
return formattedDateTime;
}
}
}