SHARE
TWEET

Untitled

Ortund Apr 9th, 2014 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Web Project/App_Code/User.cs
  2. // This is the class that the website will use to send requests
  3. // to retrieve and manipulate user data
  4.  
  5. using DataProject; // the project that handles the data manipulation and retreival
  6.  
  7. public class User
  8. {
  9.     public int userid { get; protected set; }
  10.     public int storeid { get; protected set; }
  11.     public string emailaddress { get; protected set; }
  12.     public string password { get; protected set; }
  13.     public string role { get; protected set; }
  14.  
  15.     public bool Login()
  16.     {
  17.         bool result = false;
  18.  
  19.         POSUser user = new POSUser(emailaddress, password);
  20.         //POSUser loggedIn = user.Login();
  21.  
  22.         //if (loggedIn != null)
  23.         //{
  24.         //    processLogin(loggedIn);
  25.         //}
  26.         user = user.Login();
  27.  
  28.         if (user != null)
  29.         {
  30.             processLogin(user);
  31.         }
  32.  
  33.         return result;
  34.     }
  35. }
  36.  
  37. // DataProject/POSUser.cs
  38. // This is the class that handles all data manipulation in relation to users
  39.  
  40. using System;
  41. using System.Collections.Generic;
  42. using System.Linq;
  43. using System.Text;
  44.  
  45. namespace DataProject
  46. {
  47.     public class POSUser
  48.     {
  49.         public int userid { get; protected set; }
  50.         public int storeid { get; protected set; }
  51.         public string emailaddress { get; protected set; }
  52.         public string password { get; protected set; }
  53.         public string role { get; protected set; }
  54.  
  55.         public dataEntities de = new dataEntities();
  56.  
  57.         public POSUser(string EmailAddress, string Password)
  58.         {
  59.             emailaddress = EmailAddress;
  60.             password = Password;
  61.         }
  62.  
  63.         public POSUser Login()
  64.         {
  65.             var user = (from u in de.users
  66.                         where u.emailaddress == emailaddress && u.password == password
  67.                         select u).FirstOrDefault();
  68.  
  69.             POSUser result = new POSUser();
  70.  
  71.             if (user != null)
  72.             {
  73.                 result.userid = user.userid;
  74.                 result.storeid = user.storeid;
  75.                 result.emailaddress = user.emailaddress;
  76.                 result.password = user.password;
  77.                 result.role = user.role;
  78.             }
  79.  
  80.             return result;
  81.         }
  82.     }
  83. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top