I am new new to the .NET can someone help with the code. The code below is used to send alerts but i am able to receive only SMS when a user account is created successfully. I wanted to be able to send alert depending on the option selected(SMS/email) by the user while creating account. This is the part of the code from by DAL.
Any help would be greatly appreciated
using System.Net.Mail;
///
/// Summary description for AlertSender
///
namespace Exampl1
{
public class AlertSender
{
public AlertSender()
{
}
public bool HtmlFormatted = true;
public string EmailTo;
public string EmailFrom;
public string EmailSubject;
public string EmailBody;
public string SMSTo;
public string SMSPhoneNetwork;
public void EmailSend()
{
if (!string.IsNullOrEmpty(SMSTo))
{
EmailTo = "";
EmailTo = SMSTo.Replace("-","") + SMSPhoneNetworkToGateway(SMSPhoneNetwork);
HtmlFormatted = false;
}
if (string.IsNullOrEmpty(EmailFrom)) EmailFrom = "[email protected]";
MailMessage msg = new MailMessage(EmailFrom, EmailTo, EmailSubject, EmailBody);
msg.IsBodyHtml = HtmlFormatted;
SmtpClient client = new SmtpClient("localhost");
client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
client.Send(msg);
}
private string SMSPhoneNetworkToGateway(string parmSMSSPhoneNetwork)
{
DBLib.DBOps DBWorker = new DBLib.DBOps("HealthETrax");
DBWorker.StoredProcName = "SMSGatewayFromPhoneNetwork";
DBWorker.ParamsInputSet("@PhoneNetworkName", parmSMSSPhoneNetwork);
return DBWorker.GetScalar();
}
} // end class AlertSender
} // end namespace Example

Raja KrishnamurthyRank #3,615 · 403 reputationPosted Mar 14, 2011, 1:01 PM EDT
public static bool IsNullOrWhiteSpace(string value) { if (String.IsNullOrEmpty(value)) { return true; } return String.IsNullOrEmpty(value.Trim()); }Regards,
Raja
ASPbee40 reputationPosted Mar 15, 2011, 5:53 PM EDT
thanks
Raja KrishnamurthyRank #3,615 · 403 reputationPosted Mar 16, 2011, 3:07 AM EDT
HTH.
Happy Programming!!!
Regards,
Raja
Suthish NairRank #92 · 22.8K reputationPosted Mar 16, 2011, 10:27 AM EDT