#W# Initial Commit: Avatars Conquest
This commit is contained in:
commit
5df497787a
7510 changed files with 416048 additions and 0 deletions
311
Scripts/Engines/Reports/Objects/Charts/BarGraph.cs
Normal file
311
Scripts/Engines/Reports/Objects/Charts/BarGraph.cs
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public enum BarGraphRenderMode
|
||||
{
|
||||
Bars,
|
||||
Lines
|
||||
}
|
||||
|
||||
public class BarGraph : Chart
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "bg", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new BarGraph();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private int m_Ticks;
|
||||
private BarGraphRenderMode m_RenderMode;
|
||||
|
||||
private string m_xTitle;
|
||||
private string m_yTitle;
|
||||
|
||||
private int m_FontSize = 7;
|
||||
private int m_Interval = 1;
|
||||
|
||||
private BarRegion[] m_Regions;
|
||||
|
||||
public int Ticks{ get{ return m_Ticks; } set{ m_Ticks = value; } }
|
||||
public BarGraphRenderMode RenderMode{ get{ return m_RenderMode; } set{ m_RenderMode = value; } }
|
||||
|
||||
public string xTitle{ get{ return m_xTitle; } set{ m_xTitle = value; } }
|
||||
public string yTitle{ get{ return m_yTitle; } set{ m_yTitle = value; } }
|
||||
|
||||
public int FontSize{ get{ return m_FontSize; } set{ m_FontSize = value; } }
|
||||
public int Interval{ get{ return m_Interval; } set{ m_Interval = value; } }
|
||||
|
||||
public BarRegion[] Regions{ get{ return m_Regions; } set{ m_Regions = value; } }
|
||||
|
||||
public BarGraph( string name, string fileName, int ticks, string xTitle, string yTitle, BarGraphRenderMode rm )
|
||||
{
|
||||
m_Name = name;
|
||||
m_FileName = fileName;
|
||||
m_Ticks = ticks;
|
||||
m_xTitle = xTitle;
|
||||
m_yTitle = yTitle;
|
||||
m_RenderMode = rm;
|
||||
}
|
||||
|
||||
private BarGraph()
|
||||
{
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
base.SerializeAttributes( op );
|
||||
|
||||
op.SetInt32( "t", m_Ticks );
|
||||
op.SetInt32( "r", (int) m_RenderMode );
|
||||
|
||||
op.SetString( "x", m_xTitle );
|
||||
op.SetString( "y", m_yTitle );
|
||||
|
||||
op.SetInt32( "s", m_FontSize );
|
||||
op.SetInt32( "i", m_Interval );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
base.DeserializeAttributes( ip );
|
||||
|
||||
m_Ticks = ip.GetInt32( "t" );
|
||||
m_RenderMode = (BarGraphRenderMode) ip.GetInt32( "r" );
|
||||
|
||||
m_xTitle = Utility.Intern( ip.GetString( "x" ) );
|
||||
m_yTitle = Utility.Intern( ip.GetString( "y" ) );
|
||||
|
||||
m_FontSize = ip.GetInt32( "s" );
|
||||
m_Interval = ip.GetInt32( "i" );
|
||||
}
|
||||
|
||||
public static int LookupReportValue( Snapshot ss, string reportName, string valueName )
|
||||
{
|
||||
for ( int j = 0; j < ss.Children.Count; ++j )
|
||||
{
|
||||
Report report = ss.Children[j] as Report;
|
||||
|
||||
if ( report == null || report.Name != reportName )
|
||||
continue;
|
||||
|
||||
for ( int k = 0; k < report.Items.Count; ++k )
|
||||
{
|
||||
ReportItem item = report.Items[k];
|
||||
|
||||
if ( item.Values[0].Value == valueName )
|
||||
return Utility.ToInt32( item.Values[1].Value );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static BarGraph DailyAverage( SnapshotHistory history, string reportName, string valueName )
|
||||
{
|
||||
int[] totals = new int[24];
|
||||
int[] counts = new int[24];
|
||||
|
||||
int min = history.Snapshots.Count - (7 * 24); // averages over one week
|
||||
|
||||
if ( min < 0 )
|
||||
min = 0;
|
||||
|
||||
for ( int i = min; i < history.Snapshots.Count; ++i )
|
||||
{
|
||||
Snapshot ss = history.Snapshots[i];
|
||||
|
||||
int val = LookupReportValue( ss, reportName, valueName );
|
||||
|
||||
if ( val == -1 )
|
||||
continue;
|
||||
|
||||
int hour = ss.TimeStamp.TimeOfDay.Hours;
|
||||
|
||||
totals[hour] += val;
|
||||
counts[hour]++;
|
||||
}
|
||||
|
||||
BarGraph barGraph = new BarGraph( "Hourly average " + valueName, "graphs_" + valueName.ToLower() + "_avg", 10, "Time", valueName, BarGraphRenderMode.Lines );
|
||||
|
||||
barGraph.m_FontSize = 6;
|
||||
|
||||
for ( int i = 7; i <= totals.Length+7; ++i )
|
||||
{
|
||||
int val;
|
||||
|
||||
if ( counts[i%totals.Length] == 0 )
|
||||
val = 0;
|
||||
else
|
||||
val = (totals[i%totals.Length] + (counts[i%totals.Length] / 2)) / counts[i%totals.Length];
|
||||
|
||||
int realHours = i%totals.Length;
|
||||
int hours;
|
||||
|
||||
if ( realHours == 0 )
|
||||
hours = 12;
|
||||
else if ( realHours > 12 )
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
|
||||
barGraph.Items.Add( hours + (realHours >= 12 ? " PM" : " AM"), val );
|
||||
}
|
||||
|
||||
return barGraph;
|
||||
}
|
||||
|
||||
public static BarGraph Growth( SnapshotHistory history, string reportName, string valueName )
|
||||
{
|
||||
BarGraph barGraph = new BarGraph( "Growth of " + valueName + " over time", "graphs_" + valueName.ToLower() + "_growth", 10, "Time", valueName, BarGraphRenderMode.Lines );
|
||||
|
||||
barGraph.FontSize = 6;
|
||||
barGraph.Interval = 7;
|
||||
|
||||
DateTime startPeriod = history.Snapshots[0].TimeStamp.Date + TimeSpan.FromDays( 1.0 );
|
||||
DateTime endPeriod = history.Snapshots[history.Snapshots.Count - 1].TimeStamp.Date;
|
||||
|
||||
ArrayList regions = new ArrayList();
|
||||
|
||||
DateTime curDate = DateTime.MinValue;
|
||||
int curPeak = -1;
|
||||
int curLow = 1000;
|
||||
int curTotl = 0;
|
||||
int curCont = 0;
|
||||
int curValu = 0;
|
||||
|
||||
for ( int i = 0; i < history.Snapshots.Count; ++i )
|
||||
{
|
||||
Snapshot ss = history.Snapshots[i];
|
||||
DateTime timeStamp = ss.TimeStamp;
|
||||
|
||||
if ( timeStamp < startPeriod || timeStamp >= endPeriod )
|
||||
continue;
|
||||
|
||||
int val = LookupReportValue( ss, reportName, valueName );
|
||||
|
||||
if ( val == -1 )
|
||||
continue;
|
||||
|
||||
DateTime thisDate = timeStamp.Date;
|
||||
|
||||
if ( curDate == DateTime.MinValue )
|
||||
curDate = thisDate;
|
||||
|
||||
curCont++;
|
||||
curTotl += val;
|
||||
curValu = curTotl / curCont;
|
||||
|
||||
if ( curDate != thisDate && curValu >= 0 )
|
||||
{
|
||||
string mnthName = thisDate.ToString( "MMMM" );
|
||||
|
||||
if ( regions.Count == 0 )
|
||||
{
|
||||
regions.Add( new BarRegion( barGraph.Items.Count, barGraph.Items.Count, mnthName ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
BarRegion region = (BarRegion)regions[regions.Count - 1];
|
||||
|
||||
if ( region.m_Name == mnthName )
|
||||
region.m_RangeTo = barGraph.Items.Count;
|
||||
else
|
||||
regions.Add( new BarRegion( barGraph.Items.Count, barGraph.Items.Count, mnthName ) );
|
||||
}
|
||||
|
||||
barGraph.Items.Add( thisDate.Day.ToString(), curValu );
|
||||
|
||||
curPeak = val;
|
||||
curLow = val;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( val > curPeak )
|
||||
curPeak = val;
|
||||
|
||||
if ( val > 0 && val < curLow )
|
||||
curLow = val;
|
||||
}
|
||||
|
||||
curDate = thisDate;
|
||||
}
|
||||
|
||||
barGraph.Regions = (BarRegion[])regions.ToArray( typeof( BarRegion ) );
|
||||
|
||||
return barGraph;
|
||||
}
|
||||
|
||||
public static BarGraph OverTime( SnapshotHistory history, string reportName, string valueName, int step, int max, int ival )
|
||||
{
|
||||
BarGraph barGraph = new BarGraph( valueName + " over time", "graphs_" + valueName.ToLower() + "_ot", 10, "Time", valueName, BarGraphRenderMode.Lines );
|
||||
|
||||
TimeSpan ts = TimeSpan.FromHours( (max*step)-0.5 );
|
||||
|
||||
DateTime mostRecent = history.Snapshots[history.Snapshots.Count - 1].TimeStamp;
|
||||
DateTime minTime = mostRecent - ts;
|
||||
|
||||
barGraph.FontSize = 6;
|
||||
barGraph.Interval = ival;
|
||||
|
||||
ArrayList regions = new ArrayList();
|
||||
|
||||
for ( int i = 0; i < history.Snapshots.Count; ++i )
|
||||
{
|
||||
Snapshot ss = history.Snapshots[i];
|
||||
DateTime timeStamp = ss.TimeStamp;
|
||||
|
||||
if ( timeStamp < minTime )
|
||||
continue;
|
||||
|
||||
if ( (i % step) != 0 )
|
||||
continue;
|
||||
|
||||
int val = LookupReportValue( ss, reportName, valueName );
|
||||
|
||||
if ( val == -1 )
|
||||
continue;
|
||||
|
||||
int realHours = timeStamp.TimeOfDay.Hours;
|
||||
int hours;
|
||||
|
||||
if ( realHours == 0 )
|
||||
hours = 12;
|
||||
else if ( realHours > 12 )
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
|
||||
string dayName = timeStamp.DayOfWeek.ToString();
|
||||
|
||||
if ( regions.Count == 0 )
|
||||
{
|
||||
regions.Add( new BarRegion( barGraph.Items.Count, barGraph.Items.Count, dayName ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
BarRegion region = (BarRegion) regions[regions.Count - 1];
|
||||
|
||||
if ( region.m_Name == dayName )
|
||||
region.m_RangeTo = barGraph.Items.Count;
|
||||
else
|
||||
regions.Add( new BarRegion( barGraph.Items.Count, barGraph.Items.Count, dayName ) );
|
||||
}
|
||||
|
||||
barGraph.Items.Add( hours + (realHours >= 12 ? " PM" : " AM"), val );
|
||||
}
|
||||
|
||||
barGraph.Regions = (BarRegion[])regions.ToArray( typeof( BarRegion ) );
|
||||
|
||||
return barGraph;
|
||||
}
|
||||
}
|
||||
}
|
||||
44
Scripts/Engines/Reports/Objects/Charts/Chart.cs
Normal file
44
Scripts/Engines/Reports/Objects/Charts/Chart.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public abstract class Chart : PersistableObject
|
||||
{
|
||||
protected string m_Name;
|
||||
protected string m_FileName;
|
||||
protected ChartItemCollection m_Items;
|
||||
|
||||
public string Name{ get{ return m_Name; } set{ m_Name = value; } }
|
||||
public string FileName{ get{ return m_FileName; } set{ m_FileName = value; } }
|
||||
public ChartItemCollection Items{ get{ return m_Items; } }
|
||||
|
||||
public Chart()
|
||||
{
|
||||
m_Items = new ChartItemCollection();
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetString( "n", m_Name );
|
||||
op.SetString( "f", m_FileName );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_Name = Utility.Intern( ip.GetString( "n" ) );
|
||||
m_FileName = Utility.Intern( ip.GetString( "f" ) );
|
||||
}
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < m_Items.Count; ++i )
|
||||
m_Items[i].Serialize( op );
|
||||
}
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
m_Items.Add( ip.GetChild() as ChartItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
46
Scripts/Engines/Reports/Objects/Charts/ChartItem.cs
Normal file
46
Scripts/Engines/Reports/Objects/Charts/ChartItem.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class ChartItem : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "ci", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ChartItem();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private string m_Name;
|
||||
private int m_Value;
|
||||
|
||||
public string Name{ get{ return m_Name; } set{ m_Name = value; } }
|
||||
public int Value{ get{ return m_Value; } set{ m_Value = value; } }
|
||||
|
||||
private ChartItem()
|
||||
{
|
||||
}
|
||||
|
||||
public ChartItem( string name, int value )
|
||||
{
|
||||
m_Name = name;
|
||||
m_Value = value;
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetString( "n", m_Name );
|
||||
op.SetInt32( "v", m_Value );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_Name = Utility.Intern( ip.GetString( "n" ) );
|
||||
m_Value = ip.GetInt32( "v" );
|
||||
}
|
||||
}
|
||||
}
|
||||
205
Scripts/Engines/Reports/Objects/Charts/ChartItemCollection.cs
Normal file
205
Scripts/Engines/Reports/Objects/Charts/ChartItemCollection.cs
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version: 1.1.4322.573
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ChartItem.
|
||||
/// </summary>
|
||||
public class ChartItemCollection : System.Collections.CollectionBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ChartItemCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ChartItem at a specific position in the ChartItemCollection.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.ChartItem this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((Server.Engines.Reports.ChartItem)(this.List[index]));
|
||||
}
|
||||
set
|
||||
{
|
||||
this.List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Add( string name, int value )
|
||||
{
|
||||
return Add( new ChartItem( name, value ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ChartItem entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ChartItem instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(Server.Engines.Reports.ChartItem value)
|
||||
{
|
||||
return this.List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ChartItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ChartItem instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ChartItem instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(Server.Engines.Reports.ChartItem value)
|
||||
{
|
||||
return this.List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ChartItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ChartItem instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.ChartItem instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(Server.Engines.Reports.ChartItem value)
|
||||
{
|
||||
return this.List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ChartItem instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ChartItem instance to remove.</param>
|
||||
public void Remove(Server.Engines.Reports.ChartItem value)
|
||||
{
|
||||
this.List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ChartItem instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ChartItem's enumerator.</returns>
|
||||
public new ChartItemCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ChartItemCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ChartItem instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ChartItem instance to insert.</param>
|
||||
public void Insert(int index, Server.Engines.Reports.ChartItem value)
|
||||
{
|
||||
this.List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ChartItem.
|
||||
/// </summary>
|
||||
public class ChartItemCollectionEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private Server.Engines.Reports.ChartItem _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ChartItemCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal ChartItemCollectionEnumerator(ChartItemCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ChartItem object in the enumerated ChartItemCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.ChartItem Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current element in the collection.
|
||||
/// </summary>
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the cursor, so it points to the beginning of the enumerator.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_index = -1;
|
||||
_currentElement = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the enumerator to the next queue of the enumeration, if one is currently available.
|
||||
/// </summary>
|
||||
/// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
if ((_index
|
||||
< (_collection.Count - 1)))
|
||||
{
|
||||
_index = (_index + 1);
|
||||
_currentElement = this._collection[_index];
|
||||
return true;
|
||||
}
|
||||
_index = _collection.Count;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
47
Scripts/Engines/Reports/Objects/Charts/PieChart.cs
Normal file
47
Scripts/Engines/Reports/Objects/Charts/PieChart.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class PieChart : Chart
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "pc", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new PieChart();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private bool m_ShowPercents;
|
||||
|
||||
public bool ShowPercents{ get{ return m_ShowPercents; } set{ m_ShowPercents = value; } }
|
||||
|
||||
public PieChart( string name, string fileName, bool showPercents )
|
||||
{
|
||||
m_Name = name;
|
||||
m_FileName = fileName;
|
||||
m_ShowPercents = showPercents;
|
||||
}
|
||||
|
||||
private PieChart()
|
||||
{
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
base.SerializeAttributes( op );
|
||||
|
||||
op.SetBoolean( "p", m_ShowPercents );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
base.DeserializeAttributes( ip );
|
||||
|
||||
m_ShowPercents = ip.GetBoolean( "p" );
|
||||
}
|
||||
}
|
||||
}
|
||||
53
Scripts/Engines/Reports/Objects/Reports/ItemValue.cs
Normal file
53
Scripts/Engines/Reports/Objects/Reports/ItemValue.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class ItemValue : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "iv", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ItemValue();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private string m_Value;
|
||||
private string m_Format;
|
||||
|
||||
public string Value{ get{ return m_Value; } set{ m_Value = value; } }
|
||||
public string Format{ get{ return m_Format; } set{ m_Format = value; } }
|
||||
|
||||
private ItemValue()
|
||||
{
|
||||
}
|
||||
|
||||
public ItemValue( string value ) : this( value, null )
|
||||
{
|
||||
}
|
||||
|
||||
public ItemValue( string value, string format )
|
||||
{
|
||||
m_Value = value;
|
||||
m_Format = format;
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetString( "v", m_Value );
|
||||
op.SetString( "f", m_Format );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_Value = ip.GetString( "v" );
|
||||
m_Format = Utility.Intern( ip.GetString( "f" ) );
|
||||
|
||||
if ( m_Format == null )
|
||||
Utility.Intern( ref m_Value );
|
||||
}
|
||||
}
|
||||
}
|
||||
210
Scripts/Engines/Reports/Objects/Reports/ItemValueCollection.cs
Normal file
210
Scripts/Engines/Reports/Objects/Reports/ItemValueCollection.cs
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version: 1.1.4322.573
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ItemValue.
|
||||
/// </summary>
|
||||
public class ItemValueCollection : System.Collections.CollectionBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ItemValueCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ItemValue at a specific position in the ItemValueCollection.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.ItemValue this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((Server.Engines.Reports.ItemValue)(this.List[index]));
|
||||
}
|
||||
set
|
||||
{
|
||||
this.List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Add( string value )
|
||||
{
|
||||
return Add( new ItemValue( value ) );
|
||||
}
|
||||
|
||||
public int Add( string value, string format )
|
||||
{
|
||||
return Add( new ItemValue( value, format ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ItemValue entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ItemValue instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(Server.Engines.Reports.ItemValue value)
|
||||
{
|
||||
return this.List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ItemValue instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ItemValue instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ItemValue instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(Server.Engines.Reports.ItemValue value)
|
||||
{
|
||||
return this.List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ItemValue instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ItemValue instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.ItemValue instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(Server.Engines.Reports.ItemValue value)
|
||||
{
|
||||
return this.List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ItemValue instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ItemValue instance to remove.</param>
|
||||
public void Remove(Server.Engines.Reports.ItemValue value)
|
||||
{
|
||||
this.List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ItemValue instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ItemValue's enumerator.</returns>
|
||||
public new ItemValueCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ItemValueCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ItemValue instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ItemValue instance to insert.</param>
|
||||
public void Insert(int index, Server.Engines.Reports.ItemValue value)
|
||||
{
|
||||
this.List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ItemValue.
|
||||
/// </summary>
|
||||
public class ItemValueCollectionEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private Server.Engines.Reports.ItemValue _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ItemValueCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal ItemValueCollectionEnumerator(ItemValueCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ItemValue object in the enumerated ItemValueCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.ItemValue Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current element in the collection.
|
||||
/// </summary>
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the cursor, so it points to the beginning of the enumerator.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_index = -1;
|
||||
_currentElement = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the enumerator to the next queue of the enumeration, if one is currently available.
|
||||
/// </summary>
|
||||
/// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
if ((_index
|
||||
< (_collection.Count - 1)))
|
||||
{
|
||||
_index = (_index + 1);
|
||||
_currentElement = this._collection[_index];
|
||||
return true;
|
||||
}
|
||||
_index = _collection.Count;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
74
Scripts/Engines/Reports/Objects/Reports/Report.cs
Normal file
74
Scripts/Engines/Reports/Objects/Reports/Report.cs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class Report : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "rp", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new Report();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private string m_Name;
|
||||
private string m_Width;
|
||||
private ReportColumnCollection m_Columns;
|
||||
private ReportItemCollection m_Items;
|
||||
|
||||
public string Name{ get{ return m_Name; } set{ m_Name = value; } }
|
||||
public string Width{ get{ return m_Width; } set{ m_Width = value; } }
|
||||
public ReportColumnCollection Columns{ get{ return m_Columns; } }
|
||||
public ReportItemCollection Items{ get{ return m_Items; } }
|
||||
|
||||
private Report() : this( null, null )
|
||||
{
|
||||
}
|
||||
|
||||
public Report( string name, string width )
|
||||
{
|
||||
m_Name = name;
|
||||
m_Width = width;
|
||||
m_Columns = new ReportColumnCollection();
|
||||
m_Items = new ReportItemCollection();
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetString( "n", m_Name );
|
||||
op.SetString( "w", m_Width );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_Name = Utility.Intern( ip.GetString( "n" ) );
|
||||
m_Width = Utility.Intern( ip.GetString( "w" ) );
|
||||
}
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < m_Columns.Count; ++i )
|
||||
m_Columns[i].Serialize( op );
|
||||
|
||||
for ( int i = 0; i < m_Items.Count; ++i )
|
||||
m_Items[i].Serialize( op );
|
||||
}
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
{
|
||||
PersistableObject child = ip.GetChild();
|
||||
|
||||
if ( child is ReportColumn )
|
||||
m_Columns.Add( (ReportColumn) child );
|
||||
else if ( child is ReportItem )
|
||||
m_Items.Add( (ReportItem) child );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
55
Scripts/Engines/Reports/Objects/Reports/ReportColumn.cs
Normal file
55
Scripts/Engines/Reports/Objects/Reports/ReportColumn.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class ReportColumn : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "rc", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ReportColumn();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private string m_Width;
|
||||
private string m_Align;
|
||||
private string m_Name;
|
||||
|
||||
public string Width{ get{ return m_Width; } set{ m_Width = value; } }
|
||||
public string Align{ get{ return m_Align; } set{ m_Align = value; } }
|
||||
public string Name{ get{ return m_Name; } set{ m_Name = value; } }
|
||||
|
||||
private ReportColumn()
|
||||
{
|
||||
}
|
||||
|
||||
public ReportColumn( string width, string align ) : this( width, align, null )
|
||||
{
|
||||
}
|
||||
|
||||
public ReportColumn( string width, string align, string name )
|
||||
{
|
||||
m_Width = width;
|
||||
m_Align = align;
|
||||
m_Name = name;
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetString( "w", m_Width );
|
||||
op.SetString( "a", m_Align );
|
||||
op.SetString( "n", m_Name );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_Width = Utility.Intern( ip.GetString( "w" ) );
|
||||
m_Align = Utility.Intern( ip.GetString( "a" ) );
|
||||
m_Name = Utility.Intern( ip.GetString( "n" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version: 1.1.4322.573
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ReportColumn.
|
||||
/// </summary>
|
||||
public class ReportColumnCollection : System.Collections.CollectionBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ReportColumnCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ReportColumn at a specific position in the ReportColumnCollection.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.ReportColumn this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((Server.Engines.Reports.ReportColumn)(this.List[index]));
|
||||
}
|
||||
set
|
||||
{
|
||||
this.List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Add( string width, string align )
|
||||
{
|
||||
return Add( new ReportColumn( width, align ) );
|
||||
}
|
||||
|
||||
public int Add( string width, string align, string name )
|
||||
{
|
||||
return Add( new ReportColumn( width, align, name ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ReportColumn entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportColumn instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(Server.Engines.Reports.ReportColumn value)
|
||||
{
|
||||
return this.List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ReportColumn instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportColumn instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ReportColumn instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(Server.Engines.Reports.ReportColumn value)
|
||||
{
|
||||
return this.List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ReportColumn instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportColumn instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.ReportColumn instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(Server.Engines.Reports.ReportColumn value)
|
||||
{
|
||||
return this.List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ReportColumn instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportColumn instance to remove.</param>
|
||||
public void Remove(Server.Engines.Reports.ReportColumn value)
|
||||
{
|
||||
this.List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ReportColumn instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ReportColumn's enumerator.</returns>
|
||||
public new ReportColumnCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ReportColumnCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ReportColumn instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportColumn instance to insert.</param>
|
||||
public void Insert(int index, Server.Engines.Reports.ReportColumn value)
|
||||
{
|
||||
this.List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ReportColumn.
|
||||
/// </summary>
|
||||
public class ReportColumnCollectionEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private Server.Engines.Reports.ReportColumn _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ReportColumnCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal ReportColumnCollectionEnumerator(ReportColumnCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ReportColumn object in the enumerated ReportColumnCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.ReportColumn Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current element in the collection.
|
||||
/// </summary>
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the cursor, so it points to the beginning of the enumerator.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_index = -1;
|
||||
_currentElement = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the enumerator to the next queue of the enumeration, if one is currently available.
|
||||
/// </summary>
|
||||
/// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
if ((_index
|
||||
< (_collection.Count - 1)))
|
||||
{
|
||||
_index = (_index + 1);
|
||||
_currentElement = this._collection[_index];
|
||||
return true;
|
||||
}
|
||||
_index = _collection.Count;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Scripts/Engines/Reports/Objects/Reports/ReportItem.cs
Normal file
39
Scripts/Engines/Reports/Objects/Reports/ReportItem.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class ReportItem : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "ri", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ReportItem();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private ItemValueCollection m_Values;
|
||||
|
||||
public ItemValueCollection Values{ get{ return m_Values; } }
|
||||
|
||||
public ReportItem()
|
||||
{
|
||||
m_Values = new ItemValueCollection();
|
||||
}
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < m_Values.Count; ++i )
|
||||
m_Values[i].Serialize( op );
|
||||
}
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
m_Values.Add( ip.GetChild() as ItemValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
215
Scripts/Engines/Reports/Objects/Reports/ReportItemCollection.cs
Normal file
215
Scripts/Engines/Reports/Objects/Reports/ReportItemCollection.cs
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version: 1.1.4322.573
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ReportItem.
|
||||
/// </summary>
|
||||
public class ReportItemCollection : System.Collections.CollectionBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ReportItemCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ReportItem at a specific position in the ReportItemCollection.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.ReportItem this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((Server.Engines.Reports.ReportItem)(this.List[index]));
|
||||
}
|
||||
set
|
||||
{
|
||||
this.List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Add( string name, object value )
|
||||
{
|
||||
return Add( name, value, null );
|
||||
}
|
||||
|
||||
public int Add( string name, object value, string format )
|
||||
{
|
||||
ReportItem item = new ReportItem();
|
||||
|
||||
item.Values.Add( name );
|
||||
item.Values.Add( value == null ? "" : value.ToString(), format );
|
||||
|
||||
return Add( item );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ReportItem entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportItem instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(Server.Engines.Reports.ReportItem value)
|
||||
{
|
||||
return this.List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ReportItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportItem instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ReportItem instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(Server.Engines.Reports.ReportItem value)
|
||||
{
|
||||
return this.List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ReportItem instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ReportItem instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.ReportItem instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(Server.Engines.Reports.ReportItem value)
|
||||
{
|
||||
return this.List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ReportItem instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportItem instance to remove.</param>
|
||||
public void Remove(Server.Engines.Reports.ReportItem value)
|
||||
{
|
||||
this.List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ReportItem instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ReportItem's enumerator.</returns>
|
||||
public new ReportItemCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ReportItemCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ReportItem instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ReportItem instance to insert.</param>
|
||||
public void Insert(int index, Server.Engines.Reports.ReportItem value)
|
||||
{
|
||||
this.List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ReportItem.
|
||||
/// </summary>
|
||||
public class ReportItemCollectionEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private Server.Engines.Reports.ReportItem _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ReportItemCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal ReportItemCollectionEnumerator(ReportItemCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ReportItem object in the enumerated ReportItemCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.ReportItem Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current element in the collection.
|
||||
/// </summary>
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the cursor, so it points to the beginning of the enumerator.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_index = -1;
|
||||
_currentElement = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the enumerator to the next queue of the enumeration, if one is currently available.
|
||||
/// </summary>
|
||||
/// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
if ((_index
|
||||
< (_collection.Count - 1)))
|
||||
{
|
||||
_index = (_index + 1);
|
||||
_currentElement = this._collection[_index];
|
||||
return true;
|
||||
}
|
||||
_index = _collection.Count;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
52
Scripts/Engines/Reports/Objects/Snapshots/Snapshot.cs
Normal file
52
Scripts/Engines/Reports/Objects/Snapshots/Snapshot.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class Snapshot : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "ss", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new Snapshot();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private DateTime m_TimeStamp;
|
||||
private ObjectCollection m_Children;
|
||||
|
||||
public DateTime TimeStamp{ get{ return m_TimeStamp; } set{ m_TimeStamp = value; } }
|
||||
public ObjectCollection Children{ get{ return m_Children; } set{ m_Children = value; } }
|
||||
|
||||
public Snapshot()
|
||||
{
|
||||
m_Children = new ObjectCollection();
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetDateTime( "t", m_TimeStamp );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_TimeStamp = ip.GetDateTime( "t" );
|
||||
}
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < m_Children.Count; ++i )
|
||||
m_Children[i].Serialize( op );
|
||||
}
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
m_Children.Add( ip.GetChild() );
|
||||
}
|
||||
}
|
||||
}
|
||||
200
Scripts/Engines/Reports/Objects/Snapshots/SnapshotCollection.cs
Normal file
200
Scripts/Engines/Reports/Objects/Snapshots/SnapshotCollection.cs
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version: 1.1.4322.573
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.Snapshot.
|
||||
/// </summary>
|
||||
public class SnapshotCollection : System.Collections.CollectionBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public SnapshotCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.Snapshot at a specific position in the SnapshotCollection.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.Snapshot this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((Server.Engines.Reports.Snapshot)(this.List[index]));
|
||||
}
|
||||
set
|
||||
{
|
||||
this.List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.Snapshot entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.Snapshot instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(Server.Engines.Reports.Snapshot value)
|
||||
{
|
||||
return this.List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.Snapshot instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.Snapshot instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.Snapshot instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(Server.Engines.Reports.Snapshot value)
|
||||
{
|
||||
return this.List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.Snapshot instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.Snapshot instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.Snapshot instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(Server.Engines.Reports.Snapshot value)
|
||||
{
|
||||
return this.List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.Snapshot instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.Snapshot instance to remove.</param>
|
||||
public void Remove(Server.Engines.Reports.Snapshot value)
|
||||
{
|
||||
this.List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.Snapshot instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.Snapshot's enumerator.</returns>
|
||||
public new SnapshotCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new SnapshotCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.Snapshot instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.Snapshot instance to insert.</param>
|
||||
public void Insert(int index, Server.Engines.Reports.Snapshot value)
|
||||
{
|
||||
this.List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.Snapshot.
|
||||
/// </summary>
|
||||
public class SnapshotCollectionEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private Server.Engines.Reports.Snapshot _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private SnapshotCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal SnapshotCollectionEnumerator(SnapshotCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.Snapshot object in the enumerated SnapshotCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.Snapshot Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current element in the collection.
|
||||
/// </summary>
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the cursor, so it points to the beginning of the enumerator.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_index = -1;
|
||||
_currentElement = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the enumerator to the next queue of the enumeration, if one is currently available.
|
||||
/// </summary>
|
||||
/// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
if ((_index
|
||||
< (_collection.Count - 1)))
|
||||
{
|
||||
_index = (_index + 1);
|
||||
_currentElement = this._collection[_index];
|
||||
return true;
|
||||
}
|
||||
_index = _collection.Count;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
65
Scripts/Engines/Reports/Objects/Snapshots/SnapshotHistory.cs
Normal file
65
Scripts/Engines/Reports/Objects/Snapshots/SnapshotHistory.cs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class SnapshotHistory : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "sh", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new SnapshotHistory();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private SnapshotCollection m_Snapshots;
|
||||
|
||||
public SnapshotCollection Snapshots{ get{ return m_Snapshots; } set{ m_Snapshots = value; } }
|
||||
|
||||
public SnapshotHistory()
|
||||
{
|
||||
m_Snapshots = new SnapshotCollection();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
string path = Path.Combine( Core.BaseDirectory, "reportHistory.xml" );
|
||||
PersistanceWriter pw = new XmlPersistanceWriter( path, "Stats" );
|
||||
|
||||
pw.WriteDocument( this );
|
||||
|
||||
pw.Close();
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
string path = Path.Combine( Core.BaseDirectory, "reportHistory.xml" );
|
||||
|
||||
if ( !File.Exists( path ) )
|
||||
return;
|
||||
|
||||
PersistanceReader pr = new XmlPersistanceReader( path, "Stats" );
|
||||
|
||||
pr.ReadDocument( this );
|
||||
|
||||
pr.Close();
|
||||
}
|
||||
|
||||
public override void SerializeChildren( PersistanceWriter op )
|
||||
{
|
||||
for ( int i = 0; i < m_Snapshots.Count; ++i )
|
||||
m_Snapshots[i].Serialize( op );
|
||||
}
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
m_Snapshots.Add( ip.GetChild() as Snapshot );
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Scripts/Engines/Reports/Objects/Staffing/Info.cs
Normal file
103
Scripts/Engines/Reports/Objects/Staffing/Info.cs
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Accounting;
|
||||
using Server.Engines;
|
||||
using Server.Engines.Help;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public abstract class BaseInfo : IComparable
|
||||
{
|
||||
private static TimeSpan m_SortRange;
|
||||
|
||||
public static TimeSpan SortRange{ get{ return m_SortRange; } set{ m_SortRange = value; } }
|
||||
|
||||
private string m_Account;
|
||||
private string m_Display;
|
||||
private PageInfoCollection m_Pages;
|
||||
|
||||
public string Account{ get{ return m_Account; } set{ m_Account = value; } }
|
||||
public PageInfoCollection Pages{ get{ return m_Pages; } set{ m_Pages = value; } }
|
||||
|
||||
public string Display
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Display != null )
|
||||
return m_Display;
|
||||
|
||||
if ( m_Account != null )
|
||||
{
|
||||
IAccount acct = Accounts.GetAccount( m_Account );
|
||||
|
||||
if ( acct != null )
|
||||
{
|
||||
Mobile mob = null;
|
||||
|
||||
for ( int i = 0; i < acct.Length; ++i )
|
||||
{
|
||||
Mobile check = acct[i];
|
||||
|
||||
if ( check != null && (mob == null || check.AccessLevel > mob.AccessLevel) )
|
||||
mob = check;
|
||||
}
|
||||
|
||||
if ( mob != null && mob.Name != null && mob.Name.Length > 0 )
|
||||
return ( m_Display = mob.Name );
|
||||
}
|
||||
}
|
||||
|
||||
return ( m_Display = m_Account );
|
||||
}
|
||||
}
|
||||
|
||||
public int GetPageCount( PageResolution res, DateTime min, DateTime max )
|
||||
{
|
||||
return StaffHistory.GetPageCount( m_Pages, res, min, max );
|
||||
}
|
||||
|
||||
public BaseInfo( string account )
|
||||
{
|
||||
m_Account = account;
|
||||
m_Pages = new PageInfoCollection();
|
||||
}
|
||||
|
||||
public void Register( PageInfo page )
|
||||
{
|
||||
m_Pages.Add( page );
|
||||
}
|
||||
|
||||
public void Unregister( PageInfo page )
|
||||
{
|
||||
m_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.Now - m_SortRange, DateTime.Now )
|
||||
- this.GetPageCount( this is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.Now - m_SortRange, DateTime.Now );
|
||||
|
||||
if ( v == 0 )
|
||||
v = String.Compare( this.Display, cmp.Display );
|
||||
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
public class StaffInfo : BaseInfo
|
||||
{
|
||||
public StaffInfo( string account ) : base( account )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class UserInfo : BaseInfo
|
||||
{
|
||||
public UserInfo( string account ) : base( account )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
257
Scripts/Engines/Reports/Objects/Staffing/PageInfo.cs
Normal file
257
Scripts/Engines/Reports/Objects/Staffing/PageInfo.cs
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Engines;
|
||||
using Server.Engines.Help;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public enum PageResolution
|
||||
{
|
||||
None,
|
||||
Handled,
|
||||
Deleted,
|
||||
Logged,
|
||||
Canceled
|
||||
}
|
||||
|
||||
public class PageInfo : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "pi", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new PageInfo();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private StaffHistory m_History;
|
||||
private StaffInfo m_Resolver;
|
||||
private UserInfo m_Sender;
|
||||
|
||||
public StaffInfo Resolver
|
||||
{
|
||||
get{ return m_Resolver; }
|
||||
set
|
||||
{
|
||||
if ( m_Resolver == value )
|
||||
return;
|
||||
|
||||
lock ( StaffHistory.RenderLock )
|
||||
{
|
||||
if ( m_Resolver != null )
|
||||
m_Resolver.Unregister( this );
|
||||
|
||||
m_Resolver = value;
|
||||
|
||||
if ( m_Resolver != null )
|
||||
m_Resolver.Register( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public UserInfo Sender
|
||||
{
|
||||
get{ return m_Sender; }
|
||||
set
|
||||
{
|
||||
if ( m_Sender == value )
|
||||
return;
|
||||
|
||||
lock ( StaffHistory.RenderLock )
|
||||
{
|
||||
if ( m_Sender != null )
|
||||
m_Sender.Unregister( this );
|
||||
|
||||
m_Sender = value;
|
||||
|
||||
if ( m_Sender != null )
|
||||
m_Sender.Register( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
get{ return m_History; }
|
||||
set
|
||||
{
|
||||
if ( m_History == value )
|
||||
return;
|
||||
|
||||
if ( m_History != null )
|
||||
{
|
||||
Sender = null;
|
||||
Resolver = null;
|
||||
}
|
||||
|
||||
m_History = value;
|
||||
|
||||
if ( m_History != null )
|
||||
{
|
||||
Sender = m_History.GetUserInfo( m_SentBy );
|
||||
UpdateResolver();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PageType PageType{ get{ return m_PageType; } set{ m_PageType = value; } }
|
||||
public PageResolution Resolution{ get{ return m_Resolution; } }
|
||||
|
||||
public DateTime TimeSent{ get{ return m_TimeSent; } set{ m_TimeSent = value; } }
|
||||
public DateTime TimeResolved{ get{ return m_TimeResolved; } }
|
||||
|
||||
public string SentBy
|
||||
{
|
||||
get{ return m_SentBy; }
|
||||
set
|
||||
{
|
||||
m_SentBy = value;
|
||||
|
||||
if ( m_History != null )
|
||||
Sender = m_History.GetUserInfo( m_SentBy );
|
||||
}
|
||||
}
|
||||
|
||||
public string ResolvedBy
|
||||
{
|
||||
get{ return m_ResolvedBy; }
|
||||
}
|
||||
|
||||
public string Message{ get{ return m_Message; } set{ m_Message = value; } }
|
||||
public ResponseInfoCollection Responses{ get{ return m_Responses; } set{ m_Responses = value; } }
|
||||
|
||||
public void UpdateResolver()
|
||||
{
|
||||
string resolvedBy;
|
||||
DateTime timeResolved;
|
||||
PageResolution res = GetResolution( out resolvedBy, out timeResolved );
|
||||
|
||||
if ( m_History != null && IsStaffResolution( res ) )
|
||||
Resolver = m_History.GetStaffInfo( resolvedBy );
|
||||
else
|
||||
Resolver = null;
|
||||
|
||||
m_ResolvedBy = resolvedBy;
|
||||
m_TimeResolved = timeResolved;
|
||||
m_Resolution = res;
|
||||
}
|
||||
|
||||
public bool IsStaffResolution( PageResolution res )
|
||||
{
|
||||
return ( res == PageResolution.Handled );
|
||||
}
|
||||
|
||||
public static PageResolution ResFromResp( string resp )
|
||||
{
|
||||
switch ( resp )
|
||||
{
|
||||
case "[Handled]": return PageResolution.Handled;
|
||||
case "[Deleting]": return PageResolution.Deleted;
|
||||
case "[Logout]": return PageResolution.Logged;
|
||||
case "[Canceled]": return PageResolution.Canceled;
|
||||
}
|
||||
|
||||
return PageResolution.None;
|
||||
}
|
||||
|
||||
public PageResolution GetResolution( out string resolvedBy, out DateTime timeResolved )
|
||||
{
|
||||
for ( int i = m_Responses.Count - 1; i >= 0; --i )
|
||||
{
|
||||
ResponseInfo resp = m_Responses[i];
|
||||
PageResolution res = ResFromResp( resp.Message );
|
||||
|
||||
if ( res != PageResolution.None )
|
||||
{
|
||||
resolvedBy = resp.SentBy;
|
||||
timeResolved = resp.TimeStamp;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
resolvedBy = m_SentBy;
|
||||
timeResolved = m_TimeSent;
|
||||
return PageResolution.None;
|
||||
}
|
||||
|
||||
public static string GetAccount( Mobile mob )
|
||||
{
|
||||
if ( mob == null )
|
||||
return null;
|
||||
|
||||
Accounting.Account acct = mob.Account as Accounting.Account;
|
||||
|
||||
if ( acct == null )
|
||||
return null;
|
||||
|
||||
return acct.Username;
|
||||
}
|
||||
|
||||
public PageInfo()
|
||||
{
|
||||
m_Responses = new ResponseInfoCollection();
|
||||
}
|
||||
|
||||
public PageInfo( PageEntry entry )
|
||||
{
|
||||
m_PageType = entry.Type;
|
||||
|
||||
m_TimeSent = entry.Sent;
|
||||
m_SentBy = GetAccount( entry.Sender );
|
||||
|
||||
m_Message = entry.Message;
|
||||
m_Responses = new ResponseInfoCollection();
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetInt32( "p", (int)m_PageType );
|
||||
|
||||
op.SetDateTime( "ts", m_TimeSent );
|
||||
op.SetString( "s", m_SentBy );
|
||||
|
||||
op.SetString( "m", m_Message );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_PageType = (PageType) ip.GetInt32( "p" );
|
||||
|
||||
m_TimeSent = ip.GetDateTime( "ts" );
|
||||
m_SentBy = ip.GetString( "s" );
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
while ( ip.HasChild )
|
||||
m_Responses.Add( ip.GetChild() as ResponseInfo );
|
||||
}
|
||||
}
|
||||
}
|
||||
200
Scripts/Engines/Reports/Objects/Staffing/PageInfoCollection.cs
Normal file
200
Scripts/Engines/Reports/Objects/Staffing/PageInfoCollection.cs
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version: 1.1.4322.573
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.PageInfo.
|
||||
/// </summary>
|
||||
public class PageInfoCollection : System.Collections.CollectionBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public PageInfoCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.PageInfo at a specific position in the PageInfoCollection.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.PageInfo this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((Server.Engines.Reports.PageInfo)(this.List[index]));
|
||||
}
|
||||
set
|
||||
{
|
||||
this.List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.PageInfo entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.PageInfo instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(Server.Engines.Reports.PageInfo value)
|
||||
{
|
||||
return this.List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.PageInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.PageInfo instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.PageInfo instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(Server.Engines.Reports.PageInfo value)
|
||||
{
|
||||
return this.List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.PageInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.PageInfo instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.PageInfo instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(Server.Engines.Reports.PageInfo value)
|
||||
{
|
||||
return this.List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.PageInfo instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.PageInfo instance to remove.</param>
|
||||
public void Remove(Server.Engines.Reports.PageInfo value)
|
||||
{
|
||||
this.List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.PageInfo instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.PageInfo's enumerator.</returns>
|
||||
public new PageInfoCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new PageInfoCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.PageInfo instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.PageInfo instance to insert.</param>
|
||||
public void Insert(int index, Server.Engines.Reports.PageInfo value)
|
||||
{
|
||||
this.List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.PageInfo.
|
||||
/// </summary>
|
||||
public class PageInfoCollectionEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private Server.Engines.Reports.PageInfo _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private PageInfoCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal PageInfoCollectionEnumerator(PageInfoCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.PageInfo object in the enumerated PageInfoCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.PageInfo Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current element in the collection.
|
||||
/// </summary>
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the cursor, so it points to the beginning of the enumerator.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_index = -1;
|
||||
_currentElement = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the enumerator to the next queue of the enumeration, if one is currently available.
|
||||
/// </summary>
|
||||
/// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
if ((_index
|
||||
< (_collection.Count - 1)))
|
||||
{
|
||||
_index = (_index + 1);
|
||||
_currentElement = this._collection[_index];
|
||||
return true;
|
||||
}
|
||||
_index = _collection.Count;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
50
Scripts/Engines/Reports/Objects/Staffing/QueueStatus.cs
Normal file
50
Scripts/Engines/Reports/Objects/Staffing/QueueStatus.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Engines;
|
||||
using Server.Engines.Help;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class QueueStatus : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "qs", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new QueueStatus();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private DateTime m_TimeStamp;
|
||||
private int m_Count;
|
||||
|
||||
public DateTime TimeStamp{ get{ return m_TimeStamp; } set{ m_TimeStamp = value; } }
|
||||
public int Count{ get{ return m_Count; } set{ m_Count = value; } }
|
||||
|
||||
public QueueStatus()
|
||||
{
|
||||
}
|
||||
|
||||
public QueueStatus( int count )
|
||||
{
|
||||
m_TimeStamp = DateTime.Now;
|
||||
m_Count = count;
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetDateTime( "t", m_TimeStamp );
|
||||
op.SetInt32( "c", m_Count );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_TimeStamp = ip.GetDateTime( "t" );
|
||||
m_Count = ip.GetInt32( "c" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,200 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version: 1.1.4322.573
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.QueueStatus.
|
||||
/// </summary>
|
||||
public class QueueStatusCollection : System.Collections.CollectionBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public QueueStatusCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.QueueStatus at a specific position in the QueueStatusCollection.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.QueueStatus this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((Server.Engines.Reports.QueueStatus)(this.List[index]));
|
||||
}
|
||||
set
|
||||
{
|
||||
this.List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.QueueStatus entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.QueueStatus instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(Server.Engines.Reports.QueueStatus value)
|
||||
{
|
||||
return this.List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.QueueStatus instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.QueueStatus instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.QueueStatus instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(Server.Engines.Reports.QueueStatus value)
|
||||
{
|
||||
return this.List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.QueueStatus instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.QueueStatus instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.QueueStatus instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(Server.Engines.Reports.QueueStatus value)
|
||||
{
|
||||
return this.List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.QueueStatus instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.QueueStatus instance to remove.</param>
|
||||
public void Remove(Server.Engines.Reports.QueueStatus value)
|
||||
{
|
||||
this.List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.QueueStatus instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.QueueStatus's enumerator.</returns>
|
||||
public new QueueStatusCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new QueueStatusCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.QueueStatus instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.QueueStatus instance to insert.</param>
|
||||
public void Insert(int index, Server.Engines.Reports.QueueStatus value)
|
||||
{
|
||||
this.List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.QueueStatus.
|
||||
/// </summary>
|
||||
public class QueueStatusCollectionEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private Server.Engines.Reports.QueueStatus _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private QueueStatusCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal QueueStatusCollectionEnumerator(QueueStatusCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.QueueStatus object in the enumerated QueueStatusCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.QueueStatus Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current element in the collection.
|
||||
/// </summary>
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the cursor, so it points to the beginning of the enumerator.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_index = -1;
|
||||
_currentElement = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the enumerator to the next queue of the enumeration, if one is currently available.
|
||||
/// </summary>
|
||||
/// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
if ((_index
|
||||
< (_collection.Count - 1)))
|
||||
{
|
||||
_index = (_index + 1);
|
||||
_currentElement = this._collection[_index];
|
||||
return true;
|
||||
}
|
||||
_index = _collection.Count;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
59
Scripts/Engines/Reports/Objects/Staffing/ResponseInfo.cs
Normal file
59
Scripts/Engines/Reports/Objects/Staffing/ResponseInfo.cs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Engines;
|
||||
using Server.Engines.Help;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class ResponseInfo : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "rs", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new ResponseInfo();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private DateTime m_TimeStamp;
|
||||
|
||||
private string m_SentBy;
|
||||
private string m_Message;
|
||||
|
||||
public DateTime TimeStamp{ get{ return m_TimeStamp; } set{ m_TimeStamp = value; } }
|
||||
|
||||
public string SentBy{ get{ return m_SentBy; } set{ m_SentBy = value; } }
|
||||
public string Message{ get{ return m_Message; } set{ m_Message = value; } }
|
||||
|
||||
public ResponseInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public ResponseInfo( string sentBy, string message )
|
||||
{
|
||||
m_TimeStamp = DateTime.Now;
|
||||
m_SentBy = sentBy;
|
||||
m_Message = message;
|
||||
}
|
||||
|
||||
public override void SerializeAttributes( PersistanceWriter op )
|
||||
{
|
||||
op.SetDateTime( "t", m_TimeStamp );
|
||||
|
||||
op.SetString( "s", m_SentBy );
|
||||
op.SetString( "m", m_Message );
|
||||
}
|
||||
|
||||
public override void DeserializeAttributes( PersistanceReader ip )
|
||||
{
|
||||
m_TimeStamp = ip.GetDateTime( "t" );
|
||||
|
||||
m_SentBy = ip.GetString( "s" );
|
||||
m_Message = ip.GetString( "m" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,205 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version: 1.1.4322.573
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed collection of Server.Engines.Reports.ResponseInfo.
|
||||
/// </summary>
|
||||
public class ResponseInfoCollection : System.Collections.CollectionBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ResponseInfoCollection() :
|
||||
base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the Server.Engines.Reports.ResponseInfo at a specific position in the ResponseInfoCollection.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.ResponseInfo this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((Server.Engines.Reports.ResponseInfo)(this.List[index]));
|
||||
}
|
||||
set
|
||||
{
|
||||
this.List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Add( string sentBy, string message )
|
||||
{
|
||||
return Add( new ResponseInfo( sentBy, message ) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a Server.Engines.Reports.ResponseInfo entry to this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ResponseInfo instance.</param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(Server.Engines.Reports.ResponseInfo value)
|
||||
{
|
||||
return this.List.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a specified Server.Engines.Reports.ResponseInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ResponseInfo instance to search for.</param>
|
||||
/// <returns>True if the Server.Engines.Reports.ResponseInfo instance is in the collection; otherwise false.</returns>
|
||||
public bool Contains(Server.Engines.Reports.ResponseInfo value)
|
||||
{
|
||||
return this.List.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the index a specified Server.Engines.Reports.ResponseInfo instance is in this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Server.Engines.Reports.ResponseInfo instance to find.</param>
|
||||
/// <returns>The zero-based index of the specified Server.Engines.Reports.ResponseInfo instance. If the object is not found, the return value is -1.</returns>
|
||||
public int IndexOf(Server.Engines.Reports.ResponseInfo value)
|
||||
{
|
||||
return this.List.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified Server.Engines.Reports.ResponseInfo instance from this collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The Server.Engines.Reports.ResponseInfo instance to remove.</param>
|
||||
public void Remove(Server.Engines.Reports.ResponseInfo value)
|
||||
{
|
||||
this.List.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the Server.Engines.Reports.ResponseInfo instance.
|
||||
/// </summary>
|
||||
/// <returns>An Server.Engines.Reports.ResponseInfo's enumerator.</returns>
|
||||
public new ResponseInfoCollectionEnumerator GetEnumerator()
|
||||
{
|
||||
return new ResponseInfoCollectionEnumerator(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a Server.Engines.Reports.ResponseInfo instance into this collection at a specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">Zero-based index.</param>
|
||||
/// <param name="value">The Server.Engines.Reports.ResponseInfo instance to insert.</param>
|
||||
public void Insert(int index, Server.Engines.Reports.ResponseInfo value)
|
||||
{
|
||||
this.List.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strongly typed enumerator of Server.Engines.Reports.ResponseInfo.
|
||||
/// </summary>
|
||||
public class ResponseInfoCollectionEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Current index
|
||||
/// </summary>
|
||||
private int _index;
|
||||
|
||||
/// <summary>
|
||||
/// Current element pointed to.
|
||||
/// </summary>
|
||||
private Server.Engines.Reports.ResponseInfo _currentElement;
|
||||
|
||||
/// <summary>
|
||||
/// Collection to enumerate.
|
||||
/// </summary>
|
||||
private ResponseInfoCollection _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor for enumerator.
|
||||
/// </summary>
|
||||
/// <param name="collection">Instance of the collection to enumerate.</param>
|
||||
internal ResponseInfoCollectionEnumerator(ResponseInfoCollection collection)
|
||||
{
|
||||
_index = -1;
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Server.Engines.Reports.ResponseInfo object in the enumerated ResponseInfoCollection currently indexed by this instance.
|
||||
/// </summary>
|
||||
public Server.Engines.Reports.ResponseInfo Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current element in the collection.
|
||||
/// </summary>
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((_index == -1)
|
||||
|| (_index >= _collection.Count)))
|
||||
{
|
||||
throw new System.IndexOutOfRangeException("Enumerator not started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return _currentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the cursor, so it points to the beginning of the enumerator.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_index = -1;
|
||||
_currentElement = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advances the enumerator to the next queue of the enumeration, if one is currently available.
|
||||
/// </summary>
|
||||
/// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns>
|
||||
public bool MoveNext()
|
||||
{
|
||||
if ((_index
|
||||
< (_collection.Count - 1)))
|
||||
{
|
||||
_index = (_index + 1);
|
||||
_currentElement = this._collection[_index];
|
||||
return true;
|
||||
}
|
||||
_index = _collection.Count;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
406
Scripts/Engines/Reports/Objects/Staffing/StaffHistory.cs
Normal file
406
Scripts/Engines/Reports/Objects/Staffing/StaffHistory.cs
Normal file
|
|
@ -0,0 +1,406 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
public class StaffHistory : PersistableObject
|
||||
{
|
||||
#region Type Identification
|
||||
public static readonly PersistableType ThisTypeID = new PersistableType( "stfhst", new ConstructCallback( Construct ) );
|
||||
|
||||
private static PersistableObject Construct()
|
||||
{
|
||||
return new StaffHistory();
|
||||
}
|
||||
|
||||
public override PersistableType TypeID{ get{ return ThisTypeID; } }
|
||||
#endregion
|
||||
|
||||
private PageInfoCollection m_Pages;
|
||||
private QueueStatusCollection m_QueueStats;
|
||||
|
||||
private Hashtable m_UserInfo;
|
||||
private Hashtable m_StaffInfo;
|
||||
|
||||
public PageInfoCollection Pages{ get{ return m_Pages; } set{ m_Pages = value; } }
|
||||
public QueueStatusCollection QueueStats{ get{ return m_QueueStats; } set{ m_QueueStats = value; } }
|
||||
|
||||
public Hashtable UserInfo{ get{ return m_UserInfo; } set{ m_UserInfo = value; } }
|
||||
public Hashtable StaffInfo{ get{ return m_StaffInfo; } set{ m_StaffInfo = value; } }
|
||||
|
||||
public void AddPage( PageInfo info )
|
||||
{
|
||||
lock ( SaveLock )
|
||||
m_Pages.Add( info );
|
||||
|
||||
info.History = this;
|
||||
}
|
||||
|
||||
public StaffHistory()
|
||||
{
|
||||
m_Pages = new PageInfoCollection();
|
||||
m_QueueStats = new QueueStatusCollection();
|
||||
|
||||
m_UserInfo = new Hashtable( StringComparer.OrdinalIgnoreCase );
|
||||
m_StaffInfo = new Hashtable( StringComparer.OrdinalIgnoreCase );
|
||||
}
|
||||
|
||||
public StaffInfo GetStaffInfo( string account )
|
||||
{
|
||||
lock ( RenderLock )
|
||||
{
|
||||
if ( account == null || account.Length == 0 )
|
||||
return null;
|
||||
|
||||
StaffInfo info = m_StaffInfo[account] as StaffInfo;
|
||||
|
||||
if ( info == null )
|
||||
m_StaffInfo[account] = info = new StaffInfo( account );
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
public UserInfo GetUserInfo( string account )
|
||||
{
|
||||
if ( account == null || account.Length == 0 )
|
||||
return null;
|
||||
|
||||
UserInfo info = m_UserInfo[account] as UserInfo;
|
||||
|
||||
if ( info == null )
|
||||
m_UserInfo[account] = info = new UserInfo( account );
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
public static readonly object RenderLock = new object();
|
||||
public static readonly object SaveLock = new object();
|
||||
|
||||
public void Save()
|
||||
{
|
||||
lock ( SaveLock )
|
||||
{
|
||||
string path = Path.Combine( Core.BaseDirectory, "staffHistory.xml" );
|
||||
PersistanceWriter pw = new XmlPersistanceWriter( path, "Staff" );
|
||||
|
||||
pw.WriteDocument( this );
|
||||
|
||||
pw.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
string path = Path.Combine( Core.BaseDirectory, "staffHistory.xml" );
|
||||
|
||||
if ( !File.Exists( path ) )
|
||||
return;
|
||||
|
||||
PersistanceReader pr = new XmlPersistanceReader( path, "Staff" );
|
||||
|
||||
pr.ReadDocument( this );
|
||||
|
||||
pr.Close();
|
||||
}
|
||||
|
||||
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 < m_QueueStats.Count; ++i )
|
||||
m_QueueStats[i].Serialize( op );
|
||||
}
|
||||
|
||||
public override void DeserializeChildren( PersistanceReader ip )
|
||||
{
|
||||
DateTime min = DateTime.Now - TimeSpan.FromDays( 8.0 );
|
||||
|
||||
while ( ip.HasChild )
|
||||
{
|
||||
PersistableObject obj = ip.GetChild();
|
||||
|
||||
if ( obj is PageInfo )
|
||||
{
|
||||
PageInfo pageInfo = obj as PageInfo;
|
||||
|
||||
pageInfo.UpdateResolver();
|
||||
|
||||
if ( pageInfo.TimeSent >= min || pageInfo.TimeResolved >= min )
|
||||
{
|
||||
m_Pages.Add( pageInfo );
|
||||
pageInfo.History = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
pageInfo.Sender = null;
|
||||
pageInfo.Resolver = null;
|
||||
}
|
||||
}
|
||||
else if ( obj is QueueStatus )
|
||||
{
|
||||
QueueStatus queueStatus = obj as QueueStatus;
|
||||
|
||||
if ( queueStatus.TimeStamp >= min )
|
||||
m_QueueStats.Add( queueStatus );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public StaffInfo[] GetStaff()
|
||||
{
|
||||
StaffInfo[] staff = new StaffInfo[m_StaffInfo.Count];
|
||||
int index = 0;
|
||||
|
||||
foreach ( StaffInfo staffInfo in m_StaffInfo.Values )
|
||||
staff[index++] = staffInfo;
|
||||
|
||||
return staff;
|
||||
}
|
||||
|
||||
public void Render( ObjectCollection objects )
|
||||
{
|
||||
lock ( RenderLock )
|
||||
{
|
||||
objects.Add( GraphQueueStatus() );
|
||||
|
||||
StaffInfo[] staff = GetStaff();
|
||||
|
||||
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" ) );
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays( 1.0 );
|
||||
Array.Sort( staff );
|
||||
|
||||
objects.Add( ReportTotalPages( staff, TimeSpan.FromDays( 1.0 ), "1 Day" ) );
|
||||
objects.AddRange( (PersistableObject[])ChartTotalPages( staff, TimeSpan.FromDays( 1.0 ), "1 Day", "graph_daily_pages" ) );
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays( 7.0 );
|
||||
Array.Sort( staff );
|
||||
|
||||
objects.Add( ReportTotalPages( staff, TimeSpan.FromDays( 7.0 ), "1 Week" ) );
|
||||
objects.AddRange( (PersistableObject[])ChartTotalPages( staff, TimeSpan.FromDays( 7.0 ), "1 Week", "graph_weekly_pages" ) );
|
||||
|
||||
BaseInfo.SortRange = TimeSpan.FromDays( 30.0 );
|
||||
Array.Sort( staff );
|
||||
|
||||
objects.Add( ReportTotalPages( staff, TimeSpan.FromDays( 30.0 ), "1 Month" ) );
|
||||
objects.AddRange( (PersistableObject[])ChartTotalPages( staff, TimeSpan.FromDays( 30.0 ), "1 Month", "graph_monthly_pages" ) );
|
||||
|
||||
for ( int i = 0; i < staff.Length; ++i )
|
||||
objects.Add( GraphHourlyPages( staff[i] ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetPageCount( StaffInfo staff, DateTime min, DateTime max )
|
||||
{
|
||||
return GetPageCount( staff.Pages, PageResolution.Handled, min, max );
|
||||
}
|
||||
|
||||
public static int GetPageCount( PageInfoCollection pages, PageResolution res, DateTime min, DateTime max )
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for ( int i = 0; i < pages.Count; ++i )
|
||||
{
|
||||
if ( res != PageResolution.None && pages[i].Resolution != res )
|
||||
continue;
|
||||
|
||||
DateTime ts = pages[i].TimeResolved;
|
||||
|
||||
if ( ts >= min && ts < max )
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
private BarGraph GraphQueueStatus()
|
||||
{
|
||||
int[] totals = new int[24];
|
||||
int[] counts = new int[24];
|
||||
|
||||
DateTime max = DateTime.Now;
|
||||
DateTime min = max - TimeSpan.FromDays( 7.0 );
|
||||
|
||||
for ( int i = 0; i < m_QueueStats.Count; ++i )
|
||||
{
|
||||
DateTime ts = m_QueueStats[i].TimeStamp;
|
||||
|
||||
if ( ts >= min && ts < max )
|
||||
{
|
||||
DateTime date = ts.Date;
|
||||
TimeSpan time = ts.TimeOfDay;
|
||||
|
||||
int hour = time.Hours;
|
||||
|
||||
totals[hour] += m_QueueStats[i].Count;
|
||||
counts[hour]++;
|
||||
}
|
||||
}
|
||||
|
||||
BarGraph barGraph = new BarGraph( "Average pages in queue", "graph_pagequeue_avg", 10, "Time", "Pages", BarGraphRenderMode.Lines );
|
||||
|
||||
barGraph.FontSize = 6;
|
||||
|
||||
for ( int i = 7; i <= totals.Length+7; ++i )
|
||||
{
|
||||
int val;
|
||||
|
||||
if ( counts[i%totals.Length] == 0 )
|
||||
val = 0;
|
||||
else
|
||||
val = (totals[i%totals.Length] + (counts[i%totals.Length] / 2)) / counts[i%totals.Length];
|
||||
|
||||
int realHours = i%totals.Length;
|
||||
int hours;
|
||||
|
||||
if ( realHours == 0 )
|
||||
hours = 12;
|
||||
else if ( realHours > 12 )
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
|
||||
barGraph.Items.Add( hours + (realHours >= 12 ? " PM" : " AM"), val );
|
||||
}
|
||||
|
||||
return barGraph;
|
||||
}
|
||||
|
||||
private BarGraph GraphHourlyPages( StaffInfo staff )
|
||||
{
|
||||
return GraphHourlyPages( staff.Pages, PageResolution.Handled, "Average pages handled by " + staff.Display, "graphs_" + staff.Account.ToLower() + "_avg" );
|
||||
}
|
||||
|
||||
private BarGraph GraphHourlyPages( PageInfoCollection pages, PageResolution res, string title, string fname )
|
||||
{
|
||||
int[] totals = new int[24];
|
||||
int[] counts = new int[24];
|
||||
|
||||
DateTime[] dates = new DateTime[24];
|
||||
|
||||
DateTime max = DateTime.Now;
|
||||
DateTime min = max - TimeSpan.FromDays( 7.0 );
|
||||
|
||||
bool sentStamp = ( res == PageResolution.None );
|
||||
|
||||
for ( int i = 0; i < pages.Count; ++i )
|
||||
{
|
||||
if ( res != PageResolution.None && pages[i].Resolution != res )
|
||||
continue;
|
||||
|
||||
DateTime ts = ( sentStamp ? pages[i].TimeSent : pages[i].TimeResolved );
|
||||
|
||||
if ( ts >= min && ts < max )
|
||||
{
|
||||
DateTime date = ts.Date;
|
||||
TimeSpan time = ts.TimeOfDay;
|
||||
|
||||
int hour = time.Hours;
|
||||
|
||||
totals[hour]++;
|
||||
|
||||
if ( dates[hour] != date )
|
||||
{
|
||||
counts[hour]++;
|
||||
dates[hour] = date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BarGraph barGraph = new BarGraph( title, fname, 10, "Time", "Pages", BarGraphRenderMode.Lines );
|
||||
|
||||
barGraph.FontSize = 6;
|
||||
|
||||
for ( int i = 7; i <= totals.Length+7; ++i )
|
||||
{
|
||||
int val;
|
||||
|
||||
if ( counts[i%totals.Length] == 0 )
|
||||
val = 0;
|
||||
else
|
||||
val = (totals[i%totals.Length] + (counts[i%totals.Length] / 2)) / counts[i%totals.Length];
|
||||
|
||||
int realHours = i%totals.Length;
|
||||
int hours;
|
||||
|
||||
if ( realHours == 0 )
|
||||
hours = 12;
|
||||
else if ( realHours > 12 )
|
||||
hours = realHours - 12;
|
||||
else
|
||||
hours = realHours;
|
||||
|
||||
barGraph.Items.Add( hours + (realHours >= 12 ? " PM" : " AM"), val );
|
||||
}
|
||||
|
||||
return barGraph;
|
||||
}
|
||||
|
||||
private Report ReportTotalPages( StaffInfo[] staff, TimeSpan ts, string title )
|
||||
{
|
||||
DateTime max = DateTime.Now;
|
||||
DateTime min = max - ts;
|
||||
|
||||
Report report = new Report( title + " Staff Report", "400" );
|
||||
|
||||
report.Columns.Add( "65%", "left", "Staff Name" );
|
||||
report.Columns.Add( "35%", "center", "Page Count" );
|
||||
|
||||
for ( int i = 0; i < staff.Length; ++i )
|
||||
report.Items.Add( staff[i].Display, GetPageCount( staff[i], min, max ) );
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
private PieChart[] ChartTotalPages( StaffInfo[] staff, TimeSpan ts, string title, string fname )
|
||||
{
|
||||
DateTime max = DateTime.Now;
|
||||
DateTime min = max - ts;
|
||||
|
||||
PieChart staffChart = new PieChart( title + " Staff Chart", fname + "_staff", true );
|
||||
|
||||
int other = 0;
|
||||
|
||||
for ( int i = 0; i < staff.Length; ++i )
|
||||
{
|
||||
int count = GetPageCount( staff[i], min, max );
|
||||
|
||||
if ( i < 12 && count > 0 )
|
||||
staffChart.Items.Add( staff[i].Display, count );
|
||||
else
|
||||
other += count;
|
||||
}
|
||||
|
||||
if ( other > 0 )
|
||||
staffChart.Items.Add( "Other", other );
|
||||
|
||||
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 countUnres = countTotal - ( countHandled + countDeleted + countCanceled + countLogged );
|
||||
|
||||
resChart.Items.Add( "Handled", countHandled );
|
||||
resChart.Items.Add( "Deleted", countDeleted );
|
||||
resChart.Items.Add( "Canceled", countCanceled );
|
||||
resChart.Items.Add( "Logged Out", countLogged );
|
||||
resChart.Items.Add( "Unresolved", countUnres );
|
||||
|
||||
return new PieChart[]{ staffChart, resChart };
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue