当前位置: 首页>>代码示例>>C#>>正文


C# Data.MakeNiceNameFull方法代码示例

本文整理汇总了C#中Data.MakeNiceNameFull方法的典型用法代码示例。如果您正苦于以下问题:C# Data.MakeNiceNameFull方法的具体用法?C# Data.MakeNiceNameFull怎么用?C# Data.MakeNiceNameFull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Data的用法示例。


在下文中一共展示了Data.MakeNiceNameFull方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GoToSearch

 protected void GoToSearch(object sender, EventArgs e)
 {
     Data dat = new Data(DateTime.Now);
     string str = dat.MakeNiceNameFull(dat.stripHTML(KeywordsTextBox.Text)).Replace("_", "+");
     Response.Redirect("event-search?title=" + str);
 }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:6,代码来源:Home.aspx.cs

示例2: PostIt


//.........这里部分代码省略.........
                        //}

                    }
                }
                else
                {

                }

                if (isEdit)
                {
                    dat.Execute("DELETE FROM Ad_Category_Mapping WHERE AdID=" + theID);
                }

                CreateCategories(theID);

                string adFeatured = "";
                string adFeaturedEmail = "";

                DataSet dsUser = dat.GetData("SELECT Email, UserName FROM USERS WHERE User_ID=" +
                        Session["User"].ToString());

                try
                {
                    bool showMessage = false;
                    if (chargeCard)
                    {
                        Encryption encrypt = new Encryption();

                        //Charge Card
                        string country = dat.GetDataDV("SELECT country_2_code FROM Countries WHERE country_id=" + BillingCountry.SelectedValue)[0]["country_2_code"].ToString();
                        com.paypal.sdk.util.NVPCodec status = d.DoCaptureCode(transactionID, price.ToString(),
                            "B" + theID + isn.ToString(), "Capture Transaction for Featuring Bulletin '" +
                            dat.MakeNiceNameFull(AdNameTextBox.Text) + "'");
                        //message = status.ToString();
                        string successORFailure = status["ACK"];
                        switch (successORFailure.ToLower())
                        {
                            case "failure":
                                MessagePanel.Visible = true;
                                YourMessagesLabel.Text += status["L_LONGMESSAGE0"];
                                //MessagePanel.Visible = true;
                                //foreach (string key in status.Keys)
                                //{
                                //    YourMessagesLabel.Text += "key: '" + key + "', value: '" + status[key] + "' <br/>";
                                //}
                                break;
                            case "success":
                                showMessage = true;
                                break;
                            default:
                                MessagePanel.Visible = true;
                                foreach (string key in status.Keys)
                                {
                                    YourMessagesLabel.Text += "key: '" + key + "', value: '" + status[key] + "' <br/>";
                                }
                                break;
                        }
                    }
                    else
                    {
                        showMessage = true;
                    }

                    if (showMessage)
                    {
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:PostAnAd.aspx.cs

示例3: Page_Load


//.........这里部分代码省略.........
                    //if image height is greater than resize height...resize it
                    else
                    {
                        //make height equal to the requested height.
                        newHeight = height;

                        //get the ratio of the new height/original height and apply that to the width
                        double theDivider = double.Parse(image.Height.ToString()) / double.Parse(newHeight.ToString());
                        double newDoubleWidth = double.Parse(newIntWidth.ToString());
                        newDoubleWidth = double.Parse(image.Width.ToString()) / theDivider;
                        newIntWidth = (int)newDoubleWidth;

                        //if the resized width is still to big
                        if (newIntWidth > width)
                        {
                            //make it equal to the requested width
                            newIntWidth = width;

                            //get the ratio of old/new width and apply it to the already resized height
                            theDivider = double.Parse(image.Width.ToString()) / double.Parse(newIntWidth.ToString());
                            double newDoubleHeight = double.Parse(newHeight.ToString());
                            newDoubleHeight = double.Parse(image.Height.ToString()) / theDivider;
                            newHeight = (int)newDoubleHeight;
                        }
                    }

                    string alt = "";
                    if (node.Attributes.Contains("alt"))
                    {
                        alt = node.Attributes["alt"].Value;
                    }
                    else
                    {
                        alt = dat.MakeNiceNameFull(header);
                    }

                    Literal literal4 = new Literal();
                    literal4.Text = "<div class=\"RotatorImage\"><img alt=\"" + alt +
                "\" style=\" margin-left: " + ((410 - newIntWidth) / 2).ToString() + "px; margin-top: " + ((250 - newHeight) / 2).ToString() + "px;\" height=\"" + newHeight + "px\" width=\"" + newIntWidth + "px\" src=\""
                        + node.Attributes["src"].Value + "\" /></div>";
                    Telerik.Web.UI.RadRotatorItem r4 = new Telerik.Web.UI.RadRotatorItem();
                    r4.Controls.Add(literal4);

                    Rotator1.Items.Add(r4);
                }

                if (Rotator1.Items.Count == 0)
                    RotatorPanel.Visible = false;
                else
                {
                    RotatorPanel.Visible = true;
                    if (Rotator1.Items.Count == 1)
                    {
                        RotatorPanel.CssClass = "HiddeButtons";
                    }
                }
                #endregion

                #region Going
                DataView dvGoing = dat.GetDataDV("SELECT * FROM ClEventGoing WHERE ClEventID = '" + GetEventID() + "'");
                if (dvGoing.Count > 0)
                    NumberPeopleLabel.Text = dvGoing.Count.ToString();
                else
                    GoingPanel.Visible = false;

                if (Session["User"] != null)
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:Event.aspx.cs

示例4: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        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);
        }

        Session["RedirectTo"] = Request.Url.AbsoluteUri;
        bool fillUserData = false;
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        try
        {
            if (Session["User"] != null)
            {
                fillUserData = true;
                DataSet dsAd = dat.GetData("SELECT User_ID FROM Ads WHERE Ad_ID=" + Request.QueryString["AdID"].ToString());
                if (dsAd.Tables[0].Rows[0]["User_ID"].ToString() == Session["User"].ToString())
                {
                    EditAdLink.Visible = true;
                }
                else
                    EditAdLink.Visible = false;

                LoggedInPanel.Visible = true;
                LoggedOutPanel.Visible = false;
            }
            else
            {
                Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink");
                LoggedOutPanel.Visible = true;
                LoggedInPanel.Visible = false;
            }

            GetFeaturedBulletins();
        }
        catch (Exception ex)
        {
            ErrorLabel.Text = ex.ToString();
        }

        int ID = int.Parse(Request.QueryString["AdID"].ToString());

        Session["FlagID"] = ID;
        Session["FlagType"] = "A";
        DataSet ds = dat.GetData("SELECT * FROM Ads A, Users U WHERE U.User_ID=A.User_ID AND A.Ad_ID=" + ID);
        Cache.Remove(Server.MapPath("Controls/PlayList.xml"));
        if (ds.Tables.Count > 0)
        {
            if (ds.Tables[0].Rows.Count > 0)
            {
                TagCloud.THE_ID = ID;
                ShowHeaderName.Text = "<a id=\""+dat.MakeNiceNameFull(ds.Tables[0].Rows[0]["Header"].ToString())+"\" class=\"aboutLink\" href=\"http://" + Request.Url.Authority + "/" +
                    dat.MakeNiceName(ds.Tables[0].Rows[0]["Header"].ToString()) +
                    "_" + ID.ToString() + "_Ad\"><h1>" +
                    dat.BreakUpString(ds.Tables[0].Rows[0]["Header"].ToString(), 50)+"</h1></a>";
                ShowDescription.Text = dat.BreakUpString(ds.Tables[0].Rows[0]["Description"].ToString(), 60);

                #region SEO
                //Create keyword and description meta tags
                topTopLiteral.Text = "<a class=\"NavyLink12UD\" href=\"#" + dat.MakeNiceNameFull(ds.Tables[0].Rows[0]["Header"].ToString()) + "\">" +
                    dat.MakeNiceNameFull(ds.Tables[0].Rows[0]["Header"].ToString()).Replace("-", " ") + " From The Top</a>";

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

                cn.Attributes.Add("rel", "canonical");
                cn.Href = "http://" + Request.Url.Authority + "/" +
                    dat.MakeNiceName(ds.Tables[0].Rows[0]["Header"].ToString()) +
                    "_" + ID.ToString() + "_Ad";
                head.Controls.AddAt(0, cn);

                kw.Name = "keywords";
                hm.Name = "Description";

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

                char [] delimeter = {' '};
                string[] keywords = dat.MakeNiceNameFull(ds.Tables[0].Rows[0]["Header"].ToString()).Replace("-", " ").Split(delimeter, StringSplitOptions.RemoveEmptyEntries);
                int count = 0;
                foreach (string token in keywords)
                {
                    if (count < 16)
                    {
                        if (kw.Content != "")
                            kw.Content += " ";
                        kw.Content += token;

                        count++;
                    }
                }
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:Ad.aspx.cs

示例5: PostIt


//.........这里部分代码省略.........

                        }

                        #endregion

                        conn.Close();

                        #region Take care of search terms
                        if (FeaturePanel.Visible)
                        {
                            string terms = "";
                            foreach (ListItem item in SearchTermsListBox.Items)
                            {
                                terms += ";" + item.Text + ";";
                            }
                            foreach (ListItem item in FeatureDatesListBox.Items)
                            {
                                if (item.Value != "Disabled")
                                    dat.Execute("INSERT INTO EventSearchTerms (EventID, SearchTerms, SearchDate) VALUES(" + ID +
                                        ", '" + terms.Replace("'", "''") + "', '" + item.Text + "')");
                            }
                        }
                        #endregion

                        try
                        {
                            if (chargeCard)
                            {
                                Encryption encrypt = new Encryption();

                                //Charge Card though Capture
                                country = dat.GetDataDV("SELECT country_2_code FROM Countries WHERE country_id=" + BillingCountry.SelectedValue)[0]["country_2_code"].ToString();
                                com.paypal.sdk.util.NVPCodec status = d.DoCaptureCode(transactionID, price.ToString(),
                                    "E" + temporaryID + isn.ToString(), "Capture Transaction for Featuring Event '" +
                                    dat.MakeNiceNameFull(EventNameTextBox.Text) + "'");
                                //message = status.ToString();
                                string successORFailure = status["ACK"];
                                switch (successORFailure.ToLower())
                                {
                                    case "failure":
                                        MessagePanel.Visible = true;
                                        YourMessagesLabel.Text = status["L_LONGMESSAGE0"];
                                        //MessagePanel.Visible = true;
                                        //foreach (string key in status.Keys)
                                        //{
                                        //    YourMessagesLabel.Text += "key: '" + key + "', value: '" + status[key] + "' <br/>";
                                        //}
                                        break;
                                    case "success":
                                        //MessagePanel.Visible = true;
                                        //foreach (string key in status.Keys)
                                        //{
                                        //    YourMessagesLabel.Text += "key: '" + key + "', value: '" + status[key] + "' <br/>";
                                        //}
                                        TakeCareOfPostEmail(isEditing, isOwner, isNewVenue, ownerUpForGrabs,
                                        temporaryID, venueID.ToString(), tempID, revisionID, ownerID);
                                        break;
                                    default:
                                        MessagePanel.Visible = true;
                                        foreach (string key in status.Keys)
                                        {
                                            YourMessagesLabel.Text += "key: '" + key + "', value: '" + status[key] + "' <br/>";
                                        }
                                        break;
                                }
                            }
                            else
                            {
                                //MessagePanel.Visible = true;
                                //YourMessagesLabel.Text = "no charge here";
                                TakeCareOfPostEmail(isEditing, isOwner, isNewVenue, ownerUpForGrabs,
                                    temporaryID, venueID.ToString(), tempID, revisionID, ownerID);
                            }
                        }
                        catch (Exception ex)
                        {
                            MessagePanel.Visible = true;
                            YourMessagesLabel.Text = "problem: " + problem + ex.ToString();
                        }

                    }
                    else
                    {
                        MessagePanel.Visible = true;
                        YourMessagesLabel.Text = "" + message;
                    }
                }
                else
                {
                    MessagePanel.Visible = true;
                    YourMessagesLabel.Text = "You must agree to the terms and conditions.";
                }
            }
        }
        catch (Exception ex)
        {
            MessagePanel.Visible = true;
            YourMessagesLabel.Text = "problem: " + problem + ex.ToString() + ", command: ";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:BlogEvent.aspx.cs

示例6: Page_Load


//.........这里部分代码省略.........
                    }
                }
                else
                {
                    EditLink.Visible = false;
                    ContactOwnerLink.Visible = false;
                }
            }
            else
            {
                LoggedInPanel.Visible = false;
                LoggedOutPanel.Visible = true;
                DataSet dsComments = dat.GetData("SELECT VC.CommentDate AS theDate, * FROM Venue_Comments VC, Users U WHERE VC.UserID=U.User_ID AND VC.ID=" + ID + " ORDER BY VC.CommentDate ");
                TheComments.DATA_SET = dsComments;
                TheComments.DataBind2(false);
            }

            DataSet ds = dat.GetData("SELECT * FROM Venues WHERE ID=" + ID);

            Session["FlagID"] = ID;
            Session["FlagType"] = "V";

            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (bool.Parse(ds.Tables[0].Rows[0]["Live"].ToString()))
                    {
                        //Get venue's categories
                        DataSet dscat = dat.GetData("SELECT DISTINCT VC.Name, VC.ID FROM Venue_Category V_C, VenueCategories VC WHERE " +
                            "V_C.Venue_ID=" + ID + " AND V_C.Category_ID=VC.ID ");

                        #region SEO
                        topTopLiteral.Text = "<a class=\"NavyLink12UD\" href=\"#" + dat.MakeNiceNameFull(ds.Tables[0].Rows[0]["Name"].ToString()) + "\">" +
                        dat.MakeNiceNameFull(ds.Tables[0].Rows[0]["Name"].ToString()).Replace("-", " ") + " From The Top</a>";

                        string theLink = "http://" + Request.Url.Authority + "/" +
                            dat.MakeNiceName(ds.Tables[0].Rows[0]["Name"].ToString()) +
                            "_" + ID.ToString() + "_Venue";

                        HtmlHead head = (HtmlHead)Page.Header;
                        HtmlLink lk = new HtmlLink();
                        lk.Href = theLink;
                        lk.Attributes.Add("rel", "bookmark");
                        head.Controls.AddAt(0, lk);

                        //Create keyword and description meta tags
                        HtmlMeta hm = new HtmlMeta();
                        HtmlMeta kw = new HtmlMeta();
                        HtmlMeta lg = new HtmlMeta();
                        HtmlLink cn = new HtmlLink();

                        cn.Attributes.Add("rel", "canonical");
                        cn.Href = theLink;
                        head.Controls.AddAt(0, cn);

                        kw.Name = "keywords";
                        hm.Name = "Description";
                        lg.Name = "language";
                        lg.Content = "English";
                        head.Controls.AddAt(0, lg);
                        char[] delimeter = { ' ' };

                        string[] keywords = dat.MakeNiceNameFull(ds.Tables[0].Rows[0]["Name"].ToString()).Replace("-", " ").Split(delimeter, StringSplitOptions.RemoveEmptyEntries);
                        int count = 0;
                        foreach (string token in keywords)
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:Venue.aspx.cs

示例7: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];

        DateTime isn = DateTime.Now;

        DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn);

        Data dat = new Data(isn);

        if (IsPostBack)
        {
            MessageRadWindowManager.VisibleOnPageLoad = false;
        }

        string background = "";
        if (isFeatured)
        {
            background = "background-color: #e9f1f4;";
        }
        else
        {
            background = "border-bottom: solid 1px #dedbdb;";
        }

        if (searchNumber != "")
        {
            string markerNumber = dat.GetImageNum(searchNumber);
            ImageLiteral.Text = imageLiteral + "<div class=\"topDiv\" style=\"float: left;padding-right: 5px;height: 50px;\"><img style=\"cursor: " +
                "pointer;\" onclick=\"myclick(" + markerNumber + ");\" id='image" + searchNumber + "' src=" +
                "\"http://www.google.com/mapfiles/marker" + searchNumber + ".png\" /></div>";
            BeginingLiteral.Text = "<div style=\"margin-top: 3px;height: 56px;margin-bottom: 3px; width: " + width.ToString() +
                "px; padding: 3px;" + background + "\">";
        }
        else
        {
            BeginingLiteral.Text = "<div class=\"topDiv\" style=\"margin-top: 3px;margin-bottom: 3px;" + background +
                " width: " + width.ToString() + "px;padding: 3px;\">";
        }

        bool imgAbsolute = false;
        VenueLabel.Text = venueLabel;

        if (!isVenue)
        {
            DataView dvEvent = dat.GetDataDV("SELECT * FROM Events WHERE ID=" + eventID);

            DataView dvEventsSlider = dat.GetDataDV("SELECT * FROM Events E, Event_Slider_Mapping ESM WHERE E.ID=ESM.EventID AND E.ID=" + eventID);
            if (dvEventsSlider.Count > 0)
            {
                if(bool.Parse(dvEventsSlider[0]["ImgPathAbsolute"].ToString()))
                    imgAbsolute = true;

                if (imgAbsolute)
                {
                    string name = dat.MakeNiceNameFull(dvEventsSlider[0]["PictureName"].ToString().Replace("/", "_").Replace(":", "_").Replace(".", "_"));

                    int i = 0;
                    for (i = name.Length - 1; i >= 0; i--)
                    {
                        if (name[i] == '_')
                        {
                            break;
                        }
                    }

                    Random rand = new Random(DateTime.Now.Millisecond);

                    name = dat.MakeNiceNameFive(dvEventsSlider[0]["PictureName"].ToString()) + "_" + eventID + "." + name.Substring(i + 1, name.Length - i - 1);

                    //if (name.Length > 230)
                    //    name = name.Substring(name.Length - 50, 50);

                    //if (!System.IO.File.Exists(MapPath("../") + "\\Temp\\Temp_" + name))
                    //{
                    try
                    {
                        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(dvEventsSlider[0]["PictureName"].ToString());
                        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                        Stream receiveStream = response.GetResponseStream();
                        // read the stream
                        System.Drawing.Image img = System.Drawing.Image.FromStream(receiveStream);
                        receiveStream.Close();
                        response.Close();

                        SaveThumbnail(img, MapPath("../") + "\\Temp\\Temp_" + name);
                        //}
                        EventImageLiteral.Text = "<img style='float: left; padding-right: 5px;' src='http://hippohappenings.com/Temp/Temp_" +
                            name + "' />";
                    }
                    catch (Exception ex)
                    {

                    }
                }
                else
                {
                    if (!System.IO.File.Exists(MapPath("../") + "\\Temp\\Temp_" + dvEventsSlider[0]["PictureName"].ToString()))
                    {
                        if (System.IO.File.Exists(MapPath("../") + "\\UserFiles\\" +
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:SearchElement.ascx.cs

示例8: DoAds


//.........这里部分代码省略.........
                UpdatePanel1.Visible = false;
            }
            else
            {
                UpdatePanel1.Visible = true;
                for (int i = 0; i < dvAds.Count; i++)
                {
                    if (count < cutOff)
                    {
                        count++;
                        lit = new Literal();
                        lit.Text = "";

                        indexToUse = i + startIndex;
                        if (indexToUse > dvAds.Count - 1)
                        {
                            indexToUse = 0;
                            startIndex = -i;
                        }

                        if (dvAds[indexToUse]["Template"].ToString() == "1" || dvAds[indexToUse]["Template"].ToString() == "")
                        {
                            lit.Text = "<div align=\"center\" class=\"AdTemplate1\"><div align=\"center\" class=\"AdTemplate1Wrapper\">";

                            if (dvAds[indexToUse]["FeaturedPicture"] != null)
                            {
                                if (dvAds[indexToUse]["FeaturedPicture"].ToString().Trim() != "")
                                {
                                    GetAdSize(ref w, ref h, dvAds[indexToUse]["UserName"].ToString() + "\\" +
                                        dvAds[indexToUse]["FeaturedPicture"].ToString(), "1");

                                    lit.Text += "<div class=\"AdTemplate1Inner\"><table width=\"100px\" height=\"100px\" " +
                                        "cellpadding=\"0\" cellspacing=\"0\"><tbody align=\"center\"><tr><td valign=\"middle\"> " +
                                        "<img alt=\"" + dat.MakeNiceNameFull(dvAds[indexToUse]["Header"].ToString()).Replace("-", " ") + "\" onclick=\"window.location = '../" + dat.MakeNiceName(dvAds[indexToUse]["Header"].ToString()) +
                                            "_" + dvAds[indexToUse]["Ad_ID"].ToString() + "_Ad'\" class=\"AdImage\" width=\"" + w +
                                            "px\" Height=\"" + h + "px\" src=\"UserFiles/" + dvAds[indexToUse]["UserName"].ToString() +
                                            "/" + dvAds[indexToUse]["FeaturedPicture"].ToString() + "\" /> " +
                                        "</td></tr></tbody></table></div>";
                                }
                            }

                            string headerStr = dat.BreakUpString(dvAds[indexToUse]["Header"].ToString(), 10);

                            lit.Text += "<div><h1 class=\"Text14\"><a class=\"AdsTitle\" href=\"../" + dat.MakeNiceName(dvAds[indexToUse]["Header"].ToString()) +
                                            "_" + dvAds[indexToUse]["Ad_ID"].ToString() + "_Ad\">" + headerStr +
                                            "</a></h1></div></div>" +
                                "<div align=\"center\" class=\"AdTemplate1InnerInner\"> " +
                                "<span class=\"Text12\">" +
                                dat.BreakUpString(dvAds[indexToUse]["FeaturedSummary"].ToString(), 21) + "</span>" +

                                "</div>" +
                                "<div><a class=\"ReadMoreHome\" href=\"../" +
                                dat.MakeNiceName(dvAds[indexToUse]["Header"].ToString()) +
                                            "_" + dvAds[indexToUse]["Ad_ID"].ToString() + "_Ad\">Read More</a>" +
                                "</div></div>";
                        }
                        else if (dvAds[indexToUse]["Template"].ToString() == "2")
                        {
                            lit.Text = "<div align=\"center\" class=\"AdTemplate1\"><div class=\"AdTemplate2Wrapper\">";

                            if (dvAds[indexToUse]["FeaturedPicture"] != null)
                            {
                                if (dvAds[indexToUse]["FeaturedPicture"].ToString().Trim() != "")
                                {
                                    GetAdSize(ref w, ref h, dvAds[indexToUse]["UserName"].ToString() + "\\" +
                                        dvAds[indexToUse]["FeaturedPicture"].ToString(), "2");
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:Ads.ascx.cs

示例9: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        string eventID = Request.QueryString["ID"].ToString();
        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", ":")));

        try
        {
            Session["RedirectTo"] = Request.Url.AbsoluteUri;

            bool fillUserData = false;

            try
            {
                if (Session["User"] != null)
                {
                    LoggedInPanel.Visible = true;
                    LoggedOutPanel.Visible = false;

                    fillUserData = true;

                }
                else
                {
                    LoggedOutPanel.Visible = true;
                    LoggedInPanel.Visible = false;
                }

                GetOtherEvents();
            }
            catch (Exception ex)
            {
                ErrorLabel.Text = ex.ToString();
            }

            if (Request.QueryString["ID"] == null)
                Response.Redirect("~/home");

            string ID = eventID;
            Session["TripID"] = ID;
            DataView dv = dat.GetDataDV("SELECT * FROM Trips WHERE ID=" + ID);

            Session["FlagID"] = ID;
            Session["FlagType"] = "T";

            #region SEO
            //Create keyword and description meta tags and title
            topTopLiteral.Text = "<a class=\"NavyLink12UD\" href=\"#" + dat.MakeNiceNameFull(dv[0]["Header"].ToString()) + "\">" +
            dat.MakeNiceNameFull(dv[0]["Header"].ToString()).Replace("-", " ") + " From The Top</a>";

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

            cn.Attributes.Add("rel", "canonical");
            cn.Href = "http://" + Request.Url.Authority + "/" +
                dat.MakeNiceName(dv[0]["Header"].ToString()) +
                "_" + eventID + "_Trip";
            head.Controls.AddAt(0, cn);

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

            char[] delimeter = { ' ' };
            string[] keywords = dat.MakeNiceNameFull(dv[0]["Header"].ToString()).Replace("-", " ").Split(delimeter, StringSplitOptions.RemoveEmptyEntries);
            int count2 = 0;
            foreach (string token in keywords)
            {
                if (count2 < 16)
                {
                    if (kw.Content != "")
                        kw.Content += " ";
                    kw.Content += token;

                    count2++;
                }
            }
            head.Controls.AddAt(0, kw);

            hm.Content = dat.MakeNiceNameFull(dat.stripHTML(dv[0]["Content"].ToString()).Replace("   ", " ").Replace("  ", " ")).Replace("-", " ");
            if (hm.Content.Length > 200)
                hm.Content = hm.Content.Substring(0, 197) + "...";

            head.Controls.AddAt(0, hm);

            this.Title = kw.Content;

            HtmlLink lk = new HtmlLink();
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:Trip.aspx.cs


注:本文中的Data.MakeNiceNameFull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。