Ejemplo n.º 1
0
        public static CustomerDataWS.customerResponse UpdateCustomer(CustomerDataWS.customerTo ToUpdate, int PortalID)
        {
            var ToReturn = new CustomerDataWS.customerResponse();

            try
            {
                System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
                var cliente = new CustomerDataWS.CustomerDataWSClient();

                var TheRequest = new CustomerDataWS.customerRequest();


                TheRequest.customer = ToUpdate;

                // este id debe venir del portal id
                TheRequest.customer.country.id = CountryID(PortalID);
                TheRequest.source    = new CustomerDataWS.sourceTo();
                TheRequest.source.id = "WEB";
                TheRequest.customer.customerTypeSpecified  = true;
                TheRequest.customer.customerType           = CustomerDataWS.customerType.N;
                TheRequest.customer.operationType          = CustomerDataWS.operationType.UPDATE;
                TheRequest.customer.operationTypeSpecified = true;

                // we update the customer
                ToReturn = cliente.updateCustomer(TheRequest);
            }
            catch {
                // llena el catch!
            }
            return(ToReturn);
        }
Ejemplo n.º 2
0
        //core code esta en el primero
        public static CustomerDataWS.customerResponse SearchCustomer(string nationalID, int PortalID, bool shortCustomer = true)
        {
            try
            {
                System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
                var cliente  = new CustomerDataWS.CustomerDataWSClient();
                var ToSearch = new CustomerDataWS.customerRequest();


                ToSearch.customer            = new CustomerDataWS.customerTo();
                ToSearch.customer.country    = new CustomerDataWS.countryTo();
                ToSearch.customer.country.id = CountryID(PortalID);

                ToSearch.source    = new CustomerDataWS.sourceTo();
                ToSearch.source.id = "WEB";

                ToSearch.customer.customerType          = CustomerDataWS.customerType.N;
                ToSearch.customer.customerTypeSpecified = true;
                ToSearch.customer.nationalId            = nationalID;
                var ToReturn = new CustomerDataWS.customerResponse();

                if (shortCustomer)
                {
                    // este trae datos basicos
                    ToReturn = cliente.searchShortCustomer(ToSearch);
                }
                else
                {
                    // este trae el full info (muy pesado segun shiradit)
                    ToReturn = cliente.searchCustomer(ToSearch);
                }
                ///todo
                return(ToReturn);
            }
            catch (Exception Ex)
            {
                throw new Exception("Hubo un error al tratar de Buscar a " + nationalID + " con SearchCustomer. La excepcion dice: " + Ex.Message, Ex.InnerException);
            }
        }