Exemple #1
0
        public ResponseRegistrarViaje RegistrarViajes(RequestRegistroViaje request)
        {
            var url      = ConfigurationManager.AppSettings["UrlRegistrarViaje"];
            var response = Util.InvocarServicio <ResponseRegistrarViaje>(request, url);

            if (response == null)
            {
                throw new Exception(string.Format("Problemas con el servicio: {0}", url));
            }


            return(response);
        }
Exemple #2
0
        public void InvocarServiciosViajes()
        {
            TransDepotMaestrosProxy proxy = new TransDepotMaestrosProxy();

            try
            {
                ViajesBL               viajesBL    = new ViajesBL();
                RequestRegistroViaje   request     = new RequestRegistroViaje();
                ResponseRegistrarViaje response    = new ResponseRegistrarViaje();
                List <TramaViaje>      listaViajes = new List <TramaViaje>();

                listaViajes = viajesBL.ListarViaje();

                if (listaViajes != null && listaViajes.Count > 0) // se supone que aqui ya tienes todos los datos
                {
                    foreach (TramaViaje ent in listaViajes)
                    {
                        request.Trama.VesselIMO    = ent.VesselIMO;
                        request.Trama.VoyageNumber = ent.VoyageNumber;
                        request.Trama.RowStatus    = ent.RowStatus;
                        request.Trama.VoyageStops  = ent.VoyageStops;
                        request.ID = 0;

                        response = proxy.RegistrarViajes(request);

                        if (response.isValid == true)
                        {
                            viajesBL.ActualizaViajeTDepotMaestros(ent.VoyageStops.FirstOrDefault().VoyageStopExternalCode);
                        }
                        else
                        {
                            InsertLog.Instanse.Insert(string.Format(@"Error en el metodo: {0}{1}Mensaje Error:{2}{3}Detalle Error:{4}", MethodBase.GetCurrentMethod().Name, Environment.NewLine, "Invocar Servicio TDepot Viajes ", Environment.NewLine, response.messages.FirstOrDefault().message));
                        }
                    }
                }
                //else
                //{
                //    InsertLog.Instanse.Insert(string.Format(@"Error en el metodo: {0}{1}Mensaje Error:{2}{3}Detalle Error:{4}", MethodBase.GetCurrentMethod().Name, Environment.NewLine, "Obtener detalle recalada ", Environment.NewLine, "No se obtuvo detalle para la recalada "));
                //}
            }
            catch (Exception ex)
            {
                InsertLog.Instanse.Insert(string.Format(@"Error en el metodo: {0}{1}Mensaje Error:{2}{3}Detalle Error:{4}", MethodBase.GetCurrentMethod().Name, Environment.NewLine, ex.Message, Environment.NewLine, ex.StackTrace));
            }
        }