private void LoadList(string siteid, string linkid)
 {
     using (ReportMgmt obj = new ReportMgmt(strconn))
     {
         obj.StartDate = GetDate(txtstartdate.Text);
         obj.EndDate   = GetDate(txtenddate.Text);
         ltlist.Text   = obj.SP_GetReviewListLandingPage(siteid, linkid);
     }
 }
        private void PromotinalLinkReportList(string fromdate, string todate, string linkid)
        {
            string txt = "";
            int    i   = 0;

            try
            {
                DataTable dt = new DataTable();

                using (ReportMgmt obj = new ReportMgmt(strconn))
                {
                    dt = obj.GetUserJourneyList(fromdate, todate, linkid);
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            i++;
                            txt += "<tr height='30' valign='top'>";
                            txt += "<td class='text' align= 'center' bgcolor='#FFFFFF' valign='middle' style='font-family:verdana;font-size:11px;text-align: center;'>" + i.ToString() + "</td>";
                            txt += "<td class='text' align='left' style='padding-left:5px;' bgcolor='#FFFFFF' valign='middle' >" + Convert.ToDateTime(dr["page_visited_time"]).ToString("dd/MM/yyyy HH:mm") + " </td>";
                            txt += "<td class='text' align='left' style='padding-left:5px;' bgcolor='#FFFFFF' valign='middle' ><a class='link' target='_blank' href='" + dr["searchengine_ref_url"].ToString() + "'>" + dr["searchrobot_name"].ToString() + "</a></td>";
                            txt += "<td class='text' align='left' style='padding-left:5px;' bgcolor='#FFFFFF' valign='middle' >" + dr["searchkeyword"].ToString() + '-' + dr["visitor_country"].ToString() + "</td>";
                            txt += "<td class='text' align='left' style='padding-left:5px;' bgcolor='#FFFFFF' valign='middle' ><a class='link' href='" + dr["page_name"].ToString() + "'>" + dr["page_name"].ToString() + " </a></td>";
                            txt += "<td class='text' align='left' style='padding-left:5px;' bgcolor='#FFFFFF' valign='middle' >" + Convert.ToDateTime(dr["hitdate"]).ToString("dd/MM/yyyy HH:mm") + " </td>";
                            txt += "<td class='text' align='left' style='padding-left:5px;' bgcolor='#FFFFFF' valign='middle' ><a class='link' target='_blank' href='" + dr["ReferrerUrl"].ToString() + "'>" + dr["ReferrerUrl"].ToString() + "</a></td>";

                            txt += "</tr>";
                        }
                    }
                    else
                    {
                        txt = "<tr height='30' valign='top'><td class='error' align='center' bgcolor='#FFFFFF' valign='middle' style='padding-right:3px;' colspan='12'> No Records Found! </td></tr>";
                    }
                    ltlist.Text = txt;
                }
            }
            catch (Exception ex)
            {
                CommonLib.ExceptionHandler.WriteLog(CommonLib.Sections.Admin, "Report/LinkWiseLandingReport.aspx.cs PromotinalLinkReportList", ex);
            }
        }
 public void FillOfferLink()
 {
     try
     {
         using (ReportMgmt obj = new ReportMgmt(strconn))
         {
             DataTable dt = new DataTable();
             dt = obj.GetOfferlink();
             if (dt.Rows.Count > 0)
             {
                 ddllink.DataSource     = dt;
                 ddllink.DataTextField  = "LinkName";
                 ddllink.DataValueField = "LinkID";
                 ddllink.DataBind();
             }
             ddllink.Items.Insert(0, new ListItem("-select-", "0"));
         }
     }
     catch (Exception ex)
     {
         CommonLib.ExceptionHandler.WriteLog(CommonLib.Sections.Admin, "Report/LinkWiseLandingReport.aspx.cs FillOfferLink", ex);
     }
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                BaseUrl = ConfigurationManager.AppSettings["BaseURL"];
                strconn = ConfigurationManager.AppSettings["Iframaddsense"];
                try
                {
                    if (string.IsNullOrEmpty(BLL.LoginInfo.Userid))
                    {
                        Response.Redirect(BLL.Constants.OldAdminUrl + "login.aspx", false);
                    }
                }
                catch
                {
                    Response.Redirect(BLL.Constants.OldAdminUrl + "login.aspx", false);
                }

                //upload pages on main site
                if (IsPostBack)
                {
                    //string day1 = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
                    //string day2 = DateTime.Now.ToString("yyyy-MM-dd");
                    Session["day1"] = txtstartdate.Text;
                    Session["day2"] = txtenddate.Text;

                    if (null != Request.QueryString["p"])
                    {
                        pagenumber = Convert.ToInt32(Request.QueryString["p"].ToString());
                    }
                    else
                    {
                        pagenumber = 1;
                    }
                    PromotinalLinkReportList(GetDate(txtstartdate.Text), GetDate(txtenddate.Text), ddllink.SelectedValue);

                    // PromotinalLinkReportList(GetDate(txtstartdate.Text), GetDate(txtenddate.Text), Request.QueryString["referrerid"]);
                }
                else
                {
                    //string day1 = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
                    //string day2 = DateTime.Now.ToString("yyyy-MM-dd");

                    txtstartdate.Text = DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy");
                    txtenddate.Text   = DateTime.Now.ToString("dd/MM/yyyy");


                    FillOfferLink();


                    if (Session["offerlink"] == null)
                    {
                        Session["offerlink"] = "0";
                    }
                    else
                    {
                        Session["offerlink"] = ddllink.SelectedValue;
                    }
                    PromotinalLinkReportList(GetDate(txtstartdate.Text), GetDate(txtenddate.Text), ddllink.SelectedValue);

                    disp_labels();
                    if (Request.QueryString["clear"] != null)
                    {
                        txtstartdate.Text     = DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy");
                        txtenddate.Text       = DateTime.Now.ToString("dd/MM/yyyy");
                        Session["day1"]       = txtstartdate.Text;
                        Session["day2"]       = txtenddate.Text;
                        ddllink.SelectedValue = "0";
                        Session["offerlink"]  = "0";
                    }
                    if (Request.QueryString["excel"] != null)
                    {
                        if (Request.QueryString["excel"] == "excel")
                        {
                            if (Session["day1"] == null && Session["day2"] == null)
                            {
                                Session["day1"] = DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy");
                                Session["day2"] = DateTime.Now.ToString("dd/MM/yyyy");
                            }
                            using (ReportMgmt obj = new ReportMgmt(strconn))
                            {
                                DataTable dtexcel       = obj.GetUserJourneyList(GetDate(Session["day1"].ToString()), GetDate(Session["day2"].ToString()), ddllink.SelectedValue);
                                ExcelMgmt objexcel      = new ExcelMgmt();
                                string    excelfilename = "userjourney_" + DateTime.Now.ToString("ddMMyyyyHHmmsss") + ".csv";
                                objexcel.WriteToCSV(dtexcel, excelfilename);
                            }
                        }
                    }
                    if (null != Request.QueryString["p"])
                    {
                        pagenumber = Convert.ToInt32(Request.QueryString["p"].ToString());
                    }
                    else
                    {
                        pagenumber = 1;
                    }
                    //if (Request.QueryString["referrerid"] != null)
                    //{
                    //    txtstartdate.Text = DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy");
                    //    txtenddate.Text = DateTime.Now.ToString("dd/MM/yyyy");
                    //    PromotinalLinkReportList(GetDate(txtstartdate.Text), GetDate(txtenddate.Text), Request.QueryString["referrerid"]);
                    //}
                }
            }
            catch (Exception ex)
            {
                CommonLib.ExceptionHandler.WriteLog(CommonLib.Sections.Admin, "Report/LinkWiseLandingReport.aspx.cs Page_Load", ex);
            }
        }