using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class RegistrationUpdate : System.Web.UI.Page
{
dataUtility appReg = new dataUtility();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
regMstData();
}
}
private DataTable OpenTable(string cExpr, string cWhere)
{
string cExcute = "";
DataTable _tConfE = new DataTable();
switch (cExpr)
{
case "Varify"://---varify email 0->1 taken reg mst data
cExcute = "Exec sp_register 2, '" + cWhere + "'";
break;
default:
break;
}
if (!string.IsNullOrEmpty(cExcute))
{
_tConfE = appReg.executeStoteProc(cExcute);
}
return _tConfE;
}
private void regMstData()
{
string cConReg = Request.QueryString["confirm"].ToString();
DataTable _tRegMst = OpenTable("Varify", cConReg.Trim());//--after do check already confirm
RegMstlbl(_tRegMst);//--label text fill
}
private void RegMstlbl(DataTable tRegMst)
{//-- label value data souce value from table
foreach (DataRow _dr in tRegMst.Rows)
{
lblUserName.Text=(_dr["first_name"]+ " "+_dr["last_name"]).ToString();
lblDbo.Text = (_dr["date_of_birth"]).ToString();
lblGender.Text = (_dr["gender"]).ToString();
lblEmail.Text = (_dr["email"]).ToString();
lblVarify.Text = (_dr["varify"]).ToString();
lblrow_id.Text = (_dr["row_id"]).ToString();
}
}
}
//----------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Net.Mail;
public partial class registration : System.Web.UI.Page
{
dataUtility appReg = new dataUtility();
protected void Page_Load(object sender, EventArgs e)
{
}
private void SaveRegistration()
{
SqlParameter[] par = new SqlParameter[6];
par[0] = appReg.addPara("@first", SqlDbType.VarChar, txtfName.Text.Trim().ToString());
par[1] = appReg.addPara("@last", SqlDbType.VarChar, txtlName.Text.Trim().ToString());
par[2] = appReg.addPara("@date_of_birth", SqlDbType.Date, txtDob.Text.Trim().ToString());
par[3] = appReg.addPara("@gender", SqlDbType.NChar, txtGender.Text.Trim().ToString());
par[4] = appReg.addPara("@email", SqlDbType.VarChar, txtEmail.Text.Trim().ToString());
par[5] = appReg.addPara("@password", SqlDbType.VarChar, txtPassword.Text.Trim().ToString());
appReg.insStoreProc("sp_registration_save", par);//---store proc save data in registrationMst/ login
SendMail(txtEmail.Text.Trim().ToString());
lblMsg.Text = "Registration Successfully Create. Go to Mail and Confirm your account Information";
}
private void SendMail(string email)
{//--send email and confirm mgs
string _conf = confirmEmail();//=== confirm code
string strMsgBody = "<table style='width: 702px; border-raduis:5px; background-color:#b6776; color:Gray; height: 200px;'><tbody>" +
"<tr> <td width='100'>Name :</td><td>" + txtfName.Text.Trim().ToString() + " " + txtlName.Text.Trim().ToString() + "</td></tr>" +
"<tr> <td>Email id :</td><td>" + txtEmail.Text.Trim() + "</td></tr>" +
"<tr> <td>password :</td><td>" + txtPassword.Text.Trim() + "</td></tr>" +
"<tr> <td> </td><td>please link blow for confirmation of your account</td></tr>" +
"<tr> <td> </td><td>" + _conf + "</td></tr>" +
"<tr> <td> </td><td> </td></tr>"+
"<tr> <td> </td><td>more information go to <a href='http://zerodegreeentertainment.in/' target='_blank'>http://zerodegreeentertainment.in </a> </td></tr>"+
"</tbody></table>";
MailAddress SendFrom = new MailAddress("********");
MailAddress SendTo = new MailAddress(email);
MailMessage MyMessage = new MailMessage(SendFrom, SendTo);
MyMessage.IsBodyHtml = true;
MyMessage.Subject = "confirm Registration of zerodegree";
MyMessage.Body = strMsgBody;
System.Net.NetworkCredential authentication = new System.Net.NetworkCredential("*******", "*********");
SmtpClient client = new SmtpClient("smtp.gmail.com", 25);
client.EnableSsl = true;
client.UseDefaultCredentials = true;
client.Credentials = authentication;
client.Send(MyMessage);
}
protected void ImageButton1_Click1(object sender, ImageClickEventArgs e)
{
//-- registration submit
SaveRegistration();
}
private DataTable OpenTable(string cExpr, string cWhere)
{
string cExcute = "";
DataTable _tConfE = new DataTable();
switch (cExpr)
{
case "ConfirmRow":
cExcute = "Exec sp_register 1, '" + cWhere + "'";
break;
default:
break;
}
if (!string.IsNullOrEmpty(cExcute))
{
_tConfE= appReg.executeStoteProc(cExcute);
}
return _tConfE;
}
private string confirmEmail()
{
string cConfirmE = null;
DataTable tConfE = OpenTable("ConfirmRow",txtEmail.Text.Trim().ToString());
if (tConfE.Rows.Count>0)
{
cConfirmE = "http://zerodegreeentertainment.in/RegistrationUpdate.aspx?confirm=";
cConfirmE += tConfE.Rows[0][0].ToString();
}
return cConfirmE;
}
}