Files
SourceCode/PROMS/VEPROMS.CSLA.Library/Minimal/UserReports.cs
T

61 lines
2.2 KiB
C#

using System;
using System.Data;
using System.Data.SqlClient;
//CSM - C2025-009 - Minimal Class for User based Reports
namespace VEPROMS.CSLA.Library
{
public static class UserReports
{
#region Get User Reports
//CSM - C2025-009 Report for tracking PROMS Users / security
public static DataTable GetUserAccessControlData() => GetDataTable("getUserAcessControl");
#endregion
#region Get Duplicate Accessory Page Reports
//CSM - C2026-058 Reports for if Acc Page Id Prefix is Used More than Once
// Procedure for Duplicate Accessory Page IDs in ROs in PROMS
public static DataTable GetDupAccIDsData() => GetDataTable("getDupAccIDs");
//CSM - C2026-058 Reports for if Acc Page Id Prefix is Used More than Once
// Procedure for Duplicate Accessory Page Prefixes in ROs in PROMS
public static DataTable GetDupAccPrefixesData() => GetDataTable("getDupAccPrefixes");
//CSM - C2026-058 Reports for if Acc Page Id Prefix is Used More than Once
// Get PROMS Documents containing Duplicate Accessory Page IDs
public static DataTable GetDocsDupAccIDsData() => GetDataTable("getDocsDupAccIDs");
#endregion
#region Generic Get Data Table
private static DataTable GetDataTable(string spname)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = spname;
cm.CommandTimeout = Database.DefaultTimeout;
using (SqlDataAdapter da = new SqlDataAdapter(cm))
{
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
}
}
}
catch (Exception ex)
{
throw new DbCslaException($"Error in {spname} Report: retrieving data failed", ex);
}
}
#endregion
}
}