Files
SourceCode/PROMS/VEPROMS.CSLA.Library/Minimal/GeneralReports.cs
mschill 00c64411c5 C2026-002 Admin Tool - Data Check - Enhancements to new admin Tool for ROs not used.
Add the ability to filter out groups of Alarms from the results.
2026-01-19 11:33:10 -05:00

77 lines
2.0 KiB
C#

using System;
using Csla.Data;
using System.Data;
using System.Data.SqlClient;
//CSM - C2025-043 - Minimal Class for General Reports
namespace VEPROMS.CSLA.Library
{
public static class GeneralReports
{
#region Get General Reports
//CSM - C2025-043 report RO's that are not used in any of the PROMS data.
public static DataTable GetROsNotUsedInPROMS(DataTable dtDBids)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "vesp_GetROsNotUsed";
cm.CommandTimeout = 0;
//Pass table Valued parameter to Store Procedure
SqlParameter sqlParam = cm.Parameters.AddWithValue("@dbIDs", dtDBids);
sqlParam.SqlDbType = SqlDbType.Structured;
using (SqlDataAdapter da = new SqlDataAdapter(cm))
{
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
}
}
}
catch (Exception ex)
{
throw new DbCslaException("Error in GetROsNotUsedInPROMS Report: retrieving data failed", ex);
}
}
//C2026-002 Enhancements to new admin Tool for ROs not used.
//used to build checkboxes of dbs to include
public static DataTable GetRODBs()
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.Text;
cm.CommandText = "select RofstDatabase.*, RODbID FROM RofstDatabase INNER JOIN (Select FSTID = max(RoFSTID), RODbID from ROFsts GROUP BY RODbID) fsts ON fsts.FSTID = RofstDatabase.RofstID ORDER BY RofstID, RODbID, dbiTitle";
cm.CommandTimeout = 0;
using (SqlDataAdapter da = new SqlDataAdapter(cm))
{
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
}
}
}
catch (Exception ex)
{
throw new DbCslaException("Error in GetROsNotUsedInPROMS Report - GetRODBs: retrieving data failed", ex);
}
}
#endregion
}
}