SafeDispatch/SafeMobileLIB_DLL/ReportsModule.cs

821 lines
27 KiB
C#
Raw Normal View History

2024-02-22 16:43:59 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.Reporting;
namespace SafeMobileLib
{
public class ReportsModule
{
public enum Filters {TIME_START, TIME_END, UNITS_IDS, COORDINATES, COMPUTE, GEOFENCE_NAME_IDS, GEOFENCE_TYPE,
LANDMARK_NAME_IDS, LANDMARK_TYPE, STATUS_TYPE, IDLING_PERIOD};
public enum Geofence_Type { IN = 1, OUT = 2 };
public enum Landmark_Type { IN = 1, OUT = 2 };
public enum Status_Type { ON = 1, OFF = 2, MADE_OFF = 3, MADE_ON = 4}
/// <summary>
/// Generate a Speeding Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// COORDINATES --- Boolean
/// COMPUTE --- Boolean
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report SpeedingReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if(parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime) parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if coordinates needs to be displayed with Lat/Lng
if (parameters.ContainsKey(Filters.COORDINATES))
{
Boolean coordinates = (Boolean)parameters[Filters.COORDINATES];
}
// check if addresses needs to be computed
if (parameters.ContainsKey(Filters.COMPUTE))
{
Boolean computer = (Boolean)parameters[Filters.COMPUTE];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a Geofence Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// GEO_NAME_IDS --- List<Int64>
/// GEOFENCE_TYPE --- List<Geofence_Type>
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report GeofenceReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if geofence name was selected
if (parameters.ContainsKey(Filters.GEOFENCE_NAME_IDS))
{
List<Int64> geofencesIds = (List<Int64>)parameters[Filters.GEOFENCE_NAME_IDS];
}
// check if addresses needs to be computed
if (parameters.ContainsKey(Filters.GEOFENCE_TYPE))
{
List<Geofence_Type> geofenceTypes = (List<Geofence_Type>)parameters[Filters.GEOFENCE_TYPE];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a Landmark Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// LAND_NAME_IDS --- List<Int64>
/// LANDMARK_TYPE --- List<Landmark_Type>
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report LandmarkReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if geofence name was selected
if (parameters.ContainsKey(Filters.LANDMARK_NAME_IDS))
{
List<Int64> landmarkIds = (List<Int64>)parameters[Filters.LANDMARK_NAME_IDS];
}
// check if addresses needs to be computed
if (parameters.ContainsKey(Filters.LANDMARK_TYPE))
{
List<Landmark_Type> landmarkTypes = (List<Landmark_Type>)parameters[Filters.LANDMARK_TYPE];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a Emergency Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// COORDINATES --- Boolean
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report EmergencyReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if coordinates needs to be displayed with Lat/Lng
if (parameters.ContainsKey(Filters.COORDINATES))
{
Boolean coordinates = (Boolean)parameters[Filters.COORDINATES];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a OnOff Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// STATUS --- List<Status_Type>
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report OnOffReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if status type was selected
if (parameters.ContainsKey(Filters.STATUS_TYPE))
{
List<Status_Type> statusTypes = (List<Status_Type>)parameters[Filters.STATUS_TYPE];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a All Alarms Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report AllAlarmsReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a History Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// COORDINATES --- Boolean
/// COMPUTE --- Boolean
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report HistoryReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if coordinates needs to be displayed with Lat/Lng
if (parameters.ContainsKey(Filters.COORDINATES))
{
Boolean coordinates = (Boolean)parameters[Filters.COORDINATES];
}
// check if addresses needs to be computed
if (parameters.ContainsKey(Filters.COMPUTE))
{
Boolean computer = (Boolean)parameters[Filters.COMPUTE];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a End of Day Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// COORDINATES --- Boolean
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report EndOfDayReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if coordinates needs to be displayed with Lat/Lng
if (parameters.ContainsKey(Filters.COORDINATES))
{
Boolean coordinates = (Boolean)parameters[Filters.COORDINATES];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a Idling Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// COORDINATES --- Boolean
/// IDLING_PERIOD --- Int16
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report IdlingReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if coordinates needs to be displayed with Lat/Lng
if (parameters.ContainsKey(Filters.COORDINATES))
{
Boolean coordinates = (Boolean)parameters[Filters.COORDINATES];
}
// check if Idling time was selected
if (parameters.ContainsKey(Filters.IDLING_PERIOD))
{
Int16 idlingPeriod = (Int16)parameters[Filters.IDLING_PERIOD];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a Stops Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// COORDINATES --- Boolean
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report StopsReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if coordinates needs to be displayed with Lat/Lng
if (parameters.ContainsKey(Filters.COORDINATES))
{
Boolean coordinates = (Boolean)parameters[Filters.COORDINATES];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a Fleet Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// COORDINATES --- Boolean
/// COMPUTE --- Boolean
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report FleetReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a TelemetryAlarms Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// COORDINATES --- Boolean
/// COMPUTE --- Boolean
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report TelemetryAlarmsReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if coordinates needs to be displayed with Lat/Lng
if (parameters.ContainsKey(Filters.COORDINATES))
{
Boolean coordinates = (Boolean)parameters[Filters.COORDINATES];
}
// check if addresses needs to be computed
if (parameters.ContainsKey(Filters.COMPUTE))
{
Boolean computer = (Boolean)parameters[Filters.COMPUTE];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a Telemetry Events Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// COORDINATES --- Boolean
/// COMPUTE --- Boolean
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report TelemetryEventsReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if coordinates needs to be displayed with Lat/Lng
if (parameters.ContainsKey(Filters.COORDINATES))
{
Boolean coordinates = (Boolean)parameters[Filters.COORDINATES];
}
// check if addresses needs to be computed
if (parameters.ContainsKey(Filters.COMPUTE))
{
Boolean computer = (Boolean)parameters[Filters.COMPUTE];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
/// <summary>
/// Generate a Text Message Location Report with the desired parameters which will act as
/// filter.
/// For each Filter the type of the object will be according to the below list
/// TIME_START --- DateTime
/// TIME_END --- DateTime
/// UNITS_IDS --- List<Int64>
/// COORDINATES --- Boolean
/// COMPUTE --- Boolean
/// </summary>
/// <param name="parameters">List with filters on which the search will be
/// done when generating this report</param>
/// <returns>Telerik Report that will be used inside a ReportViewer or
/// used to generate the pdf</returns>
public static Report TextMessageLocationReport(Dictionary<Filters, Object> parameters)
{
Report report = new Report();
// check if time start was selected
if (parameters.ContainsKey(Filters.TIME_START))
{
DateTime start = (DateTime)parameters[Filters.TIME_START];
}
// check if time end was selected
if (parameters.ContainsKey(Filters.TIME_END))
{
DateTime end = (DateTime)parameters[Filters.TIME_END];
}
// check if Units was selected
if (parameters.ContainsKey(Filters.UNITS_IDS))
{
List<Int64> unitsIds = (List<Int64>)parameters[Filters.UNITS_IDS];
}
// check if coordinates needs to be displayed with Lat/Lng
if (parameters.ContainsKey(Filters.COORDINATES))
{
Boolean coordinates = (Boolean)parameters[Filters.COORDINATES];
}
// check if addresses needs to be computed
if (parameters.ContainsKey(Filters.COMPUTE))
{
Boolean computer = (Boolean)parameters[Filters.COMPUTE];
}
//TODO
// create the gl_where based on the filters and then generate the
// report
return report;
}
}
}