/// <summary> /// Gets the report. /// </summary> /// <param name="name">The name.</param> /// <returns></returns> public ReportInfo GetReport(string name) { ReportInfo retVal = null; using (IDataReader reader = DBReport.GetByName(this.ContainerKey, name)) { if (reader.Read()) { UserReportInfo info = UserReportConfig.GetConfig().Reports[(string)reader["Name"]]; if (info != null) { retVal = new ReportInfo((int)reader["ReportId"], info, (int)SqlHelper.DBNull2Null(reader["ReportCategoryId"], -1), (string)SqlHelper.DBNull2Null(reader["ReportCategoryName"])); } } } return(retVal); }
/// <summary> /// Gets the reports. /// </summary> /// <returns></returns> public ReportInfo[] GetReports() { if (_hash != null) { return(_hash); } lock (this) { if (_hash != null) { return(_hash); } ArrayList retVal = new ArrayList(); foreach (UserReportInfo info in UserReportConfig.GetConfig().Reports) { using (IDataReader reader = DBReport.GetByName(this.ContainerKey, info.Name)) { if (reader.Read()) { // Existed report retVal.Add(new ReportInfo((int)reader["ReportId"], info, (int)SqlHelper.DBNull2Null(reader["ReportCategoryId"], -1), (string)SqlHelper.DBNull2Null(reader["ReportCategoryName"]))); continue; } } // A new report int ReportId = DBReport.Create(this.ContainerKey, info.Name); retVal.Add(new ReportInfo(ReportId, info, -1, null)); } _hash = (ReportInfo[])retVal.ToArray(typeof(ReportInfo)); } return(_hash); }