DAL
public DataSet check_Sess_DSet(Prop_Sess pro)
{
con.Open();
cmd = new SqlCommand("SP_REG_PER", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@uname", pro.Cname);
cmd.Parameters.AddWithValue("@pwd", pro.Pwd);
cmd.Parameters.AddWithValue("@Email", pro.Email);
da = new SqlDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds);
con.Close();
return ds;
}
BLL
public DataSet check_Sess_DSet(Prop_Sess _Pro)
{
DataSet ds = d.check_Sess_DSet(_Pro);
return ds;
}
Application Layer
protected void btn_Log_Click(object sender, EventArgs e)
{
Label1.Visible = false;
DataSet ds = null;
_Pro.Cname = txt_Uname.Text;
_Pro.Pwd = txt_Pwd.Text;
_Pro.Email = txt_Email.Text;
ds = b.check_Sess_DSet(_Pro);
if (ds.Tables[0].Rows.Count > 0 && txt_Uname.Text == ds.Tables[0].Rows[0]["uname"].ToString() && txt_Pwd.Text == ds.Tables[0].Rows[0]["pwd"].ToString())
{
Session["Reg_ID"] = ds.Tables[0].Rows[0]["reg_ID"];
Session["FirstName"] = ds.Tables[0].Rows[0]["fname"];
Session["LastName"] = ds.Tables[0].Rows[0]["lname"];
Session["UserName"] = ds.Tables[0].Rows[0]["uname"];
Session["Password"] = ds.Tables[0].Rows[0]["pwd"];
Response.Redirect("Redirect.aspx", true);
}
else
{
Label1.Visible = true;
Label1.ForeColor = System.Drawing.Color.Red;
Label1.Text = "Invalid Login Credentials";
}
}
Redirect Page
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Reg_ID"] != null)
{
txt_REgID.Text = Session["Reg_ID"].ToString();
}
if (Session["FirstName"] != null)
{
txt_FName.Text = Session["FirstName"].ToString();
}
if (Session["LastName"] != null)
{
txt_LName.Text = Session["LastName"].ToString();
}
if (Session["UserName"] != null)
{
txt_UName.Text = Session["UserName"].ToString();
}
if (Session["Password"] != null)
{
txt_Pwd.Text = Session["Password"].ToString();
}
}
public DataSet check_Sess_DSet(Prop_Sess pro)
{
con.Open();
cmd = new SqlCommand("SP_REG_PER", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@uname", pro.Cname);
cmd.Parameters.AddWithValue("@pwd", pro.Pwd);
cmd.Parameters.AddWithValue("@Email", pro.Email);
da = new SqlDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds);
con.Close();
return ds;
}
BLL
public DataSet check_Sess_DSet(Prop_Sess _Pro)
{
DataSet ds = d.check_Sess_DSet(_Pro);
return ds;
}
Application Layer
protected void btn_Log_Click(object sender, EventArgs e)
{
Label1.Visible = false;
DataSet ds = null;
_Pro.Cname = txt_Uname.Text;
_Pro.Pwd = txt_Pwd.Text;
_Pro.Email = txt_Email.Text;
ds = b.check_Sess_DSet(_Pro);
if (ds.Tables[0].Rows.Count > 0 && txt_Uname.Text == ds.Tables[0].Rows[0]["uname"].ToString() && txt_Pwd.Text == ds.Tables[0].Rows[0]["pwd"].ToString())
{
Session["Reg_ID"] = ds.Tables[0].Rows[0]["reg_ID"];
Session["FirstName"] = ds.Tables[0].Rows[0]["fname"];
Session["LastName"] = ds.Tables[0].Rows[0]["lname"];
Session["UserName"] = ds.Tables[0].Rows[0]["uname"];
Session["Password"] = ds.Tables[0].Rows[0]["pwd"];
Response.Redirect("Redirect.aspx", true);
}
else
{
Label1.Visible = true;
Label1.ForeColor = System.Drawing.Color.Red;
Label1.Text = "Invalid Login Credentials";
}
}
Redirect Page
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Reg_ID"] != null)
{
txt_REgID.Text = Session["Reg_ID"].ToString();
}
if (Session["FirstName"] != null)
{
txt_FName.Text = Session["FirstName"].ToString();
}
if (Session["LastName"] != null)
{
txt_LName.Text = Session["LastName"].ToString();
}
if (Session["UserName"] != null)
{
txt_UName.Text = Session["UserName"].ToString();
}
if (Session["Password"] != null)
{
txt_Pwd.Text = Session["Password"].ToString();
}
}
No comments:
Post a Comment