Added Dual Layer data in the report (pulling from the database and displaying it back on the main form)

This commit is contained in:
Daniel Wathen
2022-12-08 12:03:19 -07:00
parent 4592b035b6
commit 32d8ad8b3c
6 changed files with 67 additions and 10 deletions

View File

@ -279,5 +279,50 @@ namespace ReportingServices.Dependency_Injections
return quarterlyTargets;
}
public Dictionary<string, List<string>> GetDualLayerReactors()
{
Dictionary<string, List<string>> dualLayers = new();
dualLayers.Add("ASM", new List<string>());
dualLayers.Add("HTR", new List<string>());
dualLayers.Add("EPP", new List<string>());
OpenConnection();
SqlCommand cmd = _connection.CreateCommand();
string query = "SELECT REACTOR_TYPE, REACTOR FROM " +
"(SELECT " +
" REACTOR, " +
" rds.REACTOR_TYPE, " +
" PROD_SPEC_ID, " +
" SUM(CASE WHEN psn.LAYER_TYPE = 'Standard 2 Layer' THEN 1 ELSE 0 END) AS Dual " +
" FROM RDS " +
"INNER JOIN PROD_SPEC psn ON rds.PROD_SPEC_ID = psn.SEQ " +
" WHERE DATE_OUT BETWEEN DATEADD(DAY, -1, SYSDATETIME()) AND SYSDATETIME() " +
"GROUP BY REACTOR, PROD_SPEC_ID, rds.REACTOR_TYPE) res " +
"WHERE res.Dual > 0 " +
"ORDER BY 1, 2 ";
cmd.CommandText = query;
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
if (reader[0].ToString() == "ASM+")
dualLayers["ASM"].Add("R" + reader[1].ToString());
else
dualLayers[reader[0].ToString()].Add("R" + reader[1].ToString());
}
}
cmd.Dispose();
CloseConnection();
return dualLayers;
}
}
}