Esempio n. 1
0
        /// <summary>
        /// Purpose: Update an existing user
        /// Accepts: Nothing
        /// Returns: Boolean
        /// </summary>
        public bool UpdateUser()
        {
            bool isSuccess = false;
            try
            {
                Hashtable HashUser = new Hashtable();
                HashUser["userid"] = UserID;
                HashUser["username"] = Username;
                HashUser["password"] = Password;
                HashUser["salutation"] = Salutation;
                HashUser["firstName"] = FirstName;
                HashUser["lastName"] = LastName;
                HashUser["address1"] = Address1;
                HashUser["address2"] = Address2;
                HashUser["city"] = City;
                HashUser["stateProv"] = StateProvinceID;
                HashUser["zipPC"] = ZipCodePostal;
                HashUser["email"] = Email;
                HashUser["newsletters"] = IsReceiveNewsletters;

                UserData userData = new UserData();
                isSuccess = userData.UpdateUser(HashUser);
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "User", "UpdateUser()");
            }

            return isSuccess;
        }
Esempio n. 2
0
 /// <summary>
 /// Purpose: Sets user ID based on user login information
 /// Accepts: String username, String password
 /// Returns: Nothing
 /// </summary>
 public void Login(string username, string password)
 {
     try
     {
         UserData userData = new UserData();
         Hashtable hsh = new Hashtable();
         hsh["username"] = username.Trim();
         hsh["password"] = password.Trim();
         UserID = userData.Login(hsh);
     }
     catch (Exception ex)
     {
         ErrorRoutine(ex, "User", "Login");
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Purpose: Grabs all users
        /// Accepts: Nothing
        /// Returns: List<User>
        /// </summary>
        public List<User> GetAllUsers()
        {
            List<User> users = new List<User>();
            try
            {
                UserData data = new UserData();
                List<QSRDataObjects.User> dataUsers = data.GetAllUsers();

                foreach (QSRDataObjects.User u in dataUsers)
                {
                    User user = new User();
                    user.UserID = u.UserID;
                    user.Username = u.Username;
                    user.Password = u.Password;
                    user.Salutation = u.Salutation;
                    user.FirstName = u.FirstName;
                    user.LastName = u.LastName;
                    user.Address1 = u.Address1;
                    user.Address2 = u.Address2;
                    user.City = u.City;
                    user.StateProvinceID = Convert.ToInt32(u.StateProvinceID);
                    user.ZipCodePostal = u.ZipPostalCode;
                    user.Email = u.Email;
                    user.IsReceiveNewsletters = u.IsReceiveNewsletters;
                    user.Created = u.Created;
                    user.Modified = u.Modified;
                    users.Add(user);
                }
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "User", "GetAllUsers");
            }
            return users;
        }
Esempio n. 4
0
        /// <summary>
        /// Purpose: Grabs user information based on ID
        /// Accepts: Int
        /// Returns: Nothing
        /// </summary>
        public void GetUserByID(int id)
        {
            try
            {
                UserData data = new UserData();
                Hashtable hsh = new Hashtable();

                hsh = data.GetUserByID(id);

                UserID = id;
                Username = hsh["username"];
                Password = hsh["password"];
                Salutation = hsh["salutation"];
                FirstName = hsh["firstname"];
                LastName = hsh["lastname"];
                Address1 = hsh["address1"];
                Address2 = hsh["address2"];
                City = hsh["city"];
                StateProvinceID = Convert.ToInt32(hsh["stateprovinceid"]);
                ZipCodePostal = hsh["zippostalcode"];
                Email = hsh["email"];
                IsReceiveNewsletters = hsh["isreceivenewsletters"];
                Created = hsh["created"];
                Modified = hsh["modified"];
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "User", "GetUserByID");
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Purpose: Add new user information to the DB
        /// Accepts: Nothing
        /// Returns: Integer(the userid added)
        /// </summary>
        public int AddUser()
        {
            Hashtable HashUser = new Hashtable();
            try
            {
                UserData usr = new UserData();
                HashUser["username"] = Username;
                HashUser["password"] = Password;
                HashUser["salutation"] = Salutation;
                HashUser["firstName"] = FirstName;
                HashUser["lastName"] = LastName;
                HashUser["address1"] = Address1;
                HashUser["address2"] = Address2;
                HashUser["city"] = City;
                HashUser["stateProv"] = StateProvinceID;
                HashUser["zipPC"] = ZipCodePostal;
                HashUser["email"] = Email;
                HashUser["newsletters"] = IsReceiveNewsletters;
                UserID = usr.AddUser(HashUser);
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "User", "AddUser");
            }

            return UserID;
        }