bool EnviarPreAdvice() { TransDepotProxy proxy = new TransDepotProxy(); RequestPreAdvice request = new RequestPreAdvice(); request.YardCode = ConfigurationManager.AppSettings["DepSanAgustin"].ToString(); request.ActionType = "P"; request.OperationTypeMovementCode = ""; request.VoyageStopExternalCode = txtOrdenServicio.Text.Trim(); request.VesselIMO = ""; request.VoyageNumber = ""; request.OceanCarrier = OceanCarrier; if (OperationType != null) { if (OperationType.Equals("E")) { request.ReferenceType = ConfigurationManager.AppSettings["ReferenceTypeBK"].ToString(); } else { request.ReferenceType = ConfigurationManager.AppSettings["ReferenceTypeBL"].ToString(); } } request.OperationType = OperationType; request.ReferenceNumber = ReferenceNumber; request.PlaceOfReceipt = PlaceOfReceipt; request.PortOfLoading = PortOfLoading; request.PortOfDischarge = PortOfDischarge; request.PlaceOfDelivery = PlaceOfDelivery; request.CustomerERPCode = CustomerERPCode; request.ShipmentType = ""; request.Equipments.Add(new PreAdviceEquipment() { EquipmentNumber = EquipmentNumber, EquipmentTypeSizeISOCode = EquipmentTypeSizeISOCode, IsEmpty = (IsEmpty.Equals("S")) ? true : false, IsHazardous = (IsHazardous.Equals("S")) ? true : false, RequiresReview = false, SetPoint = (SetPoint.Trim() != "") ? Convert.ToDouble(SetPoint) : 0.0, SetPointUnitOfMeasure = SetPointUnitOfMeasure, Ventilation = 0.0, RelativeHumidityLevel = 0.0, O2Level = 0.0, CO2Level = 0.0, RequiresPlug = (RequiresPlug.Equals("S")) ? true : false, Technology = "" }); ResponsePreAdvice resp = new ResponsePreAdvice(); resp = proxy.PreAdvice(request); if (!resp.isValid) { List <string> listaDestinatarios = new List <string>(); List <string> listaCopia = new List <string>(); List <string> listaCopiaOculta = new List <string>(); string destinatarios = ConfigurationManager.AppSettings["Destinatarios"].ToString(); if (destinatarios != "" && destinatarios.Contains(";")) { var correosDestino = destinatarios.Split(';'); foreach (string item in correosDestino) { listaDestinatarios.Add(item); } } else { listaDestinatarios.Add(destinatarios); } string copia = ConfigurationManager.AppSettings["ConCopia"].ToString(); if (copia != "" && copia.Contains(";")) { var correosCopia = copia.Split(';'); foreach (string item in correosCopia) { listaCopia.Add(item); } } else { listaCopia.Add(copia); } string copiaOculta = ConfigurationManager.AppSettings["CopiaOculta"].ToString(); if (copiaOculta != "" && copiaOculta.Contains(";")) { var correosCopiaOculta = copiaOculta.Split(';'); foreach (string item in correosCopiaOculta) { listaCopiaOculta.Add(item); } } else { listaCopiaOculta.Add(copiaOculta); } new ManejadorCorreos().EnviarCorreo(ConfigurationManager.AppSettings["AsuntoCorreoError"].ToString(), resp.messages[0].message, listaDestinatarios, listaCopia, listaCopiaOculta); } return(true); }
public string IntegracionLlenos() { string dtResult = "OK"; try { List <PendientesLlenos> listaPendientes = da.ListaPendientesLlenos("INGRESOS"); foreach (PendientesLlenos item in listaPendientes) { ResponsePreAdvice resp1 = new ResponsePreAdvice(); RequestPreAdvice req1 = new RequestPreAdvice(); ResponseEquipmentOperation resp2 = new ResponseEquipmentOperation(); RequestEquipmentOperation req2 = new RequestEquipmentOperation(); req1.YardCode = item.YardCode; req1.ActionType = item.ActionType; req1.OperationTypeMovementCode = ""; req1.VoyageStopExternalCode = item.VoyageStopExternalCode; req1.VesselIMO = item.VesselIMO; req1.VoyageNumber = item.VoyageNumber; req1.OceanCarrier = item.OceanCarrier; req1.ReferenceType = item.ReferenceType; req1.ReferenceNumber = item.ReferenceNumber; req1.OperationType = item.OperationType; req1.PlaceOfReceipt = item.PlaceOfReceipt; req1.PortOfLoading = item.PortOfLoading; req1.PortOfDischarge = item.PortOfDischarge; req1.PlaceOfDelivery = item.PlaceOfDelivery; req1.CustomerERPCode = item.CustomerERPCode.Trim(); req1.ShipmentType = item.ShipmentType; PreAdviceEquipment e = new PreAdviceEquipment(); e.EquipmentNumber = item.EquipmentNumber; e.EquipmentTypeSizeISOCode = item.EquipmentTypeSizeISOCode; e.IsEmpty = false; e.IsHazardous = false; e.RequiresReview = false; e.RequiresPlug = false; e.SetPoint = 0; e.Ventilation = 0; e.RelativeHumidityLevel = 0; e.O2Level = 0; e.CO2Level = 0; e.Technology = ""; req1.Equipments.Add(e); string RptaValClie = ""; if (!item.CustomerERPCode.Trim().Equals("")) { RptaValClie = da.ValidarCliente(item.CustomerERPCode); if (RptaValClie.Equals("N")) { string rpta = RegistrarClienteTRD(item.CustomerERPCode, ""); if (rpta.Equals("NO")) { continue; } } } req2.OceanCarrier = item.OceanCarrier; req2.YardCode = item.YardCode; req2.ReferenceType = item.ReferenceType; req2.ReferenceNumber = item.ReferenceNumber; req2.ActionType = item.ActionType; req2.ActivityCode = item.ActivityCode; req2.OperationTypeMovementCode = ""; req2.OperationType = item.OperationType; req2.VehiclePlate = item.VehiclePlate; req2.ExecutionDate = item.ExecutionDate; req2.direction = item.direction; req2.Status = item.Status; req2.truckerCode = ""; req2.driverCode = ""; YardOperationEquipment a = new YardOperationEquipment(); a.EquipmentNumber = item.EquipmentNumber; a.EquipmentTypeSizeISOCode = item.EquipmentTypeSizeISOCode; a.IsEmpty = false; a.IsHazardous = false; a.RequiresReview = false; resp1 = proxy.PreAdvice(req1); if (resp1.isValid) { resp2 = proxy.EquipmentOperation(req2); if (!resp2.isValid) { dtResult = "Servicio EquipmentOperation: " + resp2.messages[0].message; } else { da.ActualizarINTF(item.NUMID); } } else { dtResult = "Servicio PreAdvice: " + resp1.messages[0].message; } } } 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)); dtResult = "ERROR"; } return(dtResult); }