protected void Page_Load(object sender, EventArgs e) { try { adminName.Text = Session["FirstName"].ToString(); } catch (Exception ex) { Response.Redirect("~/SignInPage.aspx"); } try { if (Session["UserId"] != null) { SignInBO imageBO = new SignInBO { userId = Session["UserId"].ToString() }; SignInBAL imageBAL = new SignInBAL(); DataRow dr = imageBAL.Image(imageBO); profileImage.ImageUrl = dr["details_image"].ToString(); } } catch { } }
public DataRow ImageDisplay(SignInBO obj) { string connection = ConfigurationManager.ConnectionStrings["TSConnect"].ConnectionString; using (SqlConnection con = new SqlConnection(connection)) { con.Open(); SqlCommand cmd = new SqlCommand("TS_ImageDisplay", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@userId", obj.userId); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable table = new DataTable(); da.Fill(table); con.Close(); DataRow dr = table.Rows[0]; return(dr); } }
public DataRow SignIn(SignInBO obj) { string connection = ConfigurationManager.ConnectionStrings["TSConnect"].ConnectionString; using (SqlConnection con = new SqlConnection(connection)) { con.Open(); SqlCommand cmd = new SqlCommand("TS_SignIn", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@userId", obj.userId); // cmd.Parameters.AddWithValue("@password", obj.userPassword); cmd.Parameters.AddWithValue("@password", Decrypt(obj.userPassword.Trim())); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable table = new DataTable(); da.Fill(table); con.Close(); DataRow dr = table.Rows[0]; return(dr); //int result = cmd.ExecuteNonQuery(); //con.Close(); //return result; } }
public DataRow Image(SignInBO signIn_BO_Object) { return _signIn.ImageDisplay(signIn_BO_Object); }
public DataRow LogIn(SignInBO signIn_BO_Object) { return _signIn.SignIn(signIn_BO_Object); }
protected void btnSignIn_Click(object sender, EventArgs e) { try { SignInBO _signInBO = new SignInBO(); _signInBO.userId = txtBoxUser.Text; _signInBO.userPassword = txtBoxPassword.Text; SignInBAL signInBAL = new SignInBAL(); //SignInDAL signIn = new SignInDAL(); DataRow _dataRow = signInBAL.LogIn(_signInBO); if (_dataRow == null) { lblStatus.Text = "Invalid User Name or Password"; } else { //Session _session = new Session //{ // Session_CategoryId = int.Parse(_dataRow["role_id"].ToString()), // Session_UserId = _dataRow["us_userId"].ToString(), // Session_FirstName = _dataRow["us_firstName"].ToString() //}; Session["UserId"] = _dataRow["us_userId"].ToString(); Session["RoleId"] = _dataRow["role_id"].ToString(); Session["FirstName"] = _dataRow["us_firstname"].ToString(); switch (_dataRow["role_id"].ToString()) { case "0": Response.Redirect("~/HomePageUser.aspx"); break; case "1": Response.Redirect("~/HomePageUser.aspx"); break; case "2": Response.Redirect("~/HomePageAdmin.aspx"); break; case "3": Response.Redirect("~/SuperUser.aspx"); break; } //if(_session.Session_CategoryId == 3) //{ // Session["UserId"] = _session.Session_UserId; // Response.Redirect("~/SuperUser.aspx"); //} //if (_session.Session_CategoryId == 2) //{ // Session["UserId"] = _session.Session_UserId; // Session["FirstName"] = _session.Session_FirstName; // Response.Redirect("~/HomePageAdmin.aspx"); //} //if (_session.Session_CategoryId == 1 ) //{ // Session["UserId"] = _session.Session_UserId; // Response.Redirect("~/HomePageUser.aspx"); //} //if (_session.Session_CategoryId == 0) //{ // Session["UserId"] = _session.Session_UserId; // Response.Redirect("~/HomePageUser.aspx"); //} } } catch (Exception ex) { lblStatus.Text = "Invalid User Name or Password" + ex.Message; } //Session // try // { // SignInBAL sign // if (_user != null) // { // Session["Role"] = _user.Role; // Session["UserId"] = _user.Id; // Session["UserName"] = _user.UserName; // switch (_user.Role) // { // case 1: // Response.Redirect("ShowMovieListAdmin.aspx"); // break; // case 2: // Response.Redirect("ShowMovieListCustomer.aspx"); // break; // } // } // else // { // Label1.Text = "Invalid User Details"; // Label1.ForeColor = System.Drawing.Color.Red; // } // txtBoxUserName.Text = txtBoxPassword.Text = string.Empty; // } // catch // { // } }