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


C# Data.SendEmail方法代码示例

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


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

示例1: AddAsFriend

    protected void AddAsFriend(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        conn.Open();
        SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, To_UserID, Date, [Read], Mode)"
            + " VALUES(@content, @subject, @fromID, @toID, @date, 'False', 2)", conn);
        cmd.Parameters.Add("@content", SqlDbType.Text).Value = "Good Day from Hippo Happenings!, <br/><br/> We wanted to let you know that the user '" + Session["UserName"].ToString() + "' would like " +
            "to add you to their list of friends. To accept this request select the link below. <br/><br/> Have a Happening Day! <br/><br/> ";
        cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = "You Have a Hippo Friend Request!";
        cmd.Parameters.Add("@toID", SqlDbType.Int).Value = int.Parse(Session["Friend"].ToString());
        cmd.Parameters.Add("@fromID", SqlDbType.Int).Value = int.Parse(Session["User"].ToString());
        cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
        cmd.ExecuteNonQuery();
        conn.Close();
        AddAsFriendPanel.Visible = false;
        AddedFriendLabel.Text = "Your friend request has been sent!";

        DataSet dsTo = dat.GetData("SELECT * FROM Users U, UserPreferences UP WHERE UP.UserID=U.User_ID AND U.User_ID=" + Session["Friend"].ToString());
        if (dsTo.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("5"))
        {
            dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                dsTo.Tables[0].Rows[0]["Email"].ToString(), Session["UserName"].ToString() +
                " would like to extend a Hippo Happ friend invitation to you. You can find out " +
                "about this user <a target=\"_blank\" class=\"AddLink\" href=\"http://hippohappenings.com/" + Session["UserName"].ToString() + "_Friend"
                 + "\">here</a>. To accept this Hippo user as a friend, please log onto <a href=\"http://hippohappenings.com/my-account\">Hippo Happenings</a>.", "Hippo Happs Friend Request!");
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:30,代码来源:Friend.aspx.cs

示例2: SendIt

    public int SendIt(string msgText, string userName, string userID, string eventName, 
        string[] idArray, string msgBody)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet dsUser;
        for (int i = 0; i < idArray.Length; i++)
        {
            SqlConnection conn = dat.GET_CONNECTED;
            SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, To_UserID, Date, [Read], Mode)"
                + " VALUES(@content, @subject, @fromID, @toID, @date, 'False', 0)", conn);
            cmd.Parameters.Add("@content", SqlDbType.Text).Value = msgText + "<br/><br/>"+msgBody;
            cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = userName + " wants you to check out event " + eventName;
            cmd.Parameters.Add("@toID", SqlDbType.Int).Value = int.Parse(idArray[i]);
            cmd.Parameters.Add("@fromID", SqlDbType.Int).Value = int.Parse(userID);
            cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
            cmd.ExecuteNonQuery();
            conn.Close();

            dsUser = dat.GetData("SELECT * FROM Users WHERE User_ID=" + idArray[i]);
            dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                dsUser.Tables[0].Rows[0]["Email"].ToString(),
                "<div><br/>A new email arrived at your inbox on Hippo Happenings. <br/><br/> Email Contents:<br/><br/>Subject: " +
                  userName + " wants you to check out event " + eventName + "<br/><br/>Message Body: " +
                  msgText + "<br/><br/>" + msgBody +
                  "<br/><br/> To view the message, <a href=\"HippoHappenings.com/login\">" +
                "log into Hippo Happenings</a></div>", "You have a new email at Hippo Happenings!");

            MessageLabel2.Text = "Your message has been sent.";
            ThankYouPanel.Visible = true;
            MessagePanel.Visible = false;
        }
        return 0;
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:35,代码来源:MessageAlert.aspx.cs

示例3: AddFriend_Click

    protected void AddFriend_Click(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        LinkButton theButton = (LinkButton)sender;
        string friendID = theButton.ID.Replace("link", "");
        DataSet dsSend = dat.GetData("SELECT * FROM Users WHERE User_ID=" + Session["User"].ToString());
        DataSet dsTo = dat.GetData("SELECT * FROM Users U, UserPreferences UP WHERE UP.UserID=U.User_ID AND U.User_ID=" + friendID);
        try
        {
            //only send to email if users preferences are set to do so.
            if (dsTo.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("5"))
            {

                dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                    dsTo.Tables[0].Rows[0]["Email"].ToString(), Session["UserName"].ToString() +
                    " would like to extend a Hippo Happ friend invitation to you. You can find out " +
                    "about this user <a target=\"_blank\" class=\"AddLink\" href=\"http://hippohappenings.com/" + Session["UserName"].ToString() +"_Friend"
                     + "\">here</a>. To accept this Hippo user as a friend, please log onto <a href=\"http://hippohappenings.com/User.aspx\">Hippo Happenings</a>.", "Hippo Happs Friend Request!");
            }

            SqlConnection conn = dat.GET_CONNECTED;
            SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, "+
                "From_UserID, To_UserID, Date, [Read], Mode)"
                + " VALUES(@content, @subject, @fromID, @toID, @date, 'False', 2)", conn);
            cmd.Parameters.Add("@content", SqlDbType.Text).Value = Session["UserName"].ToString() +
                " would like to extend a Hippo Happ friend invitation to you. You can find out about " +
                "this user <a target=\"_blank\" class=\"AddLink\" href=\"/" + Session["UserName"].ToString()
                 + "_Friend\">here</a>. To accept this Hippo user as a friend, " +
                "click on the 'Accept Friend' button.";
            cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = "Hippo Happs Friend Request!";
            cmd.Parameters.Add("@toID", SqlDbType.Int).Value = friendID;
            cmd.Parameters.Add("@fromID", SqlDbType.Int).Value = Session["User"].ToString();
            cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
            cmd.ExecuteNonQuery();
            conn.Close();

            int theIndex = FriendsPanel.Controls.IndexOf(theButton);
            FriendsPanel.Controls.Remove(theButton);

            Literal tex = new Literal();
            tex.Text = "<div class=\"AddGreenLink\"  style=\"display: inline;\">Friend request sent.</div>";

            FriendsPanel.Controls.AddAt(theIndex, tex);
        }
        catch (System.Net.Mail.SmtpException ex)
        {
            Label lab = new Label();
            lab.Text = ex.ToString() + ex.StatusCode;
            FriendsPanel.Controls.Clear();
            FriendsPanel.Controls.Add(lab);

        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:55,代码来源:AddFriendAlert.aspx.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: Suggest

    protected void Suggest(object sender, EventArgs e)
    {
        if (VenueSuggestTextBox.Text.Trim() != "")
        {
            Data dat = new Data(DateTime.Now);
            VenueSuggestTextBox.Text = dat.stripHTML(VenueSuggestTextBox.Text.Trim());

            dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString()
                , "Gotten a venue suggestions from: IP: " + dat.GetIP() + ", Message: " + VenueSuggestTextBox.Text + ", Email: " + EmailTextBox.Text,
                "Venue Suggestion Submitted");

            SuggestErrorLabel.Text = "Your suggestion has been made! Thanks!";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:16,代码来源:Home.aspx.cs

示例6: CreateMembers


//.........这里部分代码省略.........
                {
                    descripUpdate = " Description = '" + item.Value.Trim().Replace("'", "''") + "'";
                    descrip = ", '" + item.Value.Trim().Replace("'", "''") + "'";
                    descripBeg = ", Description";
                }
                if (tokens.Length > 2)
                {
                    if (tokens[2].Trim() == "shared hosting")
                    {
                        sharedUpdate = " SharedHosting = 'True' ";
                        shared = ", 'True'";
                        sharedBeg = ", SharedHosting";
                    }
                    else
                    {
                        if (tokens.Length > 3)
                        {
                            if (tokens[3].Trim() == "shared hosting")
                            {
                                sharedUpdate = " SharedHosting = 'True' ";
                                shared = ", 'True'";
                                sharedBeg = ", SharedHosting";
                            }
                        }
                    }
                }

                //take care of update string
                if (titleUpdate.Trim() != "")
                {
                    updateString = titleUpdate;
                }

                if (descripUpdate.Trim() != "")
                {
                    if (updateString.Trim() != "")
                    {
                        updateString += ", " + descripUpdate;
                    }
                    else
                    {
                        updateString = descripUpdate;
                    }
                }

                if (sharedUpdate.Trim() != "")
                {
                    if (updateString.Trim() != "")
                    {
                        updateString += ", " + sharedUpdate;
                    }
                    else
                    {
                        updateString = sharedUpdate;
                    }
                }

                //execute update/insert member
                DataView dvMember = new DataView();
                if (Request.QueryString["ID"] != null)
                {
                    dvMember = dat.GetDataDV("SELECT * FROM Group_Members WHERE MemberID=" +
                     ID + " AND GroupID=" + Request.QueryString["ID"].ToString());
                }

                if (dvMember.Count == 0)
                {
                    command = "INSERT INTO Group_Members (GroupID, MemberID " + titleBeg + descripBeg + sharedBeg + ") VALUES(" + theID + ", " + ID + title + descrip + shared + ")";
                }
                else
                {
                    if (updateString != "")
                        command = "UPDATE Group_Members SET " + updateString + " WHERE MemberID=" + ID + " AND GroupID=" + Request.QueryString["ID"].ToString();
                }
                dat.Execute(command);

                if (ID != Session["User"].ToString())
                {
                    dat.Execute("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, To_UserID, " +
                    "[Date], [Read], [Mode], [Live]) VALUES('" + messageBody.Replace("'", "''") + "', '" + emailSubject.Replace("'", "''") + "', " +
                    dat.HIPPOHAPP_USERID.ToString() + ", " + ID + ", '" +
                    DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).ToString() + "', 'False', 7, 'True')");
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                            System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                                            dvUser[0]["Email"].ToString(), emailBody, emailSubject);
                }
            }

            if (!isUpdate && !hasHost)
            {
                dat.Execute("INSERT INTO Group_Members (GroupID, MemberID, SharedHosting, Accepted) VALUES(" +
                    theID + ", " + Session["User"].ToString() + ", 'True', 'True')");
            }
        }
        catch (Exception ex)
        {
            MessagePanel.Visible = true;
            YourMessagesLabel.Text = ex.ToString()+"<br/>command: "+command;
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:EnterGroup_OLD.aspx.cs

示例7: SendFlagEmail

    protected void SendFlagEmail(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        try
        {
            if (TextBox2.Text.Trim() != "")
            {
                string EType = Session["FlagType"].ToString();
                string id = Session["FlagID"].ToString();
                string body = "<br/> Regarding EType: " + EType + ", ID: " + id;
                Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
                if (FlagTextPanel.Visible)
                {
                    SqlDbType[] types = { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.Int, SqlDbType.NVarChar };
                    object[] data = { TextBox2.Text, "Flag Item", 2, FlagEmailTextBox.Text };
                    dat.ExecuteWithParemeters("INSERT INTO MessagesForAdmin (Message, Subject, Type, Email) VALUES(@p0, @p1, @p2, @p3)", types, data);
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                                        System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                         "Anonymous user has flagged an item. EType: " + EType + ", ID: " + id + " Here is their email:" +
                                        FlagEmailTextBox.Text + " Here is their message:  <br/><br/>" + TextBox2.Text, "Hippo Website Flag: An item has been flagged.");
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                            System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                            FlagEmailTextBox.Text
            , "Hippo Happenings has received your request to flag an item. We will investigate and take appropriate action.", "Hippo Happenings Flag Request Received");

                }
                else
                {
                    SqlDbType[] types = { SqlDbType.NVarChar, SqlDbType.Int, SqlDbType.NVarChar, SqlDbType.Int };
                    object[] data = { TextBox2.Text, Session["User"].ToString(), "Flag Item", 2 };
                    dat.ExecuteWithParemeters("INSERT INTO MessagesForAdmin (Message, UserID, Subject, Type) VALUES(@p0, @p1, @p2, @p3)", 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 flagged an item. EType: " + EType + ", ID: " + id + " Here is their message: <br/><br/>" +
                        TextBox2.Text, "Hippo Website Flag: An item has been flagged.");

                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                                        dsUser.Tables[0].Rows[0]["Email"].ToString()
                        , "Hippo Happenings has received your request to flag an item. " +
                        "We will investigate and get back to you.", "Hippo Happenings Flag Request Received");
                }

                Label2.Text = "Your message has been sent.";
                FlagPanel.Visible = false;
                ThankYouPanel.Visible = true;
            }
            else
            {
                Label2.Text = "Please include your message.";
            }
        }
        catch (Exception ex)
        {
            Label2.Text = ex.ToString();
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:64,代码来源:MessageAlert.aspx.cs

示例8: PostIt


//.........这里部分代码省略.........
                        origName = tokensN[0].Trim();

                        string[] tokens = realName.Split(delim3);

                        if (tokens.Length >= 2)
                        {
                            if (tokens[1].ToUpper() == "JPG" || tokens[1].ToUpper() == "JPEG" || tokens[1].ToUpper() == "GIF")
                            {
                                if (!System.IO.File.Exists(MapPath(".") + "\\GroupFiles\\" + ID.ToString() + "\\Slider\\" + realName))
                                {
                                    System.IO.File.Copy(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\Slider\\" +
                                                        realName, MapPath(".") + "\\GroupFiles\\" + ID.ToString() + "\\Slider\\" + realName);
                                }

                                cmd = new SqlCommand("INSERT INTO Group_Slider_Mapping (GroupID, PictureName, RealPictureName, Caption) " +
                                    "VALUES (@eventID, @picName, @realName, @cap)", conn);
                                cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = ID;
                                cmd.Parameters.Add("@picName", SqlDbType.NVarChar).Value = realName;
                                cmd.Parameters.Add("@realName", SqlDbType.NVarChar).Value = origName;
                                cmd.Parameters.Add("@cap", SqlDbType.NVarChar).Value = caption;
                                cmd.ExecuteNonQuery();
                            }
                        }
                        else
                        {
                            cmd = new SqlCommand("INSERT INTO Group_Slider_Mapping (isYouTube,GroupID, PictureName, RealPictureName, Caption) " +
                                    "VALUES ('True',@eventID, @picName, @realName, @cap)", conn);
                            cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = ID;
                            cmd.Parameters.Add("@picName", SqlDbType.NVarChar).Value = realName.Replace("YouTube ID: ", "");
                            cmd.Parameters.Add("@realName", SqlDbType.NVarChar).Value = realName.Replace("YouTube ID: ", "");
                            cmd.Parameters.Add("@cap", SqlDbType.NVarChar).Value = caption;
                            cmd.ExecuteNonQuery();
                        }
                    }

                }

                CreateMembers(ID, isUpdate);
                CreateCategories(ID, isUpdate);

                //Send the informational email to the user
                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 group \"" + VenueNameTextBox.THE_TEXT +
                   "\". <br/><br/> You can find this group <a href=\"http://hippohappenings.com/" + dat.MakeNiceName(VenueNameTextBox.THE_TEXT) + "_" + ID + "_Group\">here</a>. " +
                   "<br/><br/> To rate your experience posting this group <a href=\"http://hippohappenings.com/RateExperience.aspx?Edit=" + isUpdate.ToString() + "&Type=G&ID=" + ID + "\">please include your feedback here.</a>" +
                   "<br/><br/><br/>Have a Hippo Happening Day!<br/><br/>";

                if (isUpdate)
                {

                        if (!Request.Url.AbsoluteUri.Contains("localhost"))
                        {
                            dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                                dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "You have updated group: " +
                                VenueNameTextBox.THE_TEXT);
                        }
                }
                else
                {
                    if (!Request.Url.AbsoluteUri.Contains("localhost"))
                    {
                        dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                            System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                            dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "You have posted the group: " +
                            VenueNameTextBox.THE_TEXT);
                    }
                }

                conn.Close();

                //pop up the message to the user
                Encryption encrypt = new Encryption();

                if (!isUpdate)
                {
                    Session["Message"] = "Your group has been posted successfully! An email with this info will also be sent to your account.<br/>"
                        + "<br/>Check out <a class=\"AddLink\" onclick=\"Search('" + dat.MakeNiceName(VenueNameTextBox.THE_TEXT) + "_" + ID + "_Group');\">this group's</a> home page.<br/><br/><br/> -<a class=\"AddLink\" onclick=\"Search('RateExperience.aspx?Edit=" + isUpdate.ToString() + "&Type=G&ID=" + ID + "');\" >Rate </a>your user experience posting this group.<br/>";
                }
                else
                {
                    Session["Message"] = "You have successfully updated group: \"" + VenueNameTextBox.THE_TEXT.Trim() +
                    "\".<br/><br/>Check out <a class=\"AddLink\" onclick=\"Search('" + dat.MakeNiceName(VenueNameTextBox.THE_TEXT) + "_" + ID +
                    "_Group');\">this group's</a> home page.<br/><br/> <a class=\"AddLink\" onclick=\"Search('RateExperience.aspx?Edit=" +
                    isUpdate.ToString() + "&Type=G&ID=" + ID + "');\" >Rate </a>your user experience editing this group.<br/>";
                }

                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;
                MessageRadWindow.VisibleOnPageLoad = true;
            }
        }
        else
        {
            MessagePanel.Visible = true;
            YourMessagesLabel.Text += "<br/><br/>You must agree to the terms and conditions.";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:EnterGroup_OLD.aspx.cs

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

示例10: PostIt


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

                //Send the informational email to the user
                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 venue \"" + VenueNameTextBox.THE_TEXT +
                   "\". <br/><br/> You can find this venue <a href=\"http://hippohappenings.com/" + dat.MakeNiceName(VenueNameTextBox.THE_TEXT) + "_" + ID + "_Venue\">here</a>. " +
                   "<br/><br/> To rate your experience posting this venue <a href=\"http://hippohappenings.com/RateExperience.aspx?Edit=" + isUpdate.ToString() + "&Type=V&ID=" + ID + "\">please include your feedback here.</a>" +
                   "<br/><br/><br/>Have a Hippo Happening Day!<br/><br/>";

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

                     if (isUpdate && !isOwner)
                     {
                         if (!ownerUpForGrabs)
                         {
                             DataSet dsEventUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + ownerID);
                             emailBody = "<br/><br/>A change request has been submitted for a venue you are the owner of on HippoHappenings: \"" + VenueNameTextBox.THE_TEXT.Trim() +
                                 "\". <br/><br/> You can find this venue <a href=\"http://hippohappenings.com/" + dat.MakeNiceName(VenueNameTextBox.THE_TEXT) + "_" + ID + "_Venue\">here</a>. " +
                                 "<br/><br/> Please log into Hippo Happenings and check your messages to view and approve these changes.</a>" +
                                 "<br/><br/><br/>Have a Hippo Happening Day!<br/><br/>";

                             //conn.Open();

                             SqlCommand cmd34 = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, To_UserID, Date, [Read], Mode, Live, SentLive) VALUES('" +
                                 "VenueID:" + Request.QueryString["ID"].ToString() + ",UserID:" + Session["User"].ToString() + ",RevisionID:" + revisionID + "',@content, "+dat.HIPPOHAPP_USERID.ToString()+", " + ownerID + ", '" + DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).ToString() + "', 0, 5, 1, 1)", conn);
                             cmd34.Parameters.Add("@content", SqlDbType.NVarChar).Value = "A change request has been submitted for a venue you've created: " +
                                 VenueNameTextBox.THE_TEXT;
                             cmd34.ExecuteNonQuery();
                             conn.Close();
                             if (!Request.Url.AbsoluteUri.Contains("localhost"))
                             {
                                 dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                 System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                                 dsEventUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "A change request has been submitted for a venue you own on HippoHappenings: " +
                                 VenueNameTextBox.THE_TEXT);
                             }

                         }
                     }

                     if (isUpdate)
                     {
                         if (isOwner)
                         {
                             //dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                             //    System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                             //    dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "You have updated venue: " +
                             //    VenueNameTextBox.THE_TEXT);
                         }
                         else
                         {
                             if (ownerUpForGrabs)
                             {
                                 emailBody = "<br/><br/>You have successfully submitted updates for venue: \"" + VenueNameTextBox.THE_TEXT.Trim() +
                                 "\". <br/><br/> You can find this venue <a href=\"http://hippohappenings.com/" + dat.MakeNiceName(VenueNameTextBox.THE_TEXT) + "_" + ID + "_Venue\">here</a>. " +
                                 "<br/><br/> To rate your experience posting this venue <a href=\"http://hippohappenings.com/RateExperience.aspx?Edit=" +
                                 isUpdate.ToString() + "&Type=V&ID=" + ID + "\">please include your feedback here.</a><br/><br/>"+
                                 "Have a Hippo Happening Day!<br/><br/>";
                             }
                             else
                             {
                                 emailBody = "<br/><br/>You have successfully submitted updates for venue: \"" + VenueNameTextBox.THE_TEXT.Trim() +
                                 "\". <br/><br/> You can find this venue <a href=\"http://hippohappenings.com/" + dat.MakeNiceName(VenueNameTextBox.THE_TEXT) + "_" + ID + "_Venue\">here</a>. " +
                                 "<br/><br/> The owner of the venue will need to approve/reject your change suggestions. If you do not hear back " +
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:EnterVenue.aspx.cs

示例11: ServerSendMessage


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

                                SqlConnection conn = dat.GET_CONNECTED;
                                SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, " +
                                    "To_UserID, Date, [Read], Mode, Live)"
                                    + " VALUES(@content, @subject, @fromID, @toID, @date, 'False', 0, 1)", conn);
                                cmd.Parameters.Add("@content", SqlDbType.Text).Value = MessageInput.Text + "<br/><br/>" +
                                    Session["MessageBody"].ToString();
                                cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = Session["UserName"].ToString() + " wants you to check out " +
                                    temp2 + " " + Session["EventName"].ToString();
                                cmd.Parameters.Add("@toID", SqlDbType.Int).Value = int.Parse(dsUser.Tables[0].Rows[0]["User_ID"].ToString());
                                cmd.Parameters.Add("@fromID", SqlDbType.Int).Value = int.Parse(Session["User"].ToString());
                                cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
                                cmd.ExecuteNonQuery();
                                conn.Close();

                                try
                                {
                                    if (dsUser.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("9"))
                                    {
                                        sendEmail = true;
                                    }
                                    else
                                    {
                                        //check if prefs are set per individual
                                        DataView dvFirendsIndividual = dat.GetDataDV("SELECT * FROM UserFriendPrefs UFP " +
                                            "WHERE UFP.Preferences LIKE '%8%'AND UFP.UserID=" + dsUser.Tables[0].Rows[0]["User_ID"].ToString() + " AND UFP.FriendID=" + Session["User"].ToString());
                                        if (dvFirendsIndividual.Count > 0)
                                            sendEmail = true;
                                    }

                                    DataView dvF = dat.GetDataDV("SELECT * FROM Users WHERE User_ID=" + Session["User"].ToString());
                                    if (sendEmail)
                                    {
                                        dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                            System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                                            dsUser.Tables[0].Rows[0]["Email"].ToString(),
                                            "<div><br/>A new email arrived at your inbox on Hippo Happenings. <br/><br/> "+dvF[0]["UserName"].ToString() + " shared " + temp3 + " with you." +
                                              "<br/><br/>Message: " +
                                              MessageInput.Text + "<br/><br/>" + Session["MessageBody"].ToString() +
                                              "<br/><br/> To view the message, <a href=\"HippoHappenings.com/login\">" +
                                            "log into Hippo Happenings</a></div>", dvF[0]["UserName"].ToString() + " shared " + temp3 + " with you.");

                                    }

                                    //if (sendText)
                                    //{
                                    //    DataView dvUser = dat.GetDataDV("SELECT *, PP.Extension AS Ex1 FROM Users U, UserPreferences UP, PhoneProviders PP " +
                                    //        "WHERE U.User_ID=UP.UserID AND U.PhoneProvider=PP.ID AND U.User_ID=" + dsUser.Tables[0].Rows[0]["User_ID"].ToString());
                                    //    if (dvUser[0]["PhoneNumber"].ToString().Trim() != "")
                                    //    {
                                    //        string txtmessage = MessageInput.Text;
                                    //        if (txtmessage.Length > 118)
                                    //            txtmessage = MessageInput.Text.Substring(0, 118);

                                    //        txtmessage += " Login to HippoHappenings.com to read more.";

                                    //        dat.SendText(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                                    //            System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                                    //            dat.MakeGoodPhone(dvUser[0]["PhoneNumber"].ToString()) +
                                    //            dvUser[0]["Ex1"].ToString(),
                                    //           txtmessage, dvF[0]["UserName"].ToString() + " shared " + temp3 + " with you.");
                                    //    }
                                    //}
                                }
                                catch (Exception ex)
                                {
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:MessageAlert.aspx.cs

示例12: SendGroupEventNotifications

    protected void SendGroupEventNotifications(string eventID, string IDofFirstOccurance)
    {
        string theID = Request.QueryString["GroupID"].ToString();

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

        DataView dvUsers = dat.GetDataDV("SELECT * FROM Group_Members GM, Users U WHERE GM.MemberID=" +
            "U.User_ID AND GM.GroupID=" + theID + " AND Prefs LIKE '%2%'");
        DataView dvGroup = dat.GetDataDV("SELECT * FROM Groups WHERE ID=" + theID);
        DataView dvThread = dat.GetDataDV("SELECT * FROM GroupEvents WHERE ID=" + eventID);
        string email = "A new event '" + dvThread[0]["Name"].ToString() +
            "' has been posted for the group '" +
            dvGroup[0]["Header"].ToString() + "'. <a href=\"http://hippohappenings.com/" +
            dat.MakeNiceName(dvThread[0]["Name"].ToString()) + "_" + IDofFirstOccurance + "_" + eventID +
            "_GroupEvent\">Check it out.</a>";
        foreach (DataRowView row in dvUsers)
        {
            dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
            System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(), row["Email"].ToString(),
            email, "A new group event has been posted");
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:23,代码来源:EnterGroupEvent.aspx.cs

示例13: SendIt

    protected void SendIt(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        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);
        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/>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)
            {

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

示例14: AddCategory

    protected void AddCategory(object sender, EventArgs e)
    {
        //MessagesLabel.Text += "got here";
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        try
        {
            HtmlButton theButt = (HtmlButton)sender;

            string[] delim = { "category" };
            string[] tokens = theButt.Attributes["commandargument"].Split(delim, StringSplitOptions.None);
            string CatID = tokens[2];
            string venueOrEvent = tokens[1];
            string contentID = tokens[0];
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

            //MessagesLabel.Text += "tok 1: " + tokens[0] + ", tok2: " + tokens[1] + ", tok3: " + tokens[2];

            Literal lab = new Literal();
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
            conn.Open();
            SqlCommand cmd;
            if (venueOrEvent == "venue")
            {
                cmd = new SqlCommand("INSERT INTO Venue_Category (VENUE_ID, CATEGORY_ID) VALUES(@vID, @cID)", conn);
                cmd.Parameters.Add("@vID", SqlDbType.Int).Value = contentID;
                cmd.Parameters.Add("@cID", SqlDbType.Int).Value = CatID;
                cmd.ExecuteNonQuery();

                dat.Execute("UPDATE VenueCategoryRevisions SET Approved='True' WHERE ID=" + tokens[3]);

                #region Send Email
                //send email
                string rowID = tokens[3];

                string venueName = dat.GetData("SELECT * FROM Venues V, VenueCategoryRevisions VCR WHERE V.ID=VCR.VenueID AND VCR.ID=" + rowID).Tables[0].Rows[0]["Name"].ToString();

                string categoryName = dat.GetData("SELECT * FROM VenueCategoryRevisions VCR, VenueCategories VC " +
                    "WHERE VC.ID=VCR.CatID AND VCR.ID=" + rowID).Tables[0].Rows[0]["Name"].ToString();

                DataSet dsRevision = dat.GetData("SELECT * FROM VenueCategoryRevisions VCR, Users U WHERE U.User_ID=VCR.modifierID AND VCR.ID=" + rowID);

                DataSet dsUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + dsRevision.Tables[0].Rows[0]["modifierID"].ToString());
                string emailBody = "The addition of category '" + categoryName + "' has been approved for the venue '" + venueName +
                    "' by the venue's author. <br/><br/> " +
                    "To view these changes, please visit <a href=\"http://HippoHappenings.com/"+dat.MakeNiceName(venueName)+"_" +
                    dsRevision.Tables[0].Rows[0]["VenueID"].ToString() + "_Venue\">" + venueName + "</a>";

                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, "One of your changes has been approved for venue: '" +
                    venueName + "'");
                }
                #endregion
            }
            else
            {
                cmd = new SqlCommand("INSERT INTO Event_Category_Mapping (EventID, CategoryID) VALUES(@vID, @cID)",
                    conn);
                cmd.Parameters.Add("@vID", SqlDbType.Int).Value = contentID;
                cmd.Parameters.Add("@cID", SqlDbType.Int).Value = CatID;
                cmd.ExecuteNonQuery();

                dat.Execute("UPDATE EventCategoryRevisions SET Approved='True' WHERE ID=" + tokens[3]);

                #region Send Email
                //send email
                string rowID = tokens[3];

                string eventName = dat.GetData("SELECT * FROM Events V, EventCategoryRevisions VCR WHERE V.ID=VCR.EventID AND VCR.ID=" + rowID).Tables[0].Rows[0]["Header"].ToString();

                string categoryName = dat.GetData("SELECT * FROM EventCategoryRevisions VCR, EventCategories VC " +
                    "WHERE VC.ID=VCR.CatID AND VCR.ID=" + rowID).Tables[0].Rows[0]["Name"].ToString();

                DataSet dsRevision = dat.GetData("SELECT * FROM EventCategoryRevisions VCR, Users U WHERE U.User_ID=VCR.modifierID AND VCR.ID=" + rowID);

                DataSet dsUser = dat.GetData("SELECT * FROM Users U WHERE User_ID=" + dsRevision.Tables[0].Rows[0]["modifierID"].ToString());
                string emailBody = "The addition of category '" + categoryName + "' has been approved for the event '" + eventName +
                    "' by the event's author. <br/><br/> " +
                    "To view these changes, please visit <a href=\"http://HippoHappenings.com/" +dat.MakeNiceName(eventName)+"_"+
                    dsRevision.Tables[0].Rows[0]["EventID"].ToString() + "_Event\">" + eventName + "</a>";

                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, "One of your changes has been approved for event: '" +
                    eventName + "'");
                }
                #endregion
            }

            conn.Close();
            lab.Text = "<label class=\"Green12LinkNF\">&nbsp;&nbsp;&nbsp;&nbsp;Added</label>";
            Label lab2 = new Label();
            Literal theLit =
                (Literal)theButt.Parent.Controls[theButt.Parent.Controls.IndexOf(theButt) - 1];
            theLit.Text = theLit.Text.Replace("<br/>", "");
            theLit.Text = theLit.Text.Replace("<div style=\"padding-bottom: 4px;\">",
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:User.aspx.cs

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


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