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


C# Data.ExecuteWithParemeters方法代码示例

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


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

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

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

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

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

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

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

示例7: 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", ":")));
        SqlDbType [] types = {SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.Int, SqlDbType.Int, SqlDbType.DateTime, SqlDbType.Bit, SqlDbType.Int};

           bool isUserSelected = false;
        for (int i = 0; i < UsersListBox.Items.Count; i++)
        {
            if (UsersListBox.Items[i].Selected)
            {
                isUserSelected = true;
                object[] data = {TextInput.InnerText, "You have a communication request for event '"+
                    Session["EventName"].ToString()+"'", Session["User"].ToString(), UsersListBox.Items[i].Value, DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")), false, 3};
                dat.ExecuteWithParemeters("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, To_UserID, Date, [Read], Mode) " +
                    " VALUES(@p0,@p1,@p2,@p3,@p4,@p5,@p6)", types, data);

                DataSet dsFriend = dat.GetData("SELECT * FROM Users U, UserPreferences UP WHERE UP.UserID=U.User_ID AND U.User_ID=" + UsersListBox.Items[i].Value);

                string subject = "You have a communication request for event '" +
                    Session["EventName"].ToString() + "' from " + dsFriend.Tables[0].Rows[0]["UserName"].ToString();
                string body = "<div style=\"color: #cccccc;\"><br/>A new email arrived at your inbox on Hippo Happenings from " + Session["UserName"].ToString() + ". <br/><br/> Subject: " + subject + ". <br/><br/> Message: " +
                TextInput.InnerText + "<br/><br/> To view the email and reply, <a href=\"http://HippoHappenings.com/User.aspx\">" +
                "log into Hippo Happenings</a></div>";

                //only send to email if users preferences are set to do so.
                if (dsFriend.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("6"))
                {
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                        System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                        dsFriend.Tables[0].Rows[0]["Email"].ToString(), body, "HippoHappenings Mail: " + subject);
                }
            }
        }

        if (!isUserSelected)
        {
            CommunicateLabel.Text = "You have not selected any participants.";
        }
        else
        {
            ThankYouPanel.Visible = true;
            MessagePanel.Visible = false;
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:45,代码来源:Communicate.aspx.cs


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