Changes properties to use automatic property initializers
This commit is contained in:
parent
f0a48ad431
commit
06fa31a7bf
623 changed files with 13072 additions and 19304 deletions
|
|
@ -5,22 +5,13 @@ namespace Server.Engines.Reports
|
|||
{
|
||||
public abstract class BaseInfo : IComparable
|
||||
{
|
||||
private static TimeSpan m_SortRange;
|
||||
public static TimeSpan SortRange { get; set; }
|
||||
|
||||
public static TimeSpan SortRange{ get => m_SortRange;
|
||||
set => m_SortRange = value;
|
||||
}
|
||||
|
||||
private string m_Account;
|
||||
private string m_Display;
|
||||
private PageInfoCollection m_Pages;
|
||||
|
||||
public string Account{ get => m_Account;
|
||||
set => m_Account = value;
|
||||
}
|
||||
public PageInfoCollection Pages{ get => m_Pages;
|
||||
set => m_Pages = value;
|
||||
}
|
||||
public string Account { get; set; }
|
||||
|
||||
public PageInfoCollection Pages { get; set; }
|
||||
|
||||
public string Display
|
||||
{
|
||||
|
|
@ -29,9 +20,9 @@ namespace Server.Engines.Reports
|
|||
if ( m_Display != null )
|
||||
return m_Display;
|
||||
|
||||
if ( m_Account != null )
|
||||
if ( Account != null )
|
||||
{
|
||||
IAccount acct = Accounts.GetAccount( m_Account );
|
||||
IAccount acct = Accounts.GetAccount( Account );
|
||||
|
||||
if ( acct != null )
|
||||
{
|
||||
|
|
@ -50,37 +41,37 @@ namespace Server.Engines.Reports
|
|||
}
|
||||
}
|
||||
|
||||
return ( m_Display = m_Account );
|
||||
return ( m_Display = Account );
|
||||
}
|
||||
}
|
||||
|
||||
public int GetPageCount( PageResolution res, DateTime min, DateTime max )
|
||||
{
|
||||
return StaffHistory.GetPageCount( m_Pages, res, min, max );
|
||||
return StaffHistory.GetPageCount( Pages, res, min, max );
|
||||
}
|
||||
|
||||
public BaseInfo( string account )
|
||||
{
|
||||
m_Account = account;
|
||||
m_Pages = new PageInfoCollection();
|
||||
Account = account;
|
||||
Pages = new PageInfoCollection();
|
||||
}
|
||||
|
||||
public void Register( PageInfo page )
|
||||
{
|
||||
m_Pages.Add( page );
|
||||
Pages.Add( page );
|
||||
}
|
||||
|
||||
public void Unregister( PageInfo page )
|
||||
{
|
||||
m_Pages.Remove( page );
|
||||
Pages.Remove( page );
|
||||
}
|
||||
|
||||
public int CompareTo( object obj )
|
||||
{
|
||||
BaseInfo cmp = obj as BaseInfo;
|
||||
|
||||
int v = cmp.GetPageCount( cmp is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - m_SortRange, DateTime.UtcNow )
|
||||
- GetPageCount( this is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - m_SortRange, DateTime.UtcNow );
|
||||
int v = cmp.GetPageCount( cmp is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - SortRange, DateTime.UtcNow )
|
||||
- GetPageCount( this is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - SortRange, DateTime.UtcNow );
|
||||
|
||||
if ( v == 0 )
|
||||
v = string.Compare( Display, cmp.Display );
|
||||
|
|
|
|||
|
|
@ -68,17 +68,7 @@ namespace Server.Engines.Reports
|
|||
}
|
||||
}
|
||||
|
||||
private PageType m_PageType;
|
||||
private PageResolution m_Resolution;
|
||||
|
||||
private DateTime m_TimeSent;
|
||||
private DateTime m_TimeResolved;
|
||||
|
||||
private string m_SentBy;
|
||||
private string m_ResolvedBy;
|
||||
|
||||
private string m_Message;
|
||||
private ResponseInfoCollection m_Responses;
|
||||
|
||||
public StaffHistory History
|
||||
{
|
||||
|
|
@ -104,15 +94,13 @@ namespace Server.Engines.Reports
|
|||
}
|
||||
}
|
||||
|
||||
public PageType PageType{ get => m_PageType;
|
||||
set => m_PageType = value;
|
||||
}
|
||||
public PageResolution Resolution => m_Resolution;
|
||||
public PageType PageType { get; set; }
|
||||
|
||||
public DateTime TimeSent{ get => m_TimeSent;
|
||||
set => m_TimeSent = value;
|
||||
}
|
||||
public DateTime TimeResolved => m_TimeResolved;
|
||||
public PageResolution Resolution { get; private set; }
|
||||
|
||||
public DateTime TimeSent { get; set; }
|
||||
|
||||
public DateTime TimeResolved { get; private set; }
|
||||
|
||||
public string SentBy
|
||||
{
|
||||
|
|
@ -126,14 +114,11 @@ namespace Server.Engines.Reports
|
|||
}
|
||||
}
|
||||
|
||||
public string ResolvedBy => m_ResolvedBy;
|
||||
public string ResolvedBy { get; private set; }
|
||||
|
||||
public string Message{ get => m_Message;
|
||||
set => m_Message = value;
|
||||
}
|
||||
public ResponseInfoCollection Responses{ get => m_Responses;
|
||||
set => m_Responses = value;
|
||||
}
|
||||
public string Message { get; set; }
|
||||
|
||||
public ResponseInfoCollection Responses { get; set; }
|
||||
|
||||
public void UpdateResolver()
|
||||
{
|
||||
|
|
@ -146,9 +131,9 @@ namespace Server.Engines.Reports
|
|||
else
|
||||
Resolver = null;
|
||||
|
||||
m_ResolvedBy = resolvedBy;
|
||||
m_TimeResolved = timeResolved;
|
||||
m_Resolution = res;
|
||||
ResolvedBy = resolvedBy;
|
||||
TimeResolved = timeResolved;
|
||||
Resolution = res;
|
||||
}
|
||||
|
||||
public bool IsStaffResolution( PageResolution res )
|
||||
|
|
@ -171,9 +156,9 @@ namespace Server.Engines.Reports
|
|||
|
||||
public PageResolution GetResolution( out string resolvedBy, out DateTime timeResolved )
|
||||
{
|
||||
for ( int i = m_Responses.Count - 1; i >= 0; --i )
|
||||
for ( int i = Responses.Count - 1; i >= 0; --i )
|
||||
{
|
||||
ResponseInfo resp = m_Responses[i];
|
||||
ResponseInfo resp = Responses[i];
|
||||
PageResolution res = ResFromResp( resp.Message );
|
||||
|
||||
if ( res != PageResolution.None )
|
||||
|
|
@ -185,7 +170,7 @@ namespace Server.Engines.Reports
|
|||
}
|
||||
|
||||
resolvedBy = m_SentBy;
|
||||
timeResolved = m_TimeSent;
|
||||
timeResolved = TimeSent;
|
||||
return PageResolution.None;
|
||||
}
|
||||
|
||||
|
|
@ -196,53 +181,53 @@ namespace Server.Engines.Reports
|
|||
|
||||
public PageInfo()
|
||||
{
|
||||
m_Responses = new ResponseInfoCollection();
|
||||
Responses = new ResponseInfoCollection();
|
||||
}
|
||||
|
||||
public PageInfo( PageEntry entry )
|
||||
{
|
||||
m_PageType = entry.Type;
|
||||
PageType = entry.Type;
|
||||
|
||||
m_TimeSent = entry.Sent;
|
||||
TimeSent = entry.Sent;
|
||||
m_SentBy = GetAccount( entry.Sender );
|
||||
|
||||
m_Message = entry.Message;
|
||||
m_Responses = new ResponseInfoCollection();
|
||||
Message = entry.Message;
|
||||
Responses = new ResponseInfoCollection();
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetInt32( "p", (int)m_PageType );
|
||||
op.SetInt32( "p", (int)PageType );
|
||||
|
||||
op.SetDateTime( "ts", m_TimeSent );
|
||||
op.SetDateTime( "ts", TimeSent );
|
||||
op.SetString( "s", m_SentBy );
|
||||
|
||||
op.SetString( "m", m_Message );
|
||||
op.SetString( "m", Message );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_PageType = (PageType) ip.GetInt32( "p" );
|
||||
PageType = (PageType) ip.GetInt32( "p" );
|
||||
|
||||
m_TimeSent = ip.GetDateTime( "ts" );
|
||||
TimeSent = ip.GetDateTime( "ts" );
|
||||
m_SentBy = ip.GetString( "s" );
|
||||
|
||||
m_Message = ip.GetString( "m" );
|
||||
Message = ip.GetString( "m" );
|
||||
}
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
lock ( this )
|
||||
{
|
||||
for ( int i = 0; i < m_Responses.Count; ++i )
|
||||
m_Responses[i].Serialize( op );
|
||||
for ( int i = 0; i < Responses.Count; ++i )
|
||||
Responses[i].Serialize( op );
|
||||
}
|
||||
}
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
m_Responses.Add( ip.GetChild() as ResponseInfo );
|
||||
Responses.Add( ip.GetChild() as ResponseInfo );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,15 +15,9 @@ namespace Server.Engines.Reports
|
|||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
|
||||
private DateTime m_TimeStamp;
|
||||
private int m_Count;
|
||||
public DateTime TimeStamp { get; set; }
|
||||
|
||||
public DateTime TimeStamp{ get => m_TimeStamp;
|
||||
set => m_TimeStamp = value;
|
||||
}
|
||||
public int Count{ get => m_Count;
|
||||
set => m_Count = value;
|
||||
}
|
||||
public int Count { get; set; }
|
||||
|
||||
public QueueStatus()
|
||||
{
|
||||
|
|
@ -31,20 +25,20 @@ namespace Server.Engines.Reports
|
|||
|
||||
public QueueStatus( int count )
|
||||
{
|
||||
m_TimeStamp = DateTime.UtcNow;
|
||||
m_Count = count;
|
||||
TimeStamp = DateTime.UtcNow;
|
||||
Count = count;
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetDateTime( "t", m_TimeStamp );
|
||||
op.SetInt32( "c", m_Count );
|
||||
op.SetDateTime( "t", TimeStamp );
|
||||
op.SetInt32( "c", Count );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_TimeStamp = ip.GetDateTime( "t" );
|
||||
m_Count = ip.GetInt32( "c" );
|
||||
TimeStamp = ip.GetDateTime( "t" );
|
||||
Count = ip.GetInt32( "c" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,21 +15,11 @@ namespace Server.Engines.Reports
|
|||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
|
||||
private DateTime m_TimeStamp;
|
||||
public DateTime TimeStamp { get; set; }
|
||||
|
||||
private string m_SentBy;
|
||||
private string m_Message;
|
||||
public string SentBy { get; set; }
|
||||
|
||||
public DateTime TimeStamp{ get => m_TimeStamp;
|
||||
set => m_TimeStamp = value;
|
||||
}
|
||||
|
||||
public string SentBy{ get => m_SentBy;
|
||||
set => m_SentBy = value;
|
||||
}
|
||||
public string Message{ get => m_Message;
|
||||
set => m_Message = value;
|
||||
}
|
||||
public string Message { get; set; }
|
||||
|
||||
public ResponseInfo()
|
||||
{
|
||||
|
|
@ -37,25 +27,25 @@ namespace Server.Engines.Reports
|
|||
|
||||
public ResponseInfo( string sentBy, string message )
|
||||
{
|
||||
m_TimeStamp = DateTime.UtcNow;
|
||||
m_SentBy = sentBy;
|
||||
m_Message = message;
|
||||
TimeStamp = DateTime.UtcNow;
|
||||
SentBy = sentBy;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetDateTime( "t", m_TimeStamp );
|
||||
op.SetDateTime( "t", TimeStamp );
|
||||
|
||||
op.SetString( "s", m_SentBy );
|
||||
op.SetString( "m", m_Message );
|
||||
op.SetString( "s", SentBy );
|
||||
op.SetString( "m", Message );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_TimeStamp = ip.GetDateTime( "t" );
|
||||
TimeStamp = ip.GetDateTime( "t" );
|
||||
|
||||
m_SentBy = ip.GetString( "s" );
|
||||
m_Message = ip.GetString( "m" );
|
||||
SentBy = ip.GetString( "s" );
|
||||
Message = ip.GetString( "m" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,41 +17,29 @@ namespace Server.Engines.Reports
|
|||
public override PersistableType TypeID => ThisTypeID;
|
||||
#endregion
|
||||
|
||||
private PageInfoCollection m_Pages;
|
||||
private QueueStatusCollection m_QueueStats;
|
||||
public PageInfoCollection Pages { get; set; }
|
||||
|
||||
private Hashtable m_UserInfo;
|
||||
private Hashtable m_StaffInfo;
|
||||
public QueueStatusCollection QueueStats { get; set; }
|
||||
|
||||
public PageInfoCollection Pages{ get => m_Pages;
|
||||
set => m_Pages = value;
|
||||
}
|
||||
public QueueStatusCollection QueueStats{ get => m_QueueStats;
|
||||
set => m_QueueStats = value;
|
||||
}
|
||||
public Hashtable UserInfo { get; set; }
|
||||
|
||||
public Hashtable UserInfo{ get => m_UserInfo;
|
||||
set => m_UserInfo = value;
|
||||
}
|
||||
public Hashtable StaffInfo{ get => m_StaffInfo;
|
||||
set => m_StaffInfo = value;
|
||||
}
|
||||
public Hashtable StaffInfo { get; set; }
|
||||
|
||||
public void AddPage( PageInfo info )
|
||||
{
|
||||
lock ( SaveLock )
|
||||
m_Pages.Add( info );
|
||||
Pages.Add( info );
|
||||
|
||||
info.History = this;
|
||||
}
|
||||
|
||||
public StaffHistory()
|
||||
{
|
||||
m_Pages = new PageInfoCollection();
|
||||
m_QueueStats = new QueueStatusCollection();
|
||||
Pages = new PageInfoCollection();
|
||||
QueueStats = new QueueStatusCollection();
|
||||
|
||||
m_UserInfo = new Hashtable( StringComparer.OrdinalIgnoreCase );
|
||||
m_StaffInfo = new Hashtable( StringComparer.OrdinalIgnoreCase );
|
||||
UserInfo = new Hashtable( StringComparer.OrdinalIgnoreCase );
|
||||
StaffInfo = new Hashtable( StringComparer.OrdinalIgnoreCase );
|
||||
}
|
||||
|
||||
public StaffInfo GetStaffInfo( string account )
|
||||
|
|
@ -61,8 +49,8 @@ namespace Server.Engines.Reports
|
|||
if ( string.IsNullOrEmpty(account) )
|
||||
return null;
|
||||
|
||||
if ( !(m_StaffInfo[account] is StaffInfo info) )
|
||||
m_StaffInfo[account] = info = new StaffInfo( account );
|
||||
if ( !(StaffInfo[account] is StaffInfo info) )
|
||||
StaffInfo[account] = info = new StaffInfo( account );
|
||||
|
||||
return info;
|
||||
}
|
||||
|
|
@ -73,8 +61,8 @@ namespace Server.Engines.Reports
|
|||
if ( string.IsNullOrEmpty(account) )
|
||||
return null;
|
||||
|
||||
if ( !(m_UserInfo[account] is UserInfo info) )
|
||||
m_UserInfo[account] = info = new UserInfo( account );
|
||||
if ( !(UserInfo[account] is UserInfo info) )
|
||||
UserInfo[account] = info = new UserInfo( account );
|
||||
|
||||
return info;
|
||||
}
|
||||
|
|
@ -111,11 +99,11 @@ namespace Server.Engines.Reports
|
|||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < m_Pages.Count; ++i )
|
||||
m_Pages[i].Serialize( op );
|
||||
for ( int i = 0; i < Pages.Count; ++i )
|
||||
Pages[i].Serialize( op );
|
||||
|
||||
for ( int i = 0; i < m_QueueStats.Count; ++i )
|
||||
m_QueueStats[i].Serialize( op );
|
||||
for ( int i = 0; i < QueueStats.Count; ++i )
|
||||
QueueStats[i].Serialize( op );
|
||||
}
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
|
|
@ -132,7 +120,7 @@ namespace Server.Engines.Reports
|
|||
|
||||
if ( pageInfo.TimeSent >= min || pageInfo.TimeResolved >= min )
|
||||
{
|
||||
m_Pages.Add( pageInfo );
|
||||
Pages.Add( pageInfo );
|
||||
pageInfo.History = this;
|
||||
}
|
||||
else
|
||||
|
|
@ -144,17 +132,17 @@ namespace Server.Engines.Reports
|
|||
else if ( obj is QueueStatus queueStatus )
|
||||
{
|
||||
if ( queueStatus.TimeStamp >= min )
|
||||
m_QueueStats.Add( queueStatus );
|
||||
QueueStats.Add( queueStatus );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public StaffInfo[] GetStaff()
|
||||
{
|
||||
StaffInfo[] staff = new StaffInfo[m_StaffInfo.Count];
|
||||
StaffInfo[] staff = new StaffInfo[StaffInfo.Count];
|
||||
int index = 0;
|
||||
|
||||
foreach ( StaffInfo staffInfo in m_StaffInfo.Values )
|
||||
foreach ( StaffInfo staffInfo in StaffInfo.Values )
|
||||
staff[index++] = staffInfo;
|
||||
|
||||
return staff;
|
||||
|
|
@ -171,11 +159,11 @@ namespace Server.Engines.Reports
|
|||
BaseInfo.SortRange = TimeSpan.FromDays( 7.0 );
|
||||
Array.Sort( staff );
|
||||
|
||||
objects.Add( GraphHourlyPages( m_Pages, PageResolution.None, "New pages by hour", "graph_new_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( m_Pages, PageResolution.Handled, "Handled pages by hour", "graph_handled_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( m_Pages, PageResolution.Deleted, "Deleted pages by hour", "graph_deleted_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( m_Pages, PageResolution.Canceled, "Canceled pages by hour", "graph_canceled_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( m_Pages, PageResolution.Logged, "Logged-out pages by hour", "graph_logged_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( Pages, PageResolution.None, "New pages by hour", "graph_new_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( Pages, PageResolution.Handled, "Handled pages by hour", "graph_handled_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( Pages, PageResolution.Deleted, "Deleted pages by hour", "graph_deleted_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( Pages, PageResolution.Canceled, "Canceled pages by hour", "graph_canceled_pages_hr" ) );
|
||||
objects.Add( GraphHourlyPages( Pages, PageResolution.Logged, "Logged-out pages by hour", "graph_logged_pages_hr" ) );
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays( 1.0 );
|
||||
Array.Sort( staff );
|
||||
|
|
@ -231,9 +219,9 @@ namespace Server.Engines.Reports
|
|||
DateTime max = DateTime.UtcNow;
|
||||
DateTime min = max - TimeSpan.FromDays( 7.0 );
|
||||
|
||||
for ( int i = 0; i < m_QueueStats.Count; ++i )
|
||||
for ( int i = 0; i < QueueStats.Count; ++i )
|
||||
{
|
||||
DateTime ts = m_QueueStats[i].TimeStamp;
|
||||
DateTime ts = QueueStats[i].TimeStamp;
|
||||
|
||||
if ( ts >= min && ts < max )
|
||||
{
|
||||
|
|
@ -242,7 +230,7 @@ namespace Server.Engines.Reports
|
|||
|
||||
int hour = time.Hours;
|
||||
|
||||
totals[hour] += m_QueueStats[i].Count;
|
||||
totals[hour] += QueueStats[i].Count;
|
||||
counts[hour]++;
|
||||
}
|
||||
}
|
||||
|
|
@ -386,11 +374,11 @@ namespace Server.Engines.Reports
|
|||
|
||||
PieChart resChart = new PieChart( title + " Resolutions", fname + "_resol", true );
|
||||
|
||||
int countTotal = GetPageCount( m_Pages, PageResolution.None, min, max );
|
||||
int countHandled = GetPageCount( m_Pages, PageResolution.Handled, min, max );
|
||||
int countDeleted = GetPageCount( m_Pages, PageResolution.Deleted, min, max );
|
||||
int countCanceled = GetPageCount( m_Pages, PageResolution.Canceled, min, max );
|
||||
int countLogged = GetPageCount( m_Pages, PageResolution.Logged, min, max );
|
||||
int countTotal = GetPageCount( Pages, PageResolution.None, min, max );
|
||||
int countHandled = GetPageCount( Pages, PageResolution.Handled, min, max );
|
||||
int countDeleted = GetPageCount( Pages, PageResolution.Deleted, min, max );
|
||||
int countCanceled = GetPageCount( Pages, PageResolution.Canceled, min, max );
|
||||
int countLogged = GetPageCount( Pages, PageResolution.Logged, min, max );
|
||||
int countUnres = countTotal - ( countHandled + countDeleted + countCanceled + countLogged );
|
||||
|
||||
resChart.Items.Add( "Handled", countHandled );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue