Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    HVE.Files.dbConnection conn = new HVE.Files.dbConnection();
                    string sclearsql            = string.Concat("SELECT top 5 DocName, DocLocation, DownloadCount FROM [AAES Home].[dbo].[TopViewedDocsTable11] order by DownloadCount desc");
                    tempTabale = conn.executeSelectNoParameter(sclearsql);

                    webApp = SPContext.Current.Site.WebApplication.GetResponseUri(Microsoft.SharePoint.Administration.SPUrlZone.Default).ToString();
                    for (int i = 0; i < tempTabale.Rows.Count; i++)
                    {
                        hrefLink = "/" + tempTabale.Rows[i][1].ToString();
                        htmlString.Append("<br>");
                        htmlString.Append(@"<span>" +
                                          "<a href='" + hrefLink + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a>" +
                                          " (" + tempTabale.Rows[i][2] + ")" +
                                          "</span>");
                        htmlString.Append("&nbsp");
                    }
                    Literal1.Text = htmlString.ToString();
                }
            }
            catch (System.Exception excep)
            {
                throw excep;
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Button1.Visible = false;
            try
            {
                if (!Page.IsPostBack)
                {
                    //HVEStage_Search_Service_Application_LinksStoreDB_ac061569c0804ca68d18ac6f23bb2758
                    //HVEDev_Search_Service_Application_LinksStoreDB_151f333c38ce4fd3a6527d79d5532774
                    string quer = @"Select top 10
                                      querystring, COUNT(queryString) as CountValue
	                                  from  [HVEDev_Search_Service_Application_LinksStoreDB_151f333c38ce4fd3a6527d79d5532774].[dbo].[MSSQLogPageImpressionQuery]
	                                  where queryString !='' 
			                                and queryString IS NOT NULL 
											and queryString not like 'path:%'                                          
			                                and queryString not like 'siteid:%'  
	                                  group by queryString
                                      order by CountValue desc";
                    //HVE.Files.dbConnection conn = new HVE.Files.dbConnection("TopSearchedItems");
                    HVE.Files.dbConnection conn = new HVE.Files.dbConnection();
                    DataTable tempTabale        = null;
                    tempTabale = conn.executeSelectNoParameter(quer);

                    Repeater1.DataSource = tempTabale;
                    Repeater1.DataBind();

                    #region GridView Bound Columns

                    //////DataTable dt = new DataTable();
                    //////for (int i = 0; i < tempTabale.Rows.Count; i++)
                    //////{
                    //////    DataColumn dcol = new DataColumn("Col" + (i + 1), typeof(System.String));
                    //////    dcol.AutoIncrement = true;
                    //////    dt.Columns.Add(dcol);
                    //////}
                    //////DataRow drow = dt.NewRow();
                    ////////drow["Col1"] = 1;// "Row-";
                    //////dt.Rows.Add(drow);
                    ////////GridView1.DataSource = dt;
                    ////////GridView1.DataBind();



                    #endregion

                    #region LiteralControl
                    StringBuilder htmlStr = new StringBuilder("");
                    //string hrefLinks = "http://win-njfp7te48bn/sites/HVEDev3Search/Pages/search.aspx?k=";
                    string hrefLinks = this.Page.Request.Url.ToString().Substring(0, this.Page.Request.Url.ToString().IndexOf(".aspx?k=")) + ".aspx?k=";


                    string str  = SPContext.Current.Site.Url;
                    string str1 = this.Page.Request.Url.ToString();
                    string var1 = str1.Substring(0, str1.IndexOf(".aspx?k="));


                    //string var1 = str1.Substring(str1.LastIndexOf(".aspx?k="));

                    /*
                     * var1 = entry.DocLocation.Substring(entry.DocLocation.LastIndexOf("/"));
                     *                              var2 = var1.Substring(var1.LastIndexOf("/"));
                     *                              var3 = var2.Substring(1);
                     *                              var4 = var3.Substring(var3.LastIndexOf('.') + 1);
                     */

                    for (int i = 0; i < tempTabale.Rows.Count; i++)
                    {
                        //htmlStr.Append("<table><tr></tr></table>");
                        switch (i)
                        {
                        case 0:
                            string hyperLink1 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:xx-large; '><a href='" + hyperLink1 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 1:
                            string hyperLink2 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:x-large; '><a href='" + hyperLink2 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 2:
                            string hyperLink3 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:large; '><a href='" + hyperLink3 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 3:
                            string hyperLink4 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:large; '><a href='" + hyperLink4 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 4:
                            string hyperLink5 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:larger; '><a href='" + hyperLink5 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 5:
                            string hyperLink6 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:medium; '><a href='" + hyperLink6 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 6:
                            string hyperLink7 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:small; '><a href='" + hyperLink7 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 7:
                            string hyperLink8 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:small; '><a href='" + hyperLink8 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 8:
                            string hyperLink9 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:smaller; '><a href='" + hyperLink9 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 9:
                            string hyperLink10 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:smaller; '><a href='" + hyperLink10 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append("&nbsp");
                            break;

                        default:
                            Console.WriteLine("Default case");
                            break;
                        }
                    }
                    LiteralText.Text = htmlStr.ToString();
                }
                #endregion
            }
            catch (System.Exception excep)
            {
                Label1.Text += excep.Message;
            }
        }
Пример #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    string quer = @"Select top 10
                                      querystring, COUNT(queryString) as CountValue
	                                  from  [Search_Service_Application_1_LinksStoreDB_85b9e99e32794b6c9785675b4fb6757f].[dbo].[MSSQLogPageImpressionQuery]
	                                  where queryString !='' 
			                                and queryString IS NOT NULL 
			                                and queryString not like 'path:\""http://%' 
			                                and queryString not like 'path:\""https://%' 
			                                and queryString not like 'siteid:%'  
	                                  group by queryString
                                      order by CountValue desc";
                    HVE.Files.dbConnection conn = new HVE.Files.dbConnection();
                    DataTable tempTabale        = null;
                    tempTabale = conn.executeSelectNoParameter(quer);
                    //GridView1.DataSource = tempTabale;
                    //GridView1.DataBind();
                    //foreach (DataRow row in tempTabale.Rows) {}

                    string        linkVal = @"http://aespaspsas/sites/HVEDevSite/_layouts/15/osssearchresults.aspx?u=http%3A%2F%2Faespaspsas%2Fsites%2FHVEDevSite&k=";
                    StringBuilder htmlStr = new StringBuilder("This is string builder");

                    for (int i = 0; i < tempTabale.Rows.Count; i++)
                    {
                        switch (i)
                        {
                        case 0:
                            htmlStr.Append("<p><font size='7'>" + tempTabale.Rows[i][0] + "</font>");
                            //htmlStr.Append(@"<a href='<%#Eval(\""tempTabale.Rows[i][0]\"")%>' target='_blank'>Visit W3Schools</a>");

                            //htmlStr.Append("<p><font size='7'>" + tempTabale.Rows[i][0] + "</font></p>");
                            htmlStr.Append("&nbsp");
                            break;

                        case 1:
                            htmlStr.Append("<font size='7'>" + tempTabale.Rows[i][0] + "</font>");
                            htmlStr.Append("&nbsp");
                            break;

                        case 2:
                            htmlStr.Append("<font size='6'>" + tempTabale.Rows[i][0] + "</font>");
                            htmlStr.Append("&nbsp");
                            break;

                        case 3:
                            htmlStr.Append("<font size='6'>" + tempTabale.Rows[i][0] + "</font>");
                            htmlStr.Append("&nbsp");
                            break;

                        case 4:
                            htmlStr.Append("<font size='6'>" + tempTabale.Rows[i][0] + "</font>");
                            htmlStr.Append("&nbsp");
                            break;

                        case 5:
                            htmlStr.Append("<font size='5'>" + tempTabale.Rows[i][0] + "</font>");
                            htmlStr.Append("&nbsp");
                            break;

                        case 6:
                            htmlStr.Append("<font size='5'>" + tempTabale.Rows[i][0] + "</font>");
                            htmlStr.Append("&nbsp");
                            break;

                        case 7:
                            htmlStr.Append("<font size='5'>" + tempTabale.Rows[i][0] + "</font>");
                            htmlStr.Append("&nbsp");
                            break;

                        case 8:
                            htmlStr.Append("<font size='4'>" + tempTabale.Rows[i][0] + "</font>");
                            htmlStr.Append("&nbsp");
                            break;

                        case 9:
                            htmlStr.Append("<font size='4'>" + tempTabale.Rows[i][0] + "</font></p>");
                            htmlStr.Append("&nbsp");
                            break;

                        //              case 10:
                        //                  htmlStr.Append("<p><font size='4'>" + tempTabale.Rows[i][0] + "</font></p>");
                        ////                  htmlStr.Append("&nbsp");
                        //                  break;
                        default:
                            Console.WriteLine("Default case");
                            break;
                        }
                    }
                    LiteralText.Text     = htmlStr.ToString();
                    Repeater1.DataSource = tempTabale;
                    Repeater1.DataBind();
                }
            }
            catch (System.Exception excep)
            {
                Label1.Text += excep.Message;
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Button1.Visible = false;
            try
            {
                if (!Page.IsPostBack)
                { //AES_Search_Service_Application_LinksStoreDB_07d1b3d709b844288e1c87626eb41904   //HVEDev_Search_Service_Application_LinksStoreDB_151f333c38ce4fd3a6527d79d5532774
//////////////                    string quer = @"Select top 10
//////////////                                      querystring, COUNT(queryString) as CountValue
//////////////	                                  from  [HVEDev_Search_Service_Application_LinksStoreDB_151f333c38ce4fd3a6527d79d5532774].[dbo].[MSSQLogPageImpressionQuery]
//////////////	                                  where queryString !=''
//////////////			                                and queryString IS NOT NULL
//////////////											and queryString not like 'path:%'
//////////////			                                and queryString not like 'siteid:%'
//////////////	                                  group by queryString
//////////////                                      order by CountValue desc";
                    string quer = @"Select top 10
                                      querystring, COUNT(queryString) as CountValue
	                                  from  [HVEStage_Search_Service_Application_LinksStoreDB_ac061569c0804ca68d18ac6f23bb2758].[dbo].[MSSQLogPageImpressionQuery]
	                                  where queryString !='' 
			                                and queryString IS NOT NULL 
											and queryString not like 'path:%'                                          
			                                and queryString not like 'siteid:%'  
	                                  group by queryString
                                      order by CountValue desc";
                    HVE.Files.dbConnection conn = new HVE.Files.dbConnection();
                    DataTable tempTabale        = null;
                    tempTabale = conn.executeSelectNoParameter(quer);


                    #region GridView Bound Columns

                    DataTable dt = new DataTable();
                    for (int i = 0; i < tempTabale.Rows.Count; i++)
                    {
                        DataColumn dcol = new DataColumn("Col" + (i + 1), typeof(System.String));
                        dcol.AutoIncrement = true;
                        dt.Columns.Add(dcol);
                    }
                    DataRow drow = dt.NewRow();
                    //drow["Col1"] = 1;// "Row-";
                    dt.Rows.Add(drow);
                    GridView1.DataSource = dt;
                    GridView1.DataBind();



                    #endregion

                    #region LiteralControl
                    StringBuilder htmlStr   = new StringBuilder("");
                    string        hrefLinks = "http://win-njfp7te48bn/sites/HVEDev3Search/Pages/search.aspx?k=";
                    for (int i = 0; i < tempTabale.Rows.Count; i++)
                    {
                        //htmlStr.Append("<table><tr></tr></table>");
                        switch (i)
                        {
                        case 0:
                            string hyperLink1 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:xx-large; '><a href='" + hyperLink1 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 1:
                            string hyperLink2 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:x-large; '><a href='" + hyperLink2 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 2:
                            string hyperLink3 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:large; '><a href='" + hyperLink3 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 3:
                            string hyperLink4 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:large; '><a href='" + hyperLink4 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 4:
                            string hyperLink5 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:larger; '><a href='" + hyperLink5 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 5:
                            string hyperLink6 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:medium; '><a href='" + hyperLink6 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 6:
                            string hyperLink7 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:small; '><a href='" + hyperLink7 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 7:
                            string hyperLink8 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:small; '><a href='" + hyperLink8 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 8:
                            string hyperLink9 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:smaller; '><a href='" + hyperLink9 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append(" | ");
                            htmlStr.Append("&nbsp");
                            break;

                        case 9:
                            string hyperLink10 = hrefLinks + tempTabale.Rows[i][0];
                            htmlStr.Append("<span style='font-size:smaller; '><a href='" + hyperLink10 + "' title='" + tempTabale.Rows[i][0] + "' >" + tempTabale.Rows[i][0] + "</a></span>");
                            htmlStr.Append("&nbsp");
                            break;

                        default:
                            Console.WriteLine("Default case");
                            break;
                        }
                    }
                    LiteralText.Text = htmlStr.ToString();
                }
                #endregion
            }
            catch (System.Exception excep)
            {
                //Label1.Text += excep.Message;
            }
        }