public bool SendLink(string UserType, string UserID, string EmailID)
{
bool tran = false;
try
{
string ResetCode = Guid.NewGuid().ToString();
int TranRes = 0;
System.Text.StringBuilder sbBody = new System.Text.StringBuilder();
sbBody.Append("Your Registration Id is : <b>" + UserID + "</b> ");
sbBody.Append("<a href=" + System.Configuration.ConfigurationManager.AppSettings["resetp"].ToString() + LuminousSecurity.Encryption.Encrypt(EmailID));
sbBody.Append("&ut=" + HttpContext.Current.Server.UrlEncode(LuminousSecurity.Encryption.Encrypt(UserType)) + "&reset=" + ResetCode + "&uname=" + LuminousSecurity.Encryption.Encrypt(UserID) + ">Click here to set your password</a>");
TranRes = SqlHelper.ExecuteNonQuery(Configuration.ConnectionString, CommandType.Text, @"UPDATE MST_STUDENT_LOGIN SET PwdResetCode=@PwdResetCode
WHERE Student_loging_id=@Student_loging_id",
new SqlParameter[] { new SqlParameter("@PwdResetCode", ResetCode), new SqlParameter("@Student_loging_id", UserID) });
if (TranRes > 0)
{
bool result = LuminousMail.EmailHelper.SendEmail(EmailID, "SET STUDENT PASSWORD", sbBody.ToString());
if (result)
{
tran = true;
}
else
{
tran = false;
//lblError.Text = "Unable to send mail! Transaction Failed !";
// lblError.ForeColor = System.Drawing.Color.Tomato;
}
}
else
{
tran = false;
// lblError.Text = "Invalid User name or mail account!";
//lblError.ForeColor = System.Drawing.Color.Tomato;
}
}
catch (SqlException ee)
{
ExceptionHandler.WriteException(ee.Message);
}
catch (Exception ee)
{
ExceptionHandler.WriteException(ee.Message);
return false;
}
return tran;
}
-------------------------------
<configuration>
<appSettings>
<add key="resetp" value="http://esdm-skill.deity.gov.in/ResetPassword.aspx?email="/>
</appSettings>
</configuration>
No comments:
Post a Comment