Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // App_Code/User.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using projectData;
- /// <summary>
- /// Summary description for User
- /// </summary>
- public class User
- {
- public int userid { get; protected set; }
- public int storeid { get; protected set; }
- public string emailaddress { get; protected set; }
- public string password { get; protected set; }
- public string role { get; protected set; }
- public User()
- {
- //
- // TODO: Add constructor logic here
- //
- }
- public bool Login()
- {
- POSUser user = new POSUser(emailaddress, password);
- user = user.Login();
- bool result = false;
- if (user != null)
- {
- processLogin(user);
- }
- return result;
- }
- private void processLogin(POSUser loggedIn)
- {
- HttpContext.Current.Session["userid"] = loggedIn.userid;
- HttpContext.Current.Session["storeid"] = loggedIn.storeid;
- HttpContext.Current.Session["role"] = loggedIn.role;
- }
- }
- // ~/Login.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- public partial class Login : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- if (Context.User.Identity.IsAuthenticated)
- {
- Response.Redirect("~/User/Default.aspx");
- }
- }
- }
- protected void btnLogin_Click(object sender, EventArgs e)
- {
- User. // Only User object in Intellisense is the Context.User object
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement