public void InvocarServiciosNaves() { TransDepotMaestrosProxy proxy = new TransDepotMaestrosProxy(); try { NavesBL navesBL = new NavesBL(); List <Naves> listaNaves = new List <Naves>(); RequestMaestroNave request = new RequestMaestroNave(); ResponseRegistrarNave response = new ResponseRegistrarNave(); listaNaves = navesBL.ListarNaves(); if (listaNaves != null && listaNaves.Count > 0) { foreach (Naves ent in listaNaves) { request.Trama.VesselName = ent.NombreNave; request.Trama.VesselCode = ent.CodigoNave; request.Trama.IMO = ent.Imo; if (ent.CodigoLinea != null && ent.CodigoLinea != "") { request.Trama.Carrier = ent.CodigoLinea; } if (ent.CodigoPais != null && ent.CodigoPais != "") { request.Trama.Flag = ent.CodigoPais; } request.Trama.RowStatus = listaNaves.FirstOrDefault().EstadoRegistro; request.ID = 0; // inicio envio a servicio TransDepot response = proxy.RegistrarNaves(request); if (response.isValid == true) { navesBL.ActualizaEnvioTDepotMaestros(ent.CodigoNave); } 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 Naves", 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 Listado Naves ", Environment.NewLine, "No se obtuvo Listado de Naves" + listaNaves.ToString())); //} } 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)); } }
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)); } }