コード例 #1
0
        // Add to interface
        public void SignUp(Customers customer)
        {
            int user_role = 3;

            if (_customerDAO != null)
            {
                if (customer.User.UserRole == 0)
                {
                    customer.User.UserRole = user_role;
                }
                _userDAO.Add(customer.User);
                List <Users> users       = _userDAO.GetAll();
                Users        createdUser = users[users.Count - 1];
                customer.UserId = createdUser.ID;

                _customerDAO.Add(customer);
                // check that user is created - if not throw error
            }
            else
            {
                _userDAO = new UsersDAOPGSQL();
                _userDAO.Add(customer.User);
                _customerDAO = new CustomersDAOPGSQL();
                _customerDAO.Add(customer);
            }
        }
コード例 #2
0
 public void CreateNewUser(LoginToken <Administrator> token, Users users)
 {
     if (token != null)
     {
         if (_userDAO != null)
         {
             _userDAO.Add(users);
         }
         else
         {
             _userDAO = new UsersDAOPGSQL();
             _userDAO.Add(users);
         }
     }
 }