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); }
void InvocarServicio() { TransDepotProxy proxy = new TransDepotProxy(); RequestEquipmentOperation request = new RequestEquipmentOperation(); request.OceanCarrier = OceanCarrier; if (OperationType != null) { if (OperationType.Equals("E")) { request.ReferenceType = ConfigurationManager.AppSettings["ReferenceTypeBK"].ToString(); } else { request.ReferenceType = ConfigurationManager.AppSettings["ReferenceTypeBL"].ToString(); } } request.ReferenceNumber = ReferenceNumber; request.YardCode = ConfigurationManager.AppSettings["DepSanAgustin"].ToString(); request.ActionType = ActionType; request.ActivityCode = ActivityCode; request.OperationTypeMovementCode = ""; request.OperationType = OperationType; request.VehiclePlate = VehiclePlate; request.ExecutionDate = ExecutionDate; request.direction = Direction; request.Status = Status; request.truckerCode = ""; request.driverCode = ""; request.Equipments.Add(new YardOperationEquipment() { EquipmentNumber = EquipmentNumber, EquipmentTypeSizeISOCode = EquipmentTypeSizeISOCode, IsEmpty = (IsEmpty.Equals("S")) ? true : false, IsHazardous = (IsHazardous.Equals("S")) ? true : false, RequiresReview = false }); ResponseEquipmentOperation resp = new ResponseEquipmentOperation(); try { resp = proxy.EquipmentOperation(request); }catch (Exception ex) { resp.isValid = false; Message msg = new Message(); msg.message = ex.Message.ToString(); resp.messages.Add(msg); MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } 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); } else { MessageBox.Show("Se procesó correctamente", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } }