コード例 #1
0
ファイル: Error.aspx.cs プロジェクト: D6C92FE5/itsTDH
    protected void Page_Load(object sender, EventArgs e)
    {
        switch ((Page.RouteData.Values["info"] ?? "").ToString())
        {
            case "404":
                PageHelper.ShowResultPage("您访问的页面不存在", "~/Index");
                break;
            default:
                break;
        }

        if (Session["Result"] == null)
        {
            Session["Result"] = "未知错误";
            Session["ResultRedirect"] = "~/Index".ResolveUrl();
        }

        object redirect = Session["ResultRedirect"];
        if (redirect != null)
        {
            HtmlMeta autoRefresh = new HtmlMeta();
            autoRefresh.HttpEquiv = "refresh";
            autoRefresh.Content = "5;url=" + redirect.ToString();
            Page.Header.Controls.Add(autoRefresh);
        }
        ctContent.Text = Session["Result"].ToString();
    }
コード例 #2
0
ファイル: Tire.aspx.cs プロジェクト: bdarby22/soberay
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.SmartNavigation = false;

        lblType.Text = "TIRE MACHINERY";

        //SELECT [item_number], [size], [style], [manufacturer] FROM [TIRE_MACHINERY] WHERE ([type] = ?)

        OleDbConnection TireConnection = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source=" +
            Server.MapPath("").ToString() + "\\App_Data\\xSobesInventoryx.mdb");

        OleDbCommand TireCommand = new OleDbCommand("SELECT [item_number], [size], [style], [manufacturer] FROM [TIRE_MACHINERY] WHERE ([type] = @type)", TireConnection);
        TireCommand.Parameters.Add("@type", OleDbType.Char).Value = Convert.ToString(DropDownList1.SelectedItem);

        TireConnection.Open();
        OleDbDataReader TireReader = TireCommand.ExecuteReader();

        if (TireReader.HasRows)
        {
            DataList1.DataSource = TireReader;
            DataList1.DataBind();
        }

        {
            HtmlMeta keywords = new HtmlMeta();
            keywords.Name = "keywords";
            keywords.Content = "tire machinery, used tire machinery, tires, rubber machinery, used rubber machinery";
            Header.Controls.Add(keywords);

            HtmlMeta description = new HtmlMeta();
            description.Name = "description";
            description.Content = "Over 20 different types of used tire machinery";
            Header.Controls.Add(description);
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string val = Request.QueryString["val"] == null ? string.Empty : Convert.ToString(Request.QueryString["val"]);
        string orderId = SaveLead();
        if (val == "3")
        {   //Flow Ajax call: Capture ShortLEad  IN DB
            string returnShortLeadValue = orderId;
            Response.Clear();
            Response.ContentType = "text/xml";
            Response.Write(returnShortLeadValue);
            Response.End();
        }
        else
        {

            if (string.IsNullOrEmpty(Request.Form["redirectURL"]))
                redirectURL = "Error.htm";
            else
            {
                redirectURL = Request.Form["redirectURL"] + "?id=" + orderId;
            }

            HtmlMeta meta = new HtmlMeta();
            meta.HttpEquiv = "refresh";
            meta.Content = "0.005;url=" + redirectURL;

            this.Header.Controls.Add(meta);

        }
    }
コード例 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            HtmlMeta ds = new HtmlMeta();
            HtmlMeta kw = new HtmlMeta();
            HtmlMeta lg = new HtmlMeta();

            HtmlHead head = (HtmlHead)Page.Header;

            kw.Name = "keywords";
            kw.Content = "About HippoHappenings";
            head.Controls.AddAt(0, kw);

            ds.Name = "description";
            ds.Content = "HippoHappenings provides events and unconventional local happenings";
            head.Controls.AddAt(0, ds);

            lg.Name = "language";
            lg.Content = "English";
            head.Controls.AddAt(0, lg);

            ChangeMission(MissionTimer, new EventArgs());
        }
    }
コード例 #5
0
ファイル: Site.master.cs プロジェクト: Reza1024/mywebsite
    protected void Page_Load(object sender, EventArgs e)
    {
        var googleSiteVerificationMeta = new HtmlMeta { Name = "google-site-verification" };

        if (Request.IsDotInfo())
        {
            googleSiteVerificationMeta.Content = "6M9JTp1F2QTbPqYFmcJnf06iUb8RSsA6QOc_wQ_8";

            //if (!Request.IsRobot() || (Page.Request.AppRelativeCurrentExecutionFilePath.ToLower() != "~/default.aspx"))
            {
                var oldUri = Request.Url.AbsoluteUri.ToLower();
                Response.RedirectPermanent(oldUri.Replace("jooyandeh.info", "jooyandeh.com"));
            }
        }
        else if (Request.IsDotCom())
        {
            googleSiteVerificationMeta.Content = "jJh_5Te44yV12kapDQNEfYp32gejcxXdVIXEjVJIu4g";
        }
        else if (Request.IsOnAzureProd())
        {
            googleSiteVerificationMeta.Content = "leZeHIkj_1Av8w090g9O6rNaBzxgqOevyf8CpCFuiGk";
        }
        else if (Request.IsOnAzureDev())
        {
            googleSiteVerificationMeta.Content = "leZeHIkj_1Av8w090g9O6rNaBzxgqOevyf8CpCFuiGk";
        }

        if (googleSiteVerificationMeta.Content != string.Empty)
            Page.Header.Controls.Add(googleSiteVerificationMeta);

        if (Request.IsOnAzure())
        {
            Page.Header.Controls.Add(new HtmlMeta { Name = "robots", Content = "noindex" });
        }
    }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlLink lk = new HtmlLink();
        HtmlHead head = (HtmlHead)Page.Header;
        lk.Attributes.Add("rel", "canonical");
        lk.Href = "http://hippohappenings.com/EventUpdate.aspx";
        head.Controls.AddAt(0, lk);

        HtmlMeta hm = new HtmlMeta();
        hm.Name = "ROBOTS";
        hm.Content = "NOINDEX, NOFOLLOW";
        head.Controls.AddAt(0, hm);

        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        Response.Redirect("~/Home.aspx");
        if (Session["User"] == null)
        {
            Response.Redirect("~/Home.aspx");
        }
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet dsEvent = dat.GetData("SELECT * FROM Events WHERE ID="+Request.QueryString["ID"].ToString());

        nameLabel.Text = "Enter an update for the event ' " + dsEvent.Tables[0].Rows[0]["Header"].ToString() +" '";
    }
コード例 #7
0
ファイル: spa_moi_list.ascx.cs プロジェクト: nhatkycon/spav4
    protected void Page_Load(object sender, EventArgs e)
    {
        var sb = new StringBuilder();
        sb.AppendFormat(@"<ul class=""tin-view-navi-menus spa-view-navi-menus"">");
        sb.AppendFormat(@"<li>
        <a href=""/"" class=""tin-view-navi-menus-item home"">
        Trang chủ
        </a>
        </li>");
        sb.Append(
            @"<li><a class=""tin-view-navi-menus-item"" href=""/Spa-moi-khai-truong/"">Spa mới khai trương</a></li>");
        sb.AppendFormat(@"</ul>");
        txtPath = sb.ToString();

        this.Page.Header.Title = string.Format("Spa mới khai trương - Tạp chí spa");

        var meta = new HtmlMeta();
        meta.Name = "description";
        meta.Content = "Danh sách những Spa mới khai trương";
        this.Page.Header.Controls.Add(meta);

        meta = new HtmlMeta();
        meta.Name = "og:description";
        meta.Content = "Danh sách những Spa mới khai trương";
        this.Page.Header.Controls.Add(meta);

        meta = new HtmlMeta();
        meta.Name = "og:title";
        meta.Content = string.Format("Spa mới khai trương - Tạp chí spa");
        this.Page.Header.Controls.Add(meta);
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.Date.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        DateTime isNow = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":").Replace("%28", "(").Replace("%29", ")"));
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":").Replace("%28", "(").Replace("%29", ")")));

        HtmlMeta hm = new HtmlMeta();
        HtmlMeta kw = new HtmlMeta();
        HtmlMeta lg = new HtmlMeta();
        HtmlHead head = (HtmlHead)Page.Header;

        hm.Name = "Description";
        hm.Content = "Hippo Boss and Hippo Points are your tool on HippoHappenings for "+
            "promoting yourself online. It's our gift to you for having posted lots of content on our site.";
        head.Controls.AddAt(0, hm);

        kw.Name = "keywords";
        kw.Content = "Hippo Boss and Points promote your cause";
        head.Controls.AddAt(0, kw);

        lg.Name = "language";
        lg.Content = "English";
        head.Controls.AddAt(0, lg);
    }
コード例 #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     HtmlMeta description = new HtmlMeta();
     description.Name = "description";
     description.Content = "All rubber machinery products, excluding tire machinery, both new and used";
     Header.Controls.Add(description);
 }
コード例 #10
0
ファイル: ReadyReader.aspx.cs プロジェクト: Wynnah/ASP.NET
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] == null)
        {
            Response.Redirect("~/ReadyReaders.aspx?gender=all");
        }

        // Gets the name of the product and put it as the title
        string title = Frames.GetName(Request.QueryString["id"]) + " @ OnSiteEyewear.ca";
        HtmlMeta metaTitle = new HtmlMeta();
        metaTitle.Name = title;
        metaTitle.Content = title;
        Page.Header.Controls.Add(metaTitle);
        Page.Title = metaTitle.Content;

        // Add values to the ddlPower
        ddlPower = (DropDownList)fvSpecificReadyReader.FindControl("ddlPower");

        while (ddlPowerInt < 3)
        {
            ddlPowerInt = ddlPowerInt + 0.25;

            ddlPower.Items.Add(new ListItem(String.Format("{0:+0.00}", ddlPowerInt), ddlPowerNum.ToString()));
            ddlPowerNum++;
        }
    }
コード例 #11
0
ファイル: Message.aspx.cs プロジェクト: ForeverYoungW/its0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var id = Request.QueryString["ID"];
            if (Session["Message" + id] == null)
            {
                Session["Message" + id] = "未知错误";
                Session["Redirect" + id] = "Index.aspx";
            }

            var redirect = Session["Redirect" + id];
            if (redirect != null)
            {
                var autoRefresh = new HtmlMeta();
                autoRefresh.HttpEquiv = "refresh";
                autoRefresh.Content = "2;url=" + redirect.ToString();
                Page.Header.Controls.Add(autoRefresh);

                ctRedirect.Visible = true;
                ctRedirect.NavigateUrl = redirect.ToString();
            }
            ctMessage.Text = Session["Message" + id].ToString();
        }
    }
コード例 #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlMeta hm = new HtmlMeta();
        HtmlHead head = (HtmlHead)Page.Header;
        hm.Name = "ROBOTS";
        hm.Content = "NOINDEX, FOLLOW";
        head.Controls.AddAt(0, hm);

        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        //Ajax.Utility.RegisterTypeForAjax(typeof(Delete));
        if (!IsPostBack)
        {
            string cookieName = FormsAuthentication.FormsCookieName;
            HttpCookie authCookie = Context.Request.Cookies[cookieName];
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            DataView dvEvent = dat.GetDataDV("SELECT * FROM GroupEvents WHERE ID=" +
                Request.QueryString["ID"].ToString());
            string groupID = dvEvent[0]["GroupID"].ToString();
            DataView dvGroup = dat.GetDataDV("SELECT * FROM Groups WHERE ID=" + groupID);
            ImageButton9.OnClientClick = "Search('" + dat.MakeNiceName(dvGroup[0]["Header"].ToString()) + "_" + groupID + "_Group');";

            TextLabel.Text = "Are you sure you want to delete the event '" + dvEvent[0]["Name"].ToString() +
                "' from the group '" + dvGroup[0]["Header"].ToString() + "'";
        }
    }
コード例 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strTitle, strDescription, strMetaTitle, strMetaDescription;
            if (!string.IsNullOrEmpty(Request.QueryString["tv"]))
            {
                var oComment = new Comment();
                var dv = oComment.CommentSelectOne(Request.QueryString["tv"]).DefaultView;

                if (dv != null && dv.Count <= 0) return;
                var row = dv[0];

                strTitle = Server.HtmlDecode(row["Title"].ToString());
                strDescription = Server.HtmlDecode(row["Title"].ToString());
                strMetaTitle = Server.HtmlDecode(row["Title"].ToString());
                strMetaDescription = Server.HtmlDecode(row["Title"].ToString());

            }
            else
            {
                strTitle = strMetaTitle = "Tư Vấn";
                strDescription = "";
                strMetaDescription = "";
            }
            Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
            var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
            Header.Controls.Add(meta);
        }
    }
コード例 #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlMeta hm = new HtmlMeta();
        HtmlHead head = (HtmlHead)Page.Header;
        hm.Name = "ROBOTS";
        hm.Content = "NOINDEX, FOLLOW";
        head.Controls.AddAt(0, hm);

        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        DataView dvGroup = dat.GetDataDV("SELECT * FROM Groups WHERE ID="+Request.QueryString["ID"].ToString());
        if (dvGroup[0]["Host"].ToString() == Session["User"].ToString())
        {
            TheLabel.Text = "Since you are the primary host of the group, you must first designate another host for the group. Go to your group's home page and click on 'Edit Members' Prefs'.";
            Button3.Visible = false;
        }
    }
コード例 #15
0
ファイル: km_view.ascx.cs プロジェクト: nhatkycon/spav4
    protected void Page_Load(object sender, EventArgs e)
    {
        var sb = new StringBuilder();
        sb.AppendFormat(@"<ul class=""tin-view-navi-menus spa-view-navi-menus"">");
        sb.AppendFormat(@"<li>
        <a href=""/"" class=""tin-view-navi-menus-item home"">
        Trang chủ
        </a>
        </li>");
        sb.Append(
            @"<li><a class=""tin-view-navi-menus-item"" href=""/Spa-khuyen-mai/"">Spa khuyến mãi</a></li>");
        sb.AppendFormat(@"</ul>");
        txtPath = sb.ToString();

        this.Page.Header.Title = string.Format(Item.Ten + " Spa khuyến mãi, Spa giảm giá, spa voucher - Tạp chí spa");

        var meta = new HtmlMeta();
        meta.Name = "description";
        meta.Content = Item.MoTa;
        this.Page.Header.Controls.Add(meta);

        meta = new HtmlMeta();
        meta.Name = "og:description";
        meta.Content = Item.MoTa;
        this.Page.Header.Controls.Add(meta);

        meta = new HtmlMeta();
        meta.Name = "og:title";
        meta.Content = string.Format(Item.Ten + " Spa khuyến mãi, Spa giảm giá, spa voucher - Tạp chí spa");
        this.Page.Header.Controls.Add(meta);
    }
コード例 #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strTitle, strDescription, strMetaTitle, strMetaDescription;
            if (!string.IsNullOrEmpty(Request.QueryString["tv"]))
            {
                var oTuVan = new Article();
                var dv = oTuVan.ArticleSelectOne(Request.QueryString["tv"]).DefaultView;

                if (dv != null && dv.Count <= 0) return;
                var row = dv[0];

                strTitle = Server.HtmlDecode(row["ArticleTitle"].ToString());
                strDescription = Server.HtmlDecode(row["Description"].ToString());
                strMetaTitle = Server.HtmlDecode(row["MetaTittle"].ToString());
                strMetaDescription = Server.HtmlDecode(row["MetaDescription"].ToString());

                //hdnSanPham.Value = progressTitle(dv[0]["ProductCategoryName"].ToString()) + "-pci-" + dv[0]["ProductCategoryID"].ToString() + ".aspx";
            }
            else
            {
                strTitle = strMetaTitle = "Tư Vấn";
                strDescription = "";
                strMetaDescription = "";
            }
            Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
            var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
            Header.Controls.Add(meta);

            lblTitle.Text = strTitle;
            lblTitle2.Text = strTitle;
        }
    }
コード例 #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strTitle, strDescription, strMetaTitle, strMetaDescription;
            if (!string.IsNullOrEmpty(Request.QueryString["tt"]))
            {
                var oArticle = new Article();
                var oArticleCategory = new ArticleCategory();
                var dv = oArticle.ArticleSelectOne(Request.QueryString["tt"]).DefaultView;

                if (dv != null && dv.Count <= 0) return;
                var row = dv[0];

                var dv2 = oArticleCategory.ArticleCategorySelectOne(row["ArticleCategoryID"].ToString()).DefaultView;
                
                strTitle = Server.HtmlDecode(row["ArticleTitleEn"].ToString());
                strDescription = Server.HtmlDecode(row["DescriptionEn"].ToString());
                strMetaTitle = Server.HtmlDecode(row["MetaTittleEn"].ToString());
                strMetaDescription = Server.HtmlDecode(row["MetaDescriptionEn"].ToString());

                lblTitleNews.Text = dv2[0]["ArticleCategoryNameEn"].ToString();
            }
            else
            {
                strTitle = strMetaTitle = "News";
                strDescription = "";
                strMetaDescription = "";
            }
            Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
            var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
            Header.Controls.Add(meta);
        }
    }
コード例 #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //if (((DataView)odsTinTuc.Select()).Count <= DataPager1.PageSize)
            //{
            //    DataPager1.Visible = false;
            //}

            string strTitle, strDescription, strMetaTitle, strMetaDescription;
            if (!string.IsNullOrEmpty(Request.QueryString["pi"]))
            {
                var oProduct = new Product();
                var oProductCategory = new ProductCategory();
                var dv = oProduct.ProductSelectOne(Request.QueryString["pi"]).DefaultView;

                if (dv != null && dv.Count <= 0) return;
                var row = dv[0];

                strTitle = Server.HtmlDecode(row["ProductName"].ToString());
                strDescription = Server.HtmlDecode(row["Description"].ToString());
                strMetaTitle = Server.HtmlDecode(row["MetaTittle"].ToString());
                strMetaDescription = Server.HtmlDecode(row["MetaDescription"].ToString());
            }
            else
            {
                strTitle = strMetaTitle = "Sản Phẩm";
                strDescription = "";
                strMetaDescription = "";
            }
            Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
            var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
            Header.Controls.Add(meta);
        }
    }
コード例 #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     HtmlMeta description = new HtmlMeta();
     description.Name = "description";
     description.Content = "All tire machinery / tyre machinery products that Soberay and Sons has in stock";
     Header.Controls.Add(description);
 }
コード例 #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strTitle, strDescription, strMetaTitle, strMetaDescription;
            if (!string.IsNullOrEmpty(Request.QueryString["ni"]))
            {
                var oProduct = new Product();
                var oProductCategory = new ProductCategory();
                var dv = oProduct.ProductSelectOne(Request.QueryString["ni"]).DefaultView;

                if (dv != null && dv.Count <= 0) return;
                var row = dv[0];

                var dv2 = oProductCategory.ProductCategorySelectOne(row["CategoryID"].ToString()).DefaultView;
                
                strTitle = Server.HtmlDecode(row["ProductName"].ToString());
                strDescription = Server.HtmlDecode(row["Description"].ToString());
                strMetaTitle = Server.HtmlDecode(row["MetaTittle"].ToString());
                strMetaDescription = Server.HtmlDecode(row["MetaDescription"].ToString());

                lblTitleProduct.Text = dv2[0]["ProductCategoryName"].ToString();
            }
            else
            {
                strTitle = strMetaTitle = "Nghiên Cứu Phát Triển";
                strDescription = "";
                strMetaDescription = "";
            }
            Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
            var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
            Header.Controls.Add(meta);
        }
    }
コード例 #21
0
 public static void AddDescritpintags(HtmlHead Header)
 {
     HtmlMeta tag = new HtmlMeta();
     tag.Name = "Title";
     tag.Content = "Best Car Selling Packages to Sell your Car Online at UnitedCarExchange.com";
     Header.Controls.Add(tag);
 }
コード例 #22
0
    protected override void OnLoad(EventArgs e)
    {
        #region 获取站点

        //_Site = new Sites()[Shove._Web.Utility.GetUrlWithoutHttp()];
        _Site = new Sites()[1];

        if (_Site == null)
        {
            PF.GoError(ErrorNumber.Unknow, "域名无效,限制访问", this.GetType().FullName);

            return;
        }

        #endregion

        #region 获取用户

        _ElectronTicketAgents = ElectronTicketAgents.GetCurrentUser();

        if (isRequestLogin && (_ElectronTicketAgents == null))
        {
            Response.Redirect("Login.aspx");

            return;
        }

        #endregion

        HtmlMeta hm = new HtmlMeta();
        hm.HttpEquiv = "X-UA-Compatible";
        hm.Content = "IE=EmulateIE7";

        base.OnLoad(e);
    }
コード例 #23
0
ファイル: Header.aspx.cs プロジェクト: spbooks/ASPNETANT1
 protected void Button2_Click(object sender, EventArgs e)
 {
     HtmlMeta meta = new HtmlMeta();
     meta.HttpEquiv = "Refresh";
     meta.Content = "2;URL=http://www.OdeToCode.com";
     Header.Controls.Add(meta);
 }
コード例 #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlMeta hm = new HtmlMeta();
        HtmlHead head = (HtmlHead)Page.Header;
        hm.Name = "ROBOTS";
        hm.Content = "NOINDEX, FOLLOW";
        head.Controls.AddAt(0, hm);

        ImageButton9.OnClientClick = "javascript:Search('Group.aspx?ID=" +
            Request.QueryString["ID"].ToString() + "');";

        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        string groupID = Request.QueryString["ID"].ToString();

        DataView dvMembers = dat.GetDataDV("SELECT * FROM Group_Members WHERE GroupID=" +
           groupID + " AND MemberID=" + Session["User"].ToString());

        if (bool.Parse(dvMembers[0]["SharedHosting"].ToString()))
        {
            HostPanel.Visible = true;
        }
        else
            HostPanel.Visible = false;
    }
コード例 #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.Date.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        DateTime isNow = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":").Replace("%28", "(").Replace("%29", ")"));
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":").Replace("%28", "(").Replace("%29", ")")));

        HtmlMeta hm = new HtmlMeta();
        HtmlMeta kw = new HtmlMeta();
        HtmlMeta lg = new HtmlMeta();
        HtmlHead head = (HtmlHead)Page.Header;

        hm.Name = "Description";
        hm.Content = "Feature events, locales, trips and bulletins on HippoHappenings. By making all posting entirely free, we encourage you to post all public evets, whether big, small or even just a street performance. Promote them even further by featuring your happenings.";
        head.Controls.AddAt(0, hm);

        kw.Name = "keywords";
        kw.Content = "Feature event locale trip and bulletin on HippoHappenings";
        head.Controls.AddAt(0, kw);

        lg.Name = "language";
        lg.Content = "English";
        head.Controls.AddAt(0, lg);
    }
コード例 #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (((DataView)odsDieuTriHo.Select()).Count <= DataPager1.PageSize)
            {
                DataPager1.Visible = false;
            }

            string strTitle, strDescription, strMetaTitle, strMetaDescription;
            if (!string.IsNullOrEmpty(Request.QueryString["di"]))
            {
                var oArticle = new Article();
                var oArticleCategory = new ArticleCategory();
                var dv = oArticle.ArticleSelectOne(Request.QueryString["di"]).DefaultView;

                if (dv != null && dv.Count <= 0) return;
                var row = dv[0];

                strTitle = Server.HtmlDecode(row["ArticleTitleEn"].ToString());
                strDescription = Server.HtmlDecode(row["DescriptionEn"].ToString());
                strMetaTitle = Server.HtmlDecode(row["MetaTittleEn"].ToString());
                strMetaDescription = Server.HtmlDecode(row["MetaDescriptionEn"].ToString());
            }
            else
            {
                strTitle = strMetaTitle = "Cough Treatment";
                strDescription = "";
                strMetaDescription = "";
            }
            Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
            var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
            Header.Controls.Add(meta);
        }
    }
コード例 #27
0
ファイル: CpsAdminPageBase.cs プロジェクト: ichari/ichari
    protected override void OnLoad(EventArgs e)
    {
        #region 获取站点

        _Site = new Sites()[1];

        if (_Site == null)
        {
            PF.GoError(ErrorNumber.Unknow, "域名无效,限制访问", this.GetType().FullName);

            return;
        }

        #endregion

        #region 获取用户

        Users users = Users.GetCurrentUser(1);

        if (users == null)
        {
            PF.GoLogin(RequestLoginPage, false);

            return;
        }

        if (_User == null)
        {
            _User = Session["CpsAdminPageBase_Users"] as Users;
        }

        if (_User == null)
        {
            PF.GoLogin(RequestLoginPage, false);

            return;
        }

        #endregion

        #region 判断权限

        if (!users.Competences.IsOwnedCompetences(RequestCompetences))
        {
            PF.GoError(ErrorNumber.NotEnoughCompetence, "对不起,您没有足够的权限访问此页面", this.GetType().FullName);

            return;
        }

        #endregion

        HtmlMeta hm = new HtmlMeta();
        hm.HttpEquiv = "X-UA-Compatible";
        hm.Content = "IE=EmulateIE7";

        PageUrl = this.Request.Url.AbsoluteUri;

        base.OnLoad(e);
    }
コード例 #28
0
    private static void PAGE_META(HtmlHead _hd, string keywords, string description)
    {

        HtmlMeta hm1 = new HtmlMeta();
        hm1.Name = "description";
        hm1.Content = description;
        _hd.Controls.Add(hm1);
    }
コード例 #29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     HtmlMeta hm = new HtmlMeta();
     HtmlHead head = (HtmlHead)Page.Header;
     hm.Name = "ROBOTS";
     hm.Content = "NOINDEX, FOLLOW";
     head.Controls.AddAt(0, hm);
 }
コード例 #30
0
ファイル: default.aspx.cs プロジェクト: mangmaytinh/vguitar
 private void GetMetaKeywords()
 {
     Page.Header.Title = "VGuitar";
     HtmlMeta metaTag = new HtmlMeta();
     metaTag.Name = Resources.lang.Keywords;
     metaTag.Content = "Hợp âm, Gam , bản nhạc";
     this.Header.Controls.Add(metaTag);
 }
コード例 #31
0
        private void Page_Init()
        {
            // Load Page Properties
            HtmlMeta myDescription = new HtmlMeta();

            myDescription.Name    = "Description";
            myDescription.Content = myMasterPageIndex.MasterPage_Description;
            this.Header.Controls.Add(myDescription);

            //// Add CSS for Advanced window
            //string[] CssFiles = {
            //                         "~/App_Themes/NexusCore/PageEditor.css",
            //                         "~/App_Themes/NexusCore/PageEditor_ToolBar.css",
            //                     };

            //foreach (string CssFile in CssFiles)
            //{
            //    HtmlLink cssEditor_Link = new HtmlLink();
            //    cssEditor_Link.Href = CssFile;
            //    cssEditor_Link.Attributes.Add("type", "text/css");
            //    cssEditor_Link.Attributes.Add("rel", "stylesheet");
            //    Header.Controls.Add(cssEditor_Link);
            //}


            //// Add Script File for Advanced window
            //string[] Scripts = {
            //                   };

            //foreach (string myScript in Scripts)
            //{
            //    string MapPath = Request.ApplicationPath;

            //    if (MapPath.EndsWith("/"))
            //    {
            //        MapPath = MapPath.Remove(MapPath.Length - 1) + myScript;
            //    }
            //    else
            //    {
            //        MapPath = MapPath + myScript;
            //    }

            //    HtmlGenericControl scriptTag = new HtmlGenericControl("script");
            //    scriptTag.Attributes.Add("type", "text/javascript");
            //    scriptTag.Attributes.Add("src", MapPath);
            //    Header.Controls.Add(scriptTag);
            //}

            #region Add MetaTags

            PageMgr myPageMgr = new PageMgr();
            Templates.MasterPageMgr myMasterPageMgr = new Templates.MasterPageMgr();

            #region Global and Page Level

            // Add CSS for Advanced window
            List <Pages.MetaTag> CssFiles = new List <Pages.MetaTag>();

            // Load Global CSS
            List <Pages.MetaTag> myGlobalCSS = myPageMgr.Get_Page_MetaTags("-1", Pages.Meta_Type.StyleSheet);

            foreach (Pages.MetaTag myMetaTag in myGlobalCSS)
            {
                CssFiles.Add(myMetaTag);
            }

            foreach (Pages.MetaTag CssFile in CssFiles)
            {
                HtmlLink cssEditor_Link = new HtmlLink();
                cssEditor_Link.Href = CssFile.Meta_Src;
                cssEditor_Link.Attributes.Add("type", "text/css");
                cssEditor_Link.Attributes.Add("rel", "stylesheet");
                Header.Controls.Add(cssEditor_Link);
            }

            // Add Script File for Editor
            List <Pages.MetaTag> Scripts = new List <Pages.MetaTag>();

            // Load Global Script
            List <Pages.MetaTag> myGlobalScripts = myPageMgr.Get_Page_MetaTags("-1", Pages.Meta_Type.JavaScript);

            foreach (Pages.MetaTag myMetaTag in myGlobalScripts)
            {
                Scripts.Add(myMetaTag);
            }

            foreach (Pages.MetaTag myScript in Scripts)
            {
                string MapPath = Request.ApplicationPath;

                if (MapPath.EndsWith("/"))
                {
                    MapPath = MapPath.Remove(MapPath.Length - 1) + myScript.Meta_Src;
                }
                else
                {
                    MapPath = MapPath + myScript;
                }

                HtmlGenericControl scriptTag = new HtmlGenericControl("script");
                scriptTag.Attributes.Add("type", "text/javascript");
                scriptTag.Attributes.Add("src", MapPath);
                Header.Controls.Add(scriptTag);
            }

            #endregion

            #region Masterpage Level

            // Load MasterPage CSS
            List <Templates.MetaTag> Master_CssFiles = new List <Templates.MetaTag>();


            List <Templates.MetaTag> myMasterPageCSS = myMasterPageMgr.Get_MasterPage_MetaTags(myPage_Loading_Info.MasterPageIndexID, Templates.Meta_Type.StyleSheet);

            foreach (Templates.MetaTag myMetaTag in myMasterPageCSS)
            {
                Master_CssFiles.Add(myMetaTag);
            }

            foreach (Templates.MetaTag CssFile in Master_CssFiles)
            {
                HtmlLink cssEditor_Link = new HtmlLink();
                cssEditor_Link.Href = CssFile.Meta_Src;
                cssEditor_Link.Attributes.Add("type", "text/css");
                cssEditor_Link.Attributes.Add("rel", "stylesheet");
                Header.Controls.Add(cssEditor_Link);
            }

            // Load MasterPage Scripts
            List <Templates.MetaTag> Master_Scripts = new List <Templates.MetaTag>();


            List <Templates.MetaTag> myMasterPageScripts = myMasterPageMgr.Get_MasterPage_MetaTags(myPage_Loading_Info.MasterPageIndexID, Templates.Meta_Type.JavaScript);

            foreach (Templates.MetaTag myMetaTag in myMasterPageScripts)
            {
                Master_Scripts.Add(myMetaTag);
            }

            foreach (Templates.MetaTag myScript in Master_Scripts)
            {
                string MapPath = Request.ApplicationPath;

                if (MapPath.EndsWith("/"))
                {
                    MapPath = MapPath.Remove(MapPath.Length - 1) + myScript.Meta_Src;
                }
                else
                {
                    MapPath = MapPath + myScript;
                }

                HtmlGenericControl scriptTag = new HtmlGenericControl("script");
                scriptTag.Attributes.Add("type", "text/javascript");
                scriptTag.Attributes.Add("src", MapPath);
                Header.Controls.Add(scriptTag);
            }


            #endregion

            #endregion

            // Add Script Manager
            RadScriptManager myScriptMgr = new RadScriptManager();
            myScriptMgr.ID = "RadScriptManager1";

            HtmlForm myForm = (HtmlForm)Page.Master.FindControl("Form_NexusCore");
            myForm.Controls.Add(myScriptMgr);

            // Add PlaceHolder
            PlaceHolder myPlaceHolder = new PlaceHolder();
            myPlaceHolder.ID = "PlaceHolder_AdvancedMode";

            #region Add Control Manager Windows
            // Create CodeBlock
            RadScriptBlock myCodeBlock = new RadScriptBlock();

            // Create Script Tag
            HtmlGenericControl myCodeBlock_ScriptTag = new HtmlGenericControl("Script");
            myCodeBlock_ScriptTag.Attributes.Add("type", "text/javascript");
            myCodeBlock_ScriptTag.InnerHtml = Nexus.Core.Phrases.PhraseMgr.Get_Phrase_Value("NexusCore_PageEditor_PoPWindow");
            myCodeBlock.Controls.Add(myCodeBlock_ScriptTag);

            // Create Window Manager
            RadWindowManager myWindowManager = new RadWindowManager();
            myWindowManager.ID = "RadWindowManager_ControlManager";

            // Create RadWindow
            RadWindow myRadWindow = new RadWindow();
            myRadWindow.ID                    = "RadWindow_ControlManager";
            myRadWindow.Title                 = "User Control Manager";
            myRadWindow.ReloadOnShow          = true;
            myRadWindow.ShowContentDuringLoad = false;
            myRadWindow.Modal                 = true;
            myRadWindow.Animation             = WindowAnimation.Fade;
            myRadWindow.AutoSize              = true;
            myRadWindow.Behaviors             = WindowBehaviors.Maximize | WindowBehaviors.Close;
            myRadWindow.InitialBehaviors      = WindowBehaviors.Resize | WindowBehaviors.Pin;
            //myRadWindow.DestroyOnClose = true;
            myRadWindow.KeepInScreenBounds = true;
            myRadWindow.VisibleStatusbar   = false;

            myWindowManager.Windows.Add(myRadWindow);

            // Create AjaxManager
            RadAjaxManager myRadAjaxManager = new RadAjaxManager();
            myRadAjaxManager.ID           = "RadAjaxManager_ControlManger";
            myRadAjaxManager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_AjaxRequest);

            // Add to Place Holder
            myPlaceHolder.Controls.Add(myCodeBlock);
            myPlaceHolder.Controls.Add(myWindowManager);
            myPlaceHolder.Controls.Add(myRadAjaxManager);

            #endregion

            #region Add Warp Controls and Dock Layout

            // Remove inline Controls
            HtmlGenericControl myContentDiv = (HtmlGenericControl)Page.Master.FindControl("pageWrapContainer");
            Page.Master.Controls.Remove(myContentDiv);

            // Create Hidden Update_Panel
            UpdatePanel myUpdatePanel_Docks = new UpdatePanel();
            myUpdatePanel_Docks.ID = "UpdatePanel_Docks";

            // Create myRadAjaxManager Postback Trigger
            PostBackTrigger RadAjaxTrigger = new PostBackTrigger();
            RadAjaxTrigger.ControlID = myRadAjaxManager.ID;
            myUpdatePanel_Docks.Triggers.Add(RadAjaxTrigger);

            // Add inLine Controls back
            myPlaceHolder.Controls.Add(myUpdatePanel_Docks);

            //myUpdatePanel_DockLayout.ContentTemplateContainer.Controls.Add(myDockLayout);

            myPlaceHolder.Controls.Add(myContentDiv);
            myForm.Controls.Add(myPlaceHolder);

            #endregion

            // Load MasterPage Control
            myMasterPageMgr.Load_MasterPageControls_Advanced(this.Page, myPage_Loading_Info);
        }
コード例 #32
0
        protected override void OnInit(EventArgs e)
        {
            if (Request.Path.StartsWith((ResolveUrl(AquariumExtenderBase.DefaultServicePath) + "/"), StringComparison.CurrentCultureIgnoreCase))
            {
                ApplicationServices.HandleServiceRequest(Context);
            }
            if (Request.Params["_page"] == "_blank")
            {
                return;
            }
            string link = Request.Params["_link"];

            if (!(String.IsNullOrEmpty(link)))
            {
                StringEncryptor enc       = new StringEncryptor();
                string[]        permalink = enc.Decrypt(link.Split(',')[0]).Split('?');
                Page.ClientScript.RegisterStartupScript(GetType(), "Redirect", String.Format("window.location.replace(\'0?_link=1\');", permalink[0], HttpUtility.UrlEncode(link)), true);
                return;
            }
            else
            {
                string requestUrl = Request.RawUrl;
                if ((requestUrl.Length > 1) && requestUrl.EndsWith("/"))
                {
                    requestUrl = requestUrl.Substring(0, (requestUrl.Length - 1));
                }
                if (Request.ApplicationPath.Equals(requestUrl, StringComparison.CurrentCultureIgnoreCase))
                {
                    string homePageUrl = ApplicationServices.HomePageUrl;
                    if (!(Request.ApplicationPath.Equals(homePageUrl)))
                    {
                        Response.Redirect(homePageUrl);
                    }
                }
            }
            SortedDictionary <string, string> contentInfo = ApplicationServices.LoadContent();

            InitializeSiteMaster();
            string s = null;

            if (!(contentInfo.TryGetValue("PageTitle", out s)))
            {
                s = ApplicationServices.Current.Name;
            }
            this.Title = s;
            if (_pageTitleContent != null)
            {
                if (_isTouchUI)
                {
                    _pageTitleContent.Text = String.Empty;
                }
                else
                {
                    _pageTitleContent.Text = s;
                }
            }
            HtmlMeta appName = new HtmlMeta();

            appName.Name    = "application-name";
            appName.Content = ApplicationServices.Current.Name;
            Header.Controls.Add(appName);
            if (contentInfo.TryGetValue("Head", out s) && (_headContent != null))
            {
                _headContent.Text = s;
            }
            if (contentInfo.TryGetValue("PageContent", out s) && (_pageContent != null))
            {
                if (_isTouchUI)
                {
                    s = String.Format("<div id=\"PageContent\" style=\"display:none\">{0}</div>", s);
                }
                Match userControl = Regex.Match(s, "<div\\s+data-user-control\\s*=s*\"([\\s\\S]+?)\"\\s*>\\s*</div>");
                if (userControl.Success)
                {
                    int startPos = 0;
                    while (userControl.Success)
                    {
                        _pageContent.Controls.Add(new LiteralControl(s.Substring(startPos, (userControl.Index - startPos))));
                        startPos = (userControl.Index + userControl.Length);
                        string controlFileName  = userControl.Groups[1].Value;
                        string controlExtension = Path.GetExtension(controlFileName);
                        string siteControlText  = null;
                        if (!(controlFileName.StartsWith("~")))
                        {
                            controlFileName = (controlFileName + "~");
                        }
                        if (String.IsNullOrEmpty(controlExtension))
                        {
                            string testFileName = (controlFileName + ".ascx");
                            if (File.Exists(Server.MapPath(testFileName)))
                            {
                                controlFileName  = testFileName;
                                controlExtension = ".ascx";
                            }
                            else
                            {
                                if (ApplicationServices.IsSiteContentEnabled)
                                {
                                    string relativeControlPath = controlFileName.Substring(1);
                                    if (relativeControlPath.StartsWith("/"))
                                    {
                                        relativeControlPath = relativeControlPath.Substring(1);
                                    }
                                    siteControlText = ApplicationServices.Current.ReadSiteContentString(("sys/" + relativeControlPath));
                                }
                                if (siteControlText == null)
                                {
                                    testFileName = (controlFileName + ".html");
                                    if (File.Exists(Server.MapPath(testFileName)))
                                    {
                                        controlFileName  = testFileName;
                                        controlExtension = ".html";
                                    }
                                }
                            }
                        }
                        try
                        {
                            if (controlExtension == ".ascx")
                            {
                                _pageContent.Controls.Add(LoadControl(controlFileName));
                            }
                            else
                            {
                                string controlText = siteControlText;
                                if (controlText == null)
                                {
                                    controlText = File.ReadAllText(Server.MapPath(controlFileName));
                                }
                                Match bodyMatch = Regex.Match(controlText, "<body[\\s\\S]*?>([\\s\\S]+?)</body>");
                                if (bodyMatch.Success)
                                {
                                    controlText = bodyMatch.Groups[1].Value;
                                }
                                controlText = Localizer.Replace("Controls", Path.GetFileName(Server.MapPath(controlFileName)), controlText);
                                _pageContent.Controls.Add(new LiteralControl(controlText));
                            }
                        }
                        catch (Exception ex)
                        {
                            _pageContent.Controls.Add(new LiteralControl(String.Format("Error loading \'{0}\': {1}", controlFileName, ex.Message)));
                        }
                        userControl = userControl.NextMatch();
                    }
                    if (startPos < s.Length)
                    {
                        _pageContent.Controls.Add(new LiteralControl(s.Substring(startPos)));
                    }
                }
                else
                {
                    _pageContent.Text = s;
                }
            }
            else
            if (_isTouchUI)
            {
                _pageContent.Text = "<div id=\"PageContent\" style=\"display:none\"><div data-app-role=\"page\">404 Not Foun" +
                                    "d</div></div>";
                this.Title = "Police-Training";
            }
            else
            {
                _pageContent.Text = "404 Not Found";
            }
            if (_isTouchUI)
            {
                if (_pageFooterContent != null)
                {
                    _pageFooterContent.Text = "<footer style=\"display:none\"><small>\t\r\n2017 &copy;<b> Beaver Borough Police Depar" +
                                              "tment</b> All rights reserved.</small></footer>";
                }
            }
            else
            if (contentInfo.TryGetValue("About", out s))
            {
                if (_pageSideBarContent != null)
                {
                    _pageSideBarContent.Text = String.Format("<div class=\"TaskBox About\"><div class=\"Inner\"><div class=\"Header\">About</div><div" +
                                                             " class=\"Value\">{0}</div></div></div>", s);
                }
            }
            string bodyAttributes = null;

            if (contentInfo.TryGetValue("BodyAttributes", out bodyAttributes))
            {
                _bodyAttributes.Parse(bodyAttributes);
            }
            if (!(_isTouchUI))
            {
                string classAttr = _bodyAttributes["class"];
                if (String.IsNullOrEmpty(classAttr))
                {
                    classAttr = String.Empty;
                }
                if (!(classAttr.Contains("Wide")))
                {
                    classAttr = (classAttr + " Standard");
                }
                classAttr = ((classAttr + " ")
                             + (Regex.Replace(Request.Path.ToLower(), "\\W", "_").Substring(1) + "_html"));
                _bodyAttributes["class"] = classAttr.Trim();
            }
            _bodyTag.Text = String.Format("\r\n<body{0}>\r\n", _bodyAttributes.ToString());
            base.OnInit(e);
        }
コード例 #33
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Exibe o título no navegador
            Page.Title = __SessionWEB.TituloGeral;

            #region Adiciona links de favicon

            HtmlLink link = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon.ico");
            link.Attributes["rel"]   = "shortcut icon";
            link.Attributes["sizes"] = "";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-57x57.png");
            link.Attributes["rel"]   = "apple-touch-icon";
            link.Attributes["sizes"] = "57x57";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-114x114.png");
            link.Attributes["rel"]   = "apple-touch-icon";
            link.Attributes["sizes"] = "114x114";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-72x72.png");
            link.Attributes["rel"]   = "apple-touch-icon";
            link.Attributes["sizes"] = "72x72";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-144x144.png");
            link.Attributes["rel"]   = "apple-touch-icon";
            link.Attributes["sizes"] = "144x144";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-60x60.png");
            link.Attributes["rel"]   = "apple-touch-icon";
            link.Attributes["sizes"] = "60x60";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-120x120.png");
            link.Attributes["rel"]   = "apple-touch-icon";
            link.Attributes["sizes"] = "120x120";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-76x76.png");
            link.Attributes["rel"]   = "apple-touch-icon";
            link.Attributes["sizes"] = "76x76";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-152x152.png");
            link.Attributes["rel"]   = "apple-touch-icon";
            link.Attributes["sizes"] = "152x152";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-196x196.png");
            link.Attributes["rel"]   = "icon";
            link.Attributes["sizes"] = "196x196";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-160x160.png");
            link.Attributes["rel"]   = "icon";
            link.Attributes["sizes"] = "160x160";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-96x96.png");
            link.Attributes["rel"]   = "icon";
            link.Attributes["sizes"] = "96x96";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-16x16.png");
            link.Attributes["rel"]   = "icon";
            link.Attributes["sizes"] = "16x16";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-32x32.png");
            link.Attributes["rel"]   = "icon";
            link.Attributes["sizes"] = "32x32";
            Page.Header.Controls.Add(link);

            link      = new HtmlLink();
            link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-32x32.png");
            link.Attributes["rel"]   = "icon";
            link.Attributes["sizes"] = "32x32";
            Page.Header.Controls.Add(link);

            HtmlMeta meta = new HtmlMeta();
            meta.Name    = "msapplication-TileImage";
            meta.Content = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/mstile-144x144.png");
            Page.Header.Controls.Add(meta);

            meta         = new HtmlMeta();
            meta.Name    = "msapplication-config";
            meta.Content = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/browserconfig.xml");
            Page.Header.Controls.Add(meta);

            #endregion Adiciona links de favicon


            if (ACA_ParametroAcademicoBO.ParametroValorBooleanoPorEntidade(eChaveAcademico.EXIBIR_LISTA_SISTEMAS_AREA_ALUNO, __SessionWEB.__UsuarioWEB.Usuario.ent_id) &&
                !ApplicationWEB.LoginProprioDoSistema)
            {
                //Carrega logo geral do sistema
                imgGeral.ImageUrl        = UtilBO.UrlImagemGestao(__SessionWEB.UrlCoreSSO, __SessionWEB.UrlLogoGeral);
                imgGeral.ToolTip         = __SessionWEB.TituloGeral;
                imgGeral.AlternateText   = __SessionWEB.TituloGeral;
                ImgLogoGeral.ToolTip     = __SessionWEB.TituloGeral;
                ImgLogoGeral.NavigateUrl = __SessionWEB.UrlCoreSSO + "/Sistema.aspx";
            }
            else
            {
                h1Logo.Visible = ImgLogoGeral.Visible = false;
                if (UCSistemas1 != null)
                {
                    UCSistemas1.Visible = false;
                }
            }

            //Atribui o caminho do logo do sistema atual, caso ele exista no Sistema Administrativo
            if (string.IsNullOrEmpty(__SessionWEB.UrlLogoSistema))
            {
                ImgLogoSistemaAtual.Visible = false;
            }
            else
            {
                //Carrega logo do sistema atual
                imgSistemaAtual.ImageUrl        = UtilBO.UrlImagemGestao(__SessionWEB.UrlCoreSSO, __SessionWEB.UrlLogoSistema);
                imgSistemaAtual.AlternateText   = __SessionWEB.TituloSistema;
                imgSistemaAtual.ToolTip         = __SessionWEB.TituloSistema;
                ImgLogoSistemaAtual.ToolTip     = __SessionWEB.TituloSistema;
                ImgLogoSistemaAtual.NavigateUrl = "~/Index.aspx";
            }

            try
            {
                // Busca dados do aluno

                Int64 alu_id = 0;
                if (__SessionWEB.__UsuarioWEB.responsavel && __SessionWEB.__UsuarioWEB.alu_id > 0)
                {
                    alu_id = __SessionWEB.__UsuarioWEB.alu_id;
                }
                else if (__SessionWEB.__UsuarioWEB.responsavel)
                {
                    alu_id = ACA_AlunoBO.SelectAlunoby_pes_id(__SessionWEB.__UsuarioWEB.pes_idAluno);
                }
                else
                {
                    alu_id = ACA_AlunoBO.SelectAlunoby_pes_id(__SessionWEB.__UsuarioWEB.Usuario.pes_id);
                }

                bool boletimBloqueado           = false;
                bool compromissoEstudoBloqueado = false;
                if (alu_id > 0)
                {
                    compromissoEstudoBloqueado = !ACA_TipoCicloBO.VerificaSeExibeCompromissoAluno(alu_id);
                    DataTable dtCurriculo = ACA_AlunoCurriculoBO.SelecionaDadosUltimaMatricula(alu_id);
                    if (dtCurriculo.Rows.Count > 0)
                    {
                        string nomeAluno = dtCurriculo.Rows[0]["pes_nome"].ToString();
                        string parametroMatriculaEstadual = ACA_ParametroAcademicoBO.ParametroValorPorEntidade(eChaveAcademico.MATRICULA_ESTADUAL, __SessionWEB.__UsuarioWEB.Usuario.ent_id);
                        string matriculaEstadual          = dtCurriculo.Rows[0]["alc_matriculaEstadual"].ToString();
                        string numeroMatricula            = dtCurriculo.Rows[0]["alc_matricula"].ToString();

                        litNomeAluno.Text    = __SessionWEB.__UsuarioWEB.responsavel ? (string)GetGlobalResourceObject("AreaAluno.MasterPageAluno", "litNomeAluno.Text.Responsavel") : (string)GetGlobalResourceObject("AreaAluno.MasterPageAluno", "litNomeAluno.Text.Aluno");
                        lblNomeAluno.Text    = nomeAluno;
                        lblMatricula.Text    = string.IsNullOrEmpty(parametroMatriculaEstadual) ? numeroMatricula : matriculaEstadual;
                        lblNroMatricula.Text = string.IsNullOrEmpty(parametroMatriculaEstadual)
                            ? GetGlobalResourceObject("AreaAluno", "MasterPageAluno.lblNroMatricula.Text").ToString()
                            : parametroMatriculaEstadual + ":";
                    }

                    ACA_Aluno entityAluno = ACA_AlunoBO.GetEntity(new ACA_Aluno {
                        alu_id = alu_id
                    });
                    if (entityAluno.alu_possuiInformacaoSigilosa && entityAluno.alu_bloqueioBoletimOnline)
                    {
                        boletimBloqueado = true;
                    }
                }

                if (__SessionWEB.__UsuarioWEB.responsavel && boletimBloqueado)
                {
                    Response.Redirect("~/Index.aspx", false);
                    HttpContext.Current.ApplicationInstance.CompleteRequest();
                }

                // Se ja tiver logado mostra o linkbutton pra selecionar o aluno, senão esconde
                if (Session["Pes_Id_Responsavel"] != null)
                {
                    if (Convert.ToInt32(Session["Qtde_Filhos_Responsavel"]) > 1)
                    {
                        lbSelecaoAlunos.Visible = true;
                    }
                    else
                    {
                        lbSelecaoAlunos.Visible = false;
                    }
                    imgLogoAreaAluno.Visible = false;
                    imgLogoAreaResp.Visible  = true;
                }
                else
                {
                    lbSelecaoAlunos.Visible  = false;
                    imgLogoAreaAluno.Visible = true;
                    imgLogoAreaResp.Visible  = false;
                }

                // Busca dados do menu

                int mod_id = GetModuloId;

                string menuXml = SYS_ModuloBO.CarregarSiteMapXML2(
                    __SessionWEB.__UsuarioWEB.Grupo.gru_id,
                    __SessionWEB.__UsuarioWEB.Grupo.sis_id,
                    __SessionWEB.__UsuarioWEB.Grupo.vis_id,
                    mod_id
                    );

                if (String.IsNullOrEmpty(menuXml))
                {
                    menuXml = "<menus/>";
                }
                menuXml = menuXml.Replace("url=\"~/", String.Concat("url=\"", ApplicationWEB._DiretorioVirtual));

                // Verifica se o aluno está com o boletim bloqueado. Se estiver, retiro do menu.
                int indiceBoletim = menuXml.IndexOf("<menu id=\"Boletim");
                if (boletimBloqueado && indiceBoletim >= 0)
                {
                    menuXml = menuXml.Remove(indiceBoletim, menuXml.IndexOf("/>", indiceBoletim) - indiceBoletim + 2);
                }

                IDictionary <string, ICFG_Configuracao> configuracao;
                MSTech.GestaoEscolar.BLL.CFG_ConfiguracaoBO.Consultar(eConfig.Academico, out configuracao);
                if (configuracao.ContainsKey("AppURLAreaAlunoInfantil") && !string.IsNullOrEmpty(configuracao["AppURLAreaAlunoInfantil"].cfg_valor))
                {
                    string url            = HttpContext.Current.Request.Url.AbsoluteUri;
                    string configInfantil = configuracao["AppURLAreaAlunoInfantil"].cfg_valor;

                    if (url.Contains(configInfantil))
                    {
                        menuXml = menuXml.Replace("menu id=\"Boletim Online\"", "menu id=\"" + (string)GetGlobalResourceObject("AreaAluno.MasterPageAluno", "MenuBoletimInfantil") + "\"");
                    }
                }

                // Verifica se o aluno está com o compromisso estudo bloqueado. Se estiver, retiro do menu.
                int indiceCompromissoEstudo = menuXml.IndexOf("<menu id=\"Compromisso de Estudo");
                if (compromissoEstudoBloqueado && indiceCompromissoEstudo >= 0)
                {
                    menuXml = menuXml.Remove(indiceCompromissoEstudo, menuXml.IndexOf("/>", indiceCompromissoEstudo) - indiceCompromissoEstudo + 2);
                }

                XmlTextReader        reader  = new XmlTextReader(new StringReader(menuXml));
                XPathDocument        treeDoc = new XPathDocument(reader);
                XslCompiledTransform siteMap = new XslCompiledTransform();

                if (__SessionWEB.__UsuarioWEB.responsavel)
                {
                    siteMap.Load(String.Concat(__SessionWEB._AreaAtual._DiretorioIncludes, "SiteMapPagesResponsavel.xslt"));
                }
                else
                {
                    siteMap.Load(String.Concat(__SessionWEB._AreaAtual._DiretorioIncludes, "SiteMapPages.xslt"));
                }

                string page = Page.Request.Url.ToString();

                StringWriter sw = new StringWriter();
                siteMap.Transform(treeDoc, null, sw);

                string result = sw.ToString();


                //Carrega a lista de link e moduloId
                Dictionary <string, string> linkModulo = new Dictionary <string, string>();
                string[] linkMenusXml = menuXml.Split(new[] { "<menu id=\"" }, StringSplitOptions.None);
                if (linkMenusXml.Length > 0)
                {
                    bool primeiroItem = true;
                    foreach (string item in linkMenusXml)
                    {
                        if (!primeiroItem)
                        {
                            string link2  = item.Substring(item.IndexOf("url=\"") + 5, item.Substring(item.IndexOf("url=\"") + 5).IndexOf("\""));
                            string modulo = item.Substring(0, item.IndexOf("\""));
                            linkModulo.Add(link2, modulo);
                        }
                        primeiroItem = false;
                    }
                }

                //Carrega a lista de link e classe css atual
                Dictionary <string, string> linkClasse = new Dictionary <string, string>();
                string[] linkMenus = result.Split(new[] { "<li class=\"txtSubMenu\"><a " }, StringSplitOptions.None);
                if (linkMenus.Length > 0)
                {
                    bool primeiroItem = true;
                    foreach (string item in linkMenus)
                    {
                        if (!primeiroItem)
                        {
                            string link2  = item.Substring(item.IndexOf("href=\"") + 6, item.Substring(item.IndexOf("href=\"") + 6).IndexOf("\""));
                            string classe = item.Substring(item.IndexOf("class=\"") + 7, item.Substring(item.IndexOf("class=\"") + 7).IndexOf("\""));
                            linkClasse.Add(link2, "class=\"" + classe + "\" " + "href=\"" + link2);
                        }
                        primeiroItem = false;
                    }
                }

                //Troca a classe css atual do link conforme o que está configurado na tabela filtrando pelo modulo
                List <CFG_ModuloClasse> lstModClasse = new List <CFG_ModuloClasse>();
                if (linkModulo.Count > 0 && linkClasse.Count > 0)
                {
                    lstModClasse = CFG_ModuloClasseBO.SelecionaAtivos(ApplicationWEB.AreaAlunoSistemaID);
                    foreach (var item in linkClasse)
                    {
                        string modulo = linkModulo[item.Key];
                        if (!string.IsNullOrEmpty(modulo) && lstModClasse.Any(p => p.mod_nome == modulo))
                        {
                            string classeCfg = lstModClasse.Where(p => p.mod_nome == modulo).FirstOrDefault().mdc_classe;
                            if (!string.IsNullOrEmpty(classeCfg))
                            {
                                result = result.Replace(item.Value, "class=\"link " + classeCfg + "\" " + "href=\"" + item.Key);
                            }
                        }
                    }
                }


                int indexPagina = result.IndexOf(Page.Request.Url.ToString()) > 0 ? result.IndexOf(Page.Request.Url.ToString()) : result.IndexOf(Page.Request.UrlReferrer.ToString());
                int indexClasse = 0;
                if (indexPagina > 0)
                {
                    indexClasse = result.IndexOf("txtSubMenu", (indexPagina - 60), result.Length - indexPagina);
                }

                string resultClasse = result.Substring(indexClasse);

                // Busca menu que está sendo chamado, para adicionar a classe ativo para a aba selecionada
                if (indexClasse > 0)
                {
                    result = result.Replace(resultClasse, "ativo " + resultClasse);
                }

                Control ctrl = Page.ParseControl(result);
                menuAreaAlunoComponentes.Controls.Add(ctrl);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
            }
        }
コード例 #34
0
ファイル: ModelDetails.aspx.cs プロジェクト: vizualz/BH3
/*
 */
        private void BindData()
        {
            string strSQL;
            string myConnectString;
            string strCat;

            string itemType = "";
            int    picCount = 0;

            //get connect string
            myConnectString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            //query item and user details for entry
            strSQL = @"SELECT u.iD, u.txtWebSite, u.txtFirstName, u.txtEmail, u.txtBrandName, u.txtPhonenum, u.userDir, u.iShowPhoneNum, u.notify_comment_flg, tblEntry.* 
                     FROM tblUser u 
                     INNER JOIN tblEntry ON u.Id = tblEntry.iUser 
                     WHERE tblEntry.iD = '" + hdnEId.Value + "'";

            SqlConnection myConnection = new SqlConnection(myConnectString);
            SqlCommand    objCommand   = new SqlCommand(strSQL, myConnection);
            SqlDataReader SQLReader    = null;

            try
            {
                myConnection.Open();
                SQLReader = objCommand.ExecuteReader();

                while (SQLReader.Read())
                {
                    //Date
                    lblDateData.Text = String.Format("{0:MM/dd}", SQLReader["dCreateDate"]);

                    //model
                    lblModelData.Text = SQLReader["txtModel"].ToString();

                    //link to parent
                    HypNavPrim.Text       = "ShaperHouse";
                    HypNavSec.Text        = SQLReader["txtBrandName"].ToString();
                    HypNavSec.NavigateUrl = "SurfboardShaper.aspx?q=" + SQLReader["iUser"].ToString();

                    //Price
                    if (SQLReader["fltPrice"] == DBNull.Value)
                    {
                        lblPriceData.Text = SQLReader["txtPrice"].ToString();
                    }
                    else
                    {
                        lblPriceData.Text = Global.FormatPrice(SQLReader["fltPrice"]);
                    }

                    //Details
                    lblDetailsData.Text = SQLReader["txtDetails"].ToString();

                    //Contact
                    Session["Email"] = SQLReader["txtEmail"].ToString();
                    //lnkEmailData.Text = ParseEmail(SQLReader["txtEmail"].ToString());
                    lnkEmailData.Text            = "Click to email";
                    lnkEmailData.CommandArgument = SQLReader["txtEmail"].ToString();

                    hdnBuyURL.Value = SQLReader["txtWebSite"].ToString();

                    string mailBodyTxt = System.Web.HttpUtility.UrlEncode(this.Page.Request.Url.ToString());
                    string subjAndMsg  = "?subject=About your Model&body=I'm interested in more: ";

                    lnkEmailData.Attributes.Add("href", "mailto:" + SQLReader["txtEmail"].ToString() + subjAndMsg + mailBodyTxt);
                    hdnNotifyEmail.Value = SQLReader["notify_comment_flg"].ToString();

                    lblPhoneData.Visible = ShowPhone(SQLReader["iShowPhoneNum"]);
                    if (lblPhoneData.Visible == true)
                    {
                        lblPhoneData.Text = Global.FormatPhone(SQLReader["txtPhoneNum"].ToString());
                    }

                    if (SQLReader["iStatus"].ToString() == "3")
                    {
                        lblStatus.Text      = "This item has been sold";
                        lblStatus.ForeColor = Color.Red;
                        lblStatus.BackColor = Color.White;
                    }
                    //user
                    hdnUserId.Value = SQLReader["iUser"].ToString();

                    //Category
                    strCat          = SQLReader["iCategory"].ToString();
                    hdniCat.Value   = strCat;
                    hdnStrCat.Value = Global.DecodeCategory(Convert.ToInt32(strCat));

                    //Ad type - Selling:1 , Wanted:2, 3:Showcase, 4:ShaperHouse
                    itemType = SQLReader["adType"].ToString();

                    //Video
                    if (SQLReader["EntryVideoEmbed"] != null)
                    {
                        if (SQLReader["EntryVideoEmbed"].ToString().Length > 0)
                        {
                            pnlVideo.Visible = true;
                            lblVideo.Text    = Server.HtmlDecode(SQLReader["EntryVideoEmbed"].ToString());
                        }
                    }

                    string ipv = incPageViewCount(SQLReader["iPageViewCount"].ToString());
                    lblViews.Text = "&nbsp;" + ipv + "&nbsp;View" + ((Convert.ToInt32(ipv) == 1) ? string.Empty : "s") + "&nbsp;";

                    string ratCnt = SQLReader["iRatingCount"].ToString();

                    if (ratCnt == string.Empty)
                    {
                        ratCnt = "0";
                    }

                    hdnRatingCnt.Value = ratCnt;

                    if (ratCnt == "1")
                    {
                        ratCnt += " Rating";
                    }
                    else
                    {
                        ratCnt += " Ratings";
                    }

                    //lblRatingCount.Text = ratCnt;

                    pnlShip.Visible = false;

                    //Set Rating if adtype is selling
                    if (itemType == "1")
                    {
                        pnlShip.Visible = true;
                        if (SQLReader["iShip"].ToString() == "1")
                        {
                            lblShip.Text = "Yes";
                        }

                        if (SQLReader["iRatingVal"].ToString() == null || SQLReader["iRatingVal"].ToString() == "")
                        {
                            //blnNullFlag = true;
                            hdnRatingVal.Value = "0";
                        }
                        else
                        {
                            int iratingVal = Convert.ToInt32(SQLReader["iRatingVal"].ToString());
                            int iratingCt  = Convert.ToInt32(SQLReader["iRatingCount"].ToString());

                            if (iratingCt > (int)0)
                            {
                                hdnRatingVal.Value = Convert.ToInt16(Math.Round(Convert.ToDouble(iratingVal / iratingCt))).ToString();
                            }
                            else
                            {
                                hdnRatingVal.Value = "0";
                            }
                        }
                    }

                    //Set category specific
                    switch (strCat)
                    {
                    case "1":     //surf

                        lblBoardTypeData.Text = Global.ProperSpace(DecodeBoard(Convert.ToInt32(SQLReader["iBoardType"]), (int)1));
                        lblBoardType.Text     = "Board type:&nbsp";
                        pnlGenDims.Visible    = true;
                        lblGenDims.Text       = SQLReader["txtGenDimensions"].ToString();
                        break;

                    case "2":     //snow

                        lblBoardTypeData.Text = Global.ProperSpace(DecodeBoard(Convert.ToInt32(SQLReader["iBoardType"]), (int)2));
                        lblBoardType.Text     = "Board type:&nbsp";

                        break;

                    case "3":     //other
                        lblBoardType.Text = "Board type:&nbsp";
                        if (SQLReader["iBoardType"].ToString() == "" || SQLReader["iBoardType"].ToString() == null)
                        {
                            lblBoardTypeData.Text = SQLReader["txtOtherBoardType"].ToString();
                        }
                        else
                        {
                            lblBoardTypeData.Text = DecodeBoard(Convert.ToInt32(SQLReader["iBoardType"]), (int)3);
                        }

                        break;

                    case "4":     //gear
                        break;
                    }

                    //selling or wanted ad type? selling=1; wanted=2
                    if (itemType == "2")
                    {
                        //just show wanted pic
                        Pic1.ImageUrl = System.Configuration.ConfigurationSettings.AppSettings["ServerURL"] + "/images/wantedbig.gif";

                        //hide ratings
                        pnlRatings.Visible = true;

                        //hide comments
                        pnlComments.Visible = true;
                    }
                    //for selling
                    else
                    {
                        //process images
                        //add up a pic count so we know wether to hide/show ratings panel
                        string strUserDir = Global.ReplaceEx(SQLReader["userDir"].ToString(), @"\", @"/");

                        Pic1.ImageUrl = GetPicPath(SQLReader["txtImgPath1"], strUserDir);
                        if ((Path.GetFileName(Pic1.ImageUrl)) == "s1x1.gif")
                        {
                            Pic1.Height = 1;
                            Pic1.Width  = 1;
                        }
                        else
                        {
                            picCount   += 1;
                            Pic1.Height = 400;
                            Pic1.Width  = 400;

                            Pic1ThmbNail.ImageUrl = GetPicPath("thmbNail_" + SQLReader["txtImgPath1"].ToString(), strUserDir);
                            Pic1ThmbNail.Width    = 75;
                            Pic1ThmbNail.Height   = 75;
                            Pic1ThmbNail.Visible  = true;
                            hdnPic1URL.Value      = GetPicPath(SQLReader["txtImgPath1"], strUserDir);
                        }

                        Pic2.ImageUrl = GetPicPath(SQLReader["txtImgPath2"], strUserDir);
                        if ((Path.GetFileName(Pic2.ImageUrl)) == "s1x1.gif")
                        {
                            Pic2.Height = 1;
                            Pic2.Width  = 1;
                        }
                        else
                        {
                            picCount   += 1;
                            Pic2.Height = 400;
                            Pic2.Width  = 400;

                            Pic2ThmbNail.ImageUrl = GetPicPath("thmbNail_" + SQLReader["txtImgPath2"].ToString(), strUserDir);
                            Pic2ThmbNail.Width    = 75;
                            Pic2ThmbNail.Height   = 75;
                            Pic2ThmbNail.Visible  = true;
                            hdnPic2URL.Value      = GetPicPath(SQLReader["txtImgPath2"], strUserDir);
                        }

                        Pic3.ImageUrl = GetPicPath(SQLReader["txtImgPath3"], strUserDir);
                        if ((Path.GetFileName(Pic3.ImageUrl)) == "s1x1.gif")
                        {
                            Pic3.Height = 1;
                            Pic3.Width  = 1;
                        }
                        else
                        {
                            picCount   += 1;
                            Pic3.Height = 400;
                            Pic3.Width  = 400;

                            Pic3ThmbNail.ImageUrl = GetPicPath("thmbNail_" + SQLReader["txtImgPath3"].ToString(), strUserDir);
                            Pic3ThmbNail.Width    = 75;
                            Pic3ThmbNail.Height   = 75;
                            Pic3ThmbNail.Visible  = true;
                            hdnPic3URL.Value      = GetPicPath(SQLReader["txtImgPath3"], strUserDir);
                        }

                        Pic4.ImageUrl = GetPicPath(SQLReader["txtImgPath4"], strUserDir);
                        if ((Path.GetFileName(Pic4.ImageUrl)) == "s1x1.gif")
                        {
                            Pic4.Height = 1;
                            Pic4.Width  = 1;
                        }
                        else
                        {
                            picCount   += 1;
                            Pic4.Height = 400;
                            Pic4.Width  = 400;

                            Pic4ThmbNail.ImageUrl = GetPicPath("thmbNail_" + SQLReader["txtImgPath4"].ToString(), strUserDir);
                            Pic4ThmbNail.Width    = 75;
                            Pic4ThmbNail.Height   = 75;
                            Pic4ThmbNail.Visible  = true;
                            hdnPic4URL.Value      = GetPicPath(SQLReader["txtImgPath4"], strUserDir);
                        }

                        //NO IMAGES were uploaded
                        if (picCount < 1)
                        {
                            pnlRatings.Visible  = false;
                            Pic1.ImageUrl       = System.Configuration.ConfigurationSettings.AppSettings["ServerURL"] + "/images/noimage.gif";
                            pnlComments.Visible = true;

                            //old
                            //Pic1.Width = 162;
                            //Pic1.Height = 209;

                            //new
                            Pic1.Width       = 400;
                            Pic1.Height      = 468;
                            pnlDetails.Width = 800;
                        }
                        else
                        {
                            string imgURLVal;
                            string voteVal = "voted_" + hdnEId.Value;

                            imgURLVal = string.Empty;

                            if (Session[voteVal] == null)
                            {
                                imgURLVal = "images/target_green.gif";
                            }
                            else //disallow voting
                            {
                                if (Session[voteVal].ToString() == "Y")
                                {
                                    imgURLVal = "images/target_orange.gif";
                                    //star1.Enabled = star2.Enabled = star3.Enabled = star4.Enabled = star5.Enabled = false;
                                }
                            }
                        }
                    }

                    lblFB.Text = "<fb:like href='" + Request.Url.ToString() + "' show_faces='false' colorscheme='dark' width='300'></fb:like>";

                    ////FB:OpenGraph meta tags
                    HtmlMeta mt = new HtmlMeta();
                    mt.Attributes.Add("property", "og:title");
                    mt.Attributes.Add("content", SQLReader["txtBrandName"].ToString() + "|" + SQLReader["txtModel"].ToString());

                    HtmlMeta mt1 = new HtmlMeta();
                    mt1.Attributes.Add("property", "og:description");
                    mt1.Attributes.Add("content", Global.FormatDetails(SQLReader["txtDetails"].ToString(), 100));

                    HtmlMeta mt2 = new HtmlMeta();
                    mt2.Attributes.Add("property", "og:type");
                    mt2.Attributes.Add("content", "company");

                    HtmlMeta mt3 = new HtmlMeta();
                    mt3.Attributes.Add("property", "og:url");
                    mt3.Attributes.Add("content", Request.Url.ToString());

                    HtmlMeta mt4 = new HtmlMeta();
                    mt4.Attributes.Add("property", "og:image");
                    mt4.Attributes.Add("content", Pic1ThmbNail.ImageUrl);

                    HtmlMeta mt5 = new HtmlMeta();
                    mt5.Attributes.Add("property", "og:email");
                    mt5.Attributes.Add("content", SQLReader["txtEmail"].ToString());

                    HtmlMeta mt6 = new HtmlMeta();
                    mt6.Attributes.Add("property", "og:phone_number");
                    mt6.Attributes.Add("content", SQLReader["txtPhonenum"].ToString());

                    this.Header.Controls.Add(mt);
                    this.Header.Controls.Add(mt1);
                    this.Header.Controls.Add(mt2);
                    this.Header.Controls.Add(mt3);
                    this.Header.Controls.Add(mt4);
                    this.Header.Controls.Add(mt5);
                    this.Header.Controls.Add(mt6);
                } //end while
            }     // end try

            catch (Exception ex)
            {
                lblStatus.Text      = "Error Loading Data";
                lblStatus.BackColor = Color.Pink;
                ErrorLog.ErrorRoutine(false, "Error->ItemDetails:BindData: " + ex.Message);
            }

            finally
            {
                myConnection.Close();
            }

            //ShaperHouse:Models only
            //lblRatingCount.Visible = false;
            lblDateData.Visible = false;
            imgAddFav.Visible   = false;

            BindComments();
        }
コード例 #35
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        StateProvincesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT StateProvinces.* " +
                                                               "FROM StateProvinces " +
                                                               "WHERE (StateProvinces.CountryID = @CountryID) AND EXISTS (" +
                                                               " SELECT * FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID" +
                                                               " WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1)" +
                                                               " AND (Cities.StateProvinceID = StateProvinces.ID) " +
                                                               " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) " +
                                                               "ORDER BY StateProvince", SqlDbType.Int);
        CitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);

        const string STR_SELECTPropertiesInfo = "SELECT Properties.Name, Properties.NumBedrooms, Properties.NumBaths, Properties.NumSleeps, Properties.NumTVs, Properties.NumVCRs, Properties.CityID, Properties.NumCDPlayers, Properties.ID, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Beach Front')) THEN 'Beach Front' ELSE '' END AS BeachFront, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Seaside')) THEN 'Seaside' ELSE '' END AS Seaside, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Lake Front')) THEN 'Lake Front' ELSE '' END AS LakeFront, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'River Front')) THEN 'River Front' ELSE '' END AS RiverFront, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Ski In Ski Out')) THEN 'Ski In Ski Out' ELSE '' END AS Ski, Cities.City, StateProvinces.StateProvince, Countries.Country, Regions.Region, MinimumNightlyRentalTypes.Name AS MinimumNightlyRental, PropertyTypes.Name AS Type FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID INNER JOIN StateProvinces ON StateProvinces.ID = Cities.StateProvinceID INNER JOIN Countries ON StateProvinces.CountryID = Countries.ID INNER JOIN Regions ON Countries.RegionID = Regions.ID INNER JOIN Users ON Properties.UserID = Users.ID LEFT OUTER JOIN MinimumNightlyRentalTypes ON Properties.MinimumNightlyRentalID = MinimumNightlyRentalTypes.ID LEFT OUTER JOIN PropertyTypes ON Properties.TypeID = PropertyTypes.ID WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND (Cities.StateProvinceID = @StateProvinceID) AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID) ORDER BY StateProvinces.StateProvince, Cities.City, Type, CASE WHEN EXISTS (SELECT * FROM Invoices WHERE (PropertyID = Properties.ID) AND (PaymentAmount >= InvoiceAmount) AND (GETDATE() <= Invoices.RenewalDate)) THEN 1 ELSE 0 END DESC, Properties.ID";

        PropertiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTPropertiesInfo), SqlDbType.Int);

        AmenitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT Amenities.ID, Amenity," +
                                                          " PropertiesAmenities.PropertyID " +
                                                          "FROM Amenities INNER JOIN PropertiesAmenities ON Amenities.ID = PropertiesAmenities.AmenityID" +
                                                          " INNER JOIN Properties ON PropertiesAmenities.PropertyID = Properties.ID " +
                                                          " INNER JOIN Cities ON Properties.CityID = Cities.ID " +
                                                          "WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND (Cities.StateProvinceID = @StateProvinceID)" +
                                                          " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID) AND (Amenities.Amenity NOT IN" +
                                                          " ('Lake Front', 'Beach Front', 'River Front', 'Seaside', 'Ski In Ski Out', 'TV', 'VCR', 'CD Player'))",
                                                          SqlDbType.Int);

        LocationAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT StateProvinces.ID AS StateProvinceID," +
                                                         " StateProvinces.StateProvince, Countries.ID AS CountryID, Countries.Country, Regions.ID AS RegionID," +
                                                         " Regions.Region, stateprovinces.titleoverride, stateprovinces.descriptionoverride " +
                                                         "FROM StateProvinces INNER JOIN Countries ON StateProvinces.CountryID = Countries.ID" +
                                                         " INNER JOIN Regions ON Countries.RegionID = Regions.ID WHERE (StateProvinces.ID = @StateProvinceID)",
                                                         SqlDbType.Int);


        if ((Request.Params["StateProvinceID"] != null) && (Request.Params["StateProvinceID"].Length > 0))
        {
            try
            {
                stateprovinceid = Convert.ToInt32(Request.Params["StateProvinceID"]);
            }
            catch (Exception)
            {
            }
        }
        // IF state is not found throw an error
        if (stateprovinceid == -1)
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx"));
        }

        CitiesAdapter.SelectCommand.Parameters["@StateProvinceID"].Value     = stateprovinceid;
        LocationAdapter.SelectCommand.Parameters["@StateProvinceID"].Value   = stateprovinceid;
        PropertiesAdapter.SelectCommand.Parameters["@StateProvinceID"].Value = stateprovinceid;
        AmenitiesAdapter.SelectCommand.Parameters["@StateProvinceID"].Value  = stateprovinceid;
        if (LocationAdapter.Fill(MainDataSet, "Location") > 0)
        {
            regionid      = (int)MainDataSet.Tables["Location"].Rows[0]["RegionID"];
            countryid     = (int)MainDataSet.Tables["Location"].Rows[0]["CountryID"];
            region        = (string)MainDataSet.Tables["Location"].Rows[0]["Region"];
            country       = (string)MainDataSet.Tables["Location"].Rows[0]["Country"];
            stateprovince = (string)MainDataSet.Tables["Location"].Rows[0]["StateProvince"];
        }
        else
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx"));
        }

        StateProvincesAdapter.SelectCommand.Parameters["@CountryID"].Value = countryid;
        CitiesAdapter.Fill(MainDataSet, "Cities");
        PropertiesAdapter.Fill(MainDataSet, "Properties");
        AmenitiesAdapter.Fill(MainDataSet, "Amenities");
        StateProvincesAdapter.Fill(MainDataSet, "StateProvinces");
        DBConnection objTemp = new DBConnection();
        DataTable    dtTemp  = new DataTable();

        try
        {
            dtTemp = VADBCommander.CountyNamesWithProperties(Request.Params["StateProvinceID"].ToString());
            DataTable dtCopy = dtTemp.Copy();
            dtCopy.TableName = "dtcopy";
            dtCopy.Namespace = "dtcopy";
            MainDataSet.Tables.Add(dtCopy);
            MainDataSet.Relations.Add("CitiesProperties", MainDataSet.Tables["Cities"].Columns["ID"],
                                      MainDataSet.Tables["Properties"].Columns["CityID"]);
            MainDataSet.Relations.Add("PropertiesAmenities", MainDataSet.Tables["Properties"].Columns["ID"],
                                      MainDataSet.Tables["Amenities"].Columns["PropertyID"]);

            MainDataSet.Relations.Add("CountyCities", MainDataSet.Tables["dtcopy"].Columns["ID"],
                                      MainDataSet.Tables["Cities"].Columns["countyID"]);
            LocationAdapterCountry.SelectCommand.Parameters["@CountryID"].Value = countryid;
        }
        catch (Exception ex) { lblInfo22.Text += ex.Message; }
        finally { objTemp.CloseConnection(); }

        foreach (DataRow datarow in MainDataSet.Tables["Cities"].Rows)
        {
            if (datarow["City"] is string)
            {
                cities += " " + (string)datarow["City"];
            }
        }

        HtmlHead head = Page.Header;



        DataBind();

        /////// common for postback and ! postback
        List <string> vList        = new List <string>();
        DataTable     dt           = new DataTable();
        DataFunctions obj          = new DataFunctions();
        DataTable     dtCategories = new DataTable();
        DBConnection  obj1         = new DBConnection();

        try
        {
            Page page = (Page)HttpContext.Current.Handler;
            if (!IsPostBack)
            {
                dt = obj.PropertiesByCase(vList, stateprovinceid, "State");
                DataView dv = dt.DefaultView;
                dv.Sort       = "category asc";
                dt            = dv.ToTable();
                Session["dt"] = dt;

                int[] i = new int[4];
                i = FindNumAmenities(dt);



                //create rdo items from categories table
                dtCategories = obj.FindNumCategories(dt);
                int    vCategoryCount = 0;
                string firstCategory  = "";
                string subCategory    = "";
                foreach (DataRow row in dtCategories.Rows)
                {
                    int index = dtCategories.Rows.IndexOf(row);
                    if (index == 0)
                    {
                        firstCategory = row["category"].ToString();
                        subCategory   = dt.Rows[0]["SubCategory"].ToString();
                    }
                    string vTemp = row["category"].ToString() + " (" + row["count"].ToString() + ")";
                    vTemp          = vTemp.Replace(" ", "&nbsp;");
                    vCategoryCount = vCategoryCount + Convert.ToInt32(row["count"].ToString());
                }
                if (!IsPostBack)
                {
                }        //numbedrooms filter
                dtCategories = obj.FindNumBedrooms(dt);

                int vBedCount = 0;
                foreach (DataRow row in dtCategories.Rows)
                {
                    vBedCount += Convert.ToInt32(row["count"]);
                }

                //Implement 404 logic less then 10 property with Prorerty in URL - Develop By Nimesh Sapovadiya
                if (Request.QueryString["category"] != null)
                {
                    Response.Clear();
                    Response.StatusCode = 404;
                    Response.End();
                }
                string dispString = "";
                if (firstCategory.Contains("_"))
                {
                    string[] strSplit = firstCategory.Split('_');
                    dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
                }
                else
                {
                    dispString = UppercaseFirst(firstCategory) + "s";
                }

                statestr           = char.ToUpper(stateprovince[0]) + stateprovince.Substring(1);
                altTag             = char.ToUpper(stateprovince[0]) + stateprovince.Substring(1) + " Vacation Rentals";
                ltrH1.Text         = char.ToUpper(stateprovince[0]) + stateprovince.Substring(1) + " Vacations";// Rentals";// And " +  dispString;
                ltrHeading.Text    = statestr + " Vacation Rentals and " + statestr + " Hotels";
                ltrStateThing.Text = char.ToUpper(stateprovince[0]) + stateprovince.Substring(1);

                hyplinkBackRegion.NavigateUrl = "/" + region.ToLower().ToLower().Replace(" ", "_") + "/" + "default.aspx";
                ltrRegion.Text = region + "<<";

                hyplnkBackLink.NavigateUrl = "/" + country.ToLower().ToLower().Replace(" ", "_") + "/" + "default.aspx";
                ltrBackText.Text           = country + "<<";
                string iframe = "<iframe height='260' width='95%' frameborder='0' src='/" + country.ToLower().ToLower().Replace(" ", "_") + "/" + stateprovince.ToLower().ToLower().Replace(" ", "_") + "/maps.aspx'></iframe>";
                googlemap.InnerHtml = iframe;
                page.Title          = char.ToUpper(stateprovince[0]) + stateprovince.Substring(1) + " Vacation Rentals, Boutique Hotels | Vacations Abroad";

                string tempcountry1 = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") + "/" + stateprovince.ToLower().Replace(" ", "_") +
                                      "/default.aspx";
            }

            string vText = "Vacations-abroad.com is a " + stateprovince + " accommodation directory of " + stateprovince + " rentals by owner and privately owned " + stateprovince + " holiday accommodation. Our short term " + stateprovince + " rentals include luxury " +
                           stateprovince + " holiday homes, " + stateprovince + " vacation homes and " + stateprovince + " vacation home rentals which are perfect for group or family vacation rentals in " + stateprovince + " " + country;

            //TOP DEFAULT TEXT
            if (!IsPostBack)
            {
                txtCityText.Text = vText;
            }
            lblcityInfo.Text = vText;

            //BOTTOM, NO DEFAULT TEXT
            dt = VADBCommander.CityTextByStateInd(stateprovinceid.ToString());

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["cityText"] != null)
                {
                    if (!IsPostBack)
                    {
                        lblcityInfo.Text = dt.Rows[0]["cityText"].ToString();
                        txtCityText.Text = Server.HtmlDecode(dt.Rows[0]["cityText"].ToString().Replace("<br />-ipx-", Environment.NewLine));
                    }
                }
                if (dt.Rows[0]["cityText2"] != null)
                {
                    if (!IsPostBack)
                    {
                        lblInfo2.Text = Server.HtmlDecode(dt.Rows[0]["cityText2"].ToString());

                        if (string.IsNullOrEmpty(dt.Rows[0]["cityText2"].ToString()) || dt.Rows[0]["cityText2"].ToString() == "")
                        {
                            OrangeTitle.Visible = false;
                        }
                        txtCityText2.Text = Server.HtmlDecode(dt.Rows[0]["cityText2"].ToString()).Replace("<br />", Environment.NewLine);
                    }
                }
                else
                {
                    OrangeTitle.Visible   = false;
                    ltrStateThing.Visible = false;
                }
            }
            else
            {
                OrangeTitle.Visible   = false;
                ltrStateThing.Visible = false;
            }

            if (String.IsNullOrEmpty(lblcityInfo.Text))
            {
                //IF EMPTY VALUES OR 'DELETES' FROM ADMIN FOR TOP

                txtCityText.Text = vText;
                lblcityInfo.Text = vText;
            }
            if (Request.QueryString["Category"] != null)
            {
                lblInfo2.Visible    = false;
                OrangeTitle.Visible = false;
                txtCityText.Visible = false;
            }
        }
        catch (Exception ex) { lblInfo.Text = ex.Message; }

        DBConnection  obj3   = new DBConnection();
        SqlDataReader reader = obj3.ExecuteRecordSetArtificial("SELECT Cities.* FROM Cities WHERE (Cities.StateProvinceID = " + stateprovinceid + ") " + "AND EXISTS ( SELECT * FROM Properties WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND " + "(Properties.CityID = Cities.ID)  AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) ORDER " + "BY City");

        foreach (DataRow dr in MainDataSet.Tables["StateProvinces"].Rows)
        {
            string temp = CommonFunctions.GetSiteAddress() + "/" + country +
                          "/" + dr["StateProvince"].ToString() + "/default.aspx";
            temp         = temp.ToLower();
            temp         = temp.Replace(' ', '_');
            rtLow3.Text += "<li><a href='" + temp + "'>" + dr["StateProvince"].ToString().Replace(" ", "&nbsp;") + ", </a></li>";
        }
        rtLow3.Text     = rtLow3.Text;
        rtHd3.InnerHtml = country + " Regions: ";

        //add counties to right column
        //add counties within state
        string query = "";

        dt = obj1.spGetRightSideCounties(stateprovinceid);
        if (dt.Rows.Count > 0)
        {
            rtCountiesHd.InnerHtml = stateprovince + " Counties";
            foreach (DataRow datarow in dt.Rows)
            {
                if (datarow["county"] is string)
                {
                    string temp = CommonFunctions.GetSiteAddress() + "/" + stateprovince + "/Holiday-Rentals/" +
                                  datarow["county"].ToString() + "-Vacation_Rentals/default.aspx";
                    temp              = temp.ToLower();
                    temp              = temp.Replace(' ', '_');
                    divCitiesRt.Text += "<li><a href='" + temp + "'>" + datarow["county"].ToString().Replace(" ", "&nbsp;") + "</a></li> ";
                }
            }
            divCitiesRt.Text = divCitiesRt.Text.Remove(divCitiesRt.Text.Length - 2, 2);
        }
        else
        {
        }

        //add counties within state
        DataTable dtCountries = obj1.spStateProvByCountries(countryid);

        foreach (DataRow row in dtCountries.Rows)
        {
            if (row["stateprovince"] is string)
            {
                string temp = CommonFunctions.GetSiteAddress() + "/" + country + "/" + row["stateprovince"].ToString() + "/default.aspx";
                temp = temp.ToLower();
                temp = temp.Replace(' ', '_');
            }
        }
        /////// common for postback and ! postback ////////
        string cities1   = "";
        string citiesNew = "";

        foreach (DataRow dr in MainDataSet.Tables["Cities"].Rows)
        {
            string temp = CommonFunctions.GetSiteAddress() + "/" + country +
                          "/" + stateprovince + "/" + dr["City"].ToString() + "/default.aspx";
            temp     = temp.ToLower();
            temp     = temp.Replace(' ', '_');
            cities1 += "<a href='" + temp + "'><span class=\"tdNoSleeps\" style=\"font-weight:normal;font-style:normal\">" + dr["City"].ToString().Replace(" ", "&nbsp;") + "</span></a>, ";
        }

        string str_cities = "";
        int    ind        = 0;
        // string cls = " class='borderright' ";
        string cls = "border-right:1px solid #0094ff;";
        string li  = "";

        foreach (DataRow dr in MainDataSet.Tables["Cities"].Rows)
        {
            string temp = "/" + country +
                          "/" + stateprovince + "/" + dr["City"].ToString() + "/default.aspx";
            temp = temp.ToLower();
            temp = temp.Replace(' ', '_');

            DataTable dt1 = new DataTable();
            dt1 = obj.PropertiesByCase(vList, Convert.ToInt32(dr["id"]), "City");

            // li = " style='" + ((ind > 4) ? "border-top:0px;" : "") + (((ind++ % 5) == 4) ? cls : "") + "'";

            citiesNew += "<li" + li + ">" +
                         "<a href='" + temp + "' class='StateTitle'>" + dr["City"].ToString() + "</a> <br/>" +
                         "<a href='" + temp + "'>" +
                         "<div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt1.Rows[0]["PhotoImage"]) + "' alt='" + dr["City"].ToString() + " Vacation Rentals and Boutique Hotels in " + stateprovince + "' title='" + dr["City"].ToString() + " Vacation Rentals and Boutique Hotels in " + stateprovince + "' /></a></div>" +
                         "</li>";
            str_cities += dr["City"].ToString() + ", ";
        }

        str_cities = str_cities.Substring(0, str_cities.Length - 2);

        ulManiGrid.InnerHtml = citiesNew;

        string tempcountry2 = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") + "/" + stateprovince.ToLower().Replace(" ", "_") +
                              "/default.aspx";

        string tempstate = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") +
                           "/" + stateprovince.ToLower().Replace(" ", "_") + "/default.aspx";
        string tempcountry3 = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") +
                              "/default.aspx";
        string tempregion = CommonFunctions.GetSiteAddress() + "/" + region.ToLower().Replace(" ", "_") +
                            "/default.aspx";

        Session["tempstate"]   = stateprovince;
        Session["tempcountry"] = country;

        //FillCitiesColumn();

        /* HtmlMeta description = new HtmlMeta();
         *
         * description.Name = "description";
         * description.Content = Description.Text.Replace("%country%", country).Replace("%stateprovince%", stateprovince).
         *   Replace("%cities%", cities);
         * // Description OVER RIDE area
         *
         * string DescripReplacement = MainDataSet.Tables["Location"].Rows[0]["descriptionoverride"].ToString();
         * if (DescripReplacement.Length > 0)
         *   description.Content = DescripReplacement;
         * description.Content = "Plan your next " + stateprovince + " vacation: where to stay and places to visit!";
         *
         * head.Controls.Add(description);*/

        Page page1 = (Page)HttpContext.Current.Handler;


        HtmlMeta newdescription = new HtmlMeta();

        int counts = AjaxProvider.getPropertyNumsbyState(stateprovinceid);

        string str_meta = "(%counts%) %state% vacation rentals and boutique hotels in %cities%.";

        newdescription.Name    = "description";
        newdescription.Content = str_meta.Replace("%state%", stateprovince).Replace("%cities%", str_cities).Replace("%counts%", counts.ToString());

        head.Controls.Add(newdescription);



        HtmlMeta keywords = new HtmlMeta();

        keywords.Name    = "keywords";
        keywords.Content = Keywords.Text.Replace("%country%", country).Replace("%stateprovince%", stateprovince).
                           Replace("%cities%", cities);
        keywords.Content = page1.Title;
        head.Controls.Add(keywords);
        // ((System.Web.UI.WebControls.Image)Master.FindControl("Logo")).AlternateText = page1.Title;
        // Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheetBig4.css' rel='stylesheet' type='text/css'></script>"));
    }
コード例 #36
0
    public void SetOGTags()
    {
        //Set the OG tags if there is a lid
        Master.Page.Title = "FashionKred - Find your best outfit!";

        HtmlMeta title = new HtmlMeta();

        title.Attributes.Add("property", "og:title");
        if (look.products.Count == 3)
        {
            title.Content = look.products[0].name + ", " + look.products[1].name + " and " + look.products[2].name;
        }
        else
        {
            title.Content = look.products[0].name + " and " + look.products[1].name;
        }
        Master.FindControl("head").Controls.Add(title);

        HtmlMeta url = new HtmlMeta();

        url.Attributes.Add("property", "og:url");
        url.Content = "http://fashionKred.com/look.aspx?lid=" + look.id;
        Master.FindControl("head").Controls.Add(url);

        HtmlMeta type = new HtmlMeta();

        type.Attributes.Add("property", "og:type");
        type.Content = "fashionkred:outfit";
        Master.FindControl("head").Controls.Add(type);

        HtmlMeta image = new HtmlMeta();

        image.Attributes.Add("property", "og:image");

        try
        {
            string imageFilePath = Path.Combine(Server.MapPath("images/looks"), look.id + ".jpg");

            if (look.products.Count >= 3)
            {
                if (!File.Exists(imageFilePath))
                {
                    WebHelper.CreateLookPanel(look, imageFilePath);
                    //WebHelper.MergeThreeImages(look.products[0].GetImageUrl(), look.products[1].GetNormalImageUrl(), look.products[2].GetNormalImageUrl(), imageFilePath);
                }

                image.Content = "http://fashionkred.com/images/looks/" + look.id + ".jpg";
                Master.FindControl("head").Controls.Add(image);
            }
            else
            {
                if (!File.Exists(imageFilePath))
                {
                    WebHelper.MergeTwoImages(look.products[0].GetImageUrl(), look.products[1].GetImageUrl(), imageFilePath);
                }

                image.Content = "http://fashionkred.com/images/looks/" + look.id + ".jpg";
                Master.FindControl("head").Controls.Add(image);
            }
        }
        catch
        {
            image.Content = look.products[0].GetImageUrl();
            Master.FindControl("head").Controls.Add(image);
        }



        HtmlMeta desc = new HtmlMeta();

        desc.Attributes.Add("property", "og:description");
        if (look.products.Count == 3)
        {
            desc.Content = "Outfit containing " + look.products[0].name + ", " + look.products[1].name + " and " + look.products[2].name;
        }
        else
        {
            desc.Content = "Outfit containing " + look.products[0].name + " and " + look.products[1].name;
        }
        Master.FindControl("head").Controls.Add(desc);

        HtmlMeta appId = new HtmlMeta();

        appId.Attributes.Add("property", "fb:app_id");
        appId.Content = ConfigurationManager.AppSettings["AppId"];
        Master.FindControl("head").Controls.Add(appId);
    }
コード例 #37
0
        public void LoadPageControls()
        {
            this.CurrentWebPage.Header.Controls.Add(new Literal {
                Text = "\r\n"
            });

            List <HtmlMeta> lstMD = GetHtmlMeta(this.CurrentWebPage.Header);

            HtmlMeta metaGenerator = new HtmlMeta();

            metaGenerator.Name    = "generator";
            metaGenerator.Content = SiteData.CarrotCakeCMSVersion;
            this.CurrentWebPage.Header.Controls.Add(metaGenerator);
            this.CurrentWebPage.Header.Controls.Add(new Literal {
                Text = "\r\n"
            });

            if (guidContentID == SiteData.CurrentSiteID && SiteData.IsPageReal)
            {
                IsPageTemplate = true;
            }

            if (theSite != null && pageContents != null)
            {
                if (theSite.BlockIndex || pageContents.BlockIndex)
                {
                    bool     bCrawlExist = false;
                    HtmlMeta metaNoCrawl = new HtmlMeta();
                    metaNoCrawl.Name = "robots";

                    if (lstMD.Where(x => x.Name == "robots").Count() > 0)
                    {
                        metaNoCrawl = lstMD.Where(x => x.Name == "robots").FirstOrDefault();
                        bCrawlExist = true;
                    }

                    metaNoCrawl.Content = "noindex,nofollow,noarchive";

                    if (!bCrawlExist)
                    {
                        this.CurrentWebPage.Header.Controls.Add(metaNoCrawl);
                        this.CurrentWebPage.Header.Controls.Add(new Literal {
                            Text = "\r\n"
                        });
                    }
                }
            }

            InsertSpecialCtrl(this.CurrentWebPage.Header, ControlLocation.Header);

            if (pageContents != null)
            {
                HtmlMeta metaDesc   = new HtmlMeta();
                HtmlMeta metaKey    = new HtmlMeta();
                bool     bDescExist = false;
                bool     bKeyExist  = false;

                if (lstMD.Where(x => x.Name == "description").Count() > 0)
                {
                    metaDesc   = lstMD.Where(x => x.Name == "description").FirstOrDefault();
                    bDescExist = true;
                }
                if (lstMD.Where(x => x.Name == "keywords").Count() > 0)
                {
                    metaKey   = lstMD.Where(x => x.Name == "keywords").FirstOrDefault();
                    bKeyExist = true;
                }

                metaDesc.Name    = "description";
                metaKey.Name     = "keywords";
                metaDesc.Content = String.IsNullOrEmpty(pageContents.MetaDescription) ? theSite.MetaDescription : pageContents.MetaDescription;
                metaKey.Content  = String.IsNullOrEmpty(pageContents.MetaKeyword) ? theSite.MetaKeyword : pageContents.MetaKeyword;

                int indexPos = 6;
                if (this.CurrentWebPage.Header.Controls.Count > indexPos)
                {
                    if (!String.IsNullOrEmpty(metaDesc.Content) && !bDescExist)
                    {
                        this.CurrentWebPage.Header.Controls.AddAt(indexPos, new Literal {
                            Text = "\r\n"
                        });
                        this.CurrentWebPage.Header.Controls.AddAt(indexPos, metaDesc);
                    }
                    if (!String.IsNullOrEmpty(metaKey.Content) && !bKeyExist)
                    {
                        this.CurrentWebPage.Header.Controls.AddAt(indexPos, new Literal {
                            Text = "\r\n"
                        });
                        this.CurrentWebPage.Header.Controls.AddAt(indexPos, metaKey);
                    }
                }
                else
                {
                    if (!String.IsNullOrEmpty(metaDesc.Content) && !bDescExist)
                    {
                        this.CurrentWebPage.Header.Controls.Add(metaDesc);
                        this.CurrentWebPage.Header.Controls.Add(new Literal {
                            Text = "\r\n"
                        });
                    }
                    if (!String.IsNullOrEmpty(metaKey.Content) && !bKeyExist)
                    {
                        this.CurrentWebPage.Header.Controls.Add(metaKey);
                        this.CurrentWebPage.Header.Controls.Add(new Literal {
                            Text = "\r\n"
                        });
                    }
                }

                metaDesc.Visible = !String.IsNullOrEmpty(metaDesc.Content);
                metaKey.Visible  = !String.IsNullOrEmpty(metaKey.Content);
            }

            contCenter = new ContentContainer();
            contLeft   = new ContentContainer();
            contRight  = new ContentContainer();

            if (pageContents != null)
            {
                using (ContentPageHelper pageHelper = new ContentPageHelper()) {
                    PageViewType pvt            = pageHelper.GetBlogHeadingFromURL(theSite, SiteData.CurrentScriptName);
                    string       sTitleAddendum = pvt.ExtraTitle;

                    if (!String.IsNullOrEmpty(sTitleAddendum))
                    {
                        if (!String.IsNullOrEmpty(pageContents.PageHead))
                        {
                            pageContents.PageHead = pageContents.PageHead.Trim() + ": " + sTitleAddendum;
                        }
                        else
                        {
                            pageContents.PageHead = sTitleAddendum;
                        }
                        pageContents.TitleBar = pageContents.TitleBar.Trim() + ": " + sTitleAddendum;
                    }

                    PagedDataSummary pd = (PagedDataSummary)cu.FindControl(typeof(PagedDataSummary), this.CurrentWebPage);

                    if (pd != null)
                    {
                        PagedDataSummaryTitleOption titleOpts = pd.TypeLabelPrefixes.Where(x => x.KeyValue == pvt.CurrentViewType).FirstOrDefault();

                        if (titleOpts == null &&
                            (pvt.CurrentViewType == PageViewType.ViewType.DateDayIndex ||
                             pvt.CurrentViewType == PageViewType.ViewType.DateMonthIndex ||
                             pvt.CurrentViewType == PageViewType.ViewType.DateYearIndex))
                        {
                            titleOpts = pd.TypeLabelPrefixes.Where(x => x.KeyValue == PageViewType.ViewType.DateIndex).FirstOrDefault();
                        }

                        if (titleOpts != null && !String.IsNullOrEmpty(titleOpts.FormatText))
                        {
                            pvt.ExtraTitle = string.Format(titleOpts.FormatText, pvt.RawValue);
                            sTitleAddendum = pvt.ExtraTitle;
                        }

                        if (titleOpts != null && !String.IsNullOrEmpty(titleOpts.LabelText))
                        {
                            pageContents.PageHead    = titleOpts.LabelText + " " + sTitleAddendum;
                            pageContents.NavMenuText = pageContents.PageHead;
                            pageContents.TitleBar    = pageContents.PageHead;
                        }
                    }
                }

                this.CurrentWebPage.Title = SetPageTitle(pageContents);

                DateTime dtModified = theSite.ConvertSiteTimeToLocalServer(pageContents.EditDate);
                string   strModifed = dtModified.ToString("r");
                HttpContext.Current.Response.AppendHeader("Last-Modified", strModifed);
                HttpContext.Current.Response.Cache.SetLastModified(dtModified);

                DateTime dtExpire = DateTime.Now.AddSeconds(15);

                contCenter.Text = pageContents.PageText;
                contLeft.Text   = pageContents.LeftPageText;
                contRight.Text  = pageContents.RightPageText;

                contCenter.DatabaseKey = pageContents.Root_ContentID;
                contLeft.DatabaseKey   = pageContents.Root_ContentID;
                contRight.DatabaseKey  = pageContents.Root_ContentID;

                pageContents = CMSConfigHelper.IdentifyLinkAsInactive(pageContents);

                if (this.CurrentWebPage.User.Identity.IsAuthenticated)
                {
                    HttpContext.Current.Response.Cache.SetNoServerCaching();
                    HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                    dtExpire = DateTime.Now.AddMinutes(-10);
                    HttpContext.Current.Response.Cache.SetExpires(dtExpire);

                    if (!SecurityData.AdvancedEditMode)
                    {
                        if (SecurityData.IsAdmin || SecurityData.IsSiteEditor)
                        {
                            if (!SiteData.IsPageSampler && !IsPageTemplate)
                            {
                                Control editor = this.CurrentWebPage.LoadControl(SiteFilename.EditNotifierControlPath);
                                this.CurrentWebPage.Form.Controls.Add(editor);
                            }
                        }
                    }
                    else
                    {
                        contCenter.IsAdminMode = true;
                        contLeft.IsAdminMode   = true;
                        contRight.IsAdminMode  = true;

                        contCenter.ZoneChar = "c";
                        contLeft.ZoneChar   = "l";
                        contRight.ZoneChar  = "r";

                        contCenter.TextZone = ContentContainer.TextFieldZone.TextCenter;
                        contLeft.TextZone   = ContentContainer.TextFieldZone.TextLeft;
                        contRight.TextZone  = ContentContainer.TextFieldZone.TextRight;

                        contCenter.Text = pageContents.PageText;
                        contLeft.Text   = pageContents.LeftPageText;
                        contRight.Text  = pageContents.RightPageText;

                        Control editor = this.CurrentWebPage.LoadControl(SiteFilename.AdvancedEditControlPath);
                        this.CurrentWebPage.Form.Controls.Add(editor);

                        MarkWidgets(this.CurrentWebPage, true);
                    }
                }
                else
                {
                    HttpContext.Current.Response.Cache.SetExpires(dtExpire);
                }

                InsertSpecialCtrl(this.CurrentWebPage.Form, ControlLocation.Footer);

                if (pageWidgets.Any())
                {
                    CMSConfigHelper cmsHelper = new CMSConfigHelper();

                    //find each placeholder in use ONCE!
                    List <LabeledControl> lstPlaceholders = (from ph in pageWidgets
                                                             where ph.Root_ContentID == pageContents.Root_ContentID
                                                             select new LabeledControl {
                        ControlLabel = ph.PlaceholderName,
                        KeyControl = FindTheControl(ph.PlaceholderName, this.CurrentWebPage)
                    }).Distinct().ToList();

                    List <Widget> lstWidget = null;

                    if (SecurityData.AdvancedEditMode)
                    {
                        lstWidget = (from w in pageWidgets
                                     orderby w.WidgetOrder, w.EditDate
                                     where w.Root_ContentID == pageContents.Root_ContentID
                                     //&& w.IsWidgetActive == true
                                     && w.IsWidgetPendingDelete == false
                                     select w).ToList();
                    }
                    else
                    {
                        lstWidget = (from w in pageWidgets
                                     orderby w.WidgetOrder, w.EditDate
                                     where w.Root_ContentID == pageContents.Root_ContentID &&
                                     w.IsWidgetActive == true &&
                                     w.IsRetired == false && w.IsUnReleased == false &&
                                     w.IsWidgetPendingDelete == false
                                     select w).ToList();
                    }

                    foreach (Widget theWidget in lstWidget)
                    {
                        WidgetContainer plcHolder = (WidgetContainer)(from d in lstPlaceholders
                                                                      where d.ControlLabel == theWidget.PlaceholderName
                                                                      select d.KeyControl).FirstOrDefault();
                        if (plcHolder != null)
                        {
                            plcHolder.EnableViewState = true;
                            Control widget = new Control();

                            if (theWidget.ControlPath.EndsWith(".ascx"))
                            {
                                if (File.Exists(this.CurrentWebPage.Server.MapPath(theWidget.ControlPath)))
                                {
                                    try {
                                        widget = this.CurrentWebPage.LoadControl(theWidget.ControlPath);
                                    } catch (Exception ex) {
                                        Literal lit = new Literal();
                                        lit.Text = "<b>ERROR: " + theWidget.ControlPath + "</b> <br />\r\n" + ex.ToString();
                                        widget   = lit;
                                    }
                                }
                                else
                                {
                                    Literal lit = new Literal();
                                    lit.Text = "MISSING FILE: " + theWidget.ControlPath + "<br />\r\n";
                                    widget   = lit;
                                }
                            }

                            if (theWidget.ControlPath.ToLower().StartsWith("class:"))
                            {
                                try {
                                    string className = theWidget.ControlPath.Replace("CLASS:", "");
                                    Type   t         = Type.GetType(className);
                                    Object o         = Activator.CreateInstance(t);

                                    if (o != null)
                                    {
                                        widget = o as Control;
                                    }
                                    else
                                    {
                                        Literal lit = new Literal();
                                        lit.Text = "OOPS: " + theWidget.ControlPath + "<br />\r\n";
                                        widget   = lit;
                                    }
                                } catch (Exception ex) {
                                    Literal lit = new Literal();
                                    lit.Text = "<b>ERROR: " + theWidget.ControlPath + "</b> <br />\r\n" + ex.ToString();
                                    widget   = lit;
                                }
                            }

                            widget.EnableViewState = true;

                            IWidget w = null;
                            if (widget is IWidget)
                            {
                                w               = widget as IWidget;
                                w.SiteID        = SiteData.CurrentSiteID;
                                w.PageWidgetID  = theWidget.Root_WidgetID;
                                w.RootContentID = theWidget.Root_ContentID;
                            }

                            if (widget is IWidgetParmData)
                            {
                                IWidgetParmData    wp      = widget as IWidgetParmData;
                                List <WidgetProps> lstProp = theWidget.ParseDefaultControlProperties();

                                wp.PublicParmValues = lstProp.ToDictionary(t => t.KeyName, t => t.KeyValue);
                            }

                            if (widget is IWidgetRawData)
                            {
                                IWidgetRawData wp = widget as IWidgetRawData;
                                wp.RawWidgetData = theWidget.ControlProperties;
                            }

                            if (widget is IWidgetEditStatus)
                            {
                                IWidgetEditStatus wes = widget as IWidgetEditStatus;
                                wes.IsBeingEdited = SecurityData.AdvancedEditMode;
                            }

                            Dictionary <string, string> lstMenus = new Dictionary <string, string>();
                            if (widget is IWidgetMultiMenu)
                            {
                                IWidgetMultiMenu wmm = widget as IWidgetMultiMenu;
                                lstMenus = wmm.JSEditFunctions;
                            }

                            if (SecurityData.AdvancedEditMode)
                            {
                                WidgetWrapper plcWrapper = plcHolder.AddWidget(widget, theWidget);

                                CMSPlugin plug = (from p in cmsHelper.ToolboxPlugins
                                                  where p.FilePath.ToLower() == plcWrapper.ControlPath.ToLower()
                                                  select p).FirstOrDefault();

                                if (plug != null)
                                {
                                    plcWrapper.ControlTitle = plug.Caption;
                                }
                                else
                                {
                                    plcWrapper.ControlTitle = "UNTITLED";
                                }

                                plcWrapper.ID = WrapCtrlId;

                                if (w != null)
                                {
                                    if (w.EnableEdit)
                                    {
                                        if (lstMenus.Count < 1)
                                        {
                                            string sScript = w.JSEditFunction;
                                            if (String.IsNullOrEmpty(sScript))
                                            {
                                                sScript = "cmsGenericEdit('" + pageContents.Root_ContentID + "','" + plcWrapper.DatabaseKey + "')";
                                            }

                                            plcWrapper.JSEditFunction = sScript;
                                        }
                                        else
                                        {
                                            plcWrapper.JSEditFunctions = lstMenus;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                plcHolder.AddWidget(widget);
                            }

                            widget.ID = CtrlId;
                        }
                    }

                    cmsHelper.Dispose();
                }
            }
        }
コード例 #38
0
        protected override void OnPreRender(EventArgs e)
        {
            this.Controls.Clear();

            try {
                ContentPage cp      = cu.GetContainerContentPage(this);
                SiteData    theSite = SiteData.CurrentSite;

                if (cp != null)
                {
                    HtmlMeta metaSub = new HtmlMeta();
                    metaSub.Attributes["property"] = "og:description";
                    metaSub.Content = String.IsNullOrEmpty(cp.MetaDescription) ? theSite.MetaDescription : cp.MetaDescription;
                    this.Controls.Add(metaSub);

                    HtmlMeta metaURL = new HtmlMeta();
                    metaURL.Attributes["property"] = "og:url";
                    metaURL.Content = theSite.DefaultCanonicalURL;
                    this.Controls.Add(metaURL);

                    HtmlMeta metaType = new HtmlMeta();
                    metaType.Attributes["property"] = "og:type";
                    if (this.OpenGraphType == OpenGraphTypeDef.Default)
                    {
                        if (cp.ContentType == ContentPageType.PageType.BlogEntry)
                        {
                            metaType.Content = OpenGraphTypeDef.Blog.ToString().ToLowerInvariant();
                        }
                        else
                        {
                            metaType.Content = OpenGraphTypeDef.Article.ToString().ToLowerInvariant();
                        }
                        if (theSite.Blog_Root_ContentID.HasValue && cp.Root_ContentID == theSite.Blog_Root_ContentID)
                        {
                            metaType.Content = OpenGraphTypeDef.Website.ToString().ToLowerInvariant();
                        }
                    }
                    else
                    {
                        metaType.Content = this.OpenGraphType.ToString().ToLowerInvariant();
                    }

                    this.Controls.Add(metaType);

                    if (!String.IsNullOrEmpty(this.Page.Title))
                    {
                        HtmlMeta metaTitle = new HtmlMeta();
                        metaTitle.Attributes["property"] = "og:title";
                        metaTitle.Content = cp.TitleBar;
                        this.Controls.Add(metaTitle);
                    }

                    if (!String.IsNullOrEmpty(cp.Thumbnail))
                    {
                        HtmlMeta metaTitle = new HtmlMeta();
                        metaTitle.Attributes["property"] = "og:image";
                        metaTitle.Content = String.Format("{0}/{1}", theSite.MainCanonicalURL, cp.Thumbnail).Replace(@"//", @"/").Replace(@"//", @"/").Replace(@":/", @"://");
                        this.Controls.Add(metaTitle);
                    }

                    if (!String.IsNullOrEmpty(theSite.SiteName))
                    {
                        HtmlMeta metaSite = new HtmlMeta();
                        metaSite.Attributes["property"] = "og:site_name";
                        metaSite.Content = theSite.SiteName;
                        this.Controls.Add(metaSite);
                    }

                    HtmlMeta metaPubDate = new HtmlMeta();
                    metaPubDate.Attributes["property"] = "article:published_time";
                    metaPubDate.Content = theSite.ConvertSiteTimeToISO8601(cp.GoLiveDate);
                    this.Controls.Add(metaPubDate);

                    HtmlMeta metaUpdateDate = new HtmlMeta();
                    metaUpdateDate.Attributes["property"] = "article:modified_time";
                    metaUpdateDate.Content = theSite.ConvertSiteTimeToISO8601(cp.EditDate);
                    this.Controls.Add(metaUpdateDate);

                    if (ShowExpirationDate)
                    {
                        HtmlMeta metaExpireDate = new HtmlMeta();
                        metaExpireDate.Attributes["property"] = "article:expiration_time";
                        metaExpireDate.Content = theSite.ConvertSiteTimeToISO8601(cp.RetireDate);
                        this.Controls.Add(metaExpireDate);
                    }
                }
            } catch (Exception ex) {
            }

            base.OnPreRender(e);
        }
コード例 #39
0
ファイル: Register.aspx.cs プロジェクト: cumen/Online_Test
        protected void btn_uyeol_Click(object sender, EventArgs e)
        {
            string        baglanti = WebConfigurationManager.ConnectionStrings["OnlineTestConnectionString"].ConnectionString;
            SqlConnection con      = new SqlConnection(baglanti);

            con.Open();
            if (con.State == System.Data.ConnectionState.Open)
            {
                string     q1   = "select count(*) from Uyeler where mail='" + txt_mail.Text + "'";
                SqlCommand cmd1 = new SqlCommand(q1, con);
                cmd1.ExecuteNonQuery();
                int say = (int)cmd1.ExecuteScalar();
                if (say != 0) // mail sql karşılaştırması yapılıyor
                {
                    lbl_hata.Text = "Mail adresi kullanılıyor!";
                }
                else
                {                                             // aynı mail tabloda bulunmuyorsa
                    if (txt_parola1.Text == txt_parola2.Text) // parolaları karşılaştırıyor
                    {
                        string uzanti;
                        uzanti = Path.GetExtension(fu_kayit.PostedFile.FileName);
                        double boyut = fu_kayit.PostedFile.ContentLength;
                        if (fu_kayit.HasFile)                         // Fileupload ın içi doluysa
                        {
                            if (uzanti == ".jpg" || uzanti == ".JPG") // yüklenen dosyanın uzantısı kontrol ediliyor
                            {
                                if (boyut < 1048576)                  // boyut 1 mb dan ufaksa
                                {
                                    fotoisim = txt_mail.Text + ".jpg";
                                    fu_kayit.SaveAs(Server.MapPath("fotograf/" + fotoisim));
                                }
                                else // boyut 1 mb dan ufak değilse
                                {
                                    lbl_hata.Text = "Dosya boyutunu 1 mb dan az giriniz.";
                                }
                            }
                            else // uzantı jpg değilse
                            {
                                lbl_hata.Text = "Lütfen .jpg uzantılı resim ekleyiniz.";
                            }
                        }
                        else // FileUpload boşsa varsayılan resim ismi yükleniyor.
                        {
                            fotoisim = "profilfoto.jpg";
                        }
                        string     q   = "insert into Uyeler(ad,soyad,mail,parola,profil_foto) values ('" + txt_ad.Text + "', '" + txt_soyad.Text + "', '" + txt_mail.Text + "', '" + txt_parola1.Text + "', '" + fotoisim + "')";
                        SqlCommand cmd = new SqlCommand(q, con);
                        cmd.ExecuteNonQuery();
                        HtmlMeta meta = new HtmlMeta();
                        meta.HttpEquiv = "Refresh";
                        meta.Content   = "5;url=Login.aspx";
                        this.Page.Controls.Add(meta);
                        lbl_hata.Text = "Kayıdınız oluşturuldu.<br> 5 saniye sonra yönlendirileceksiniz...";
                    }
                    else // parolalar uyuşmuyorsa
                    {
                        lbl_hata.Text = "Parolalar uyuşmuyor!";
                    }
                }
            }
            con.Close();
        }
コード例 #40
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (RequiresLegacyIE)
            {
                var meta = new HtmlMeta {
                    Name = "IE7Compatible", HttpEquiv = "X-UA-Compatible", Content = "IE=7"
                };
                Page.Header.Controls.Add(meta);
            }
            else
            {
                // Still need to force IE to use IE10 mode because Compatibility View may be turned on for intranet websites.
                // This will make IE to run in compatibility mode. Some pages designed for IE10+ will not be rendered properly in that case
                var meta = new HtmlMeta {
                    Name = "IE7Compatible", HttpEquiv = "X-UA-Compatible", Content = "IE=10"
                };
                Page.Header.Controls.Add(meta);
            }

            if (IsPostBack)
            {
                return;
            }

            LogoutLink.HRef = "~/Pages/Login/Logout.aspx" + "?ReturnUrl=" + this.Request.Url.AbsoluteUri;

            if (SessionManager.Current != null && SessionManager.Current.User != null && SessionManager.Current.User.WarningMessages.Count > 0)
            {
                if (!SessionManager.Current.User.WarningsDisplayed)
                {
                    SessionManager.Current.User.WarningsDisplayed = true;
                    SessionManager.InitializeSession(SessionManager.Current);
                    LoginWarningsDialog.Show();
                }
            }

            if (ConfigurationManager.AppSettings.GetValues("CachePages")[0].Equals("false"))
            {
                Response.CacheControl = "no-cache";
                Response.AddHeader("Pragma", "no-cache");
                Response.Expires = -1;
            }

            AddIE6PngBugFixCSS();
            if (SessionManager.Current != null && SessionManager.Current.User != null)
            {
                var id = SessionManager.Current.User.Identity as CustomIdentity;

                if (DisplayUserInformationPanel)
                {
                    Username.Text = id != null ? id.DisplayName : "unknown";

                    try
                    {
                        var alertControl = (AlertIndicator)LoadControl("~/Controls/AlertIndicator.ascx");
                        AlertIndicatorPlaceHolder.Controls.Add(alertControl);
                    }
                    catch (Exception)
                    {
                        //No permissions for Alerts, control won't be displayed
                        //hide table cell that contains the control.
                        AlertIndicatorCell.Visible = false;
                    }
                    try
                    {
                        var warningControl = (LoginWarningIndicator)LoadControl("~/Controls/LoginWarningIndicator.ascx");
                        LoginIndicatorPlaceHolder.Controls.Add(warningControl);
                    }
                    catch (Exception)
                    {
                        //No permissions for Warning Indicator, control won't be displayed
                        //hide table cell that contains the control.
                        LoginWarningCell.Visible = false;
                    }
                }
                else
                {
                    UserInformationCell.Width = Unit.Percentage(0);
                    MenuCell.Width            = Unit.Percentage(100);
                }
            }
        }
コード例 #41
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Admin loggedAdmin = AdminOpr.isLogged(Request);

            if (loggedAdmin == null)
            {
                //未登录
                lblLoginStatus.Text    = "您未登录或已经登录过期,请重新登录,3秒后转回管理员登录页。";
                lblLoginStatus.Visible = true;
                LoggedForm.Visible     = false;
                //重定向
                HtmlMeta RedirectMeta = new HtmlMeta();            //重定向用Meta标签
                RedirectMeta.HttpEquiv = "refresh";                //指定行为为跳转
                RedirectMeta.Content   = "3;url=admin_login.aspx"; //时间为三秒,跳转到首页
                this.Page.Header.Controls.Add(RedirectMeta);
            }
            else
            {
                //已登录
                if (!Page.IsPostBack)
                {
                    //首次访问
                    lblLoginStatus.Visible = false;
                    LoggedForm.Visible     = true;
                    txtAdminNickname.Text  = loggedAdmin.User_nickname.Trim();
                }
                else
                {
                    //提交修改信息
                    String adminOldPassword       = Request.Form[txtOldPassword.ID];
                    String adminNewPassword       = Request.Form[txtNewPassword.ID];
                    String adminVerifyNewPassword = Request.Form[txtVerifyNewPassword.ID];
                    String adminNickname          = Request.Form[txtAdminNickname.ID].Trim();

                    //修改密码的验证,填写了旧密码,要修改密码
                    if (!adminOldPassword.Equals("") &&
                        adminOldPassword != null
                        )
                    {
                        //长度验证
                        if (adminOldPassword.Length < 6 ||
                            adminOldPassword.Length > 16 ||
                            !UserOpr.MD5(adminOldPassword).Equals(loggedAdmin.User_password)
                            )
                        { //长度不对或输入不符
                            lblChangeInfo.Text    = "旧密码输入错误或旧密码格式不正确,旧密码长度应在6-16位之间,请重试";
                            lblChangeInfo.Visible = true;
                        }
                        else
                        {
                            //新密码一致性检查
                            if (adminNewPassword.Equals("") ||
                                adminNewPassword == null ||
                                adminNewPassword.Length < 6 ||
                                adminNewPassword.Length > 16 ||
                                !adminNewPassword.Equals(adminVerifyNewPassword))
                            {
                                lblChangeInfo.Text = "新密码与确认密码不一致或长度不正确(应在6-16位之间),请重试";
                            }
                            else
                            {
                                //新密码一致性检查通过,赋值赋值赋值。
                                loggedAdmin.User_password = UserOpr.MD5(adminNewPassword);
                                loggedAdmin.User_nickname = adminNickname;
                                if (AdminOpr.UpdateAdminInfo(loggedAdmin))
                                {
                                    //修改成功
                                    lblLoginStatus.Text    = "您已成功修改密码,请重新登录,3秒后跳转到登录页面";
                                    LoggedForm.Visible     = false;
                                    lblLoginStatus.Visible = true;

                                    //跳转
                                    HtmlMeta RedirectMeta = new HtmlMeta();            //重定向用Meta标签
                                    RedirectMeta.HttpEquiv = "refresh";                //指定行为为跳转
                                    RedirectMeta.Content   = "3;url=admin_login.aspx"; //时间为三秒,跳转到首页
                                    this.Page.Header.Controls.Add(RedirectMeta);
                                }
                                else
                                {
                                    //修改失败
                                    lblLoginStatus.Text    = "修改密码失败,请检查输入项";
                                    lblLoginStatus.Visible = true;
                                    LoggedForm.Visible     = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        //没填旧密码,修改其他信息
                        loggedAdmin.User_nickname = adminNickname;
                        if (AdminOpr.UpdateAdminInfo(loggedAdmin))
                        {
                            lblLoginStatus.Text    = "您已成功修改信息";
                            LoggedForm.Visible     = true;
                            lblLoginStatus.Visible = true;
                        }
                        else
                        {
                            lblLoginStatus.Text    = "修改信息失败,原因可能是服务器大姨妈或您的输入有误,请重试";
                            LoggedForm.Visible     = true;
                            lblLoginStatus.Visible = true;
                        }
                    }
                }
            }
        }
コード例 #42
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Exibe o título no navegador
        Page.Title = __SessionWEB.TituloGeral + " - " + __SessionWEB.TituloSistema;

        #region Adiciona links de favicon

        string TemaAtual = __SessionWEB.TemaPadraoLogado.tep_nome;

        HtmlLink link = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon.ico");
        link.Attributes["rel"]   = "shortcut icon";
        link.Attributes["sizes"] = "";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-57x57.png");
        link.Attributes["rel"]   = "apple-touch-icon";
        link.Attributes["sizes"] = "57x57";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-114x114.png");
        link.Attributes["rel"]   = "apple-touch-icon";
        link.Attributes["sizes"] = "114x114";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-72x72.png");
        link.Attributes["rel"]   = "apple-touch-icon";
        link.Attributes["sizes"] = "72x72";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-144x144.png");
        link.Attributes["rel"]   = "apple-touch-icon";
        link.Attributes["sizes"] = "144x144";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-60x60.png");
        link.Attributes["rel"]   = "apple-touch-icon";
        link.Attributes["sizes"] = "60x60";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-120x120.png");
        link.Attributes["rel"]   = "apple-touch-icon";
        link.Attributes["sizes"] = "120x120";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-76x76.png");
        link.Attributes["rel"]   = "apple-touch-icon";
        link.Attributes["sizes"] = "76x76";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/apple-touch-icon-152x152.png");
        link.Attributes["rel"]   = "apple-touch-icon";
        link.Attributes["sizes"] = "152x152";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-196x196.png");
        link.Attributes["rel"]   = "icon";
        link.Attributes["sizes"] = "196x196";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-160x160.png");
        link.Attributes["rel"]   = "icon";
        link.Attributes["sizes"] = "160x160";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-96x96.png");
        link.Attributes["rel"]   = "icon";
        link.Attributes["sizes"] = "96x96";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-16x16.png");
        link.Attributes["rel"]   = "icon";
        link.Attributes["sizes"] = "16x16";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-32x32.png");
        link.Attributes["rel"]   = "icon";
        link.Attributes["sizes"] = "32x32";
        Page.Header.Controls.Add(link);

        link      = new HtmlLink();
        link.Href = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/favicon-32x32.png");
        link.Attributes["rel"]   = "icon";
        link.Attributes["sizes"] = "32x32";
        Page.Header.Controls.Add(link);

        HtmlMeta meta = new HtmlMeta();
        meta.Name    = "msapplication-TileImage";
        meta.Content = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/mstile-144x144.png");
        Page.Header.Controls.Add(meta);

        meta         = new HtmlMeta();
        meta.Name    = "msapplication-config";
        meta.Content = ResolveUrl("~/App_Themes/" + TemaAtual + "/images/favicons/browserconfig.xml");
        Page.Header.Controls.Add(meta);

        #endregion

        if (!IsPostBack)
        {
            try
            {
                //Exibe o contato do help desk do cliente
                spnHelpDesk.InnerHtml = __SessionWEB.HelpDeskContato;

                if (__SessionWEB.__UsuarioWEB.Grupo != null)
                {
                    string menuXml = SYS_ModuloBO.CarregarMenuXML(
                        __SessionWEB.__UsuarioWEB.Grupo.gru_id
                        , __SessionWEB.__UsuarioWEB.Grupo.sis_id
                        , __SessionWEB.__UsuarioWEB.Grupo.vis_id
                        );
                    if (String.IsNullOrEmpty(menuXml))
                    {
                        menuXml = "<menus/>";
                    }
                    XmlDataSource1.Data = menuXml;
                    XmlDataSource1.DataBind();

                    //LoadMenuTipo2();

                    //Carrrega nome do usuario logado no sistema e exibe na pagina na mensagem de Bem-vindo.
                    lblUsuario.Text = RetornaLoginFormatado(__SessionWEB.UsuarioLogado);

                    //Exibe a mensagem de copyright no rodapé.
                    //lblCopyright.Text = "<span class='tituloGeral'>" + __SessionWEB.TituloGeral + " - " + __SessionWEB.TituloSistema + "</span><span class='sep'> - </span><span class='versao'>" + _VS_versao + "</span><span class='sep'> - </span><span class='mensagem'>" + __SessionWEB.MensagemCopyright + "</span>";
                    lblCopyright.Text = "<span class='tituloGeral'>Desenvolvido no Brasil</span> | <span class='mensagem'>" + __SessionWEB.MensagemCopyright + "</span> | <span class='versao'>" + _VS_versao + "</span>";

                    //Atribui o caminho do logo geral do sistema, caso ele exista no Sistema Administrativo
                    if (string.IsNullOrEmpty(__SessionWEB.UrlLogoGeral))
                    {
                        ImgLogoGeral.Visible = false;
                    }
                    else
                    {
                        //Carrega logo geral do sistema
                        imgGeral.ImageUrl        = UtilBO.UrlImagem(__SessionWEB.UrlLogoGeral);
                        imgGeral.ToolTip         = __SessionWEB.TituloGeral;
                        imgGeral.AlternateText   = __SessionWEB.TituloGeral;
                        ImgLogoGeral.ToolTip     = __SessionWEB.TituloGeral;
                        ImgLogoGeral.NavigateUrl = __SessionWEB.UrlSistemaAutenticador + "/Sistema.aspx";
                    }

                    //Atribui o caminho do logo do sistema atual, caso ele exista no Sistema Administrativo
                    if (string.IsNullOrEmpty(__SessionWEB.UrlLogoSistema))
                    {
                        ImgLogoSistemaAtual.Visible = false;
                    }
                    else
                    {
                        //Carrega logo do sistema atual
                        imgSistemaAtual.ImageUrl        = UtilBO.UrlImagem(__SessionWEB.UrlLogoSistema);
                        imgSistemaAtual.AlternateText   = __SessionWEB.TituloSistema;
                        imgSistemaAtual.ToolTip         = __SessionWEB.TituloSistema;
                        ImgLogoSistemaAtual.ToolTip     = __SessionWEB.TituloSistema;
                        ImgLogoSistemaAtual.NavigateUrl = "~/Index.aspx";
                    }

                    //TODO: Descomentar codigo abaixo.
                    imgImagemInstituicao.Visible = false;
                    ImgLogoInstitiuicao.Visible  = false;

                    ////Atribui o caminho do logo cliente, caso ele exista no Sistema Administrativo
                    //if (string.IsNullOrEmpty(__SessionWEB.UrlInstituicao.Trim()))
                    //    ImgLogoInstitiuicao.Visible = false;
                    //else
                    //{
                    //    //Carrega logo do cliente
                    //    ImgLogoInstitiuicao.ImageUrl = UtilBO.UrlImagem(__SessionWEB.UrlLogoInstituicao);
                    //    ImgLogoInstitiuicao.ToolTip = string.Empty;
                    //    ImgLogoInstitiuicao.NavigateUrl = __SessionWEB.UrlInstituicao;
                    //}

                    //imgImageInstituicao.Visible = !ImgLogoInstitiuicao.Visible;
                    //imgImageInstituicao.ImageUrl = UtilBO.UrlImagem(__SessionWEB.UrlLogoInstituicao);

                    string urlHelp = SYS_ModuloSiteMapBO.SelecionaUrlHelpByUrl(__SessionWEB.__UsuarioWEB.Grupo.gru_id, Request.AppRelativeCurrentExecutionFilePath);

                    if (!string.IsNullOrEmpty(urlHelp))
                    {
                        hplHelp.Visible     = true;
                        hplHelp.NavigateUrl = urlHelp;
                        hplHelp.ToolTip     = SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.MENSAGEM_ICONE_HELP);
                    }
                    else
                    {
                        hplHelp.Visible = false;
                    }
                }
                else
                {
                    Response.Redirect("~/logout.ashx");
                }
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);

                if ((__SessionWEB.__UsuarioWEB != null) && (__SessionWEB.__UsuarioWEB.Usuario != null))
                {
                    lblUsuario.Text = RetornaLoginFormatado(__SessionWEB.__UsuarioWEB.Usuario.usu_login ?? "");
                }
            }
        }
    }
コード例 #43
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        //string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

        //CommonFunctions.Connection.ConnectionString = connectionstring;

        //if (CommonFunctions.Connection.State == System.Data.ConnectionState.Closed)
        //CommonFunctions.Connection.Open ();

        //lock (CommonFunctions.Connection)
        PropertiesAdapter.Fill(PropertiesFullSet);

        //lock (CommonFunctions.Connection)
        RegionsAdapter.Fill(RegionsSet);
        //lock (CommonFunctions.Connection)
        CountriesAdapter.Fill(CountriesSet);
        //lock (CommonFunctions.Connection)
        StateProvincesAdapter.Fill(StateProvincesSet);
        //lock (CommonFunctions.Connection)
        CitiesAdapter.Fill(CitiesSet);

        //lock (CommonFunctions.Connection)
        AmenitiesAdapter.Fill(AmenitiesSet);
        //lock (CommonFunctions.Connection)
        AttractionsAdapter.Fill(AttractionsSet);

        //if (Master.FindControl ("BodyTag") is HtmlGenericControl)
        //{
        //    HtmlGenericControl body = (HtmlGenericControl)Master.FindControl ("BodyTag");
        //    body.Attributes["onload"] = "InitializeDropdowns ();";
        //}

        string temp = "Vacation rentals at ";



        ((System.Web.UI.WebControls.Image)Master.FindControl("Logo")).AlternateText = temp + "Vacations-Abroad.com";
        //((System.Web.UI.WebControls.Image)Master.FindControl ("MainLogo")).AlternateText = temp + "@ Vacations-Abroad.com";

        foreach (DataRow datarow in RegionsSet.Tables["Regions"].Rows)
        {
            if (datarow["Region"] is string)
            {
                regions += " " + (string)datarow["Region"];
            }
        }

        HtmlHead head = Page.Header;
        //Page.ClientScript.RegisterClientScriptInclude("aKeyToIdentifyIt", "/scripts/countryStateCity.js");
        HtmlMeta keywords = new HtmlMeta();

        keywords.Name = "keywords";
        if (PropertiesFullSet.Tables["Properties"].Rows.Count < 1)
        {
            keywords.Content = "View property";
        }
        else
        {
            keywords.Content = Keywords.Text.Replace("%regions%", regions.Trim());
        }

        head.Controls.Add(keywords);
        HtmlMeta description = new HtmlMeta();

        description.Name = "description";
        if (PropertiesFullSet.Tables["Properties"].Rows.Count < 1)
        {
            description.Content = "View property";
        }
        else
        {
            description.Content = Description.Text.Replace("%regions%", regions.Trim());
        }

        head.Controls.Add(description);

        if (!IsPostBack)
        {
            DataBind();

            //Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheet.css' rel='stylesheet' type='text/css'></script>"));
            Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheet.css' rel='stylesheet' type='text/css' />"));
        }
        DataSet ds = Utility.dsGrab("RegionTextList");

        ltlAfrica.Text           = ds.Tables[0].Rows[0]["RegionTextValue"].ToString();
        ltlAsia.Text             = ds.Tables[0].Rows[1]["RegionTextValue"].ToString();
        ltlEurope.Text           = ds.Tables[0].Rows[2]["RegionTextValue"].ToString();
        ltlNorthAmerica.Text     = ds.Tables[0].Rows[3]["RegionTextValue"].ToString();
        ltlSouthAmerica.Text     = ds.Tables[0].Rows[4]["RegionTextValue"].ToString();
        ltlOceania.Text          = ds.Tables[0].Rows[5]["RegionTextValue"].ToString();
        ltlAfricaList.Text       = GenerateCountryLinks("1");
        ltlAsiaList.Text         = GenerateCountryLinks("2");
        ltlOceaniaList.Text      = GenerateCountryLinks("3");
        ltlSouthAmericaList.Text = GenerateCountryLinks("9");
        ltlEuropeList.Text       = GenerateCountryLinks("6");
        ltlNorthAmericaList.Text = GenerateCountryLinks("8");
    }
コード例 #44
0
        protected void Page_Load(object sender, EventArgs e)
        {
            certificateRepeater.ItemDataBound += new RepeaterItemEventHandler(certificateRepeater_ItemDataBound);

            if (!Page.IsPostBack)
            {
                if (Advertiser != null)
                {
                    advertiserHolder.Visible = true;

                    if (Advertiser.StationId != StationId || !Advertiser.IsActive)
                    {
                        RedirectToHomePage();
                    }

                    // log visit
                    LogPageHit();

                    // Facebook Open Graph fields
                    HtmlMeta metaOgTitle = new HtmlMeta();
                    metaOgTitle.Attributes["property"] = "og:title";
                    metaOgTitle.Content = PageTitle;
                    Page.Header.Controls.Add(metaOgTitle);

                    HtmlMeta metaOgUrl = new HtmlMeta();
                    metaOgUrl.Attributes["property"] = "og:url";
                    metaOgUrl.Content = Request.Url.AbsoluteUri;
                    Page.Header.Controls.Add(metaOgUrl);

                    HtmlMeta metaOgDesc = new HtmlMeta();
                    metaOgDesc.Attributes["property"] = "og:description";
                    metaOgDesc.Content = Advertiser.DescriptionPlainText;
                    Page.Header.Controls.Add(metaOgDesc);


                    if (Advertiser.LogoUrl != String.Empty)
                    {
                        advertiserImage.ImageUrl = Advertiser.LogoUrl;


                        if (Advertiser.IsLogoImageVertical)
                        {
                            advertiserImage.Width  = 75;
                            advertiserImage.Height = 125;
                        }
                        else
                        {
                            advertiserImage.Width  = 125;
                            advertiserImage.Height = 75;
                        }


                        advertiserImage.AlternateText = Advertiser.Name;
                        advertiserImage.ToolTip       = Advertiser.Name;


                        HtmlMeta metaOgImg = new HtmlMeta();
                        metaOgImg.Attributes["property"] = "og:image";
                        metaOgImg.Content = "http://" + EnvDomain + ResolveUrl(Advertiser.LogoUrl);
                        Page.Header.Controls.Add(metaOgImg);
                    }
                    else
                    {
                        advertiserImage.Visible = false;
                    }

                    if (Advertiser.InlineAddress.Trim() != String.Empty)
                    {
                        addressLabel.Text = "<strong>Address:</strong> " + Advertiser.InlineAddress;
                    }

                    if (Advertiser.IsAddressMappable &&
                        Advertiser.DisplayAddress1 != String.Empty &&
                        Advertiser.DisplayCity != String.Empty &&
                        Advertiser.DisplayStateCode != String.Empty)
                    {
                        mapLink.Visible     = true;
                        mapLink.NavigateUrl = "~/AdvertiserMap.aspx?advertiser_id=" + Advertiser.AdvertiserId;
                    }
                    else
                    {
                        mapLink.Visible = false;
                    }

                    if (Advertiser.DisplayPhoneNumber.Trim() != String.Empty)
                    {
                        phoneLabel.Text = "<strong>Phone:</strong> " + Advertiser.DisplayPhoneNumber;
                    }

                    advertiserNameLabel.Text        = Advertiser.Name;
                    advertiserDescriptionLabel.Text = Advertiser.DisplayDescription;

                    if (!Advertiser.IsWebsiteUrlNull())
                    {
                        viewWebsiteLink.NavigateUrl = Advertiser.WebsiteUrl;
                    }
                    else
                    {
                        viewWebsiteLink.Visible = false;
                    }


                    if (Advertiser.ActiveCertificates.Count > 0)
                    {
                        certificateRepeater.DataSource = Advertiser.ActiveCertificates.Rows;
                        certificateRepeater.DataBind();
                    }
                    else
                    {
                        InfoMessage = "No Certificates found for this Advertiser";
                    }

                    String advertiserUrl = "http://";

                    if (UseSubdomain)
                    {
                        advertiserUrl += Advertiser.Station.Subdomain + ".";
                    }

                    advertiserUrl += EnvDomain + ResolveUrl("~/Advertiser.aspx?advertiser_id=" + Advertiser.AdvertiserId);

                    advertiserUrlLiteral.Text = advertiserUrl;

                    twitterAdvertiserUrlLiteral.Text = advertiserUrl;
                    twitterTextLiteral.Text          = Server.HtmlEncode("Save at " + Advertiser.Name);
                }
                else
                {
                    RedirectToHomePage();
                }
            }
        }
コード例 #45
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        //footerPropDescContainer.Visible = false;

        //string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;


        //CommonFunctions.Connection.ConnectionString = connectionstring;

        //if (CommonFunctions.Connection.State == System.Data.ConnectionState.Closed)
        //CommonFunctions.Connection.Open ();

        //lock (CommonFunctions.Connection)
        PropertiesAdapter.Fill(PropertiesFullSet);

        //lock (CommonFunctions.Connection)
        RegionsAdapter.Fill(RegionsSet);
        //lock (CommonFunctions.Connection)
        CountriesAdapter.Fill(CountriesSet);
        //lock (CommonFunctions.Connection)
        StateProvincesAdapter.Fill(StateProvincesSet);
        //lock (CommonFunctions.Connection)
        CitiesAdapter.Fill(CitiesSet);

        //lock (CommonFunctions.Connection)
        AmenitiesAdapter.Fill(AmenitiesSet);
        //lock (CommonFunctions.Connection)
        AttractionsAdapter.Fill(AttractionsSet);

        //if (Master.FindControl ("BodyTag") is HtmlGenericControl)
        //{
        //    HtmlGenericControl body = (HtmlGenericControl)Master.FindControl ("BodyTag");
        //    body.Attributes["onload"] = "InitializeDropdowns ();";
        //}

        string temp = "Vacation rentals at ";



        //((System.Web.UI.WebControls.Image)Master.FindControl("Logo")).AlternateText = temp + "Vacations-Abroad.com";
        //((System.Web.UI.WebControls.Image)Master.FindControl ("MainLogo")).AlternateText = temp + "@ Vacations-Abroad.com";

        foreach (DataRow datarow in RegionsSet.Tables["Regions"].Rows)
        {
            if (datarow["Region"] is string)
            {
                regions += " " + (string)datarow["Region"];
            }
        }

        HtmlHead head = Page.Header;
        //Page.ClientScript.RegisterClientScriptInclude("aKeyToIdentifyIt", "/scripts/countryStateCity.js");

        string   Keywords = "Asia Vacation Rentals | Vacations-Abroad.com";
        HtmlMeta keywords = new HtmlMeta();

        keywords.Name = "keywords";
        if (PropertiesFullSet.Tables["Properties"].Rows.Count < 1)
        {
            keywords.Content = "View property";
        }
        else
        {
            keywords.Content = Keywords.Replace("%regions%", regions.Trim());
        }

        head.Controls.Add(keywords);
        string   Description = "Book Now Asia vacation rentals! Direct from owner and enjoy a luxury beach villa or city vacation apartment.";
        HtmlMeta description = new HtmlMeta();

        description.Name = "description";
        if (PropertiesFullSet.Tables["Properties"].Rows.Count < 1)
        {
            description.Content = "View property";
        }
        else
        {
            description.Content = Description.Replace("%regions%", regions.Trim());
        }

        head.Controls.Add(description);

        if (!IsPostBack)
        {
            DataBind();
            // Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheet.css' rel='stylesheet' type='text/css' />"));
        }
        DataSet ds = Utility.dsGrab("RegionTextList");
    }
コード例 #46
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            HtmlMeta objMeta = new HtmlMeta();
            objMeta.Name    = "Description";
            objMeta.Content = WebConfig.GetValues("MetaDiscription");
            this.Header.Controls.Add(objMeta);

            // Adding meta KeyWords
            objMeta         = new HtmlMeta();
            objMeta.Name    = "keywords";
            objMeta.Content = WebConfig.GetValues("MetaKeword");
            this.Header.Controls.Add(objMeta);

            bool IsRequest = false;
            switch (Request.QueryString["id"])
            {
            case "1":
                L_Type.Text   = "Grant";
                HF_Type.Value = "2";
                IsRequest     = false;
                break;

            case "2":
                L_Type.Text   = "Request";
                HF_Type.Value = "1";
                IsRequest     = true;
                break;

            default:
                L_Type.Text   = "Grant";
                HF_Type.Value = "2";
                IsRequest     = false;
                break;
            }

            // Getting User Information Fro Cookie
            HttpCookieCollection objHttpCookieCollection = Request.Cookies;
            HttpCookie           objHttpCookie           = objHttpCookieCollection.Get("MatCookie5639sb");
            string strMatrimonialID = Crypto.DeCrypto(objHttpCookie.Values["MatrimonialID"]);

            // Count
            int intCount = InternalMessage.GetPhotoHoroPasswordCount(strMatrimonialID, IsRequest);
            //Setting Count
            L_Last_2.Text = intCount.ToString();
            L_Last_1.Text = intCount.ToString();
            if (intCount > 0)
            {
                LoadList(InternalMessage.GetPasswordList(strMatrimonialID, 0, IsRequest), 0, IsRequest);

                IB_Delete_1.Visible = true;
                IB_Delete_2.Visible = true;
                if (intCount < 10)
                {
                    LB_Next_1.Enabled = false;
                    LB_Next_2.Enabled = false;

                    L_Current_1.Text = intCount.ToString();
                    L_Current_2.Text = intCount.ToString();
                }
                else
                {
                    LB_Next_1.Enabled = true;
                    LB_Next_2.Enabled = true;

                    L_Current_1.Text = "10";
                    L_Current_2.Text = "10";
                }
                HF_Start.Value = "0";
            }
            else
            {
                L_Current_1.Text = "0";
                L_Current_2.Text = "0";
            }
        }
    }
コード例 #47
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        DBConnection obj = new DBConnection();
        DataTable    dt  = new DataTable();

        if (Request.QueryString["cityID"] != null)
        {
            try
            {
                cityID = Convert.ToInt32(Request.QueryString["cityID"]);
            }
            catch (Exception)
            {
            }
        }

        //GET REGION, COUNTRY, STATE
        try
        {
            dt = VADBCommander.CityTourList(cityID.ToString());
            if (dt.Rows.Count > 0)
            {
                region        = dt.Rows[0]["region"].ToString();
                country       = dt.Rows[0]["country"].ToString();
                stateprovince = dt.Rows[0]["stateprovince"].ToString();
                city          = dt.Rows[0]["city"].ToString();
                stateID       = Convert.ToInt32(dt.Rows[0]["StateID"]);
                countryid     = Convert.ToInt32(dt.Rows[0]["countryid"]);
            }
        }
        catch (Exception ex) { lblInfo22.Text = ex.ToString(); }
        finally { obj.CloseConnection(); }

        CitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);

        string STR_SELECTPropertiesInfo = "select Cities.City, Tours.*, StateProvinces.StateProvince, Countries.Country, Countries.id as countryid,  " +
                                          "Regions.Region, StateProvinces.id as StateID from Cities inner join  " +
                                          "StateProvinces on Cities.stateprovinceid=StateProvinces.id  " +
                                          "inner join Countries on Countries.id=StateProvinces.Countryid  " +
                                          "inner join Regions on Regions.id=Countries.Regionid " +
                                          "inner join Tours on Tours.CityID=Cities.ID " +
                                          "where cities.id=@CityID";

        PropertiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTPropertiesInfo), SqlDbType.Int);

        AmenitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT Amenities.ID, Amenity," +
                                                          " PropertiesAmenities.PropertyID " +
                                                          "FROM Amenities INNER JOIN PropertiesAmenities ON Amenities.ID = PropertiesAmenities.AmenityID" +
                                                          " INNER JOIN Properties ON PropertiesAmenities.PropertyID = Properties.ID " +
                                                          " INNER JOIN Cities ON Properties.CityID = Cities.ID " +
                                                          " INNER JOIN Counties ON Cities.ID = Counties.CityID " +
                                                          "WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND (Counties.county = @countyID)" +
                                                          " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID) AND (Amenities.Amenity NOT IN" +
                                                          " ('Lake Front', 'Beach Front', 'River Front', 'Seaside', 'Ski In Ski Out', 'TV', 'VCR', 'CD Player'))",
                                                          SqlDbType.Int);

        LocationAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "select Cities.City, Cities.ID as CityID, StateProvinces.StateProvince, Countries.Country, Countries.id as countryid, " +
                                                         "Regions.Region, StateProvinces.id as StateID from Cities inner join " +
                                                         "StateProvinces on Cities.stateprovinceid=StateProvinces.id " +
                                                         "inner join Countries on Countries.id=StateProvinces.Countryid " +
                                                         "inner join Regions on Regions.id=Countries.Regionid " +
                                                         "where cities.id=@CityID",
                                                         SqlDbType.Int);

        HtmlHead head = Page.Header;

        HtmlMeta keywords    = new HtmlMeta();
        HtmlMeta description = new HtmlMeta();

        DataBind();

        if (!IsPostBack)
        {
            //INDIVIDUAL CITY TEXT INSERT HERE*****
            //DBConnection obj = new DBConnection();
            //DataTable dt = new DataTable();
            string vText = "Vacations-abroad.com is a directory of " + city + " vacation rentals and privately owned " +
                           city + " holiday accommodation. Our holiday rentals include vacation homes, holiday villas, vacation condos, holiday " +
                           "apartments, holiday cottages, vacation cabins, B&Bs, Hotels, Resorts, Guesthouses in " +
                           city + " " + stateprovince;

            List <string> vList        = new List <string>();
            DataTable     dt1          = new DataTable();
            DataTable     dtCategories = new DataTable();
            DBConnection  objR         = new DBConnection();
            try
            {
                DataFunctions objF = new DataFunctions();
                dt1                       = VADBCommander.ListApprovedToursByCity(cityID.ToString());
                Session["dt"]             = dt1;
                State_datagrid.DataSource = dt1;
                State_datagrid.DataBind();


                //add cities to right column

                SqlDataReader reader;
                DataTable     dtR = new DataTable();

                string vCountyID = "";


                //if county assoc
                dtR = VADBCommander.CountyListByCityID(cityID.ToString());

                if (dtR.Rows.Count > 0)
                {
                    vCountyID = dtR.Rows[0]["countyid"].ToString();

                    rtCounties.InnerHtml = dtR.Rows[0]["county"].ToString() + " Cities";
                    rtLowerHd.InnerHtml  = stateprovince + " Counties";


                    dtR = VADBCommander.CityListByCountyID(vCountyID);
                    foreach (DataRow row in dtR.Rows)
                    {
                        string temp = CommonFunctions.GetSiteAddress() + "/" + country +
                                      "/" + stateprovince + "/" + row["city"].ToString() + "/default.aspx";
                        temp = temp.ToLower();
                        temp = temp.Replace(' ', '_');

                        divCitiesRt.InnerHtml += "<a href=\"" + temp + "\">" + row["city"].ToString().Replace(" ", "&nbsp;") + "</a>, ";
                    }
                    divCitiesRt.InnerHtml = divCitiesRt.InnerHtml.Remove(divCitiesRt.InnerHtml.Length - 2, 2);

                    dtR = objR.spGetRightSideCounties(stateID);

                    if (dtR.Rows.Count > 0)
                    {
                        DataTable dtTooltip = VADBCommander.CityAndCountiesByStateID(stateID.ToString());

                        foreach (DataRow row in dtR.Rows)
                        {
                            string temp = CommonFunctions.GetSiteAddress() + "/" +
                                          stateprovince + "/Holiday-Rentals/" + row["county"].ToString() + "-Vacation_Rentals/default.aspx";
                            temp = temp.ToLower();
                            temp = temp.Replace(' ', '_');
                            //county tooltip
                            dtTooltip.DefaultView.RowFilter = "CountyName='" + row["county"].ToString() + "'";
                            if (dtTooltip.DefaultView.ToTable().Rows.Count > 0)
                            {
                                rtLower.InnerHtml += "<a onmouseover=\"Tip('";
                                foreach (DataRow rowCnty in dtTooltip.DefaultView.ToTable().Rows)
                                {
                                    rtLower.InnerHtml += "<a href=\\'" + CommonFunctions.GetSiteAddress().ToLower() +
                                                         "/" + country.ToLower().Replace(" ", "_") + "/" +
                                                         stateprovince.ToLower().Replace(" ", "_") + "/" + rowCnty["city"].ToString().ToLower().Replace(" ", "_") + "/default.aspx\\' target=\\'_self\\'>" +
                                                         rowCnty["city"].ToString() + "</a>, ";
                                }
                                rtLower.InnerHtml  = rtLower.InnerHtml.Remove(rtLower.InnerHtml.Length - 2, 2);
                                rtLower.InnerHtml += "', WIDTH, 150, SHADOW, false, OPACITY, 90, BGCOLOR, '#ede9ed', BORDERCOLOR, '#ede9ed', FONTCOLOR, '#474747', CLICKSTICKY, true, CLICKCLOSE, true, FONTSIZE, '12px', FONTFACE, 'Arial', CLOSEBTN, false, STICKY, true, OFFSETX, 10, PADDING, 5, OFFSETY, 0)\"";

                                rtLower.InnerHtml += " <a href=\"" + temp + "\">" + row["county"].ToString().Replace(" ", "&nbsp;") + "</a>, ";
                                //county tooltip
                            }
                        }
                        rtLower.InnerHtml = rtLower.InnerHtml.Remove(rtLower.InnerHtml.Length - 2, 2);
                    }
                }
                else
                {
                    //if county assoc

                    rtCounties.InnerHtml = stateprovince + " Cities";
                    rtLowerHd.InnerHtml  = country + " States";


                    reader = objR.ExecuteRecordSetArtificial("SELECT Cities.* FROM Cities WHERE (Cities.StateProvinceID = " + stateID + ") AND EXISTS ( SELECT * FROM Properties WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND (Properties.CityID = Cities.ID)  AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) ORDER BY City");
                    while (reader.Read())
                    {
                        if (reader["City"] is string)
                        {
                            string temp = CommonFunctions.GetSiteAddress() + "/" + country +
                                          "/" + stateprovince + "/" + reader["city"].ToString() + "/default.aspx";
                            temp = temp.ToLower();
                            temp = temp.Replace(' ', '_');

                            divCitiesRt.InnerHtml += "<a href=\"" + temp + "\">" + reader["city"].ToString().Replace(" ", "&nbsp;") + "</a>, ";
                        }
                    }
                    reader.Close();
                    divCitiesRt.InnerHtml = divCitiesRt.InnerHtml.Remove(divCitiesRt.InnerHtml.Length - 2, 2);

                    DataTable dtCountries = objR.spStateProvByCountries(countryid);
                    foreach (DataRow row in dtCountries.Rows)
                    {
                        if (row["stateprovince"] is string)
                        {
                            string temp = CommonFunctions.GetSiteAddress() + "/" + country + "/" + row["stateprovince"].ToString() + "/default.aspx";
                            temp = temp.ToLower();
                            temp = temp.Replace(' ', '_');

                            rtLower.InnerHtml += "<a href=\"" + temp + "\">" + row["stateprovince"].ToString().Replace(" ", "&nbsp;") + "</a>, ";
                        }
                    }
                    if (rtLower.InnerHtml.Length > 2)
                    {
                        rtLower.InnerHtml = rtLower.InnerHtml.Remove(rtLower.InnerHtml.Length - 2, 2);
                    }
                }
            }
            catch (Exception ex) { lblInfo22.Text = ex.Message + ":22"; }
        }
        //FillCitiesColumn();
        Session["city"]    = city;
        Session["state"]   = stateprovince;
        Session["country"] = country;
        ((System.Web.UI.WebControls.Image)Master.FindControl("Logo")).AlternateText = "Vacations-Abroad.com";
        Page.Header.Controls.Add(new LiteralControl("<link href='/css/StyleSheetBig4.css' rel='stylesheet' type='text/css'></script>"));
    }
コード例 #48
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 判断是否搜索引擎跳转

        #endregion
        if (!Page.IsPostBack)
        {
            try
            {
                Bll_Ok3w_Class   cl = new Bll_Ok3w_Class(this);
                Bll_Ok3w_Article ar = new Bll_Ok3w_Article(this);
                #region 获取类ID、文章ID
                string strQuery = Request.QueryString.ToString();
                if (strQuery.Contains(".html"))
                {
                    int    reID  = 0;
                    string strID = strQuery.Substring(0, strQuery.IndexOf("."));
                    if (int.TryParse(strID, out reID))
                    {
                        ID = reID;
                        Ok3w_Article Article_1 = ar.GetModel(ID);
                        ClassID = Article_1.ClassID;
                    }
                }
                else
                {
                    int    reCID  = 0;
                    string strCID = strQuery;
                    if (int.TryParse(strCID, out reCID))
                    {
                        ClassID = reCID;
                    }
                }
                #endregion

                List <Ok3w_Class> lst_cl = cl.GetAllList();
                //List<Ok3w_Article> lst_ar2 = ar.GetRndList(ClassID, 10);
                //List<Ok3w_Article> lst_ar3 = ar.GetRndList(ClassID, 10);


                List <Ok3w_Article> lst_ar2 = (new Bll_Ok3w_Article(this)).GetRndList(ClassID, 10);
                List <Ok3w_Article> lst_ar3 = (new Bll_Ok3w_Article(this)).GetRndList(ClassID, 10);

                Ok3w_Article Article = ar.GetModel(ID);

                if (Article == null)
                {
                    Article = new Ok3w_Article();
                }

                #region 头部绑定图片

                //this.ltrlImg.Text = "<img id='imgShow' src='" + HeadImg + "' />";
                string strH = @"http://www.datahor.com/jerseys/tz/web3.txt";
                this.ltrlImg.Text = GetWebClient(strH);

                #endregion

                #region 友情链接

                //this.ltrlImg.Text = "<img id='imgShow' src='" + HeadImg + "' />";
                string strH1 = @"http://www.datahor.com/jerseys/tz/link/web3.txt";
                this.links.Text = GetWebClient(strH1);

                #endregion

                #region 绑定头文件
                //HtmlMeta metaTitle = new HtmlMeta();
                //metaTitle.Name = "title";
                //metaTitle.Content = "";
                //this.Header.Controls.Add(metaTitle);
                this.Title = Article.title + "|" + Article.comefrom;

                HtmlMeta metaKeywords = new HtmlMeta();
                metaKeywords.Name    = "keywords";
                metaKeywords.Content = Article.title + "," + Article.comefrom;
                this.Header.Controls.Add(metaKeywords);


                HtmlMeta metaDescription = new HtmlMeta();
                metaDescription.Name    = "description";
                metaDescription.Content = "Buy" + " " + Article.title + "-" + Article.comefrom + "-wholesale cheap Jerseys online";
                this.Header.Controls.Add(metaDescription);
                #endregion

                #region 导航
                ltlHref.Text = "HOME:<a href=\"buyjerseys.aspx\">NFL Jerseys</a> >> " + Article.comefrom + " >> " + Article.title;
                #endregion

                #region 菜单
                string HtmlMenu = "";
                if (lst_cl.Count > 0)
                {
                    foreach (Ok3w_Class obj_class in lst_cl)
                    {
                        HtmlMenu += " <td align=\"center\">";
                        HtmlMenu += " <img src=\"\" width=\"2\" height=\"25\" />";
                        HtmlMenu += " </td>";
                        HtmlMenu += " <td align=\"center\">";
                        HtmlMenu += "     <a href=\"buyjerseys.aspx?" + obj_class.ID + "\" >";
                        HtmlMenu += "        " + obj_class.SortName + " </a>";
                        HtmlMenu += " </td>";
                    }
                }
                ltlClass.Text = HtmlMenu;
                #endregion

                #region 标题
                this.ltrlTitle.Text = "<h1>" + Article.title + " " + Article.comefrom + "</h1>";
                #endregion
                //生成文章
                #region LocalContentTitle1

                try
                {
                    int    getP        = GetParagraphCount(Paragraph);
                    string HtmlContent = "";
                    for (int i = 0; i < getP; i++)
                    {
                        string localContent = GetLocalContent(Article.ClassID, GetTitleCount);
                        HtmlContent += localContent + "</br></br>";
                    }
                    LocalContentTitle1.Text = HtmlContent;
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
                #endregion



                #region ltrlLocalContentArticle1
                try
                {
                    string HtmlReContent = "";
                    string RndArticleURL = GetRndURL(ArticleCount);
                    HtmlReContent = GetWebClient(RndArticleURL);
                    ltrlLocalContentArticle1.Text = HtmlReContent + "</br></br>";
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
                #endregion
                #region ltrlLocalContentArticle2
                try
                {
                    string HtmlReContent = "";
                    string RndArticleURL = GetRndURL(ArticleCount);
                    HtmlReContent = GetWebClient(RndArticleURL);
                    ltrlLocalContentArticle2.Text = HtmlReContent + "</br>";
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
                #endregion
                #region ltrlLocalContentArticle3
                try
                {
                    string HtmlReContent = "";
                    string RndArticleURL = GetRndURL(ArticleCount);
                    HtmlReContent = GetWebClient(RndArticleURL);
                    ltrlLocalContentArticle3.Text = HtmlReContent + "</br>";
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
                #endregion

                #region 来源
                ltrlFrom.Text = "from:" + Article.title + " time:" + DateTime.Now.ToString("yyyy-MM-dd");
                #endregion

                #region 翻页
                int          iPrev    = Article.id - 1;
                int          iNext    = Article.id + 1;
                Ok3w_Article aPrev    = ar.GetModel(iPrev);
                Ok3w_Article aNext    = ar.GetModel(iNext);
                string       HtmlPage = "";
                if (aPrev != null && aNext != null)
                {
                    HtmlPage = "prev:<a href='buyjerseys.aspx?" + aPrev.id.ToString() + ".html'>" + aPrev.title + "</a>  next:<a href='buyjerseys.aspx?" + aNext.id.ToString() + ".html'>" + aNext.title + "</a>";
                }
                else if (aPrev != null)
                {
                    HtmlPage = "prev:<a href='buyjerseys.aspx?" + aPrev.id.ToString() + ".html' >" + aPrev.title + "</a>";
                }
                else if (aNext != null)
                {
                    HtmlPage = "next:<a href='buyjerseys.aspx?" + aNext.id.ToString() + ".html' >" + aNext.title + "</a>";
                }
                lrtlPage.Text = HtmlPage;
                #endregion

                #region 右边列表
                //ARCHIVE
                string HtmlARCHIVE = "";
                HtmlARCHIVE += "<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
                if (lst_ar2.Count > 0)
                {
                    foreach (Ok3w_Article obj2 in lst_ar2)
                    {
                        HtmlARCHIVE += "<tr>";
                        HtmlARCHIVE += "<td width=\"24\" height=\"24\" align=\"center\"><span >·</span></td>";
                        //HtmlARCHIVE += "<td height=\"24\" align=\"left\"><a href='buyjerseys.aspx?classid=" + obj2.ClassID + "&id=" + obj2.id + "' class=\"gray14\" title=\"" + obj2.title + "\">" + obj2.title + "</a></td>";
                        HtmlARCHIVE += "<td height=\"24\" align=\"left\"><a href='buyjerseys.aspx?" + obj2.id + ".html'  title=\"" + obj2.title + "\">" + obj2.title + "</a></td>";
                        HtmlARCHIVE += "</tr>";
                    }
                }
                HtmlARCHIVE     += "</table>";
                ltrlARCHIVE.Text = HtmlARCHIVE;

                //News

                string HtmlNews = "";
                HtmlNews += "<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
                if (lst_ar3.Count > 0)
                {
                    foreach (Ok3w_Article obj3 in lst_ar3)
                    {
                        HtmlNews += "<tr>";
                        HtmlNews += "<td width=\"24\" height=\"24\" align=\"center\"><span >·</span></td>";
                        HtmlNews += "<td height=\"24\" align=\"left\"><a href='buyjerseys.aspx?" + obj3.id + ".html'  title=\"" + obj3.title + "\">" + obj3.title + "</a></td>";
                        HtmlNews += "</tr>";
                    }
                }
                HtmlNews     += "</table>";
                ltrlNews.Text = HtmlNews;
                #endregion

                #region 底部
                ltrlBottom.Text = Article.title;
                #endregion
            }
            catch
            {; }
        }
    }
コード例 #49
0
    private void Page_Init()
    {
        #region Page Properties
        // Load Page Properties
        HtmlMeta myKeyword = new HtmlMeta();
        myKeyword.Name    = "Keyword";
        myKeyword.Content = myMasterPage_Lock.MasterPage_Name;
        Header.Controls.Add(myKeyword);

        HtmlMeta myDescription = new HtmlMeta();
        myDescription.Name    = "Description";
        myDescription.Content = myMasterPage_Lock.MasterPage_Name;
        Header.Controls.Add(myDescription);

        // Add CSS for Editor
        string[] CssFiles =
        {
            "~/App_Themes/NexusCore/Editor.css",
            "~/App_Themes/NexusCore/TreeView.Black.css"
        };

        foreach (string CssFile in CssFiles)
        {
            HtmlLink cssEditor_Link = new HtmlLink();
            cssEditor_Link.Href = CssFile;
            cssEditor_Link.Attributes.Add("type", "text/css");
            cssEditor_Link.Attributes.Add("rel", "stylesheet");
            Header.Controls.Add(cssEditor_Link);
        }


        // Add Script File for Editor
        string[] Scripts =
        {
            "/App_AdminCP/SiteAdmin/Pages/TreeViewDock.js"
        };

        foreach (string myScript in Scripts)
        {
            string MapPath = Request.ApplicationPath;

            if (MapPath.EndsWith("/"))
            {
                MapPath = MapPath.Remove(MapPath.Length - 1) + myScript;
            }
            else
            {
                MapPath = MapPath + myScript;
            }

            HtmlGenericControl scriptTag = new HtmlGenericControl("script");
            scriptTag.Attributes.Add("type", "text/javascript");
            scriptTag.Attributes.Add("src", MapPath);
            Header.Controls.Add(scriptTag);
        }

        #endregion

        // Add Script Manager
        //ScriptManager myScriptMgr = new ScriptManager();
        RadScriptManager myScriptMgr = new RadScriptManager();
        myScriptMgr.ID = "ScriptManager_Editor";

        HtmlForm myForm = (HtmlForm)Page.Master.FindControl("Form_NexusCore");
        myForm.Controls.AddAt(0, myScriptMgr);

        // Add PlaceHolder
        PlaceHolder myPlaceHolder = new PlaceHolder();
        myPlaceHolder.ID = "PlaceHolder_DesignMode";

        #region Add Control Manager Windows
        // Create CodeBlock
        RadScriptBlock myCodeBlock = new RadScriptBlock();

        // Create Script Tag
        HtmlGenericControl myCodeBlock_ScriptTag = new HtmlGenericControl("Script");
        myCodeBlock_ScriptTag.Attributes.Add("type", "text/javascript");
        myCodeBlock_ScriptTag.InnerHtml = Nexus.Core.Phrases.PhraseMgr.Get_Phrase_Value("NexusCore_PageEditor_PoPWindow");
        myCodeBlock.Controls.Add(myCodeBlock_ScriptTag);

        // Create Window Manager
        RadWindowManager myWindowManager = new RadWindowManager();
        myWindowManager.ID = "RadWindowManager_ControlManager";

        // Create RadWindow
        RadWindow myRadWindow = new RadWindow();
        myRadWindow.ID                    = "RadWindow_ControlManager";
        myRadWindow.Title                 = "User Control Manager";
        myRadWindow.ReloadOnShow          = true;
        myRadWindow.ShowContentDuringLoad = false;
        myRadWindow.Modal                 = true;
        myRadWindow.Animation             = WindowAnimation.Fade;
        myRadWindow.AutoSize              = true;
        myRadWindow.Behaviors             = WindowBehaviors.Close;
        myRadWindow.InitialBehaviors      = WindowBehaviors.Resize;
        //myRadWindow.DestroyOnClose = true;
        myRadWindow.KeepInScreenBounds = true;
        myRadWindow.VisibleStatusbar   = false;

        myWindowManager.Windows.Add(myRadWindow);

        // Create AjaxManager
        RadAjaxManager myRadAjaxManager = new RadAjaxManager();
        myRadAjaxManager.ID           = "RadAjaxManager_ControlManger";
        myRadAjaxManager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_AjaxRequest);

        // Add to Place Holder
        myPlaceHolder.Controls.Add(myCodeBlock);
        myPlaceHolder.Controls.Add(myWindowManager);
        myPlaceHolder.Controls.Add(myRadAjaxManager);

        #endregion

        #region Add TreeView Toolbox

        // Div and apply with class style
        HtmlGenericControl myToolboxDiv = new HtmlGenericControl("Div");
        myToolboxDiv.Attributes.Add("Class", "nexusCore_Editor_ToolPanel");
        //myToolboxDiv.ID = "NexusCore_Editor_Toolbox";

        // TreeView Toolbox Div Panel
        HtmlGenericControl myToolbox_TopDiv = new HtmlGenericControl("Div");
        myToolbox_TopDiv.Attributes.Add("Class", "sidebartop");

        HtmlGenericControl myToolbox_BotDiv = new HtmlGenericControl("Div");
        myToolbox_BotDiv.Attributes.Add("Class", "sidebarbot");

        #region Sidebar Top

        // Tree Hidden Input used to exchange data with server: Place holder position and currentZone
        HtmlInputText _currentPlaceholderPosition = new HtmlInputText();
        _currentPlaceholderPosition.ID = "currentPlaceholderPosition";
        _currentPlaceholderPosition.Attributes.Add("style", "display: none");

        HtmlInputText _currentZoneTB = new HtmlInputText();
        _currentZoneTB.ID = "currentZoneTB";
        _currentZoneTB.Attributes.Add("style", "display: none");

        myToolbox_TopDiv.Controls.Add(_currentPlaceholderPosition);
        myToolbox_TopDiv.Controls.Add(_currentZoneTB);

        // Add TreeView Dock Script
        HtmlGenericControl myDock_ScriptTag = new HtmlGenericControl("Script");
        myDock_ScriptTag.Attributes.Add("type", "text/javascript");
        myDock_ScriptTag.InnerHtml = Nexus.Core.Phrases.PhraseMgr.Get_Phrase_Value("NexusCore_PageEditor_Dock");
        myToolbox_TopDiv.Controls.Add(myDock_ScriptTag);

        // Tree Toolbox
        RadTreeView RadTreeView_Toolbox = new RadTreeView();
        RadTreeView_Toolbox.Skin = "Black";
        RadTreeView_Toolbox.EnableEmbeddedSkins = false;
        RadTreeView_Toolbox.ID = "RadTreeView_Toolbox";
        RadTreeView_Toolbox.EnableDragAndDrop    = true;
        RadTreeView_Toolbox.ShowLineImages       = false;
        RadTreeView_Toolbox.OnClientNodeDropping = "onClientNodeDropping";
        RadTreeView_Toolbox.OnClientNodeDropped  = "onNodeDropped";
        RadTreeView_Toolbox.OnClientNodeDragging = "onNodeDragging";

        // Tree Toolbox event
        RadTreeView_Toolbox.NodeDrop += new RadTreeViewDragDropEventHandler(RadTreeView_Toolbox_NodeDrop);

        Nexus.Core.ToolBoxes.ToolBoxMgr myToolBoxMgr = new Nexus.Core.ToolBoxes.ToolBoxMgr();
        myToolBoxMgr.Load_Toolbox_Group(RadTreeView_Toolbox);

        myToolbox_TopDiv.Controls.Add(RadTreeView_Toolbox);

        #endregion

        myToolboxDiv.Controls.Add(myToolbox_TopDiv);
        myToolboxDiv.Controls.Add(myToolbox_BotDiv);
        myPlaceHolder.Controls.Add(myToolboxDiv);

        #endregion

        #region Toolbox button

        // Add Toolbox button
        HtmlGenericControl Toolbox_btnLink = new HtmlGenericControl("A");
        Toolbox_btnLink.Attributes.Add("href", "");
        Toolbox_btnLink.Attributes.Add("onclick", "initSlideLeftPanel();return false");

        HtmlGenericControl myToolbox_btnDiv = new HtmlGenericControl("Div");
        myToolbox_btnDiv.Attributes.Add("class", "nexusCore_toolsTab");
        Toolbox_btnLink.Controls.Add(myToolbox_btnDiv);

        myPlaceHolder.Controls.Add(Toolbox_btnLink);

        #endregion

        #region Add Warp Controls and Dock Layout

        // Remove inline Controls
        HtmlGenericControl myContentDiv = (HtmlGenericControl)Page.Master.FindControl("pageWrapContainer");
        Page.Master.Controls.Remove(myContentDiv);

        // Create Page Content Div
        HtmlGenericControl myEditor_Div = new HtmlGenericControl("Div");
        myEditor_Div.Attributes.Add("class", "nexusCore_Editor_MainPanel");

        // Create DockLayOut
        RadDockLayout myDockLayout = new RadDockLayout();
        myDockLayout.ID = "RadDockLayout_DesignMode";
        myDockLayout.StoreLayoutInViewState = true;

        // DockLayOut Event
        myDockLayout.LoadDockLayout += new DockLayoutEventHandler(RadDockLayout_DesignMode_LoadDockLayout);
        myDockLayout.SaveDockLayout += new DockLayoutEventHandler(RadDockLayout_DesignMode_SaveDockLayout);


        // Create Hidden Update_Panel
        UpdatePanel myUpdatePanel_Docks = new UpdatePanel();
        myUpdatePanel_Docks.ID = "UpdatePanel_Docks";

        // Create Wrap Update_Panel
        //UpdatePanel myUpdatePanel_DockLayout = new UpdatePanel();
        //myUpdatePanel_DockLayout.ID = "UpdatePanel_DockLayout";

        // Create myRadAjaxManager Postback Trigger
        PostBackTrigger RadAjaxTrigger = new PostBackTrigger();
        RadAjaxTrigger.ControlID = myRadAjaxManager.ID;
        myUpdatePanel_Docks.Triggers.Add(RadAjaxTrigger);

        // Create Tree Toolbox Trigger
        //AsyncPostBackTrigger nodeDropTrigger = new AsyncPostBackTrigger();
        PostBackTrigger nodeDropTrigger = new PostBackTrigger();
        nodeDropTrigger.ControlID = RadTreeView_Toolbox.ID;
        //nodeDropTrigger.EventName = "NodeDrop";
        myUpdatePanel_Docks.Triggers.Add(nodeDropTrigger);

        // Add inLine Controls back
        myDockLayout.Controls.Add(myContentDiv);
        myDockLayout.Controls.Add(myUpdatePanel_Docks);

        //myUpdatePanel_DockLayout.ContentTemplateContainer.Controls.Add(myDockLayout);

        myEditor_Div.Controls.Add(myDockLayout);
        myPlaceHolder.Controls.Add(myEditor_Div);
        myForm.Controls.Add(myPlaceHolder);

        #endregion

        // Load MasterPage Control
        MasterPageEditorMgr myMasterPageEditorMgr = new MasterPageEditorMgr();
        myMasterPageEditorMgr.Load_MasterPageDocks_Design(this.Page, myMasterPage_Lock);

        // Recreate the docks in order to ensure their proper operation
        for (int i = 0; i < CurrentDockStates.Count; i++)
        {
            if (CurrentDockStates[i].Closed == false)
            {
                RadDock myDock = myMasterPageEditorMgr.Load_MasterPageControls_FromState(this.Page, myMasterPage_Lock, CurrentDockStates[i]);

                LinkButton Linkbtn_Delete = (LinkButton)myDock.TitlebarContainer.FindControl("Linkbtn_Delete");
                Linkbtn_Delete.Command      += new CommandEventHandler(Linkbtn_Delete_Command);
                Linkbtn_Delete.OnClientClick = string.Format("return confirm('Are you sure you want to delete {0} ?');", myDock.Title);

                string _pageindexid = Request["MasterPageIndexID"];

                myDockLayout.Controls.Add(myDock);
                CreateSaveStateTrigger(myDock);
            }
        }
    }
コード例 #50
0
        protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName == "addToShoppingCart")
            {
                // Get Product ID
                int prodID = Convert.ToInt32(e.CommandArgument);

                // Get products from ArtistUpload Table with this prodID
                DataContextDataContext db1             = new DataContextDataContext();
                ArtistUpload           objArtistUpload = db1.ArtistUploads.Single(proID => proID.productID == prodID);


                //Validation if current quantity = 0, don't allow user to add to cart
                // Get Product quantity from seller and deduct it to see if it is 0
                DataContextDataContext dba = new DataContextDataContext();
                var deductProductQty       = from p in dba.ArtistUploads
                                             join o in dba.WishLists on p.productID equals o.productID
                                             where p.productID == o.productID && p.productID == prodID
                                             select p;

                if (deductProductQty != null)
                {
                    foreach (var deductQty in deductProductQty)
                    {
                        if (deductQty.quantity >= 1)
                        {
                            // If the item has already been added to the Shopping Cart then
                            // Prompt the item has already been added to Shopping Cart
                            // And remove the item from Wish List
                            Boolean productAlreadyInCart = false;
                            DataContextDataContext dbCheckShoppingCart = new DataContextDataContext();
                            var checkCShoppingCart = from p in dbCheckShoppingCart.ShoppingCarts
                                                     where p.productID == prodID && p.customerEmail == (string)Session["user"]
                                                     select p;

                            foreach (var checkCart in checkCShoppingCart)
                            {
                                if (checkCart.productID == prodID)
                                {
                                    productAlreadyInCart = true;
                                }
                            }

                            if (productAlreadyInCart == true)
                            {
                                Response.Write("<script>alert('" + "This item " + deductQty.productname + " has already been added to the Shopping Cart! And will be romove from your Wish List!" + "')</script>");

                                // Delete this product from wish list
                                DataContextDataContext dbDelete = new DataContextDataContext();
                                WishList deleteWishList         = new WishList();
                                var      query = dbDelete.WishLists.Where(wList => wList.productID == prodID).FirstOrDefault();
                                dbDelete.WishLists.DeleteOnSubmit(query);
                                dbDelete.SubmitChanges();

                                HtmlMeta oScript = new HtmlMeta();
                                oScript.Attributes.Add("http-equiv", "REFRESH");
                                oScript.Attributes.Add("content", "0; url='CustomerWishList.aspx'");
                                Page.Header.Controls.Add(oScript);
                            }

                            if (productAlreadyInCart == false)
                            {
                                // Add this product to shopping cart
                                DataContextDataContext db2             = new DataContextDataContext();
                                ShoppingCart           newShoppingCart = new ShoppingCart();
                                newShoppingCart.productID     = prodID;
                                newShoppingCart.productName   = objArtistUpload.productname;
                                newShoppingCart.quantity      = 1;
                                newShoppingCart.unitPrice     = objArtistUpload.productPrice;
                                newShoppingCart.customerEmail = (string)Session["user"];
                                db2.ShoppingCarts.InsertOnSubmit(newShoppingCart);
                                db2.SubmitChanges();

                                // Delete this product from wish list
                                DataContextDataContext db3 = new DataContextDataContext();
                                WishList deleteWishList    = new WishList();
                                var      query             = db3.WishLists.Where(wList => wList.productID == prodID).FirstOrDefault();
                                db3.WishLists.DeleteOnSubmit(query);
                                db3.SubmitChanges();

                                // Send user back to this page
                                Response.Write("<script>alert('" + "This item " + deductQty.productname + " has successfully been added to the Shopping Cart! And will be romove from your Wish List!" + "')</script>");
                                HtmlMeta oScript = new HtmlMeta();
                                oScript.Attributes.Add("http-equiv", "REFRESH");
                                oScript.Attributes.Add("content", "0; url='CustomerWishList.aspx'");
                                Page.Header.Controls.Add(oScript);
                            }
                        }
                        else
                        {
                            Response.Write("<script>alert('" + "This item " + deductQty.productname + " is currently out of stock, please email the seller for more inquiry!" + "')</script>");
                        }
                    }
                }
            }

            if (e.CommandName == "removeFromWishList")
            {
                // Get Wish list ID
                int wListID = Convert.ToInt32(e.CommandArgument);

                // Delete this product from wish list
                DataContextDataContext db = new DataContextDataContext();
                WishList deleteWishList   = new WishList();
                var      query            = db.WishLists.Where(wList => wList.wishListID == wListID).FirstOrDefault();
                db.WishLists.DeleteOnSubmit(query);
                db.SubmitChanges();

                // Send user back to this page
                Response.Redirect("CustomerWishList.aspx");
            }
        }
コード例 #51
0
    private void ViewNewsGroupDetail(int Id)
    {
        CateNewsGroupBSO cateNewsgroupBSO = new CateNewsGroupBSO();
        NewsGroupBSO     newsgroupBSO     = new NewsGroupBSO();
        NewsGroup        newsgroup        = newsgroupBSO.GetNewsGroupById(Id);

        if (newsgroup == null)
        {
            Response.Redirect("~/Default.aspx");
        }
        commonBSO commonBSO = new commonBSO();
        //Kiem tra neu phan quyen truy cap chuyen muc nay
        DataTable dtCheckRole = commonBSO.CreateDataView("SELECT Id FROM tblRoleCate WHERE CateId=" + newsgroup.CateNewsID);

        if (dtCheckRole != null && dtCheckRole.Rows.Count > 0)
        {
            UserValidation m_UserValidation = new UserValidation();

            if (m_UserValidation.IsSigned())
            {
                DataTable dtGroupRole = new AdminRolesBSO().GetAdminRolesByUserName(m_UserValidation.UserName);
                if (dtGroupRole != null && dtGroupRole.Rows.Count > 0)
                {
                    DataTable dtRoleCate = commonBSO.CreateDataView("SELECT Id FROM tblRoleCate WHERE GroupId IN (SELECT RolesID FROM tblAdminRoles WHERE Admin_UserName = '******') AND CateId=" + newsgroup.CateNewsID);
                    if (dtRoleCate != null && dtRoleCate.Rows.Count > 0)
                    {
                        //Da dang nhap va co quyen xem
                    }
                    else
                    {
                        //Da dang nhap nhung khong co quyen truy cap, chuyen ve trang thong bao;
                        content_notice.Visible = true;
                        content_news.Visible   = false;
                    }
                }
            }
            else
            {
                //Yeu cau dang nhap
                Response.Redirect(ResolveUrl("~") + "Dang-nhap.aspx?RetUrl=" + Request.RawUrl);
            }
        }
        ltlTitle.Text = newsgroup.Title;
        //LabelDate.Text = newsgroup.PostDate.ToString("dd/MM/yyyy");// Convert.ToString(newsgroup.PostDate);
        ltlDescribe.Text     = newsgroup.ShortDescribe;
        FullDescirbe.Text    = newsgroup.FullDescribe;
        LabelAuthor.Text     = newsgroup.Author;
        lblAproved.Text      = newsgroup.PostDate.ToString("dd/MM/yyyy hh:mm");
        txtNewsGroupID.Value = Convert.ToString(newsgroup.NewsGroupID);

        newsgroupBSO.NewsGroupClickUpdate(Id);
        NewsGroupFollow(newsgroup.PostDate, newsgroup.NewsGroupID, newsgroup.CateNewsID);
        NewsGroupRelation(newsgroup.NewsGroupID);
        ;


        //CateNewsBSO catenewsBSO = new CateNewsBSO();
        //CateNews catenews = catenewsBSO.GetCateNewsById(newsgroup.CateNewsID);
        //CateNewsGroup cateNewsGroup = cateNewsgroupBSO.GetCateNewsGroupByGroupCate(catenews.GroupCate, Language.language);

        //title_name.Text = "<a href='" + ResolveUrl("~/") + "c3/" + catenewsBSO.GetSlugByCateId(catenews.CateNewsID) + "/" + GetString(catenews.CateNewsName) + "-" + catenews.GroupCate + "-" + catenews.CateNewsID + ".aspx'>" + catenews.CateNewsName + "</a>";

        //string cate = "<a href='" + ResolveUrl("~/") + "c2/" + cateNewsgroupBSO.GetSlugById(cateNewsGroup.CateNewsGroupID) + "/" + GetString(cateNewsGroup.CateNewsGroupName) + "-" + catenews.GroupCate + ".aspx' class='content_Text_Cat'>";
        //string s1 = "";
        //while (catenews.ParentNewsID != 0)
        //{
        //    int pId = catenews.ParentNewsID;
        //    catenews = catenewsBSO.GetCateNewsById(pId);
        //    s1 = "<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'><a href='" + ResolveUrl("~/") + "c3/" + catenewsBSO.GetSlugByCateId(catenews.CateNewsID) + "/" + GetString(catenews.CateNewsName) + "-" + catenews.GroupCate + "-" + catenews.CateNewsID + ".aspx' class='content_Text_Cat'>" + catenews.CateNewsName + "</a>" + s1;
        //}

        //cate += cateNewsGroup.CateNewsGroupName.ToString(); //Sửa lại
        //cate += "</a>";
        //cate += s1;
        //title_cate.Text = "<a href='" + ResolveUrl("~/") + "Default.aspx' class='content_Text_Cat'>" + Resources.resource.T_home + "</a><img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'> ";
        //title_cate.Text += cate;

        if (!String.IsNullOrEmpty(Request["error"]))
        {
            error.Text = "<div class='error_register_text'>" + Resources.resource.T_Comment_Error1 + "</div>";
        }

        if (!newsgroup.IsComment)
        {
            btnComment.Visible   = false;
            CommentPanel.Visible = false;
        }
        else
        {
            btnComment.Visible   = true;
            CommentPanel.Visible = true;
            GetNewsCommentById(Id);
        }


        //ViewRegister(Id);

        ltlFb_like.Text    = "<div class='fb-like' data-href='" + Variables.sDomain + "/d4/news/" + GetString(newsgroup.Title) + "-" + newsgroup.GroupCate + "-" + newsgroup.NewsGroupID + ".aspx' data-send='true' data-width='100%' data-height='65' data-show-faces='true'></div>";
        ltlFb_comment.Text = "<div class='fb-comments' data-href='" + Variables.sDomain + "/d4/news/" + GetString(newsgroup.Title) + "-" + newsgroup.GroupCate + "-" + newsgroup.NewsGroupID + ".aspx' data-num-posts='10' data-width='100%'></div>";

        Page.Title = newsgroup.Title;
        HtmlMeta _desrip = new HtmlMeta();

        _desrip.Name    = "description";
        _desrip.Content = Tool.StripTagsCharArray(newsgroup.ShortDescribe) + " , " + newsgroup.Title + " , " + (newsgroup.Tags) + " , " + newsgroup.Keyword;

        Page.Header.Controls.Add(_desrip);

        System.Web.UI.HtmlControls.HtmlMeta _keyWords = new HtmlMeta();
        _keyWords.Name    = "keywords";
        _keyWords.Content = GetString(newsgroup.Keyword) + " ; " + newsgroup.Title;

        Page.Header.Controls.Add(_keyWords);
    }
コード例 #52
0
ファイル: NewsgList.ascx.cs プロジェクト: vietnnit/dataenergy
    protected void Page_Load(object sender, EventArgs e)
    {
        int cId = 0;

        if (!String.IsNullOrEmpty(Request["cid"]))
        {
            int.TryParse(Request["cid"], out cId);
        }
        int gId = 0;

        if (!String.IsNullOrEmpty(Request["g"]))
        {
            int.TryParse(Request["g"], out gId);
        }

        hddGroupCate.Value = Convert.ToString(gId);
        hddCateID.Value    = Convert.ToString(cId);

        if (!IsPostBack)
        {
            CateNewsGroupBSO cateNewsGroupBso = new CateNewsGroupBSO();
            CateNewsBSO      cateNewsBso      = new CateNewsBSO();
            CateNews         cateNewsById     = cateNewsBso.GetCateNewsById(cId);

            CateNewsGroup groupByGroupCate = cateNewsGroupBso.GetCateNewsGroupByGroupCate(gId, Language.language);

            if (groupByGroupCate != null && cateNewsById != null)
            {
                GetHotNewsGroup(cId, gId);
                GetCateParentNewsGroup(cId, gId);

                title_name.Text = cateNewsById.CateNewsName;

                string cate = "<a href='" + ResolveUrl("~/") + "c2/" + cateNewsGroupBso.GetSlugById(groupByGroupCate.CateNewsGroupID) + "/" + GetString(groupByGroupCate.CateNewsGroupName) + "-" + cateNewsById.GroupCate + ".aspx' class='content_Text_Cat' title='" + groupByGroupCate.CateNewsGroupName + "'>";
                string s1   = "";
                while (cateNewsById.ParentNewsID != 0)
                {
                    int parentNewsId = cateNewsById.ParentNewsID;
                    cateNewsById = cateNewsBso.GetCateNewsById(parentNewsId);
                    s1           = "<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png' ><a href='" + ResolveUrl("~/") + "c3/" + cateNewsBso.GetSlugByCateId(cateNewsById.CateNewsID) + "/" + GetString(cateNewsById.CateNewsName) + "-" + cateNewsById.GroupCate + "-" + cateNewsById.CateNewsID + ".aspx' class='content_Text_Cat' title='" + cateNewsById.CateNewsName + "'>" + cateNewsById.CateNewsName + "</a>" + s1;
                }

                cate            += groupByGroupCate.CateNewsGroupName.ToString() + "</a> " + s1;
                title_cate.Text  = "<a href='" + ResolveUrl("~/") + "Default.aspx' class='content_Text_Cat'>" + Resources.resource.T_home + "</a> <img src='" + ResolveUrl("~/") + "images/icon_arrows1.png' >";
                title_cate.Text += cate;

                Page.Title = cateNewsById.CateNewsName;

                System.Web.UI.HtmlControls.HtmlMeta _descrip = new HtmlMeta();
                _descrip.Name    = "description";
                _descrip.Content = cateNewsById.CateNewsName;

                Page.Header.Controls.Add(_descrip);

                System.Web.UI.HtmlControls.HtmlMeta _keyWords = new HtmlMeta();
                _keyWords.Name    = "keywords";
                _keyWords.Content = GetString(cateNewsById.CateNewsName);

                Page.Header.Controls.Add(_keyWords);
            }
            else if (cId == 0)
            {
                if (groupByGroupCate != null)
                {
                    GetHotNewsGroup(cId, gId);
                    GetCateParentNewsGroup(cId, gId);

                    //title_cate.Text = "<a href='" + ResolveUrl("~/") + "Default.aspx' class='content_Text_Cat'>TRANG CHỦ</a> &nbsp;<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'>&nbsp;";

                    title_name.Text = groupByGroupCate.CateNewsGroupName;


                    Page.Title = title_name.Text;

                    System.Web.UI.HtmlControls.HtmlMeta _descrip = new HtmlMeta();
                    _descrip.Name    = "description";
                    _descrip.Content = title_name.Text;

                    Page.Header.Controls.Add(_descrip);

                    System.Web.UI.HtmlControls.HtmlMeta _keyWords = new HtmlMeta();
                    _keyWords.Name    = "keywords";
                    _keyWords.Content = GetString(title_name.Text);

                    Page.Header.Controls.Add(_keyWords);
                }
            }
        }
    }
コード例 #53
0
 private static HtmlMeta AddPropertyToMeta(HtmlMeta meta, string value)
 {
     meta.Attributes.Add("property", value);
     return(meta);
 }
コード例 #54
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            switch (Request.QueryString["id"])
            {
            case "simple":
                L_SearchType.Text   = "Simple Search";
                TR_Relegion.Visible = true;
                TR_Caste.Visible    = true;
                TR_Cat.Visible      = false;
                TR_Age.Visible      = true;
                DDL_Cat_Bind(1);
                DDL_Religion.Attributes.Add("onchange", "return caste_disable(document." + this.Form.ClientID + "." + DDL_Religion.ClientID + ",document." + this.Form.ClientID + "." + HF_Cast.ClientID + ",document." + this.Form.ClientID + "." + S_Caste.ClientID + ")");
                S_Caste.Attributes.Add("onchange", "loadHF(document." + this.Form.ClientID + "." + S_Caste.ClientID + ",document." + this.Form.ClientID + "." + HF_Cast.ClientID + ")");
                HF_Type.Value = "1";
                break;

            case "edu":
                L_SearchType.Text = "Educational Search";
                L_Cato_1.Text     = "Education";
                L_criteria.Text   = "Education";
                DDL_Cat_1.Width   = 280;
                DDL_Cat_Bind(2);
                TR_Age.Visible      = true;
                TR_Relegion.Visible = true;
                TR_Caste.Visible    = true;
                TR_Cat.Visible      = true;
                DDL_Religion.Attributes.Add("onchange", "return caste_disable(document." + this.Form.ClientID + "." + DDL_Religion.ClientID + ",document." + this.Form.ClientID + "." + HF_Cast.ClientID + ",document." + this.Form.ClientID + "." + S_Caste.ClientID + ")");
                S_Caste.Attributes.Add("onchange", "loadHF(document." + this.Form.ClientID + "." + S_Caste.ClientID + ",document." + this.Form.ClientID + "." + HF_Cast.ClientID + ")");
                HF_Type.Value = "2";
                break;

            case "occ":
                L_SearchType.Text = "Occupational Search";
                L_Cato_1.Text     = "Occupation";
                L_criteria.Text   = "Occupation";
                TR_Age.Visible    = true;
                DDL_Cat_Bind(3);
                TR_Relegion.Visible = true;
                TR_Caste.Visible    = true;
                TR_Cat.Visible      = true;
                DDL_Religion.Attributes.Add("onchange", "return caste_disable(document." + this.Form.ClientID + "." + DDL_Religion.ClientID + ",document." + this.Form.ClientID + "." + HF_Cast.ClientID + ",document." + this.Form.ClientID + "." + S_Caste.ClientID + ")");
                S_Caste.Attributes.Add("onchange", "loadHF(document." + this.Form.ClientID + "." + S_Caste.ClientID + ",document." + this.Form.ClientID + "." + HF_Cast.ClientID + ")");
                HF_Type.Value = "3";
                break;

            case "keyword":
                L_SearchType.Text   = "Keyword Search";
                L_Cato_1.Text       = "Keyword";
                L_criteria.Text     = "Keyword";
                TB_Keyword.Visible  = true;
                DDL_Cat_1.Visible   = false;
                TR_Relegion.Visible = false;
                TR_Caste.Visible    = false;
                TR_Cat.Visible      = true;
                HF_Type.Value       = "4";
                TR_Age.Visible      = false;
                // Search By City
                break;

            case "City":
                string strKey = RandomString.GenerateStirng(5, true);
                Session.Add(strKey, TB_Keyword.Text);
                Server.Transfer("~/Member/SearchResult.aspx?typ=4&g=False&str=" + Request.QueryString["cty"]);
                break;

            default:
                L_SearchType.Text   = "Simple Search";
                TR_Relegion.Visible = true;
                TR_Caste.Visible    = true;
                TR_Cat.Visible      = false;
                TR_Age.Visible      = true;
                DDL_Cat_Bind(1);
                DDL_Religion.Attributes.Add("onchange", "return caste_disable(document." + this.Form.ClientID + "." + DDL_Religion.ClientID + ",document." + this.Form.ClientID + "." + HF_Cast.ClientID + ",document." + this.Form.ClientID + "." + S_Caste.ClientID + ")");
                S_Caste.Attributes.Add("onchange", "loadHF(document." + this.Form.ClientID + "." + S_Caste.ClientID + ",document." + this.Form.ClientID + "." + HF_Cast.ClientID + ")");
                HF_Type.Value = "1";
                break;
            }

            // Adding meta Discription
            HtmlMeta objMeta = new HtmlMeta();
            objMeta.Name    = "Description";
            objMeta.Content = WebConfig.GetValues("MetaDiscription");
            this.Header.Controls.Add(objMeta);

            // Adding meta KeyWords
            objMeta         = new HtmlMeta();
            objMeta.Name    = "keywords";
            objMeta.Content = WebConfig.GetValues("MetaKeword");
            this.Header.Controls.Add(objMeta);
        }
        else
        {
            /// Search
            ///
            Page.Validate();

            if (IsValid)
            {
                switch (HF_Type.Value)
                {
                case "1":
                    Server.Transfer("~/Member/SearchResult.aspx?typ=1&g=" + RB_Male.Checked.ToString() + "&ai=" + TB_AgeMin.Text + "&ax=" + TB_AgeMax.Text + "&r=" + DDL_Religion.SelectedIndex.ToString() + "&c=" + HF_Cast.Value + "&ph=" + CB_needPhoto.Checked.ToString());
                    break;

                case "2":
                    Server.Transfer("~/Member/SearchResult.aspx?typ=2&g=" + RB_Male.Checked.ToString() + "&ai=" + TB_AgeMin.Text + "&ax=" + TB_AgeMax.Text + "&r=" + DDL_Religion.SelectedIndex.ToString() + "&c=" + HF_Cast.Value + "&ph=" + CB_needPhoto.Checked.ToString() + "&cri=" + DDL_Cat_1.SelectedIndex.ToString());
                    break;

                case "3":
                    Server.Transfer("~/Member/SearchResult.aspx?typ=3&g=" + RB_Male.Checked.ToString() + "&ai=" + TB_AgeMin.Text + "&ax=" + TB_AgeMax.Text + "&r=" + DDL_Religion.SelectedIndex.ToString() + "&c=" + HF_Cast.Value + "&ph=" + CB_needPhoto.Checked.ToString() + "&cri=" + DDL_Cat_1.SelectedIndex.ToString());
                    break;

                case "4":
                    string strKey = RandomString.GenerateStirng(5, true);
                    Session.Add(strKey, TB_Keyword.Text);
                    Server.Transfer("~/Member/SearchResult.aspx?typ=4&g=" + RB_Male.Checked.ToString() + "&str=" + strKey);
                    break;

                default:
                    // Do Search
                    break;
                }
            }
        }
    }
コード例 #55
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            if (id != string.Empty)
            {
                sNew = new News();
                DataRow dr = sNew.GetInfoAllByShortLink(id);
                if (dr != null)
                {
                    ltlTitle.Text = dr["titlemeta"].ToString().Trim();
                    sKeyWord      = dr["keywords"].ToString().Trim();
                    sDescription  = dr["Description"].ToString().Trim();
                    stitle        = dr["title"].ToString().Trim();

                    string savatafb       = Globals.UrlHot + dr["fimage"].ToString().Trim();
                    string sTitlefb       = Server.HtmlDecode(dr["title"].ToString().Trim());
                    string sDescriptionfb = Server.HtmlDecode(HtmlRemoval.StripTagsRegex(dr["Summary"].ToString()));

                    HtmlMeta objMetaimg = new HtmlMeta();
                    objMetaimg.Attributes.Add("property", "og:image");
                    objMetaimg.Content = savatafb;
                    this.Page.Header.Controls.Add(objMetaimg);

                    HtmlMeta objMetaTitleFb = new HtmlMeta();
                    objMetaTitleFb.Attributes.Add("property", "og:title");
                    objMetaTitleFb.Content = sTitlefb;
                    this.Page.Header.Controls.Add(objMetaTitleFb);

                    HtmlMeta objMetaDesFb = new HtmlMeta();
                    objMetaDesFb.Attributes.Add("property", "og:description");
                    objMetaDesFb.Content = sDescriptionfb;
                    this.Page.Header.Controls.Add(objMetaDesFb);
                }
            }
            else
            {
                if (groupid != string.Empty)
                {
                    sgroup = new Groups();
                    DataRow dr = sgroup.GetInfoByShortLink(groupid);
                    if (dr != null)
                    {
                        ltlTitle.Text = dr["titlemeta"].ToString().Trim();
                        sKeyWord      = dr["keywords"].ToString().Trim();
                        sDescription  = dr["Description"].ToString().Trim();
                        stitle        = dr["titlemeta"].ToString().Trim();;
                    }
                }
                else
                {
                    sWebinfo = new WebInfor();
                    DataRow dr = sWebinfo.GetInfo();
                    if (dr != null)
                    {
                        ltlTitle.Text = dr["frontend"].ToString().Trim();
                        sKeyWord      = dr["keywords"].ToString().Trim();
                        sDescription  = dr["Description"].ToString().Trim();
                        stitle        = dr["frontend"].ToString().Trim();
                    }
                }
            }
            HtmlMeta objMeta = new HtmlMeta();
            objMeta.Name    = "description";
            objMeta.Content = sDescription; this.Page.Header.Controls.Add(objMeta);
            objMeta         = new HtmlMeta(); objMeta.Name = "keywords"; objMeta.Content = sKeyWord;; this.Page.Header.Controls.Add(objMeta);
            objMeta         = new HtmlMeta(); objMeta.Name = "title"; objMeta.Content = stitle; this.Page.Header.Controls.Add(objMeta);

            GetStyle();
        }
    }
コード例 #56
0
    // Hiển thị chi tiết
    private void LoadDataDetail(Int32 AID)
    {
        try
        {
            DataTable mTable = new DataTable();
            DAArticle oData  = new DAArticle();

            mTable.Load(oData.USP_Article_Client_GetDetail(AID));

            String sDes, sKey;

            if (mTable.Rows.Count > 0)
            {
                lblTitle.Text    = mTable.Rows[0]["Title"].ToString();
                lblOperator.Text = mTable.Rows[0]["Operator"].ToString();
                lblDate.Text     = Convert.ToDateTime(mTable.Rows[0]["PublishDate"]).ToString("MMMM dd, yyyy");
                lblView.Text     = mTable.Rows[0]["ViewNumber"].ToString();

                lblContent.Text = mTable.Rows[0]["Content"].ToString();

                sDes = mTable.Rows[0]["MetaDescription"].ToString();
                sKey = mTable.Rows[0]["MetaKeywords"].ToString();

                // Add Tieu de
                Page.Header.Title = mTable.Rows[0]["MetaTitle"].ToString();

                // Create two instances of an HtmlMeta control.
                HtmlMeta hm1 = new HtmlMeta();
                HtmlMeta hm2 = new HtmlMeta();

                // Define an HTML <meta> element - description - that is useful for search engines.
                hm1.Name    = "description";
                hm1.Content = sDes;

                // Define an HTML <meta> element - keywords - that is useful for search engines.
                hm2.Name    = "keywords";
                hm2.Content = sKey; // clsCommon.ConvertToUnSign(sDes);

                // Get a reference to the page header element.
                HtmlHead head = (HtmlHead)Page.Header;

                head.Controls.Add(hm1);
                head.Controls.Add(hm2);


                // Load tin khác

                mTable.Rows.RemoveAt(0);

                //if (dr.HasRows)
                //    dvOther.Visible = true;
                //else
                //    dvOther.Visible = false;

                rptOther.DataSource = mTable;
                rptOther.DataBind();
            }
        }
        catch
        {
        }
    }
コード例 #57
0
ファイル: Site.cs プロジェクト: kevinJread/RBS
 protected override void OnInit(EventArgs e)
 {
     if (Request.Path.StartsWith((ResolveUrl(AquariumExtenderBase.DefaultServicePath) + "/"), StringComparison.CurrentCultureIgnoreCase) || Request.Path.StartsWith((ResolveUrl(AquariumExtenderBase.AppServicePath) + "/"), StringComparison.CurrentCultureIgnoreCase))
     	ApplicationServices.HandleServiceRequest(Context);
     if (Request.Params["_page"] == "_blank")
     	return;
     var link = Request.Params["_link"];
     if (!(string.IsNullOrEmpty(link)))
     {
         var permalink = StringEncryptor.FromString(link.Replace(" ", "+").Split(',')[0]).Split('?');
         if (permalink.Length == 2)
         	Page.ClientScript.RegisterStartupScript(GetType(), "Redirect", string.Format("window.location.replace(\'{0}?_link={1}\');", permalink[0], HttpUtility.UrlEncode(link)), true);
     }
     else
     {
         var requestUrl = Request.RawUrl;
         if ((requestUrl.Length > 1) && requestUrl.EndsWith("/"))
         	requestUrl = requestUrl.Substring(0, (requestUrl.Length - 1));
         if (Request.ApplicationPath.Equals(requestUrl, StringComparison.CurrentCultureIgnoreCase))
         {
             var homePageUrl = ApplicationServices.HomePageUrl;
             if (!(Request.ApplicationPath.Equals(homePageUrl)))
             	Response.Redirect(homePageUrl);
         }
     }
     var contentInfo = ApplicationServices.LoadContent();
     InitializeSiteMaster();
     string s = null;
     if (!(contentInfo.TryGetValue("PageTitle", out s)))
     	s = ApplicationServicesBase.Current.DisplayName;
     this.Title = s;
     if (_pageTitleContent != null)
     	if (_isTouchUI)
         	_pageTitleContent.Text = string.Empty;
         else
         	_pageTitleContent.Text = s;
     var appName = new HtmlMeta();
     appName.Name = "application-name";
     appName.Content = ApplicationServicesBase.Current.DisplayName;
     Header.Controls.Add(appName);
     if (contentInfo.TryGetValue("Head", out s) && (_headContent != null))
     	_headContent.Text = s;
     if (contentInfo.TryGetValue("PageContent", out s) && (_pageContent != null))
     {
         if (_isTouchUI)
         	s = string.Format("<div id=\"PageContent\" style=\"display:none\">{0}</div>", s);
         var userControl = Regex.Match(s, "<div\\s+data-user-control\\s*=s*\"([\\s\\S]+?)\".*?>\\s*</div>");
         if (userControl.Success)
         {
             var startPos = 0;
             while (userControl.Success)
             {
                 _pageContent.Controls.Add(new LiteralControl(s.Substring(startPos, (userControl.Index - startPos))));
                 startPos = (userControl.Index + userControl.Length);
                 var controlFileName = userControl.Groups[1].Value;
                 var controlExtension = Path.GetExtension(controlFileName);
                 string siteControlText = null;
                 if (!(controlFileName.StartsWith("~")))
                 	controlFileName = (controlFileName + "~");
                 if (string.IsNullOrEmpty(controlExtension))
                 {
                     var testFileName = (controlFileName + ".ascx");
                     if (File.Exists(Server.MapPath(testFileName)))
                     {
                         controlFileName = testFileName;
                         controlExtension = ".ascx";
                     }
                     else
                     {
                         if (ApplicationServices.IsSiteContentEnabled)
                         {
                             var relativeControlPath = controlFileName.Substring(1);
                             if (relativeControlPath.StartsWith("/"))
                             	relativeControlPath = relativeControlPath.Substring(1);
                             siteControlText = ApplicationServices.Current.ReadSiteContentString(("sys/" + relativeControlPath));
                         }
                         if (siteControlText == null)
                         {
                             testFileName = (controlFileName + ".html");
                             if (File.Exists(Server.MapPath(testFileName)))
                             {
                                 controlFileName = testFileName;
                                 controlExtension = ".html";
                             }
                         }
                     }
                 }
                 var userControlAuthorizeRoles = Regex.Match(userControl.Value, "data-authorize-roles\\s*=\\s*\"(.+?)\"");
                 var allowUserControl = !userControlAuthorizeRoles.Success;
                 if (!allowUserControl)
                 {
                     var authorizeRoles = userControlAuthorizeRoles.Groups[1].Value;
                     if (authorizeRoles == "?")
                     {
                         if (!Context.User.Identity.IsAuthenticated)
                         	allowUserControl = true;
                     }
                     else
                     	allowUserControl = ApplicationServices.UserIsAuthorizedToAccessResource(controlFileName, authorizeRoles);
                 }
                 if (allowUserControl)
                 	try
                     {
                         if (controlExtension == ".ascx")
                         	_pageContent.Controls.Add(LoadControl(controlFileName));
                         else
                         {
                             var controlText = siteControlText;
                             if (controlText == null)
                             	controlText = File.ReadAllText(Server.MapPath(controlFileName));
                             var bodyMatch = Regex.Match(controlText, "<body[\\s\\S]*?>([\\s\\S]+?)</body>");
                             if (bodyMatch.Success)
                             	controlText = bodyMatch.Groups[1].Value;
                             controlText = ApplicationServices.EnrichData(Localizer.Replace("Controls", Path.GetFileName(Server.MapPath(controlFileName)), controlText));
                             _pageContent.Controls.Add(new LiteralControl(InjectPrefetch(controlText)));
                         }
                     }
                     catch (Exception ex)
                     {
                         _pageContent.Controls.Add(new LiteralControl(string.Format("Error loading \'{0}\': {1}", controlFileName, ex.Message)));
                     }
                 userControl = userControl.NextMatch();
             }
             if (startPos < s.Length)
             	_pageContent.Controls.Add(new LiteralControl(s.Substring(startPos)));
         }
         else
         	_pageContent.Text = InjectPrefetch(s);
     }
     else
     	if (_isTouchUI)
         {
             _pageContent.Text = "<div id=\"PageContent\" style=\"display:none\"><div data-app-role=\"page\">404 Not Foun" +
                 "d</div></div>";
             this.Title = ApplicationServicesBase.Current.DisplayName;
         }
         else
         	_pageContent.Text = "404 Not Found";
     if (_isTouchUI)
     {
         if (_pageFooterContent != null)
         	_pageFooterContent.Text = (("<footer style=\"display:none\"><small>" + Copyright) 
                         + "</small></footer>");
     }
     else
     	if (contentInfo.TryGetValue("About", out s))
         {
             if (_pageSideBarContent != null)
             	_pageSideBarContent.Text = string.Format("<div class=\"TaskBox About\"><div class=\"Inner\"><div class=\"Header\">About</div><div" +
                         " class=\"Value\">{0}</div></div></div>", s);
         }
     string bodyAttributes = null;
     if (contentInfo.TryGetValue("BodyAttributes", out bodyAttributes))
     	_bodyAttributes.Parse(bodyAttributes);
     if (!(ApplicationServices.UserIsAuthorizedToAccessResource(HttpContext.Current.Request.Path, _bodyAttributes["data-authorize-roles"])))
     {
         var requestPath = Request.Path.Substring(1);
         if (!((WorkflowRegister.IsEnabled || WorkflowRegister.Allows(requestPath))))
         	ApplicationServices.Current.RedirectToLoginPage();
     }
     _bodyAttributes.Remove("data-authorize-roles");
     var classAttr = _bodyAttributes["class"];
     if (string.IsNullOrEmpty(classAttr))
     	classAttr = string.Empty;
     if (!_isTouchUI)
     {
         if (!(classAttr.Contains("Wide")))
         	classAttr = (classAttr + " Standard");
         classAttr = ((classAttr + " ") 
                     + (Regex.Replace(Request.Path.ToLower(), "\\W", "_").Substring(1) + "_html"));
     }
     else
     	if (_summaryDisabled)
         	classAttr = (classAttr + " see-all-always");
     if (!(string.IsNullOrEmpty(classAttr)))
     	_bodyAttributes["class"] = classAttr.Trim();
     _bodyTag.Text = string.Format("\r\n<body{0}>\r\n", _bodyAttributes.ToString());
     base.OnInit(e);
 }
コード例 #58
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["typ"] != null)
            {
                switch (Request.QueryString["typ"])
                {
                case "1":     // Simple Search
                    this.Title = "Simple Search";
                    Search(SearchEngine.SearchType.Simple);
                    break;

                case "2":     // EducationalSearch
                    this.Title = "EducationalSearch";
                    Search(SearchEngine.SearchType.EducationalSearch);
                    break;

                case "3":     //OccupationalSearch
                    this.Title = "OccupationalSearch";
                    Search(SearchEngine.SearchType.OccupationSearch);
                    break;

                case "4":     // KeyWord Search
                    SerchFor1.Visible = false;
                    this.Title        = "KeyWord Search";
                    StringSearch(SearchEngine.SearchType.KeyWordSearch);
                    break;

                case "5":    // AdvanseSearch
                    this.Title        = "Advansed Search";
                    SerchFor1.Visible = false;
                    StringSearch(SearchEngine.SearchType.AdvansedSearch);
                    break;

                default:
                    ErrorLog.WriteLog("Member_SearchResult-Load- SearchType > 5");
                    Response.Redirect("~/Extras/ErrorReport.aspx");
                    break;
                }


                // Adding meta Discription
                HtmlMeta objMeta = new HtmlMeta();
                objMeta.Name    = "Description";
                objMeta.Content = WebConfig.GetValues("MetaDiscription");
                this.Header.Controls.Add(objMeta);

                // Adding meta KeyWords
                objMeta         = new HtmlMeta();
                objMeta.Name    = "keywords";
                objMeta.Content = WebConfig.GetValues("MetaKeword");
                this.Header.Controls.Add(objMeta);
            }//Type != null
            else
            {
                ErrorLog.WriteLog("Member_SearchResult-Load- SearchType = NULL");
                Response.Redirect("~/Extras/ErrorReport.aspx");
            }
        }
        else
        {
            int intTemp = int.Parse(HF_Depth.Value) + 1;
            HF_Depth.Value           = intTemp.ToString();
            SerchFor1.SearchingDepth = intTemp;
        }
    }
コード例 #59
0
    /// <summary>
    /// 绑定信息
    /// </summary>
    private void BindInfo()
    {
        List <SqlWhere> sqlWhereList = new List <SqlWhere>();

        //Title
        bll_config.Load(new string[] { "pageTitle" });
        Page.Title = model.Title + " - " + category.Title + " - " + bll_config["pageTitle"];

        //KeyWord
        HtmlMeta keywords = new HtmlMeta();

        keywords.Name    = "keywords";
        keywords.Content = model.Keywords;
        Page.Header.Controls.Add(keywords);

        //Description
        HtmlMeta description = new HtmlMeta();

        description.Name    = "description";
        description.Content = model.Descn;
        Page.Header.Controls.Add(description);

        //面包屑导航


        //上一篇
        sqlWhereList.Clear();
        sqlWhereList.Add(new SqlWhere(ArticleModel.CATEGORYID, SqlWhere.Oper.Equal, model.CategoryId.ToString()));
        sqlWhereList.Add(new SqlWhere(ArticleModel.ENABLED, SqlWhere.Oper.Equal, true));
        //sqlWhereList.Add(new SqlWhere(ArticleModel.AREAID, SqlWhere.Oper.In, "0," + bll_area.GetIds(bll_area.CookieId)));

        ArticleModel prevModel = bll_article.GetPrev(model, sqlWhereList);

        if (prevModel == null)
        {
            Prev.InnerHtml = "<a>上一篇:这就是第一篇文章啦~~</a>";
        }
        else
        {
            Prev.InnerHtml = "<a href=\"" + bll_article.GetUrl(prevModel) + "\" title='" + prevModel.Title + "' >上一篇:" + QianZhu.Utility.StringHelper.CutString(prevModel.Title, 45, "...") + "</a>";
        }

        //下一篇
        //sqlWhereList.RemoveAt(2);
        sqlWhereList.Clear();
        sqlWhereList.Add(new SqlWhere(ArticleModel.CATEGORYID, SqlWhere.Oper.Equal, model.CategoryId.ToString()));
        sqlWhereList.Add(new SqlWhere(ArticleModel.ENABLED, SqlWhere.Oper.Equal, true));
        ArticleModel nextModel = bll_article.GetNext(model, sqlWhereList);

        if (nextModel == null)
        {
            Next.InnerHtml = "<a>下一篇:这就是最后一篇文章啦~~</a>";
        }
        else
        {
            Next.InnerHtml = "<a href=\"" + bll_article.GetUrl(nextModel) + "\" title='" + nextModel.Title + "'>下一篇:" + QianZhu.Utility.StringHelper.CutString(nextModel.Title, 45, "...") + "</a>";
        }

        //浏览记录
        bll_article.RefreshPv(model);
    }
コード例 #60
0
        public static void LoadMeta(HtmlHead headTag, string title, string description, string keyws, string category,
                                    string url, string img, string dateup, string datemf, string datecre)
        {
            headTag.Title = title;
            var pagemetaTag = new HtmlMeta
            {
                Name    = "Description",
                Content = description
            };

            headTag.Controls.Add(pagemetaTag);
            pagemetaTag = new HtmlMeta
            {
                Name    = "Keywords",
                Content = keyws
            };
            headTag.Controls.Add(pagemetaTag);
            pagemetaTag = new HtmlMeta();
            pagemetaTag.Attributes.Add("property", "og:url");
            pagemetaTag.Attributes.Add("itemprop", "url");
            pagemetaTag.Content = url;
            headTag.Controls.Add(pagemetaTag);
            pagemetaTag = new HtmlMeta();
            pagemetaTag.Attributes.Add("property", "og:image");
            pagemetaTag.Attributes.Add("itemprop", "thumbnailUrl");
            pagemetaTag.Content = img;
            headTag.Controls.Add(pagemetaTag);
            pagemetaTag = new HtmlMeta();
            pagemetaTag.Attributes.Add("property", "og:title");
            pagemetaTag.Attributes.Add("itemprop", "headline");
            pagemetaTag.Content = title;
            headTag.Controls.Add(pagemetaTag);
            pagemetaTag = new HtmlMeta();
            pagemetaTag.Attributes.Add("itemprop", "articleSection");
            pagemetaTag.Content = category;
            headTag.Controls.Add(pagemetaTag);
            pagemetaTag = new HtmlMeta();
            pagemetaTag.Attributes.Add("itemprop", "sourceOrganization");
            pagemetaTag.Attributes.Add("name", "source");
            pagemetaTag.Content = GetRoot();
            headTag.Controls.Add(pagemetaTag);
            pagemetaTag = new HtmlMeta();
            pagemetaTag.Attributes.Add("itemprop", "dateCreated");
            pagemetaTag.Content = DateTime.Parse(datecre).ToString("yyyy-MM-dd HH:mm + 07:00");
            headTag.Controls.Add(pagemetaTag);
            var editdate = datemf;

            if (editdate == "")
            {
                editdate = datecre;
            }
            pagemetaTag = new HtmlMeta();
            pagemetaTag.Attributes.Add("itemprop", "dateModified");
            pagemetaTag.Attributes.Add("name", "lastmod");
            pagemetaTag.Content = DateTime.Parse(editdate).ToString("yyyy-MM-dd HH:mm + 07:00");
            headTag.Controls.Add(pagemetaTag);
            var upddate = dateup;

            if (upddate == "")
            {
                upddate = datecre;
            }
            pagemetaTag = new HtmlMeta();
            pagemetaTag.Attributes.Add("itemprop", "datePublished");
            pagemetaTag.Attributes.Add("name", "pubdate");
            pagemetaTag.Content = DateTime.Parse(upddate).ToString("yyyy-MM-dd HH:mm + 07:00");
            headTag.Controls.Add(pagemetaTag);
            pagemetaTag = new HtmlMeta();
            pagemetaTag.Attributes.Add("property", "og:type");
            pagemetaTag.Content = "article";
            headTag.Controls.Add(pagemetaTag);
            pagemetaTag = new HtmlMeta();
            pagemetaTag.Attributes.Add("property", "og:site_name");
            pagemetaTag.Content = "Botyenmachtphcm.com";
            headTag.Controls.Add(pagemetaTag);
            pagemetaTag.Attributes.Add("property", "og:description");
            pagemetaTag.Attributes.Add("itemprop", "description");
            pagemetaTag.Content = description;
            headTag.Controls.Add(pagemetaTag);
        }