Example #1
0
 protected CustomerModel PrepareCustomerModelForList(Customer customer)
 {
     return new CustomerModel()
     {
         Id = customer.Id,
         Email = customer.IsRegistered() ? customer.Email : _localizationService.GetResource("Admin.Customers.Guest"),
         Username = customer.Username,
         FullName = customer.GetFullName(),
         Company = customer.GetAttribute<string>(SystemCustomerAttributeNames.Company),
         Phone = customer.GetAttribute<string>(SystemCustomerAttributeNames.Phone),
         ZipPostalCode = customer.GetAttribute<string>(SystemCustomerAttributeNames.ZipPostalCode),
         CustomerRoleNames = GetCustomerRolesNames(customer.CustomerRoles.ToList()),
         Active = customer.Active,
         CreatedOn = _dateTimeHelper.ConvertToUserTime(customer.CreatedOnUtc, DateTimeKind.Utc),
         LastActivityDate = _dateTimeHelper.ConvertToUserTime(customer.LastActivityDateUtc, DateTimeKind.Utc),
     };
 }
Example #2
0
        public void Can_check_whether_customer_is_registered()
        {
            var customer = new Customer();
            customer.CustomerRoles.Add(new CustomerRole()
            {
                Active = true,
                Name = "Administrators",
                SystemName = SystemCustomerRoleNames.Administrators
            });

            customer.CustomerRoles.Add(new CustomerRole()
            {
                Active = true,
                Name = "Guests",
                SystemName = SystemCustomerRoleNames.Guests
            });

            customer.IsRegistered().ShouldBeFalse();

            customer.CustomerRoles.Add(
                new CustomerRole()
                {
                    Active = true,
                    Name = "Registered",
                    SystemName = SystemCustomerRoleNames.Registered
                });
            customer.IsRegistered().ShouldBeTrue();
        }