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


C# Data.RemoveNoneNumbers方法代码示例

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


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

示例1: Save

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

            if (d.ValidateEmail(EmailTextBox.Text))
            {
                //This is a flag to check whether the ads on the site need to be reset.
                //They will need to be reset if the user changed the location or ad categories
                bool resetAds = false;

                string USER_ID = Session["User"].ToString();
                SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
                conn.Open();
                SqlCommand cmd;

                string nameStart = "";
                string nameEnd = "";
                if (LastNameTextBox.THE_TEXT.Trim() != "")
                    nameStart = ", LastName='" + LastNameTextBox.THE_TEXT.Trim().Replace("'", "''") + "' ";

                if(FirstNameTextBox.THE_TEXT.Trim() != "")
                    nameEnd =  ", FirstName='" + FirstNameTextBox.THE_TEXT.Trim().Replace("'", "''") + "' ";

                cmd = new SqlCommand("UPDATE Users SET [email protected], [email protected], [email protected] " +
                    ", [email protected] " + nameStart + nameEnd + "WHERE [email protected] ", conn);
                if (Session["ProfilePicture"] != null)
                    cmd.Parameters.Add("@pic", SqlDbType.NVarChar).Value = Session["ProfilePicture"].ToString();
                else
                    cmd.Parameters.Add("@pic", SqlDbType.NVarChar).Value = DBNull.Value;
                cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value = EmailTextBox.Text;
                cmd.Parameters.Add("@phone", SqlDbType.NVarChar).Value = d.RemoveNoneNumbers(PhoneTextBox.THE_TEXT);
                cmd.Parameters.Add("@provider", SqlDbType.Int).Value = ProviderDropDown.SelectedValue;
                cmd.Parameters.Add("@id", SqlDbType.Int).Value = USER_ID;
                cmd.ExecuteNonQuery();

                string prefs = "0";

                if (TextingCheckBoxList.Items[0].Selected)
                    prefs += "1";
                if (TextingCheckBoxList.Items[1].Selected)
                    prefs += "2";
                if (TextingCheckBoxList.Items[2].Selected)
                    prefs += "3";

                string emailPrefs = "0";

                if (EmailCheckList.Items[0].Selected)
                    emailPrefs += "1";
                if (EmailCheckList.Items[1].Selected)
                    emailPrefs += "2";
                if (EmailCheckList.Items[2].Selected)
                    emailPrefs += "3";

                if (EmailCheckList3.Items[0].Selected)
                    emailPrefs += "C";

                if (EmailUserCheckList1.Items[0].Selected)
                    emailPrefs += EmailUserCheckList1.Items[0].Value;
                if (EmailUserCheckList1.Items[1].Selected)
                    emailPrefs += EmailUserCheckList1.Items[1].Value;
                if (EmailUserCheckList1.Items[2].Selected)
                    emailPrefs += EmailUserCheckList1.Items[2].Value;

                if (EmailUserCheckList2.Items[0].Selected)
                    emailPrefs += EmailUserCheckList2.Items[0].Value;
                if (EmailUserCheckList2.Items[1].Selected)
                    emailPrefs += EmailUserCheckList2.Items[1].Value;
                if (EmailUserCheckList2.Items[2].Selected)
                    emailPrefs += EmailUserCheckList2.Items[2].Value;

                string calendarPrefs = "";
                if (PublicPrivateCheckList.SelectedValue != null)
                    if (PublicPrivateCheckList.SelectedValue != "")
                        calendarPrefs = PublicPrivateCheckList.SelectedValue;

                string commPrefs = "";
                if (CommunicationPrefsRadioList.SelectedValue != null)
                    if (CommunicationPrefsRadioList.SelectedValue != "")
                        commPrefs = CommunicationPrefsRadioList.SelectedValue;

                string commentsPrefs = "";
                if (CommentsRadioList.SelectedValue != null)
                    if (CommentsRadioList.SelectedValue != "")
                        commentsPrefs = CommentsRadioList.SelectedValue;

                string pollPrefs = "";
                //if (PollRadioList.SelectedValue != null)
                //    if (PollRadioList.SelectedValue != "")
                //        pollPrefs = PollRadioList.SelectedValue;

                string onoff = "";
                RadioButtonList CategoriesOnOffRadioList = (RadioButtonList)AdCategoryRadPanel.Items[0].Items[0].FindControl("CategoriesOnOffRadioList");
                Telerik.Web.UI.RadTreeView CategoryTree = (Telerik.Web.UI.RadTreeView)AdCategoryRadPanel.Items[0].Items[0].FindControl("CategoryTree");
                Telerik.Web.UI.RadTreeView RadTreeView2 = (Telerik.Web.UI.RadTreeView)AdCategoryRadPanel.Items[0].Items[0].FindControl("RadTreeView2");

                if (CategoriesOnOffRadioList.SelectedValue != null)
                    if (CategoriesOnOffRadioList.SelectedValue != "")
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:User_OLD.aspx.cs

示例2: Save

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

            if (d.ValidateEmail(EmailTextBox.Text))
            {
                //This is a flag to check whether the ads on the site need to be reset.
                //They will need to be reset if the user changed the location or ad categories
                bool resetAds = false;

                string USER_ID = Session["User"].ToString();
                SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
                conn.Open();
                SqlCommand cmd;

                string nameStart = "";
                string nameEnd = "";
                if (LastNameTextBox.Text.Trim() != "")
                    nameStart = ", LastName='" + LastNameTextBox.Text.Trim().Replace("'", "''") + "' ";

                if(FirstNameTextBox.Text.Trim() != "")
                    nameEnd =  ", FirstName='" + FirstNameTextBox.Text.Trim().Replace("'", "''") + "' ";

                cmd = new SqlCommand("UPDATE Users SET Weekly='" + WeeklyCheckBox.Checked.ToString() + "', [email protected], [email protected] " +
                    ", [email protected] " + nameStart + nameEnd + "WHERE [email protected] ", conn);

                cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value = EmailTextBox.Text;
                cmd.Parameters.Add("@phone", SqlDbType.NVarChar).Value = d.RemoveNoneNumbers(PhoneTextBox.Text);
                cmd.Parameters.Add("@provider", SqlDbType.Int).Value = ProviderDropDown.SelectedValue;
                cmd.Parameters.Add("@id", SqlDbType.Int).Value = USER_ID;
                cmd.ExecuteNonQuery();

                string prefs = "0";

                if (TextingCheckBoxList.Items[0].Selected)
                    prefs += "1";
                //if (TextingCheckBoxList.Items[1].Selected)
                //    prefs += "2";

                string emailPrefs = "0";

                if (EmailCheckList.Items[0].Selected)
                    emailPrefs += "1";
                //if (EmailCheckList.Items[1].Selected)
                //    emailPrefs += "2";

                if (EmailUserCheckList1.Items[0].Selected)
                    emailPrefs += EmailUserCheckList1.Items[0].Value;
                if (EmailUserCheckList1.Items[1].Selected)
                    emailPrefs += EmailUserCheckList1.Items[1].Value;
                if (EmailUserCheckList1.Items[2].Selected)
                    emailPrefs += EmailUserCheckList1.Items[2].Value;
                if (EmailUserCheckList1.Items[3].Selected)
                    emailPrefs += EmailUserCheckList1.Items[3].Value;

                if (EmailUserCheckList2.Items[0].Selected)
                    emailPrefs += EmailUserCheckList2.Items[0].Value;
                if (EmailUserCheckList2.Items[1].Selected)
                    emailPrefs += EmailUserCheckList2.Items[1].Value;
                //if (EmailUserCheckList2.Items[2].Selected)
                //    emailPrefs += EmailUserCheckList2.Items[2].Value;

                string calendarPrefs = "";
                if (PublicPrivateCheckList.SelectedValue != null)
                    if (PublicPrivateCheckList.SelectedValue != "")
                        calendarPrefs = PublicPrivateCheckList.SelectedValue;

                string commPrefs = "";
                if (CommunicationPrefsRadioList.SelectedValue != null)
                    if (CommunicationPrefsRadioList.SelectedValue != "")
                        commPrefs = CommunicationPrefsRadioList.SelectedValue;

                string commentsPrefs = "";
                if (CommentsRadioList.SelectedValue != null)
                    if (CommentsRadioList.SelectedValue != "")
                        commentsPrefs = CommentsRadioList.SelectedValue;

                string pollPrefs = "";
                //if (PollRadioList.SelectedValue != null)
                //    if (PollRadioList.SelectedValue != "")
                //        pollPrefs = PollRadioList.SelectedValue;

                string onoff = "";

                //if (CategoriesOnOffRadioList.SelectedValue != null)
                //    if (CategoriesOnOffRadioList.SelectedValue != "")
                //        onoff = CategoriesOnOffRadioList.SelectedValue;

                string recommendPrefs = "";
                if (RecommendationsCheckList.Items[0].Selected)
                    recommendPrefs += "1";
                if (RecommendationsCheckList.Items[1].Selected)
                    recommendPrefs += "2";
                if (RecommendationsCheckList.Items[2].Selected)
                    recommendPrefs += "3";

                DataView usersPrevPrefs = d.GetDataDV("SELECT * FROM UserPreferences WHERE UserID="+Session["User"].ToString());
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:User.aspx.cs

示例3: Save

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

            if (d.ValidateEmail(EmailTextBox.Text))
            {
                string USER_ID = Session["User"].ToString();
                SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
                conn.Open();
                SqlCommand cmd = new SqlCommand("UPDATE Users SET [email protected], [email protected], [email protected] " +
                    ", [email protected] WHERE [email protected] ", conn);
                if (Session["ProfilePicture"] != null)
                    cmd.Parameters.Add("@pic", SqlDbType.NVarChar).Value = Session["ProfilePicture"].ToString();
                else
                    cmd.Parameters.Add("@pic", SqlDbType.NVarChar).Value = DBNull.Value;
                cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value = EmailTextBox.Text;
                cmd.Parameters.Add("@phone", SqlDbType.Real).Value = d.RemoveNoneNumbers(PhoneTextBox.THE_TEXT);
                cmd.Parameters.Add("@provider", SqlDbType.Int).Value = ProviderDropDown.SelectedValue;
                cmd.Parameters.Add("@id", SqlDbType.Int).Value = USER_ID;
                cmd.ExecuteNonQuery();

                string prefs = "0";

                if (TextingCheckBoxList.Items[0].Selected)
                    prefs += "1";
                if (TextingCheckBoxList.Items[1].Selected)
                    prefs += "2";
                if (TextingCheckBoxList.Items[2].Selected)
                    prefs += "3";

                string emailPrefs = "0";

                if (EmailCheckList.Items[0].Selected)
                    emailPrefs += "1";
                if (EmailCheckList.Items[1].Selected)
                    emailPrefs += "2";
                if (EmailCheckList.Items[2].Selected)
                    emailPrefs += "3";

                string calendarPrefs = "";
                if (PublicPrivateCheckList.SelectedValue != null)
                    if (PublicPrivateCheckList.SelectedValue != "")
                        calendarPrefs = PublicPrivateCheckList.SelectedValue;

                string commPrefs = "";
                if (CommunicationPrefsRadioList.SelectedValue != null)
                    if (CommunicationPrefsRadioList.SelectedValue != "")
                        commPrefs = CommunicationPrefsRadioList.SelectedValue;

                string commentsPrefs = "";
                if (CommentsRadioList.SelectedValue != null)
                    if (CommentsRadioList.SelectedValue != "")
                        commentsPrefs = CommentsRadioList.SelectedValue;

                string pollPrefs = "";
                if (PollRadioList.SelectedValue != null)
                    if (PollRadioList.SelectedValue != "")
                        pollPrefs = PollRadioList.SelectedValue;

                string onoff = "";
                if (CategoriesOnOffRadioList.SelectedValue != null)
                    if (CategoriesOnOffRadioList.SelectedValue != "")
                        onoff = CategoriesOnOffRadioList.SelectedValue;

                cmd = new SqlCommand("UPDATE UserPreferences SET [email protected], [email protected], [email protected], [email protected] " +
                    ", [email protected], [email protected], [email protected], [email protected], [email protected], " +
                    " [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], " +
                    " [email protected], [email protected], [email protected] WHERE [email protected] ", conn);
                cmd.Parameters.Add("@age", SqlDbType.NVarChar).Value = AgeTextBox.Text;
                cmd.Parameters.Add("@sex", SqlDbType.NVarChar).Value = SexTextBox.Text;
                cmd.Parameters.Add("@location", SqlDbType.NVarChar).Value = LocationTextBox.Text;
                if (onoff != "")
                    cmd.Parameters.Add("@onoff", SqlDbType.Int).Value = onoff;
                else
                    cmd.Parameters.Add("@onoff", SqlDbType.Int).Value = DBNull.Value;
                if (calendarPrefs != "")
                    cmd.Parameters.Add("@calendarmode", SqlDbType.Int).Value = calendarPrefs;
                else
                    cmd.Parameters.Add("@calendarmode", SqlDbType.Int).Value = DBNull.Value;
                if (commPrefs != "")
                    cmd.Parameters.Add("@commPrefs", SqlDbType.Int).Value = commPrefs;
                else
                    cmd.Parameters.Add("@commPrefs", SqlDbType.Int).Value = DBNull.Value;
                if (commentsPrefs != "")
                    cmd.Parameters.Add("@comments", SqlDbType.Int).Value = commentsPrefs;
                else
                    cmd.Parameters.Add("@comments", SqlDbType.Int).Value = DBNull.Value;
                if (pollPrefs != "")
                    cmd.Parameters.Add("@poll", SqlDbType.Int).Value = pollPrefs;
                else
                    cmd.Parameters.Add("@poll", SqlDbType.Int).Value = DBNull.Value;
                cmd.Parameters.Add("@address", SqlDbType.NVarChar).Value = AddressTextBox.THE_TEXT;
                cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = BillCityTextBox.THE_TEXT;
                if (BillCountryDropDown.SelectedValue != "-1")
                {
                    cmd.Parameters.Add("@country", SqlDbType.Int).Value = BillCountryDropDown.SelectedValue;

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


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