Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Web Project/App_Code/User.cs
- // This is the class that the website will use to send requests
- // to retrieve and manipulate user data
- using DataProject; // the project that handles the data manipulation and retreival
- 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 bool Login()
- {
- bool result = false;
- POSUser user = new POSUser(emailaddress, password);
- //POSUser loggedIn = user.Login();
- //if (loggedIn != null)
- //{
- // processLogin(loggedIn);
- //}
- user = user.Login();
- if (user != null)
- {
- processLogin(user);
- }
- return result;
- }
- }
- // DataProject/POSUser.cs
- // This is the class that handles all data manipulation in relation to users
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace DataProject
- {
- public class POSUser
- {
- 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 dataEntities de = new dataEntities();
- public POSUser(string EmailAddress, string Password)
- {
- emailaddress = EmailAddress;
- password = Password;
- }
- public POSUser Login()
- {
- var user = (from u in de.users
- where u.emailaddress == emailaddress && u.password == password
- select u).FirstOrDefault();
- POSUser result = new POSUser();
- if (user != null)
- {
- result.userid = user.userid;
- result.storeid = user.storeid;
- result.emailaddress = user.emailaddress;
- result.password = user.password;
- result.role = user.role;
- }
- return result;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement