Example #1
0
        public async Task WHEN_CustomMethod_Registered_AND_Passing_Valid_Parameters_SHOULD_Update_GuestCustomerInfo()
        {
            //Arrange
            var cart = CreateBasicCart();

            cart.Customer.Email = GetRandom.Email();

            var service = CreateCheckoutService(cart);

            var updatedCustomer = new CustomerSummaryViewModel
            {
                Email = GetRandom.Email()
            };

            // Act
            var param = new UpdateCheckoutCartParam
            {
                GetCartParam = CreateGetCartParam(),
                UpdateValues = CreateUpdateOperation("GuestCustomerInfo", updatedCustomer),
                CurrentStep  = GetRandom.Int(),
                IsGuest      = GetRandom.Boolean()
            };
            var processedCart = await service.UpdateCheckoutCartAsync(param);

            //Assert
            processedCart.Should().NotBeNull();
            processedCart.Cart.Customer.Email.ShouldBeEquivalentTo(updatedCustomer.Email);
        }
Example #2
0
        private void CustomerGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Todo: Change this to an interface reference (ICustomerSummaryViewModel)
            CustomerSummaryViewModel vm = DataContext as CustomerSummaryViewModel;

            vm.CustomerSelectionChanged.Execute(e);
        }
Example #3
0
        public async Task <CustomerSummaryViewModel> GetDetailSummary(string tenantId, string customerId)
        {
            var customerInfo = await _customerRepository.GetInfo(customerId, false);

            if (customerInfo == null)
            {
                return(null);
            }

            var listCustomerContact = await _customerContactRepository.GetByCustomerId(customerId);

            var phone = string.Empty;
            var email = string.Empty;

            if (listCustomerContact.Count > 0)
            {
                phone = listCustomerContact.First(x => x.ContactType == ContactType.MobilePhone).ContactValue;
                email = listCustomerContact.First(x => x.ContactType == ContactType.Email).ContactValue;
            }

            var customerSummeryDetail = new CustomerSummaryViewModel
            {
                Id           = customerInfo.Id,
                CustomerCode = customerInfo.CustomerCode,
                FullName     = customerInfo.FullName,
                Address      = customerInfo.Address,
                PhoneNumber  = phone,
                Email        = email
            };

            return(customerSummeryDetail);
        }
Example #4
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var customers = await _customerRepository.GetAllCustomersAsync();

            var customersList = new List <CustomerModel>();

            customersList.AddRange(customers);

            var customerSummaryViewModel = new CustomerSummaryViewModel
            {
                CustomerCount = customersList.Count()
            };

            return(View(customerSummaryViewModel));
        }
Example #5
0
        private Task UpdateCustomerCustom(Overture.ServiceModel.Orders.Cart cart, CustomerSummaryViewModel value)
        {
            if (value == null)
            {
                return(Task.FromResult(0));
            }

            if (cart.Customer == null)
            {
                cart.Customer = new CustomerSummary();
            }

            cart.Customer.Email = value.Email;

            return(Task.FromResult(0));
        }
        protected virtual Task UpdateCustomer(Overture.ServiceModel.Orders.Cart cart, CustomerSummaryViewModel customerSummaryViewModel)
        {
            if (customerSummaryViewModel == null)
            {
                return(Task.FromResult(0));
            }

            if (cart.Customer == null)
            {
                cart.Customer = new CustomerSummary();
            }

            cart.Customer.LastName   = null;
            cart.Customer.FirstName  = null;
            cart.Customer.MiddleName = null;
            cart.Customer.Phone      = null;
            cart.Customer.Email      = customerSummaryViewModel.Email;

            return(Task.FromResult(0));
        }
Example #7
0
        private Task UpdateCustomerWithCustomFieldInBag(Overture.ServiceModel.Orders.Cart cart, CustomerSummaryViewModel value)
        {
            if (value == null)
            {
                return(Task.FromResult(0));
            }

            if (cart.Customer == null)
            {
                cart.Customer = new CustomerSummary();
            }

            cart.Customer.Email = value.Email + "-" + value.Bag["CustomField"];
            return(Task.FromResult(0));
        }
        private void SetSummaryView()
        {
            DetailSectionViewModel = null;
            if (CustomerSummaryViewModel == null)
                CustomerSummaryViewModel = new CustomerSummaryViewModel(this.Messenger, this.UserLogin, this.SelectedCustomer) { ParentViewModel = this };

            DetailSectionViewModel = CustomerSummaryViewModel;
        }