protected void Button2_Click(object sender, EventArgs e) { string conStr = ConfigurationManager.ConnectionStrings["projectConnectionString"].ConnectionString; SqlConnection dbConnection = new SqlConnection(conStr); SqlCommand sqlcommand; SqlDataReader sqlreader; try { dbConnection.Open(); if (!(sec_ques1.SelectedItem.Text.Equals(null) && sec_ques2.SelectedItem.Text.Equals(null) && sec_ques3.SelectedItem.Text.Equals(null))) { string query = "INSERT INTO USER_LOGIN_DETAILS VALUES('" + email_id.Text + "','" + password.Text + "','" + sec_ques1.SelectedItem.Text + "','" + Answer1.Text + "','" + sec_ques2.SelectedItem.Text + "','" + Answer2.Text + "','" + sec_ques3.SelectedItem.Text + "','" + Answer3.Text + "');"; sqlcommand = new SqlCommand(query, dbConnection); sqlcommand.ExecuteNonQuery(); MultiView1.ActiveViewIndex = 2; //sending a text message string message = "Thank you for signing up. you will be receiving a mail shortly"; textMessage = new SMSService(DropDownList1.SelectedItem.Text, phone_num.Text, message); textMessage.SendTextMessage(textMessage); //triggering a mail message string mail_message = "Hello " + frst_name.Text + " " + last_name.Text + "<br /><br /><br />"; mail_message += "Welcome to FMSC donate a meal site. We are thankful to you, for taking time out of your schedule and doing something good for the society"; mail_message += "<br /><br />" + "We encourage you to donate some meals by buying pixels."; mail_message += "<br /><br />" + "Thank you in advance"; mail_message += "<br /><br /><br />" + "Regards," + "<br />"; mail_message += "FMSC"; //triggering mail mailsender(mail_message); } else { Label1.Text = "Please select a proper security question"; } } catch (SqlException ex) { Label1.Text = "<p>Error Code" + ex.Number + ": " + ex.Message + "</p>"; } finally { dbConnection.Close(); } }
public void SendTextMessage(SMSService textMessage) { var sms = new SUSMSClient(); sms.sendSMS(textMessage.Provider, textMessage.Number, textMessage.Message); }