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


C# Encryption.encrypt方法代码示例

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


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

示例1: OpenMessage

    protected void OpenMessage(object sender, EventArgs e)
    {
        string id = "";
        string eType = "";
        if (Request.QueryString["ID"] != null)
        {
            id = Request.QueryString["ID"].ToString();
            eType = "V";
        }
        else if (Request.QueryString["AdID"] != null)
        {
            id = Request.QueryString["AdID"].ToString();
            eType = "A";
        }
        else if (Request.QueryString["EventID"] != null)
        {
            id = Request.QueryString["EventID"].ToString();
            eType = "E";
        }

        Encryption encrypt = new Encryption();
        MessageRadWindow.NavigateUrl = "MessageAlert.aspx?T=Flag&EType="+eType+"&message=" + encrypt.encrypt(message)+"&ID="+id;
        MessageRadWindow.Visible = true;

        MessageRadWindowManager.VisibleOnPageLoad = true;
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:26,代码来源:FlagItem.ascx.cs

示例2: MakeItSo

    protected void MakeItSo(object sender, System.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);
        }
        try
        {
            Encryption encrypt = new Encryption();

            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); if (Page.IsValid)
            {
                if (DBConnection(UserNameTextBox.Text.Trim(), encrypt.encrypt(PasswordTextBox.Text.Trim())))
                {
                    string groups = "";
                    SqlConnection myConn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
                    myConn.Open();
                    SqlCommand myCmd = new SqlCommand("SELECT U.Password, U.User_ID, UP.CatCountry, UP.CatState, UP.CatCity, U.UserName FROM Users U, UserPreferences UP WHERE U.User_ID=UP.UserID AND [email protected]", myConn);
                    myCmd.CommandType = CommandType.Text;
                    myCmd.Parameters.Add("@UserName", SqlDbType.NVarChar).Value = UserNameTextBox.Text.Trim();
                    DataSet ds = new DataSet();
                    SqlDataAdapter da = new SqlDataAdapter(myCmd);
                    da.Fill(ds);
                    myConn.Close();
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        dat.WhatHappensOnUserLogin(ds);

                        string redirectTo = "my-account";
                        if (Session["RedirectTo"] != null)
                            redirectTo = Session["RedirectTo"].ToString();

                        Response.Redirect(redirectTo, false);
                    }
                    else
                    {

                        StatusLabel.Text = "Invalid Login, please try again!";
                    }
                }
                else
                {
                    StatusLabel.Text = "Invalid Login, please try again!";
                }
            }
        }
        catch (Exception ex)
        {
            StatusLabel.Text = ex.ToString();
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:60,代码来源:UserLogin.aspx.cs

示例3: Main

 public static void Main(string[] args)
 {
     string input_string = "";
     int key = Int32.Parse(args[args.Length - 1]);
     for(int i = 0; i < args.Length - 1; i++) {
         input_string += args [i] + " ";
     }
     input_string = input_string.Remove (input_string.Length - 1);
     Encryption e = new Encryption (input_string, key);
     Console.WriteLine(e.encrypt ());
 }
开发者ID:tkshnwesper,项目名称:assignment,代码行数:11,代码来源:Encrypt.cs

示例4: SendIt

    protected void SendIt(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);
        }
        if (EmailTextBox.Text != "")
        {
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            SqlDbType [] types = {SqlDbType.NVarChar};
            EmailTextBox.Text = dat.stripHTML(EmailTextBox.Text.Trim());
            object[] parameters = { EmailTextBox.Text };
            DataSet ds = dat.GetDataWithParemeters("SELECT * FROM Users WHERE [email protected]", types, parameters);

            bool isNot = false;
            if (ds.Tables.Count > 0)
                if (ds.Tables[0].Rows.Count > 0)
                {
                    Encryption encrypt = new Encryption();
                    Random r = new Random(0);
                    string code = encrypt.encrypt(ds.Tables[0].Rows[0]["UserName"].ToString() + r.Next().ToString());
                    dat.Execute("UPDATE Users SET PasswordReset='" + code + "' WHERE User_ID="+ds.Tables[0].Rows[0]["User_ID"].ToString());
                    string body = "You have requested to re-set your password with Hippo Happenings. <br/>" +
                        "Please visit <a href=\"http://HippoHappenings.com/ResetPassword.aspx?CODE=" + code + "&UserName=" +
                        ds.Tables[0].Rows[0]["UserName"].ToString() + "\">http://HippoHappenings.com/ResetPassword.aspx?CODE=" + code + "&UserName=" +
                        ds.Tables[0].Rows[0]["UserName"].ToString() + "</a> to do so.";
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                        ds.Tables[0].Rows[0]["Email"].ToString(), body, "Hippo Happenings Reset Password Request");
                    MessageLabel.Text = "An email with the instructions has been sent to your account.";
                }
                else
                    isNot = true;
            else
                isNot = true;

            if (isNot)
            {
                MessageLabel.Text = "There is no user associated with this email address. Please make sure you have typed it correctly.";
            }
        }
        else
        {
            MessageLabel.Text = "Please include the Email";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:50,代码来源:PasswordAlert.aspx.cs

示例5: MakeItSo

 protected void MakeItSo(object sender, System.EventArgs e)
 {
     HttpCookie cookie = Request.Cookies["BrowserDate"];
     Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
     Encryption encrypt = new Encryption();
     if (PasswordTextBox.Text.Trim() != "" && ConfirmPasswordTextBox.Text.Trim() != "")
     {
         if (PasswordTextBox.Text.Trim() == ConfirmPasswordTextBox.Text.Trim())
         {
             dat.Execute("UPDATE Users SET PasswordReset='', PASSWORD='"+encrypt.encrypt(PasswordTextBox.Text.Trim())+"' WHERE UserName='"+Request.QueryString["UserName"].ToString()+"'");
             ErrorLabel.Text = "Your password has been changed.";
         }
         else
         {
             ErrorLabel.Text = "Password and confirm password must match.";
         }
     }
     else
     {
         ErrorLabel.Text = "Include both password and confirm password.";
     }
 }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:22,代码来源:ResetPassword.aspx.cs

示例6: PostIt


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

                    //if (YouTubeStr != "")
                    //{
                        dat.Execute("UPDATE Ads SET YouTubeVideo='" + YouTubeStr + "' WHERE Ad_ID=" + theID);
                    //}

                }
            }
            else
            {

            }

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

            CreateCategories(theID);

            string views = dat.GetDataDV("SELECT NumViews - NumCurrentViews AS Views FROM Ads WHERE Ad_ID=" +
                theID)[0]["Views"].ToString();

            if (bool.Parse(isFeatured.Text) && int.Parse(views) != 0)
                EmailSavedSearches(theID, views);

            //if (CategoriesCheckBoxes.Items.Count > 0)
            //{
            //    int catCount = CategoriesCheckBoxes.Items.Count;

            //    for (int i = 0; i < catCount; i++)
            //    {
            //        cmd = new SqlCommand("INSERT INTO Ad_Category_Mapping (AdID, CategoryID) VALUES (@adID, @catID)", conn);
            //        cmd.Parameters.Add("@adID", SqlDbType.Int).Value = ID;
            //        cmd.Parameters.Add("@catID", SqlDbType.Int).Value = int.Parse(CategoriesCheckBoxes.Items[i].Value);
            //        cmd.ExecuteNonQuery();
            //    }
            //}

            string adFeatured = "";
            string adFeaturedEmail = "";
            if (bool.Parse(isFeatured.Text))
            {
                adFeatured += "<br/><br/>Since you selected to have your ad Featured, you can view the progress of your ad on the <a class=\"AddLink\" onclick=\"Search('AdStatistics.aspx?Ad="+theID+"');\">Ad Statistics</a> page, which is also linkable from your user page.";
                adFeaturedEmail += "<br/><br/>Since you selected to have your ad Featured, you can view the progress of your ad on the <a href=\"http://hippohappenings.com/AdStatistics.aspx?Ad="+theID+"\">Ad Statistics</a> page, which is also linkable from your user page.";
            }
            DataSet dsUser = dat.GetData("SELECT Email, UserName FROM USERS WHERE User_ID=" +
                    Session["User"].ToString());
            string emailBody = "<br/><br/>Dear " + dsUser.Tables[0].Rows[0]["UserName"].ToString() + ", <br/><br/> you have successfully posted the ad \"" + AdNameTextBox.THE_TEXT +
        "\". <br/><br/> You can find this ad <a href=\"http://hippohappenings.com/" + dat.MakeNiceName(AdNameTextBox.THE_TEXT)+"_" + theID + "_Ad\">here</a>. " + adFeaturedEmail +
        "<br/><br/> To rate your experience posting this ad <a href=\"http://hippohappenings.com/RateExperience.aspx?Type=A&ID=" + theID + "\">please include your feedback here.</a>" +
        "<br/><br/><br/>Have a Hippo Happening Day!<br/><br/>";

            if (isEdit)
            {
                emailBody = "<br/><br/>Dear " + dsUser.Tables[0].Rows[0]["UserName"].ToString() + ", <br/><br/> you have successfully edited the ad \"" + AdNameTextBox.THE_TEXT +
        "\". <br/><br/> You can find this ad <a href=\"http://hippohappenings.com/" + dat.MakeNiceName(AdNameTextBox.THE_TEXT) + "_" + theID + "_Ad\">here</a>. " + adFeaturedEmail +
        "<br/><br/> To rate your experience editing this ad <a href=\"http://hippohappenings.com/RateExperience.aspx?Type=A&ID=" + theID + "\">please include your feedback here.</a>" +
        "<br/><br/><br/>Have a Hippo Happening Day!<br/><br/>";
            }

            if (!Request.IsLocal)
            {
                dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                            System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                            dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "You have successfully posted the ad: " +
                            AdNameTextBox.THE_TEXT);
            }
            conn.Close();

            dat.SendFriendPostedAdNotification(Session["User"].ToString(), theID);

            Session["Message"] = "Your ad has been posted successfully!<br/> Here are your next steps: <br/>";

            if (isEdit)
            {
                Session["Message"] = "Your ad has been edited successfully!<br/> Here are your next steps: <br/>";
            }

            CheckAllUsers(AdPlacementList.SelectedValue != "0.01", theID);

            //Clear cache so that the PlayerList.xml can be grabbed by the browser again.
            ClearCache();

            Session["Message"] += "<br/>" + "Go to <a class=\"AddLink\" onclick=\"Search('" + dat.MakeNiceName(AdNameTextBox.THE_TEXT) + "_" + theID + "_Ad');\">your ad's</a> home page." + adFeatured + "<br/><br/> -<a class=\"AddLink\" onclick=\"Search('RateExperience.aspx?Type=A&ID=" + theID + "');\" >Rate </a>your user experience posting this venue.<br/>";
            //MessageLiteral.Text = "<script type=\"text/javascript\">alert('" + message + "');</script>";
            Encryption encrypt = new Encryption();
            MessageRadWindow.NavigateUrl = "Message.aspx?message=" + encrypt.encrypt(Session["Message"].ToString() +
                "<br/><img onclick=\"Search('Home.aspx');\" onmouseover=\"this.src='image/DoneSonButtonSelected.png'\" onmouseout=\"this.src='image/DoneSonButton.png'\" src=\"image/DoneSonButton.png\"/>");
            MessageRadWindow.Visible = true;
            MessageRadWindowManager.VisibleOnPageLoad = true;

            Session["categorySession"] = null;
        }
        else
        {
            MessagePanel.Visible = true;
            YourMessagesLabel.Text += "<br/><br/>You must agree to the terms and conditions.";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:PostAnAd.aspx.cs

示例7: 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

示例8: SendIt

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

                //get user
                string user = "";

                switch (Request.QueryString["Type"].ToString())
                {
                    case "E":
                        user = dat.GetData("SELECT * FROM Events E, Users U WHERE U.UserName=E.UserName " +
                     "AND E.ID=" + Request.QueryString["ID"].ToString()).Tables[0].Rows[0]["User_ID"].ToString();
                        break;
                    case "V":
                        string temp = "CreatedByUser";
                        if (bool.Parse(Request.QueryString["Edit"].ToString()))
                        {
                            temp = "EditedByUser";
                        }
                        user = dat.GetData("SELECT "+temp+" FROM Venues V WHERE " +
                            " ID=" + Request.QueryString["ID"].ToString()).Tables[0].Rows[0][temp].ToString();
                        break;
                    case "A":
                        user = dat.GetData("SELECT * FROM Ads WHERE Ad_ID=" +
                            Request.QueryString["ID"].ToString()).Tables[0].Rows[0]["User_ID"].ToString();
                        break;
                    case "G":
                        user = dat.GetData("SELECT * FROM Groups WHERE ID=" +
                            Request.QueryString["ID"].ToString()).Tables[0].Rows[0]["Host"].ToString();
                        break;
                    case "GE":
                        user = dat.GetData("SELECT * FROM GroupEvents WHERE ID=" +
                            Request.QueryString["ID"].ToString()).Tables[0].Rows[0]["UserID"].ToString();
                        break;
                    default: break;
                }

                dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    "user: " + user + ", postDetails: " + Request.QueryString["Type"].ToString() + "; ID=" +
                    Request.QueryString["ID"].ToString() + ", rating value: " +
                    RatingRadioList.SelectedValue + ", message: " + MessageTextBox.Text, "Hippo Experience Rating");

                string command = "INSERT INTO SiteExperienceRatings (UserID, PostDetails, ExperienceRating, ExperienceDetails) VALUES(@p0, @p1, @p2, @p3)";
                SqlDbType[] types = { SqlDbType.Int, SqlDbType.NVarChar, SqlDbType.Int, SqlDbType.NVarChar };
                object[] data = { int.Parse(user),
                    "Type="+Request.QueryString["Type"].ToString()+"; ID="+Request.QueryString["ID"].ToString(), RatingRadioList.SelectedValue, MessageTextBox.Text };
                dat.ExecuteWithParemeters(command, types, data);
                //dat.SendEmail("Hippo happenings email address", "Hippo Happening", YourEmailTextBox.Text, EmailTextBox.Text + "<br/>"+Session["message"].ToString(), EmailSubjectLabel.Text);
                Encryption encrypt = new Encryption();
                MessageRadWindow.NavigateUrl = "Message.aspx?message=" + encrypt.encrypt("Thank you for your feedback!<br/><br/><br/><img onclick=\"Search('Home.aspx');\" onmouseover=\"this.src='image/DoneSonButtonSelected.png'\" onmouseout=\"this.src='image/DoneSonButton.png'\" src=\"image/DoneSonButton.png\"/>");
                MessageRadWindow.Visible = true;
                MessageRadWindowManager.VisibleOnPageLoad = true;
            }
            catch (Exception ex)
            {
                MessageRequired.Text = ex.ToString();
            }
        }
        else
        {
            if (MessageTextBox.Text == "")
                MessageRequired.Text = "*Please include a message";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:71,代码来源:RateExperience.aspx.cs

示例9: SendItNotLoggedIn

    protected void SendItNotLoggedIn(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        string message = ConfirmEmail();
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        TextBox1.Text = dat.stripHTML(TextBox1.Text);
        TextBox2.Text = dat.stripHTML(TextBox2.Text);
        if (message == "Success")
        {
            if (TextBox1.Text != "" && TextBox2.Text != "")
            {
                try
                {

                    string command = "INSERT INTO MessagesForAdmin (Message, Subject, Type, Email) VALUES(@p0, @p1, @p2, @p3)";
                    SqlDbType[] types = { SqlDbType.NChar, SqlDbType.NVarChar, SqlDbType.Int, SqlDbType.NVarChar };
                    object[] data = { TextBox2.Text, TextBox1.Text, 1, EmailTextBox.Text.Trim().ToLower() };
                    dat.ExecuteWithParemeters(command, types, data);

                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                        System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString()
                        , "Email: " + EmailTextBox.Text + ", has filled out a 'Contact Us' form. Here is their message: <br/><br/>" +
                        TextBox2.Text, "Contact Us Form Submitted: " + TextBox1.Text);

                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                        EmailTextBox.Text.Trim().ToLower()
                        , "<br/><br/>Your contact request has been submitted to Hippo Happenings. We will reply to your " +
                        "request momentarily.", "Hippo Happenings Contact Request Submitted");

                    Encryption encrypt = new Encryption();
                    MessageRadWindow.NavigateUrl = "Message.aspx?message=" + encrypt.encrypt("<br/>Your message has been sent. We will get back to you as soon as possible.<br/><br/><button onclick=\"Search('Home.aspx');\" name=\"Ok\" title=\"Ok\">Ok</button>");
                    MessageRadWindow.Visible = true;
                    MessageRadWindowManager.VisibleOnPageLoad = true;

                }
                catch (Exception ex)
                {
                    Label2.Text = ex.ToString();
                }
            }
            else
            {
                if (TextBox1.Text.Trim() == "")
                    Label1.Text = "*Please include the subject";
                if (TextBox2.Text.Trim() == "")
                    Label2.Text = "*Please include a message";
            }
        }
        else
        {
            Label2.Text = message;
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:55,代码来源:ContactUs.aspx.cs

示例10: SendIt

    protected void SendIt(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (SubjectTextBox.Text != "" && MessageTextBox.Text != "")
        {
            try
            {
                Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
                SubjectTextBox.Text = dat.stripHTML(SubjectTextBox.Text);
                MessageTextBox.Text = dat.stripHTML(MessageTextBox.Text);

                string command = "INSERT INTO MessagesForAdmin (UserID, Message, Subject, Type) VALUES(@p0, @p1, @p2, @p3)";
                SqlDbType[] types = { SqlDbType.Int, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.Int };
                object[] data = { int.Parse(Session["User"].ToString()), MessageTextBox.Text, SubjectTextBox.Text, 3};
                dat.ExecuteWithParemeters(command, types, data);

                DataSet dsUser = dat.GetData("SELECT * FROM Users WHERE User_ID=" + Session["User"].ToString());

                dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    "Feedback from site. User logged in. UserID: " + Session["User"].ToString() +
                    "<br/><br/>User's Subject: " + SubjectTextBox.Text + "<br/><br/>User's Message: " + MessageTextBox.Text,
                    "Feedback from HippoHappenings[Logged in]: " + SubjectTextBox.Text);
                Encryption encrypt = new Encryption();
                MessageRadWindow.NavigateUrl = "Message.aspx?message=" +
                    encrypt.encrypt("<div style=\"height: 200px; vertical-align: middle;\">Your message has been sent<br/><br/><br/><br/><button onclick=\"Search('Home.aspx');\" name=\"Ok\" title=\"Ok\">Ok</button></div>");
                MessageRadWindow.Visible = true;
                MessageRadWindowManager.VisibleOnPageLoad = true;
            }
            catch (Exception ex)
            {

            }
        }
        else
        {
            if (SubjectTextBox.Text == "")
                SubjectRequired.Text = "*Please include the subject";
            if (MessageTextBox.Text == "")
                MessageRequired.Text = "*Please include a message";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:43,代码来源:Feedback.aspx.cs

示例11: VoteOnIt

    protected void VoteOnIt(object sender, EventArgs e)
    {
        Button button = (Button)sender;

        string theID = button.CommandArgument;

        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", ":")));

        dat.Execute("INSERT INTO FunctionalityVote (UserID, FunctionalityID, DateVoted) VALUES(" + Session["User"].ToString() + ", " + theID + ", GETDATE())");

        Encryption encrypt = new Encryption();
        MessageRadWindow.NavigateUrl = "Message.aspx?message=" +
            encrypt.encrypt("<div style=\"height: 200px; vertical-align: middle;\">"+
            "Thank You!<br/><br/>Your vote has been recorded.<br/><br/><button onclick=\"Search('Home.aspx');\""+
            "name=\"Ok\" title=\"Ok\">Ok</button></div>");
        MessageRadWindow.Visible = true;
        MessageRadWindowManager.VisibleOnPageLoad = true;
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:26,代码来源:Vote.aspx.cs

示例12: Save


//.........这里部分代码省略.........
                        if (RadTreeView1.Nodes[i].Nodes[n].Checked)
                        {
                            cmd = new SqlCommand("INSERT INTO UserCategories (UserID, CategoryID) VALUES(@user, @cat)", conn);
                            cmd.Parameters.Add("@user", SqlDbType.Int).Value = USER_ID;
                            cmd.Parameters.Add("@cat", SqlDbType.Int).Value = RadTreeView1.Nodes[i].Nodes[n].Value;
                            cmd.ExecuteNonQuery();
                        }
                    }
                }

                for (int i = 0; i < RadTreeView2.Nodes.Count; i++)
                {
                    if (RadTreeView2.Nodes[i].Checked)
                    {
                        cmd = new SqlCommand("INSERT INTO UserCategories (UserID, CategoryID) VALUES(@user, @cat)", conn);
                        cmd.Parameters.Add("@user", SqlDbType.Int).Value = USER_ID;
                        cmd.Parameters.Add("@cat", SqlDbType.Int).Value = RadTreeView2.Nodes[i].Value;
                        cmd.ExecuteNonQuery();
                    }
                    for (int n = 0; n < RadTreeView2.Nodes[i].Nodes.Count; n++)
                    {
                        if (RadTreeView2.Nodes[i].Nodes[n].Checked)
                        {
                            cmd = new SqlCommand("INSERT INTO UserCategories (UserID, CategoryID) VALUES(@user, @cat)", conn);
                            cmd.Parameters.Add("@user", SqlDbType.Int).Value = USER_ID;
                            cmd.Parameters.Add("@cat", SqlDbType.Int).Value = RadTreeView2.Nodes[i].Nodes[n].Value;
                            cmd.ExecuteNonQuery();
                        }
                    }
                }

                for (int i = 0; i < RadTreeView3.Nodes.Count; i++)
                {
                    if (RadTreeView3.Nodes[i].Checked)
                    {
                        cmd = new SqlCommand("INSERT INTO UserCategories (UserID, CategoryID) VALUES(@user, @cat)", conn);
                        cmd.Parameters.Add("@user", SqlDbType.Int).Value = USER_ID;
                        cmd.Parameters.Add("@cat", SqlDbType.Int).Value = RadTreeView3.Nodes[i].Value;
                        cmd.ExecuteNonQuery();
                    }
                    for (int n = 0; n < RadTreeView3.Nodes[i].Nodes.Count; n++)
                    {
                        if (RadTreeView3.Nodes[i].Nodes[n].Checked)
                        {
                            cmd = new SqlCommand("INSERT INTO UserCategories (UserID, CategoryID) VALUES(@user, @cat)", conn);
                            cmd.Parameters.Add("@user", SqlDbType.Int).Value = USER_ID;
                            cmd.Parameters.Add("@cat", SqlDbType.Int).Value = RadTreeView3.Nodes[i].Nodes[n].Value;
                            cmd.ExecuteNonQuery();
                        }
                    }
                }

                cmd = new SqlCommand("DELETE FROM UserVenues WHERE [email protected]", conn);
                cmd.Parameters.Add("@user", SqlDbType.Int).Value = USER_ID;
                cmd.ExecuteNonQuery();

                CheckBoxList VenueCheckBoxes = (CheckBoxList)VenuesRadPanel.Items[0].Items[0].FindControl("VenueCheckBoxes");

                if (VenueCheckBoxes != null)
                {
                    for (int i = 0; i < VenueCheckBoxes.Items.Count; i++)
                    {
                        if (VenueCheckBoxes.Items[i].Selected)
                        {
                            cmd = new SqlCommand("INSERT INTO UserVenues (UserID, VenueID) VALUES(@user, @cat)", conn);
                            cmd.Parameters.Add("@user", SqlDbType.Int).Value = USER_ID;
                            cmd.Parameters.Add("@cat", SqlDbType.Int).Value = VenueCheckBoxes.Items[i].Value;
                            cmd.ExecuteNonQuery();
                        }
                    }
                }
                conn.Close();
                Encryption encrypt = new Encryption();
                Session["Message"] = "Your profile has been updated!";

                //MessageLiteral.Text = "<script type=\"text/javascript\">alert('" + message + "');</script>";

                MessageRadWindow.Title = "Profile Updated";
                MessageRadWindow.NavigateUrl = "Message.aspx?message=" + encrypt.encrypt(Session["Message"].ToString() + "<br/><img onclick=\"Search('Home.aspx');\" onmouseover=\"this.src='image/DoneSonButtonSelected.png'\" onmouseout=\"this.src='image/DoneSonButton.png'\" src=\"image/DoneSonButton.png\"/>");
                MessageRadWindow.Visible = true;
                MessageRadWindowManager.VisibleOnPageLoad = true;
            }
            else
            {
                Encryption encrypt = new Encryption();
                Session["Message"] = "Email is invalid";

                //MessageLiteral.Text = "<script type=\"text/javascript\">alert('" + message + "');</script>";

                MessageRadWindow.Title = "Invalid Email";
                MessageRadWindow.NavigateUrl = "Message.aspx?message=" + encrypt.encrypt(Session["Message"].ToString() + "<br/><img onclick=\"Search('Home.aspx');\" onmouseover=\"this.src='image/DoneSonButtonSelected.png'\" onmouseout=\"this.src='image/DoneSonButton.png'\" src=\"image/DoneSonButton.png\"/>");
                MessageRadWindow.Visible = true;
                MessageRadWindowManager.VisibleOnPageLoad = true;
            }
        }
        catch (Exception ex)
        {
            ErrorLabel.Text = ex.ToString();
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:UserPreferences.aspx.cs

示例13: SendIt

    protected void SendIt(object sender, EventArgs e)
    {
        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); SubjectTextBox.Text = dat.stripHTML(SubjectTextBox.Text);
        MessageTextBox.Text = dat.stripHTML(MessageTextBox.Text);
        if (SubjectTextBox.Text != "" && MessageTextBox.Text != "")
        {
            try
            {

                string command = "INSERT INTO MessagesForAdmin (UserID, Message, Subject, Type) VALUES(@p0, @p1, @p2, @p3)";
                SqlDbType[] types = { SqlDbType.Int, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.Int };
                object[] data = { int.Parse(Session["User"].ToString()), MessageTextBox.Text, SubjectTextBox.Text, 1 };
                dat.ExecuteWithParemeters(command, types, data);

                DataSet dsUser = dat.GetData("SELECT * FROM Users WHERE User_ID="+Session["User"].ToString());

                dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString()
                    , "User ID: " + Session["User"].ToString() + ", UserName: " +
                    dsUser.Tables[0].Rows[0]["UserName"].ToString() +
                    " has filled out a 'Contact Us' form. Here is their message: <br/><br/>" +
                    MessageTextBox.Text, "Contact Us Form Submitted: "+SubjectTextBox.Text);

                dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                    dsUser.Tables[0].Rows[0]["Email"].ToString()
                    , "<br/><br/>Your contact request has been submitted to Hippo Happenings. We will reply to your "+
                    "request momentarily.", "Hippo Happenings Contact Request Submitted");

                Encryption encrypt = new Encryption();
                MessageRadWindow.NavigateUrl = "Message.aspx?message=" + encrypt.encrypt("<br/><br/>Thank you for your contact request. We will get back to you as soon as possible.<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>");
                MessageRadWindow.Visible = true;
                MessageRadWindowManager.VisibleOnPageLoad = true;

            }
            catch (Exception ex)
            {

            }
        }
        else
        {
            if (SubjectTextBox.Text == "")
                SubjectRequired.Text = "*Please include the subject";
            if (MessageTextBox.Text == "")
                MessageRequired.Text = "*Please include a message";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:66,代码来源:ContactUs.aspx.cs

示例14: 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.Text.Trim() != "")
                hasState = true;

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

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

            bool hasZip = false;
            if (CatZipTextBox.Text.Trim() != "")
                hasZip = true;

            UserNameTextBox.Text = UserNameTextBox.Text.Trim().Replace(" ", "");

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

                bool safeToGo = false;
                if (dat.TrapKey(UserNameTextBox.Text, 1))
                {
                    DataSet ds = dat.GetData("SELECT * FROM Users WHERE UserName='" +
                        UserNameTextBox.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=\"login\">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
                            {
                                safeToGo = false;
                                MessageLabel.Text = "*The Confirm Password must match the Password.";
                            }

                            if (safeToGo)
                            {
                                if (safeToGo)
                                {
                                    Encryption encrypt = new Encryption();
                                    string namesStart = "";
                                    string namesEnd = "";
                                    if (FirstNameTextBox.Text.Trim() != "")
                                    {
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:CompleteRegistration.aspx.cs

示例15: SendItNotLoggedIn

 protected void SendItNotLoggedIn(object sender, EventArgs e)
 {
     HttpCookie cookie = Request.Cookies["BrowserDate"];
     string message = ConfirmEmail();
     if (message == "Success")
     {
         if (TextBox1.Text != "" && TextBox2.Text != "")
         {
             try
             {
                 Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
                 TextBox1.Text = dat.stripHTML(TextBox1.Text);
                 TextBox2.Text = dat.stripHTML(TextBox2.Text);
                 string command = "INSERT INTO MessagesForAdmin (Message, Subject, Type, Email) VALUES(@p0, @p1, @p2, @p3)";
                 SqlDbType[] types = { SqlDbType.NChar, SqlDbType.NVarChar, SqlDbType.Int, SqlDbType.NVarChar };
                 object[] data = { TextBox2.Text, TextBox1.Text, 3, EmailTextBox.Text.Trim().ToLower() };
                 dat.ExecuteWithParemeters(command, types, data);
                 dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                 System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                                 System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                 "Feedback from site. User not logged in. Email: " + EmailTextBox.Text.Trim().ToLower() +
                                 "<br/><br/>User's Subject: " + TextBox1.Text + "<br/><br/>User's Message: " + TextBox2.Text,
                                 "Feedback from HippoHappenings[Not logged in]: " + TextBox1.Text);
                 Encryption encrypt = new Encryption();
                 MessageRadWindow.NavigateUrl = "Message.aspx?message=" +
                     encrypt.encrypt("<div style=\"height: 200px; vertical-align: middle;\"><br/>Your message has been sent. <br/><br/>Thank you for your feedback!<br/><br/><br/><button onclick=\"Search('Home.aspx');\" name=\"Ok\" title=\"Ok\">Ok</button></div>");
                 MessageRadWindow.Visible = true;
                 MessageRadWindowManager.VisibleOnPageLoad = true;
             }
             catch (Exception ex)
             {
                 Label2.Text = ex.ToString();
             }
         }
         else
         {
             if (TextBox1.Text.Trim() == "")
                 Label1.Text = "*Please include the subject";
             if (TextBox2.Text.Trim() == "")
                 Label2.Text = "*Please include a message";
         }
     }
     else
     {
         Label2.Text = message;
     }
 }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:47,代码来源:Feedback.aspx.cs


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