Esempio n. 1
0
        /// <summary>
        /// Tries to switches a member's user account to the one specified. If
        /// the account cannot be found or if the account is already associated
        /// with an existing member, then create a new user account for the
        /// member if allowed. This will also switch the customer account if the
        /// user account specified is tied to a different customer account.
        /// </summary>
        /// <param name="customer"></param>
        /// <param name="user"></param>
        /// <param name="allowCreate">Allows the creation of a new user account
        /// if one cannot be found.</param>
        /// <returns></returns>
        public static bool UpdateUser(DojoMember member,
                                      GreyFoxUser user)
        {
            DojoMember existingMember;
            RHCustomer customer;

            existingMember = GetMember(user);

            if (existingMember == null)
            {
                member.UserAccount = user;

                // Update Customer Reference
                customer = CustomerBuilder.GetCustomer(user);
                if (customer != null)
                {
                    if (member.Customer == null ||
                        member.Customer.ID != customer.ID)
                    {
                        member.Customer = customer;
                    }
                }

                return(true);
            }
            else if (existingMember.ID == member.ID)
            {
                return(true); // Member is the same;
            }

            return(false);
        }
 public void GetCustomer_Test01_GetCompanyFromRepository()
 {
     _customerBuilder.GetCustomer("CUST01");
     _mockedCustomerBuilder.Verify(x => x.InstantiateCompany(_companySettings), Times.Once);
 }