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


C# Data.TrapKey方法代码示例

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


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

示例1: OnwardsIT


//.........这里部分代码省略.........
                                            return false;
                                        }
                                        else
                                        {
                                            goOn = true;
                                        }
                                    }
                                }
                                else
                                {
                                    if (SummaryTextBox.InnerHtml.Trim().Length > 250 || SummaryTextBox.InnerHtml.Trim().Length == 0)
                                    {
                                        YourMessagesLabel.Text += "<br/><br/>*Must include the summary for a featured ad. It must be less than 250 characters.";
                                        MessagePanel.Visible = true;
                                        AdTabStrip.SelectedIndex = 2;
                                        AdPostPages.PageViews[2].Selected = true;
                                        return false;
                                    }
                                    else
                                    {
                                        goOn = true;
                                    }
                                }
                            }
                            else
                            {
                                goOn = true;
                            }

                            if (goOn)
                            {
                                if (CityTextBox.Text.Trim() != "")
                                {
                                    if (dat.TrapKey(CityTextBox.Text, 1))
                                    {
                                        if (BannerAdCheckBox.Checked && AdPictureCheckList.Items.Count == 0)
                                        {
                                            YourMessagesLabel.Text += "<br/><br/>*Please include the banner image or un-check the 'Include a Banner Image' check box.";
                                            MessagePanel.Visible = true;
                                            AdTabStrip.SelectedIndex = 2;
                                            AdPostPages.PageViews[2].Selected = true;
                                            return false;
                                        }
                                        else
                                        {
                                            goOn = true;
                                        }
                                    }
                                    else
                                    {
                                        YourMessagesLabel.Text += "<br/><br/>*City can only contain letters. No special characters allowed.";
                                        MessagePanel.Visible = true;
                                        AdTabStrip.SelectedIndex = 2;
                                        AdPostPages.PageViews[2].Selected = true;
                                        return false;
                                    }
                                }
                                else
                                {
                                    YourMessagesLabel.Text += "<br/><br/>*Must include the city.";
                                    MessagePanel.Visible = true;
                                    AdTabStrip.SelectedIndex = 2;
                                    AdPostPages.PageViews[2].Selected = true;
                                    return false;
                                }
                            }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:PostAnAd.aspx.cs

示例2: MakeItSo

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

        DateTime isn = DateTime.Now;

        if (!DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn))
            isn = DateTime.Now;
        DateTime isNow = isn;
        Data dat = new Data(isn);
        EmailTextBox.Text = dat.stripHTML(EmailTextBox.Text.Trim());
        ConfirmEmailTextBox.Text = dat.stripHTML(ConfirmEmailTextBox.Text.Trim());

        if (EmailTextBox.Text != "" && ConfirmEmailTextBox.Text != "")
        {
            bool safeToGo = true;

                if (dat.ValidateEmail(EmailTextBox.Text))
                {
                    if (safeToGo)
                    {
                        if (dat.TrapKey(EmailTextBox.Text, 2))
                        {
                            if (EmailTextBox.Text == ConfirmEmailTextBox.Text)
                                safeToGo = true;
                            else
                            {
                                MessageLabel.Text = "*Comfirmation Email must match the Email text box.";
                                safeToGo = false;
                            }
                        }
                        else
                        {
                            MessageLabel.Text = "*The Email must only contain allowed characters.";
                            safeToGo = false;
                        }

                        if (safeToGo)
                        {
                            DataSet dsEmail = dat.GetData("SELECT * FROM Users WHERE Email='"+EmailTextBox.Text+"'");

                            if (dsEmail.Tables.Count > 0)
                                if (dsEmail.Tables[0].Rows.Count > 0)
                                    safeToGo = false;

                            if (safeToGo)
                            {

                                if (TermsCheckBox.Checked)
                                {
                                    Encryption encrypt = new Encryption();

                                    dat.SendEmailNoFrills(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(), EmailTextBox.Text,
                                        "Hello From Hippo Happenings! <br/><br/> You have requested to create a Hippo Happenings account. We'd like to say, " +
                                        " GREAT CHOICE! <br/><br/> Please visit <a href=\"http://HippoHappenings.com/complete-registration?ID=" +
                                        encrypt.encrypt(EmailTextBox.Text) + "\">this link</a> to complete the creation of your account. ", "Hippo Happenings User Account Request");

                                    MessageRadWindow.NavigateUrl = "Message.aspx?message=" +
                                        encrypt.encrypt("An email has been sent to your address. "+
                                        "Please make sure to check your <b>JUNK MAIL</b> and your " +
                                        " inbox for further instruction to complete " +
                                        "your registration." +
                                        "<br/><br/><div align=\"center\">" +
                                        "<div style=\"width: 50px;\" onclick=\"Search('home')\">" +
                                        "<div class=\"topDiv\" style=\"clear: both;\">" +
                                          "  <img style=\"float: left;\" src=\"NewImages/ButtonLeft.png\" height=\"27px\" /> " +
                                           " <div class=\"NavyLink\" style=\"font-size: 12px; text-decoration: none; padding-top: 5px;padding-left: 6px; padding-right: 6px;height: 27px;float: left;background: url('NewImages/ButtonPixel.png'); background-repeat: repeat-x;\">" +
                                               " Ok " +
                                            "</div>" +
                                           " <img style=\"float: left;\" src=\"NewImages/ButtonRight.png\" height=\"27px\" /> " +
                                        "</div>" +
                                        "</div>" +
                                        "</div><br/>");
                                    MessageRadWindow.Visible = true;
                                    MessageRadWindowManager.VisibleOnPageLoad = true;
                                    MessageLabel.Text = "";
                                }
                                else
                                {
                                    MessageLabel.Text = "*You must agree to the terms and contidions.";
                                }
                            }
                            else
                            {
                                MessageLabel.Text = "An account for this email address already exists. If you believe this is your account "+
                                    "and you have forgot your password, go to <a href=\"login\">login page</a> and click on the 'forgot password' link.";
                            }
                        }
                    }
                }
                else
                    MessageLabel.Text = "Email is not valid";

        }
        else
            MessageLabel.Text = "*All fields must be filled in.";
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:99,代码来源:Register.aspx.cs

示例3: MakeItSo

    protected void MakeItSo(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);
        }
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        try
        {
            bool hasState = false;
            if (StateDropDown.Visible && StateDropDown.SelectedValue != "-1")
                hasState = true;

            if (!StateDropDown.Visible && StateTextBox.THE_TEXT.Trim() != "")
                hasState = true;

            bool hasCity = false;
            if (CityTextBox.THE_TEXT.Trim() != "")
                hasCity = true;

            bool hasHeadr = false;
            if (HowHeardTextBox.THE_TEXT.Trim() != "")
                hasHeadr = true;

            UserNameTextBox.THE_TEXT = UserNameTextBox.THE_TEXT.Trim().Replace(" ", "");
            //ReferringUserName.Text = ReferringUserName.Text.Trim().Replace(" ", "");

            //if (!dat.TrapKey(ReferringUserName.Text, 1))
            //{
            //    MessageLabel.Text = "The Referring User Name cannot contain any illegal characters.";
            //    return;
            //}
            //else
            //{
            //    DataView dv = dat.GetDataDV("SELECT * FROM Users WHERE UserName='" +
            //             ReferringUserName.Text + "'");
            //    if (dv.Count == 0)
            //    {
            //        MessageLabel.Text = "The Referring User Name you have provided does not exist in our system.";
            //        return;
            //    }
            //}

            MessageLabel.Text = "";
            if (hasCity && hasState && hasHeadr && UserNameTextBox.THE_TEXT != "" && PasswordTextBox.Text != "" &&
                ConfirmPasswordTextBox.Text != "" && ((FirstNameTextBox.THE_TEXT.Trim() != ""
                && LastNameTextBox.THE_TEXT.Trim() != "" && dat.TrapKey(FirstNameTextBox.THE_TEXT.Trim(), 1)
                && dat.TrapKey(LastNameTextBox.THE_TEXT.Trim(), 1))|| (FirstNameTextBox.THE_TEXT.Trim() == "" &&
                LastNameTextBox.THE_TEXT.Trim() == "")))
            {

                bool safeToGo = false;
                if (dat.TrapKey(UserNameTextBox.THE_TEXT, 1))
                {
                    DataSet ds = dat.GetData("SELECT * FROM Users WHERE UserName='" +
                        UserNameTextBox.THE_TEXT + "'");

                    string message = "";
                    if (ds.Tables.Count > 0)
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            message = "*This User Name already exists in the database. Choose a different User Name.";

                        }
                        else
                            safeToGo = true;
                    else
                        safeToGo = true;

                    ds = dat.GetData("SELECT * FROM Users WHERE Email='"+EmailLabel.Text+"'");

                    if (ds.Tables.Count > 0)
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            message += " This Email is already used by another user. You might have already completed this step. In that case, all you need to do is <a href=\"UserLogin.aspx\">Login</a>";
                            safeToGo = false;
                        }

                    if (safeToGo)
                    {
                        if (dat.TrapKey(PasswordTextBox.Text, 1))
                        {
                            safeToGo = true;
                        }
                        else
                        {
                            MessageLabel.Text = "*The Password can contain only letters and numbers.";
                            safeToGo = false;
                        }

                        if (safeToGo)
                        {
                            if (PasswordTextBox.Text == ConfirmPasswordTextBox.Text)
                                safeToGo = true;
                            else
                            {
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:CompleteRegistration.aspx.cs

示例4: FriendSearch

    protected void FriendSearch(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        ClearMessage();
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        TextBox FriendSearchTextBox = (TextBox)dat.FindControlRecursive(this, "FriendSearchTextBox");

        Label FriendMessageLabel = (Label)dat.FindControlRecursive(this, "FriendMessageLabel");

        if (FriendSearchTextBox.Text != "" && dat.TrapKey(FriendSearchTextBox.Text, 1))
        {
            DataSet ds = dat.GetData("SELECT * FROM Users WHERE UserName LIKE '%" + FriendSearchTextBox.Text + "%'");

            if (ds.Tables.Count > 0)
                if (ds.Tables[0].Rows.Count > 0)
                {
                    FillSearchPanel(ds);
                    ViewState["FriendDS"] = ds;
                }
                else
                    FriendMessageLabel.Text = "0 Results Found.";
            else
                FriendMessageLabel.Text = "0 Results Found.";
        }
        else
            FriendMessageLabel.Text = "Include a valid User Name in the text field.";
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:28,代码来源:User.aspx.cs


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