Example #1
0
        public Response PreAdvice(string empresa, string recalada, string regimen, string puertoOrigen, string puertoEmbarque, string tipoDoc, string Nrobl, string CodigoContenedor, string NroMovimiento, string url, string conexion)
        {
            Response        response = new Response();
            TransDepotProxy proxy    = new TransDepotProxy();
            PreAdvice       request  = new PreAdvice();
            DataAccess      da       = new DataAccess();

            try
            {
                request = da.ObtenerDatosPreAdvice(empresa, recalada, regimen, puertoOrigen, puertoEmbarque, tipoDoc, Nrobl, CodigoContenedor, NroMovimiento, conexion);

                var responseProxy = proxy.PreAdvice(request, url);

                if (responseProxy.isValid)
                {
                    response.Estado = true;
                    response.Data   = responseProxy.data;
                }
                else
                {
                    response.Estado = false;
                    responseProxy.messages.ForEach(x => response.Mensaje = response.Mensaje + " " + x.message);
                }
            }
            catch (Exception ex)
            {
                response.Estado  = false;
                response.Mensaje = ex.Message;
            }

            return(response);
        }
        public ResponsePreAdvice PreAdvice(PreAdvice request, string url)
        {
            var response = Helper.InvocarServicio <ResponsePreAdvice, PreAdvice>(request, url, "POST");

            return(response);
        }
Example #3
0
        public PreAdvice ObtenerDatosPreAdvice(string empresa, string recalada, string regimen, string puertoOrigen, string puertoEmbarque, string tipoDoc, string Nrobl, string codigoContenedor, string NroMovimiento, string conexion)
        {
            //PreAdvice oPreAdvice = new PreAdvice();
            PreAdvice respone = new PreAdvice();

            respone = null;

            using (SqlConnection cnn = new SqlConnection(conexion))
            {
                try
                {
                    cnn.Open();

                    SqlCommand cmd = new SqlCommand("USP_OBTIENE_DATOS_PREADVICE", cnn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@EMPRE_C_CODIGO", SqlDbType.Char, 10).Value           = empresa;
                    cmd.Parameters.Add("@RECA_C_NUMERO", SqlDbType.Char, 10).Value            = recalada;
                    cmd.Parameters.Add("@REGIME_C_CODIGO", SqlDbType.Char, 2).Value           = regimen;
                    cmd.Parameters.Add("@PUERTO_C_CODIGO_ORIGEN", SqlDbType.Char, 10).Value   = puertoOrigen;
                    cmd.Parameters.Add("@PUERTO_C_CODIGO_EMBARQUE", SqlDbType.Char, 10).Value = puertoEmbarque;
                    cmd.Parameters.Add("@TIPDOC_C_CODIGO", SqlDbType.Char, 2).Value           = tipoDoc;
                    cmd.Parameters.Add("@CONEMB_C_NUMERO", SqlDbType.Char, 25).Value          = Nrobl;

                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        if (respone == null)
                        {
                            respone = new PreAdvice
                            {
                                YardCode   = reader["YardCode"].ToString(),
                                ActionType = reader["ActionType"].ToString(),
                                OperationTypeMovementCode = reader["OperationTypeMovementCode"].ToString(),
                                VoyageStopExternalCode    = reader["VoyageStopExternalCode"].ToString(),
                                VesselIMO       = reader["VesselIMO"].ToString(),
                                VoyageNumber    = reader["VoyageNumber"].ToString(),
                                OceanCarrier    = reader["OceanCarrier"].ToString(),
                                ReferenceType   = reader["ReferenceType"].ToString(),
                                ReferenceNumber = reader["ReferenceNumber"].ToString(),
                                OperationType   = reader["OperationType"].ToString(),
                                PlaceOfReceipt  = reader["PlaceOfReceipt"].ToString(),
                                PortOfLoading   = reader["PortOfLoading"].ToString(),
                                PortOfDischarge = reader["PortOfDischarge"].ToString(),
                                PlaceOfDelivery = reader["PlaceOfDelivery"].ToString(),
                                CustomerERPCode = reader["CustomerERPCode"].ToString(),
                                ShipmentType    = reader["ShipmentType"].ToString()
                            };
                        }

                        var oPreAdviceEquipment = new YardPreAdviceEquipment
                        {
                            EquipmentNumber          = reader["EquipmentNumber"].ToString(),
                            EquipmentTypeSizeISOCode = reader["EquipmentTypeSizeISOCode"].ToString(),
                            IsEmpty               = Convert.ToBoolean(reader["IsEmpty"]),
                            IsHazardous           = Convert.ToBoolean(reader["IsHazardous"]),
                            RequiresReview        = Convert.ToBoolean(reader["RequiresReview"]),
                            SetPoint              = Convert.ToDouble(reader["SetPoint"]),
                            SetPointUnitOfMeasure = reader["SetPointUnitOfMeasure"].ToString(),
                            Ventilation           = Convert.ToDouble(reader["Ventilation"]),
                            RelativeHumidityLevel = Convert.ToDouble(reader["RelativeHumidityLevel"]),
                            O2Level               = Convert.ToDouble(reader["O2Level"]),
                            CO2Level              = Convert.ToDouble(reader["CO2Level"]),
                            RequiresPlug          = Convert.ToBoolean(reader["RequiresPlug"]),
                            Technology            = reader["Technology"].ToString()
                        };

                        respone.Equipments.Add(oPreAdviceEquipment);
                    }
                }
                catch (Exception ex)
                {
                    respone = null;
                }
                finally
                {
                    cnn.Close();
                }
            }

            return(respone);
        }