Beispiel #1
0
 public Entities.Customer ParseCustomer(BusinessLogic.Customer c)
 {
     return(new Entities.Customer()
     {
         City = c.City,
         FirstName = c.FirstName,
         LastName = c.LastName,
         Street = c.Street,
         State = c.State.ToString(),
         ZipCode = c.Zipcode.ToString()
     });
 }
Beispiel #2
0
        /// <summary>
        /// Actualiza el perfil local y remoto del cliente.
        /// </summary>
        /// <param name="customer">Datos del cliente/usuario</param>
        /// <returns>Perfil del cliente como es validado por los metodos para guardarlo</returns>
        internal static CustomerEntity UpdateCustomerProfile(CustomerEntity customer)
        {
            CustomerEntity returnCustomer;

            if (UtnEmallClientApplication.IsOnline)
            {
                // Guardar el cliente remotamente si se esta en línea
                CustomerClient customerClient = new CustomerClient(ServiceClient.CreateDefaultBinding(), new System.ServiceModel.EndpointAddress(UtnEmall.Client.SmartClientLayer.Connection.ServerUri + "Customer"));
                returnCustomer = customerClient.Save(customer, UtnEmall.Client.SmartClientLayer.Connection.Session);
                if (returnCustomer != null)
                {
                    Debug.WriteLine("Internal application error saving remote customer.");
                }
            }
            // Siempre actualizar en la base local
            returnCustomer = new BusinessLogic.Customer().Save(customer);
            if (returnCustomer != null)
            {
                Debug.WriteLine("Internal application error saving local customer.");
            }
            return(returnCustomer);
        }