Exemplo n.º 1
0
        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));
            }
        }
Exemplo n.º 2
0
        public ResponseRegistrarNave RegistrarNaves(RequestMaestroNave request)
        {
            var url      = ConfigurationManager.AppSettings["UrlRegistrarNave"];
            var response = Util.InvocarServicio <ResponseRegistrarNave>(request, url);

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


            return(response);
        }