/// <summary>
    /// Page Init
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Init(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            if (!string.IsNullOrEmpty(Request.QueryString["field"]))
            {
                try
                {
                    field = Request.QueryString["field"].ToString();
                    search = Request.QueryString["s"];
                    pageNo = Request.QueryString["pageNo"].ToString();
                   // pagesize = Request.QueryString["pagesize"].ToString();

                    if (long.Parse(pageNo) <= 1) PrevBtn.Visible = false;
                    if (long.Parse(pageNo) == 20) NextBtn.Visible = false;
                    if (long.Parse(pageNo) > 20) pageNo = "1";
                    string ApiId = System.Web.Configuration.WebConfigurationManager.AppSettings["SummonSSADLApiId"];
                    string ApiKey = System.Web.Configuration.WebConfigurationManager.AppSettings["SummonSSADLApiKey"];

                    var summon = new SummonXml(ApiId, ApiKey);
                    summon.Debug = true;

                    string getXMLs = summon.Query("s.q=Title:(" + search + ")&s.fvf=ContentType," + field + ",false&s.ps=50&s.pn=" + pageNo);

                    var docXML = new XmlDocument();
                    docXML.LoadXml(getXMLs);

                    DataTable DT_SearchResults = getAllDataItems(docXML);

                    listView.DataSource = DT_SearchResults;
                    listView.DataBind();

                    getSummary(docXML, field, search);
                }
                catch
                {
                    field = Request.QueryString["field"].ToString();
                    search = Request.QueryString["s"];

                    //http://digitallibraryadmin.ba.ad.ssa.gov/searchsummondetails.aspx?pageNo=1&field=Newspaper Article&s=books&pagesize=50
                    Response.Redirect(commonfunctions.host + "/searchsummondetails.aspx?field=" + field + "&pageNo=" + pageNo + "&s=" + search);
                }

            }
        }

        contentId = long.Parse(Request.QueryString["id"]);

        RightSideContent.ccontentID = contentId.ToString();
        RightSideContent.cfolderID = mainContent.EkItem.FolderId.ToString();
        uxPageTitle.pgTitle = mainContent.EkItem.Title.ToString();
        uxPageTitle.pageId = contentId.ToString();
        uxBreadcrumb.contentID = contentId.ToString();
        uxPageTitle.ResourceTypeId = "2";
    }
    /// <summary>
    /// Page Init
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Init(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                long contentId = long.Parse(Request.QueryString["id"]);
                //    this.GetContentData(contentId);
            }
        }

        try
        {
            pageNo = Request.QueryString["pageNo"].ToString();
        }
        catch { pageNo = "1"; }

        if (pageNo == "1") PrevBtn.Enabled = false;
        search = Request.QueryString["s"];

        ViewTypeURL = "/searchsummon.aspx?s=" + search;

        if (search != null)
        {

            try{
            string sfvf = "&s.fvf=ContentType,Journal / eJournal,false&s.fvf=ContentType,Book / eBook,false&s.fvf=ContentType,Newspaper Article,false";

            string ApiId = System.Web.Configuration.WebConfigurationManager.AppSettings["SummonSSADLApiId"];
            string ApiKey = System.Web.Configuration.WebConfigurationManager.AppSettings["SummonSSADLApiKey"];

            var summon = new SummonXml(ApiId, ApiKey);
            summon.Debug = false;
           string   searchStringg = string.Empty;
         //   string fields = "Title;SubjectTerms;Author;PublicationTitle;";
            string fields = "Title;";
            string[] fieldss = fields.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string field in fieldss)
            {
                searchStringg += "s.q=" + field + ":(" + search + ")&";
            }
           // string buildString = "s.q=Title:(" + search + ")&s.q=SubjectTerms:(" + search + ")&s.q=Author:(" + search + ")&s.q=PublicationTitle:(" + search + ")&s.ps=20";
            string getArticles = summon.Query(searchStringg + "s.ff=ContentType,or,1,50&s.ps=20" + sfvf);

            var docArticles = new XmlDocument();
            docArticles.LoadXml(getArticles);
            getSummary(docArticles, "Article", search);
            DT_Articles = getAllDataItems(docArticles);
            listViewArticles.DataSource = DT_Articles;
            listViewArticles.DataBind();
            }
            catch
            {
                Response.Redirect(commonfunctions.host + "/searchsummonlist.aspx?s=" + search);
            }
        }
    }
示例#3
0
 /// <summary>
 /// Makes a query to SummonXml and returns an XML node for use in XSLT parsing.
 /// </summary>
 /// <param name="queryString">Search string in Summon URL format</param>
 /// <param name="sessionId">Session Id from Summon API</param>
 /// <returns>XML node with results</returns>
 public static XmlNode GetItemsAsXml(string queryString, string sessionId)
 {
     queryString = ParseQueryString(queryString);
     var summon = new SummonXml(ApiId, ApiKey);
     var result = String.IsNullOrEmpty(sessionId) ? summon.Query(queryString) : summon.Query(queryString, sessionId);
     var doc = new XmlDocument();
     doc.LoadXml(result);
     XmlNode newNode = doc.DocumentElement;
     return newNode;
 }
    /// <summary>
    /// Page load event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                long contentId = long.Parse(Request.QueryString["id"]);

            }

            if (!string.IsNullOrEmpty(Request.QueryString["field"]))
            {
                string field = Request.QueryString["field"].ToString();
                string search = Request.QueryString["s"];
                string pageNo = Request.QueryString["pageNo"].ToString();

                string ApiId = System.Web.Configuration.WebConfigurationManager.AppSettings["SummonSSADLApiId"];
                string ApiKey = System.Web.Configuration.WebConfigurationManager.AppSettings["SummonSSADLApiKey"];

                var summon = new SummonXml(ApiId, ApiKey);
                summon.Debug = true;

                string getXMLs = summon.Query("s.q=Title:(" + search + ")&s.fvf=ContentType," + field + ",false&s.ps=50&s.pn=" + pageNo);

                var docXML = new XmlDocument();
                docXML.LoadXml(getXMLs);

                DataTable DT_SearchResults = getAllDataItems(docXML);

                listView.DataSource = DT_SearchResults;
                listView.DataBind();

            }
        }
        RightSideContent.ccontentID = mainContent.EkItem.Id.ToString();
        RightSideContent.cfolderID = mainContent.EkItem.FolderId.ToString();
        uxPageTitle.pgTitle = Title; // mainContent.EkItem.Title.ToString();
        uxPageTitle.pageId = mainContent.EkItem.Id.ToString();
        mainContent.Text = "<!-- -->";
        uxPageTitle.ResourceTypeId = "2";
        uxBreadcrumb.contentID = mainContent.EkItem.Id.ToString();
    }
示例#5
0
    /// <summary>
    /// Page Init
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Init(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                long contentId = long.Parse(Request.QueryString["id"]);
                //    this.GetContentData(contentId);
            }
        }

        string sql = "SELECT  * FROM [ViewAllSubjectArea_SSADL] order by Name ASC";
        DataTable dtSA = DataBase.dbDataTable(sql, "Ektron.DbConnection");

        search = Server.UrlDecode(Request.QueryString["s"].Replace("/",""));
        viewListURL = "/searchsummonlist.aspx?s=" + search;
        if (search != null)
        {
            try
            {
                DataTable dtResultSubjectAreas = new DataTable();
                dtResultSubjectAreas.Columns.Add("ID");
                dtResultSubjectAreas.Columns.Add("Title");
                dtResultSubjectAreas.Columns.Add("URL");

                string Author = "";
                string Year = "";
                string contenttype = "";
                DataTable dtResult = new DataTable();
                dtResult.Columns.Add("Title");
                dtResult.Columns.Add("Link");
                dtResult.Columns.Add("Author");
                dtResult.Columns.Add("Year");
                dtResult.Columns.Add("Issue");
                dtResult.Columns.Add("ContentType");
                dtResult.Columns.Add("Description");
                dtResult.Columns.Add("ID");
                DataTableReader dtr = DataBase.dbDataTable("Select top 5 * from Resources where ResourceName like '%" + search + "%' or Description like '%" + search + "%' ").CreateDataReader();
                if (dtr.HasRows)
                {
                    while (dtr.Read())
                    {
                        string ID = dtr["ID"].ToString().Trim();
                        string Title = dtr["ResourceName"].ToString().Trim();
                        string Link = "/dynamicdb.aspx?resourceid=" + dtr["ID"].ToString().Trim();
                        string Description = dtr["Description"].ToString().Trim();

                        string SubjectAreasIDs = dtr["SubjectAreasTaxonomy"].ToString().Trim();

                        if (SubjectAreasIDs != "")
                        {
                            string[] SubjectAreaIDss = SubjectAreasIDs.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                            foreach (string SubjectAreaID in SubjectAreaIDss)
                            {

                                DataRow[] result = dtSA.Select("TaxID='" + SubjectAreaID + "'");
                                foreach (DataRow row in result)
                                {
                                    dtResultSubjectAreas.Rows.Add(SubjectAreaID, row["Name"].ToString(), row["URL"].ToString());
                                }

                            }
                        }

                        dtResult.Rows.Add(Title, Link, Author, Year, "", "1", Description, ID);
                    }
                }

                //Response.Write(dtResultSubjectAreas.Rows.Count);
                listSubJectArea.DataSource = DataBase.RemoveDuplicateRows(dtResultSubjectAreas, "ID");
                listSubJectArea.DataBind();

                listViewDatabases.DataSource = dtResult;
                listViewDatabases.DataBind();

                string ApiId = System.Web.Configuration.WebConfigurationManager.AppSettings["SummonSSADLApiId"];
                string ApiKey = System.Web.Configuration.WebConfigurationManager.AppSettings["SummonSSADLApiKey"];

                //  Console.WriteLine("XML");  http://api.summon.serialssolutions.com/2.0.0/search?s.hl=false&s.ho=true&s.q=Law

                var summon = new SummonXml(ApiId, ApiKey);
                summon.Debug = false;

                string buildString = "s.q=Title:(" + search + ")&s.ps=25";
                string getArticles = summon.Query(buildString + "&s.fvf=ContentType,Newspaper Article,false");
                string geteBooks = summon.Query(buildString + "&s.fvf=ContentType,Book / eBook,false");
                string getJournals = summon.Query(buildString + "&s.fvf=ContentType,Journal Article,false");

                var docArticles = new XmlDocument();
                var docEBooks = new XmlDocument();
                var docJournals = new XmlDocument();

                docArticles.LoadXml(getArticles);
                docEBooks.LoadXml(geteBooks);
                docJournals.LoadXml(getJournals);

                getSummary(docArticles, "Article", search);
                getSummary(docEBooks, "Book", search);
                getSummary(docJournals, "Journal", search);

                getOtherSummary(docArticles, "Article", search);

                try { DT_Articles = getAllDataItems(docArticles).AsEnumerable().Take(5).CopyToDataTable(); }
                catch { }
                try { DT_EBooks = getAllDataItems(docEBooks).AsEnumerable().Take(5).CopyToDataTable(); }
                catch { }
                try { DT_Journals = getAllDataItems(docJournals).AsEnumerable().Take(5).CopyToDataTable(); }
                catch { }

                listViewArticles.DataSource = DT_Articles;
                listViewArticles.DataBind();

                listVieweBooks.DataSource = DT_EBooks;
                listVieweBooks.DataBind();

                listViewJournals.DataSource = DT_Journals;
                listViewJournals.DataBind();
                ///

                // getSummary(docJournals);
                ///Content DM Search
                int GetContentDMCount = getReports("CISOSEARCHALL^" + search + "^any");
                if (GetContentDMCount > 0)
                {
                    ContentDMSearchResults = "  <a href='/resources/ssareportsarchive.aspx?show=simple&s=" + search + "'>Government Reports (" + GetContentDMCount.ToString() + ")</a> ";
                }

                //get other resources
            }
            catch
            {
                Response.Redirect(commonfunctions.host + "/searchsummon.aspx?s=" + search);
            }

        }
    }