private ICustomer CreateCustomer(NewCustomerArgs eventArgs)
        {
            var customer = new Customer
            {
                Address = eventArgs.Address,
                City    = eventArgs.City,
                Name    = eventArgs.Name,
                State   = ConvertStateNameToStateCode(eventArgs.State),
                ZipCode = eventArgs.ZipCode
            };


            return(customer);
        }
        private bool IsValid(NewCustomerArgs eventArgs)
        {
            if (eventArgs == null)
            {
                throw new ArgumentNullException("eventArgs");
            }

            if (!String.IsNullOrEmpty(eventArgs.Address) &&
                !String.IsNullOrEmpty(eventArgs.City) &&
                !String.IsNullOrEmpty(eventArgs.Name) &&
                !String.IsNullOrEmpty(eventArgs.State) &&
                !String.IsNullOrEmpty(eventArgs.ZipCode))
            {
                return(true);
            }

            return(false);
        }
        public void OnAcceptButtonClicked(NewCustomerArgs eventArgs)
        {
            if (!IsValid(eventArgs))
            {
                DialogService.ShowMessageBox(
                    Resources.InvalidCustomerEntry,
                    Resources.InvalidEntryTitle,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                return;
            }

            var customer = CreateCustomer(eventArgs);

            customer.CustomerId = GetCustomerDbo().AddCustomer(customer);

            View.Customer = customer;

            View.SetDialogResult(DialogResult.OK);
        }