示例#1
0
        public List <CrcReportHistory> GetUsersRecentRuns(string username, int max)
        {
            string    sql = SqlPatternUsersRecentRuns();
            DataTable res = new DataTable();

            using (SqlConnection conn = new SqlConnection(GetReportServerConnectionString()))
            {
                SqlCommand comm = new SqlCommand(String.Format(sql, max), conn);

                comm.Parameters.Add("@UserName", SqlDbType.NVarChar, 520).Value = username;
                SqlDataAdapter adapt = new SqlDataAdapter(comm);
                adapt.Fill(res);
            }
            var histList = new List <CrcReportHistory>();

            foreach (DataRow rowLoop in res.Rows)
            {
                var h = new CrcReportHistory()
                {
                    ReportName  = CrcReportDefinition.ReportNameFromPath(rowLoop["ReportPath"].ToString()),
                    ReportPath  = rowLoop["ReportPath"].ToString(),
                    UserName    = rowLoop["UserName"].ToString(),
                    Parameters  = rowLoop["Parameters"].ToString(),
                    TimeStart   = (DateTime)rowLoop["TimeStart"],
                    RunDuration = (int)rowLoop["TimeDataRetrieval"],
                    RowCount    = (long)rowLoop["RowCount"]
                };
                histList.Add(h);
            }
            return(histList);
        }
示例#2
0
        public CrcReportFolder Create(ReportingService2005Soap rService, string path)
        {
            var ret = new CrcReportFolder();

            ret.Path       = path;
            ret.FolderName = CrcReportDefinition.ReportNameFromPath(path);

            var lcRequest = new ListChildrenRequest(path, false);

            var lcResponse = rService.ListChildren(lcRequest);

            foreach (CatalogItem itemLoop in lcResponse.CatalogItems)
            {
                if (itemLoop.Type == ItemTypeEnum.Folder)
                {
                    var sf = Create(rService, itemLoop.Path);
                    if (sf.Reports.Count() > 0 || sf.SubFolders.Count() > 0)
                    {
                        ret.SubFolders.Add(sf);
                    }
                }
                else if (itemLoop.Type == ItemTypeEnum.Report)
                {
                    if (!itemLoop.Hidden)
                    {
                        var repItem = new CrcReportItem();
                        repItem.ReportPath  = itemLoop.Path;
                        repItem.DisplayName = itemLoop.Name;
                        repItem.Description = itemLoop.Description;
                        ret.Reports.Add(repItem);
                    }
                }
            }
            return(ret);
        }