public List <QI_REPORT_REC> GetQiReportsCollection(bool sortByPresName) { List <QI_REPORT_REC> reportsCollection = new List <QI_REPORT_REC>(); using (SqlConnection dbConn = m_SqlHelpers.GetDbConnection(m_AwareDbConnString)) { string sqlText = "usp_GetReportsInfo"; SqlCommand sqlCmd = new SqlCommand(sqlText, dbConn); sqlCmd.CommandType = System.Data.CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@ObjectTypeId", (int)AwareObjectTypes.REPORT_DEFINITIONS); sqlCmd.Parameters.AddWithValue("@SortAsc", sortByPresName); SqlDataReader dr = sqlCmd.ExecuteReader(); while (dr.Read()) { try { QI_REPORT_REC rec = new QI_REPORT_REC(dr.GetGuid(0), dr.GetString(1), dr.GetString(2)); reportsCollection.Add(rec); } catch (InvalidCastException ex) { } } dr.Close(); dbConn.Close(); } return(reportsCollection); }
public QI_REPORT_REC GetReportRecord(Guid reportId) { QI_REPORT_REC rpt = new QI_REPORT_REC(); using (SqlConnection dbConn = m_SqlHelpers.GetDbConnection(m_AwareDbConnString)) { string sqlText = "usp_GetReportsRec"; SqlCommand sqlCmd = new SqlCommand(sqlText, dbConn); sqlCmd.CommandType = System.Data.CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@RptId", reportId); sqlCmd.Parameters.AddWithValue("@ObjTypeId", (int)AwareObjectTypes.REPORT_DEFINITIONS); SqlDataReader dr = sqlCmd.ExecuteReader(); while (dr.Read()) { try { rpt = new QI_REPORT_REC(dr.GetGuid(0), dr.GetString(1), dr.GetString(2)); } catch (InvalidCastException ex) { } } dr.Close(); dbConn.Close(); } return(rpt); }
public void UpdateReport(ref QI_REPORT_REC rptRec) { using (SqlConnection dbConn = m_SqlHelpers.GetDbConnection(m_AwareDbConnString)) { string sqlText = "usp_UpdateReportsRec"; SqlCommand sqlCmd = new SqlCommand(sqlText, dbConn); sqlCmd.CommandType = System.Data.CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@RepFileName", rptRec.Name); sqlCmd.Parameters.AddWithValue("@RepPresName", rptRec.PresentationName); sqlCmd.Parameters.AddWithValue("@RptId", rptRec.ReportID); sqlCmd.ExecuteNonQuery(); dbConn.Close(); } }