예제 #1
0
        /// <summary>
        /// Return a list of with all the names of all XML files on the server
        /// </summary>
        /// <returns>List of names (string)</returns>
        public List<XmlFileDTO> GetAllXMLName()
        {
            var xmlList = new List<XmlFileDTO>();
            using (var db = new ReportEntities())
            {
                var dbList = db.Catalog.Where(x => x.Path.Contains("/Dashboard/") && x.Path.Contains(".xml")).Select(x => new { x.ItemID, x.Name}).ToList();
                foreach (var item in dbList)
                {

                    xmlList.Add(new XmlFileDTO()
                    {
                        ItemID = item.ItemID,
                        Name = item.Name
                    });
                }
                return xmlList;
            }
        }
예제 #2
0
 /// <summary>
 /// Returns the dashboard (XML) with the given name
 /// </summary>
 /// <param name="name"></param>
 /// <returns>XElement (XML)</returns>
 public XElement GetDashboardByName(string itemId)
 {
     using (var db = new ReportEntities())
     {
         XElement xelement = XElement.Parse(db.Database.SqlQuery<string>("SELECT CAST(CAST(Content AS VARBINARY(MAX)) AS XML) AS DashboardXML FROM ReportServer$SRVSQL2012.dbo.Catalog WHERE ItemID = '" + itemId + "'").FirstOrDefault<string>());
         return xelement;
     }
 }