本文整理汇总了C#中Data.ValidateEmail方法的典型用法代码示例。如果您正苦于以下问题:C# Data.ValidateEmail方法的具体用法?C# Data.ValidateEmail怎么用?C# Data.ValidateEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.ValidateEmail方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConfirmEmail
protected string ConfirmEmail()
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
string message = "";
if (EmailTextBox.Text.Trim() == "")
{
message = "Please include a valid email.";
}
else if (ConfirmTextBox.Text.Trim() == "")
{
message = "Please include a confirmation email.";
}
else if (EmailTextBox.Text.Trim().ToLower() != ConfirmTextBox.Text.Trim().ToLower())
{
message = "Email and Confirm Email fields must match.";
}
else if (!dat.ValidateEmail(EmailTextBox.Text.Trim()))
{
message = "Email is not valid.";
}
else
{
message = "Success";
}
return message;
}
示例2: OnwardsIT
protected bool OnwardsIT(bool changeTab, int selectedIndex)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
conn.Open();
switch (selectedIndex)
{
case 0:
#region Case 0
bool goOn = false;
bool isInternational = false;
string locationStr = "";
VenueNameTextBox.THE_TEXT = dat.stripHTML(VenueNameTextBox.THE_TEXT);
CityTextBox.Text = dat.stripHTML(CityTextBox.Text);
ZipTextBox.Text = dat.stripHTML(ZipTextBox.Text);
if (CountryDropDown.SelectedValue == "223")
{
isInternational = true;
string apt = "";
if(AptNumberTextBox.Text.Trim() != "")
apt = AptDropDown.SelectedItem.Text + " " + AptNumberTextBox.Text.Trim().ToLower();
locationStr = StreetNumberTextBox.Text.Trim().ToLower() + ";" + StreetNameTextBox.Text.Trim().ToLower()
+ ";" + StreetDropDown.SelectedItem.Text + ";" + apt;
goOn = VenueNameTextBox.THE_TEXT.Trim() != "" && StreetNumberTextBox.Text.Trim() != ""
&& StreetNameTextBox.Text.Trim() != "" && StreetDropDown.SelectedItem.Text != "Select One..."
&& CityTextBox.Text.Trim() != ""
&& ZipTextBox.Text.Trim() != "";
}
else
{
string apt = "";
if (AptNumberTextBox.Text.Trim() != "")
apt = AptDropDown.SelectedItem.Text + " " + AptNumberTextBox.Text.Trim().ToLower();
locationStr = LocationTextBox.Text.Trim().ToLower() + ";" + apt;
goOn = VenueNameTextBox.THE_TEXT.Trim() != "" && LocationTextBox.Text.Trim() != "" &&
CityTextBox.Text.Trim() != "" && ZipTextBox.Text.Trim() != "";
}
if (goOn)
{
bool isUpdate = false;
if (Request.QueryString["ID"] != null)
{
isUpdate = true;
}
if (EmailTextBox.Text.Trim() != "")
{
if (!dat.ValidateEmail(EmailTextBox.Text))
{
MessagePanel.Visible = true;
YourMessagesLabel.Text += "<br/><br/>*Email address is not in the appropriate format.";
goOn = false;
}
}
if (CountryDropDown.SelectedValue == "223")
{
int zip = 0;
if (int.TryParse(ZipTextBox.Text.Trim(), out zip))
{
if (ZipTextBox.Text.Trim().Length == 5)
{
}
else
{
MessagePanel.Visible = true;
YourMessagesLabel.Text += "<br/><br/>*Zip must be a 5 digit code.";
goOn = false;
}
}
else
{
MessagePanel.Visible = true;
YourMessagesLabel.Text += "<br/><br/>*Zip must be a 5 digit code.";
goOn = false;
}
}
if (StateDropDown.Visible)
{
if (StateDropDown.SelectedIndex == -1)
{
MessagePanel.Visible = true;
YourMessagesLabel.Text += "<br/><br/>*Must include state.";
goOn = false;
}
}
else
{
if (StateTextBox.THE_TEXT.Trim() == "")
{
//.........这里部分代码省略.........
示例3: MakeItSo
protected void MakeItSo(object sender, EventArgs e)
{
MessageLabel.Text = "";
HttpCookie cookie = Request.Cookies["BrowserDate"];
DateTime isn = DateTime.Now;
if (!DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn))
isn = DateTime.Now;
DateTime isNow = isn;
Data dat = new Data(isn);
EmailTextBox.Text = dat.stripHTML(EmailTextBox.Text.Trim());
ConfirmEmailTextBox.Text = dat.stripHTML(ConfirmEmailTextBox.Text.Trim());
if (EmailTextBox.Text != "" && ConfirmEmailTextBox.Text != "")
{
bool safeToGo = true;
if (dat.ValidateEmail(EmailTextBox.Text))
{
if (safeToGo)
{
if (dat.TrapKey(EmailTextBox.Text, 2))
{
if (EmailTextBox.Text == ConfirmEmailTextBox.Text)
safeToGo = true;
else
{
MessageLabel.Text = "*Comfirmation Email must match the Email text box.";
safeToGo = false;
}
}
else
{
MessageLabel.Text = "*The Email must only contain allowed characters.";
safeToGo = false;
}
if (safeToGo)
{
DataSet dsEmail = dat.GetData("SELECT * FROM Users WHERE Email='"+EmailTextBox.Text+"'");
if (dsEmail.Tables.Count > 0)
if (dsEmail.Tables[0].Rows.Count > 0)
safeToGo = false;
if (safeToGo)
{
if (TermsCheckBox.Checked)
{
Encryption encrypt = new Encryption();
dat.SendEmailNoFrills(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(), EmailTextBox.Text,
"Hello From Hippo Happenings! <br/><br/> You have requested to create a Hippo Happenings account. We'd like to say, " +
" GREAT CHOICE! <br/><br/> Please visit <a href=\"http://HippoHappenings.com/complete-registration?ID=" +
encrypt.encrypt(EmailTextBox.Text) + "\">this link</a> to complete the creation of your account. ", "Hippo Happenings User Account Request");
MessageRadWindow.NavigateUrl = "Message.aspx?message=" +
encrypt.encrypt("An email has been sent to your address. "+
"Please make sure to check your <b>JUNK MAIL</b> and your " +
" inbox for further instruction to complete " +
"your registration." +
"<br/><br/><div align=\"center\">" +
"<div style=\"width: 50px;\" onclick=\"Search('home')\">" +
"<div class=\"topDiv\" style=\"clear: both;\">" +
" <img style=\"float: left;\" src=\"NewImages/ButtonLeft.png\" height=\"27px\" /> " +
" <div class=\"NavyLink\" style=\"font-size: 12px; text-decoration: none; padding-top: 5px;padding-left: 6px; padding-right: 6px;height: 27px;float: left;background: url('NewImages/ButtonPixel.png'); background-repeat: repeat-x;\">" +
" Ok " +
"</div>" +
" <img style=\"float: left;\" src=\"NewImages/ButtonRight.png\" height=\"27px\" /> " +
"</div>" +
"</div>" +
"</div><br/>");
MessageRadWindow.Visible = true;
MessageRadWindowManager.VisibleOnPageLoad = true;
MessageLabel.Text = "";
}
else
{
MessageLabel.Text = "*You must agree to the terms and contidions.";
}
}
else
{
MessageLabel.Text = "An account for this email address already exists. If you believe this is your account "+
"and you have forgot your password, go to <a href=\"login\">login page</a> and click on the 'forgot password' link.";
}
}
}
}
else
MessageLabel.Text = "Email is not valid";
}
else
MessageLabel.Text = "*All fields must be filled in.";
}
示例4: 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());
//.........这里部分代码省略.........
示例5: 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]pic, [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 != "")
//.........这里部分代码省略.........
示例6: SendEmail
protected void SendEmail(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
try
{
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
if (EmailTextBox.Text.Trim() != "")
{
if (Session["User"] != null)
{
DataSet dsuser = dat.GetData("SELECT * FROM Users WHERE User_ID=" + Session["User"].ToString());
char[] delim = { ';' };
string[] tokens = YourEmailTextBox.Text.Trim().Split(delim);
bool goOn = true;
string problematic = "";
for (int i = 0; i < tokens.Length; i++)
{
if (tokens[i].Trim() != "")
{
if (!dat.ValidateEmail(tokens[i].Trim()))
{
goOn = false;
problematic = " First problematic email is '"+tokens[i].Trim()+"'";
break;
}
}
}
if (goOn)
{
for (int i = 0; i < tokens.Length; i++)
{
if (tokens[i].Trim() != "")
{
if (dat.ValidateEmail(tokens[i].Trim()))
{
dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
tokens[i].Trim(), "<div> " + Session["UserName"].ToString() + " has sent you the following information."
+ "<br/><br/>Personal Message: " + EmailTextBox.Text + "<br/><br/></div>Details: <br/>" +
Session["messageEmail"].ToString(), EmailSubjectLabel.Text);
}
}
}
EmailSentLabel.Text = "Your message has been sent";
MessagePanel.Visible = false;
EmailPanel.Visible = false;
ThankYouPanel.Visible = true;
}
else
{
EmailSentLabel.Text = "One or more of the emails you provided is not valid. "+
"No emails were sent. "+problematic;
}
}
else
{
dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
YourEmailTextBox.Text, "<div> " + Session["UserName"].ToString() + " has sent you the following information."+
"<br/><br/>Personal Message: " + EmailTextBox.Text +
"<br/><br/></div>Details: <br/>" +
Session["messageEmail"].ToString(), EmailSubjectLabel.Text);
EmailSentLabel.Text = "Your message has been sent";
}
}
else
{
EmailSentLabel.Text = "Please include your message";
}
}
catch (Exception ex)
{
EmailSentLabel.Text = ex.ToString();
}
}
示例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", ":")));
try
{
int boxes = int.Parse(Infolabel.Text);
TextBox temp;
string message = "";
for (int i = 1; i <= boxes; i++)
{
temp = (TextBox)dat.FindControlRecursive(this, "text"+i);
if (temp.Text != "")
{
if (dat.ValidateEmail(temp.Text))
{
dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(), temp.Text,
"Greetings from HippoHappenings. <br/><br/> Your friend " + Session["UserName"].ToString()
+ " would like you to join Hippo Happenings. <br/><br/>At Hippo Happenings you can create "
+ "events, post classifieds, have your ads posted thoughout the site, have your very own "
+ "events calendar and much more. <br/><br/> To sign up visit <a target=\"_blank\" "+
"href=\"http://HippoHappenings.com/Register.aspx\">HippoHappenings.com/Register.aspx</a>",
Session["UserName"].ToString() + " Would like you to join Hippo Happenings!");
}
else
message += "Email in box " + i.ToString() + " was not valid and message was not sent. <br/>";
}
}
Label MessageLabel = (Label)SearchPanel.Items[0].Items[0].FindControl("MessageLabel");
if (message != "")
MessageLabel.Text = message;
else
MessageLabel.Text = "Your friends have been invited!";
}
catch (Exception ex)
{
}
}
示例8: 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;
//.........这里部分代码省略.........
示例9: ValidatePage
//.........这里部分代码省略.........
if (CountryDropDown.SelectedValue == "223")
{
isInternational = true;
string apt = "";
if (AptNumberTextBox.Text.Trim() != "")
apt = AptDropDown.SelectedItem.Text + " " + AptNumberTextBox.Text.Trim().ToLower();
locationStr = StreetNumberTextBox.Text.Trim().ToLower() + ";" + StreetNameTextBox.Text.Trim().ToLower()
+ ";" + StreetDropDown.SelectedItem.Text + ";" + apt;
goOn = VenueNameTextBox.Text.Trim() != "" && StreetNumberTextBox.Text.Trim() != ""
&& StreetNameTextBox.Text.Trim() != "" && StreetDropDown.SelectedItem.Text != "Select One..."
&& CityTextBox.Text.Trim() != ""
&& ZipTextBox.Text.Trim() != "";
}
else
{
string apt = "";
if (AptNumberTextBox.Text.Trim() != "")
apt = AptDropDown.SelectedItem.Text + " " + AptNumberTextBox.Text.Trim().ToLower();
locationStr = LocationTextBox.Text.Trim().ToLower() + ";" + apt;
goOn = VenueNameTextBox.Text.Trim() != "" && LocationTextBox.Text.Trim() != "" &&
CityTextBox.Text.Trim() != "" && ZipTextBox.Text.Trim() != "";
}
if (goOn)
{
bool isUpdate = false;
if (Request.QueryString["ID"] != null)
{
isUpdate = true;
}
if (EmailTextBox.Text.Trim() != "")
{
if (!dat.ValidateEmail(EmailTextBox.Text))
{
validateMessage += "*Email address is not in the appropriate format.";
}
}
if (CountryDropDown.SelectedValue == "223")
{
int zip = 0;
if (int.TryParse(ZipTextBox.Text.Trim(), out zip))
{
if (ZipTextBox.Text.Trim().Length == 5)
{
}
else
{
validateMessage += "*Zip must be a 5 digit code.";
goOn = false;
}
}
else
{
validateMessage += "*Zip must be a 5 digit code.";
goOn = false;
}
}
if (StateDropDown.Visible)
{
if (StateDropDown.SelectedIndex == -1)