Example #1
0
        public string Borrar_XMLprn(ArchivoConfig conf)
        {
            try
            {
                string path = conf.PathPRN;

                path = path + conf.ArchivoPRN;

                if (!File.Exists(path))
                {
                    return("No existe archivo ArchivoPRN.");
                }
                else
                {
                    File.Delete(path);
                }

                return(null);
            }
            catch (FileNotFoundException)
            {
                return("NoFile");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Example #2
0
        public Comunicacion(BaseConfig baseConf, ArchivoConfig conf)
        {
            TransacManager.ProtoConfig = new ProtocoloConfig(baseConf, conf);

            switch (TransacManager.ProtoConfig.CONFIG.LevelLog)
            {
                case EnumMessageType.DEBUG: NivelLog = EnumNivelLog.Trace; break;
                case EnumMessageType.ERROR: NivelLog = EnumNivelLog.Error; break;
                case EnumMessageType.NORMAL: NivelLog = EnumNivelLog.Info; break;
                case EnumMessageType.NOTHING: NivelLog = EnumNivelLog.Off; break;
                case EnumMessageType.WARNING: NivelLog = EnumNivelLog.Warn; break;
            }

            DateTime d = DateTime.Now;

            string fName = conf.LogFileName.Split('.')[0]
                + d.Year.ToString().PadLeft(2, '0')
                + d.Month.ToString().PadLeft(2, '0')
                + d.Day.ToString().PadLeft(2, '0')
                + d.Hour.ToString().PadLeft(2, '0')
                + d.Minute.ToString().PadLeft(2, '0')
                + d.Second.ToString().PadLeft(2, '0')
                + "." + conf.LogFileName.Split('.')[1];

            LogBMTP.InicializaLog(conf, NivelLog, fName);

            TR = new TransacManager();
        }
Example #3
0
        public string crear_XMLprn(string nombre1, string nombre2, string nombre3, string port1, string port2, string port3, string tel1, string tel2, string tel3, ArchivoConfig conf)
        {
            try
            {
                string path = conf.PathPRN; //Directory.GetCurrentDirectory();

                path = path + conf.ArchivoPRN;

                XDocument miXML = new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
                    new XElement("PRN",
                    new XElement("Nombre1", nombre1.Trim()),
                    new XElement("Nombre2", nombre2.Trim()),
                    new XElement("Nombre3", nombre3.Trim()),
                    new XElement("Port1", port1.Trim()), //6000
                    new XElement("Port2", port2.Trim()), //6500
                    new XElement("Port3", port3.Trim()), //7000
                    new XElement("Tel1", tel1.Trim()),
                    new XElement("Tel2", tel2.Trim()),
                    new XElement("Tel3", tel3.Trim())
                    ));
                miXML.Save(@path);
            }
            catch (Exception ex)
            {
                return ex.Message;
            }

            return null;
        }
Example #4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            string errorMsg = "";

            if (calendario.SelectionStart == calendario.SelectionEnd)
            {
                errorMsg += "Selecciona una fecha\n";
            }
            if (calendario.SelectionStart <= ArchivoConfig.obtenerFechaConfig())
            {
                errorMsg += "Seleccione una fecha posterior a la actual\n";
            }
            if (this.origenesList.SelectedItem == null)
            {
                errorMsg += "Seleccione un puerto de origen\n";
            }
            if (this.destinosList.SelectedItem == null)
            {
                errorMsg += "Seleccione un puerto de destino\n";
            }
            if (errorMsg != "")
            {
                resultLabel.Text = errorMsg;
                return;
            }
            resultLabel.Text = "Buena fecha";
            ElegirViajeForm elegirViajeForm = new ElegirViajeForm((string)this.origenesList.SelectedItem, (string)this.destinosList.SelectedItem, calendario.SelectionStart);

            elegirViajeForm.ShowDialog();
        }
Example #5
0
        public static void InicializaLog(ArchivoConfig lee, EnumNivelLog lvlLog, string fileName, string tipo = "")
        {
            try
            {
                BASE_DIR = lee.LogPath;
                MAX_SIZE_FILE = lee.LogMaxFileSize;
                NUMERING_WITH_SEQUENTIAL = lee.NumeringWithSecuential;
                LEVEL_LOG = lvlLog; //(LogLevel)lee.LevelLog;
                FILE_NAME = fileName;
            }
            catch
            {
            }

            if (!Directory.Exists(BASE_DIR))
            {
                Directory.CreateDirectory(BASE_DIR);
            }

            LoggingConfiguration confLog = new LoggingConfiguration();

            console = new ColoredConsoleTarget { 
                Name = "console",
                Layout = "${shortdate} ${level} ${message}"
            };

            fileTargetM = new FileTarget
            {
                FileName = BASE_DIR + FILE_NAME,
                Layout = "${message}",
                ArchiveAboveSize = MAX_SIZE_FILE,                
                ArchiveNumbering = ArchiveNumberingMode.Sequence
            };

            LogLevel lv = LogLevel.Off;
            switch(LEVEL_LOG)
            {
                case EnumNivelLog.Trace: lv = LogLevel.Trace; break;
                case EnumNivelLog.Debug: lv = LogLevel.Debug; break;
                case EnumNivelLog.Info: lv = LogLevel.Info; break;
                case EnumNivelLog.Error: lv = LogLevel.Error; break;
                case EnumNivelLog.Warn: lv = LogLevel.Warn; break;
                case EnumNivelLog.Fatal: lv = LogLevel.Fatal; break;
            }
            
            logRuleConsole = new NLog.Config.LoggingRule("*", lv, console);
            logRuleFileM = new NLog.Config.LoggingRule("*", lv, fileTargetM);

            confLog.AddTarget("console", console);
            confLog.AddTarget("fileM", fileTargetM);
            confLog.LoggingRules.Add(logRuleConsole);
            confLog.LoggingRules.Add(logRuleFileM);
#if DEBUG
            LogManager.ThrowExceptions = true;
#endif
            LogManager.Configuration = confLog;
            
            logM += new LogMessageGenerator(LogMensaje);
        }
 public Viaje setFechaInicio(DateTime fechaInicio)
 {
     // Validamos que la fecha de inicio sea posterior a la fecha actual (fecha del archivo de configuración)
     if (DateTime.Compare(ArchivoConfig.obtenerFechaConfig(), fechaInicio) > 0)
     {
         throw new FechaInicioAnteriorFechaConfigException();
     }
     this.fechaInicio = fechaInicio;
     return(this);
 }
Example #7
0
        public ProtocoloConfig(BaseConfig baseConf, ArchivoConfig conf, bool conCicloPRN = true)
        {
            nroOff = new SerialNumeroOff();

            CONFIG = conf;
            BASE_CONFIG = baseConf;
            CON_CICLO_PRN = conCicloPRN;

            CLAVE_TARJETA = new byte[8];
            PROTOCOLO = new byte[84];

            string nroTerStr = BASE_CONFIG.Terminal.ToString();
            LOCAL_PORT = Convert.ToUInt16("5" + nroTerStr.Substring(nroTerStr.Length - 4, 4));
        }
Example #8
0
        public ProtocoloConfig(BaseConfig baseConf, ArchivoConfig conf, bool conCicloPRN = true)
        {
            nroOff = new SerialNumeroOff();

            CONFIG        = conf;
            BASE_CONFIG   = baseConf;
            CON_CICLO_PRN = conCicloPRN;

            CLAVE_TARJETA = new byte[8];
            PROTOCOLO     = new byte[84];

            string nroTerStr = BASE_CONFIG.Terminal.ToString();

            LOCAL_PORT = Convert.ToUInt16("5" + nroTerStr.Substring(nroTerStr.Length - 4, 4));
        }
Example #9
0
        private void CompraReservaForm_Load(object sender, EventArgs e)
        {
            calendario.TodayDate = ArchivoConfig.obtenerFechaConfig();

            string consulta = "SELECT[puerto_nombre] from[GD1C2019].[LOS_BARONES_DE_LA_CERVEZA].[Puerto]";


            Query miConsulta = new Query(consulta);

            this.origenes = miConsulta.ejecutarReaderUnicaColumna();
            foreach (var o in origenes)
            {
                this.origenesList.Items.Add(o);
            }
        }
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            DateTime fechaDesde = ArchivoConfig.obtenerFechaConfig();
            DateTime fechaHasta = dtpFechaHasta.Value;

            // Validamos que la fecha de reinicio sea posterior a la actual (el sistema la toma del archivo de configuración)
            if (DateTime.Compare(fechaDesde, fechaHasta) > 0)
            {
                MensajeBox.error("La fecha de reinicio debe ser posterior a la actual.");
                return;
            }

            string consulta = "UPDATE LOS_BARONES_DE_LA_CERVEZA.Cruceros "
                              + "SET baja_fuera_servicio = 1 "
                              + "WHERE identificador = @identificador; "
                              + "INSERT INTO LOS_BARONES_DE_LA_CERVEZA.Cruceros_Fuera_Servicio "
                              + "(id_crucero, fecha_inicio_fuera_servicio, fecha_fin_fuera_servicio) "
                              + "SELECT id_crucero, @fecha_desde, @fecha_hasta "
                              + "FROM LOS_BARONES_DE_LA_CERVEZA.Cruceros "
                              + "WHERE identificador = @identificador ";

            List <Parametro> parametros     = new List <Parametro>();
            Parametro        paramIdCrucero = new Parametro("@identificador", SqlDbType.NVarChar, identificadorCruceroST, 50);

            parametros.Add(paramIdCrucero);
            Parametro paramFechaDesde = new Parametro("@fecha_desde", SqlDbType.NVarChar, fechaDesde.ToString("yyyy-MM-dd h:mm tt"), 255);

            parametros.Add(paramFechaDesde);
            Parametro paramFechaHasta = new Parametro("@fecha_hasta", SqlDbType.NVarChar, fechaHasta.ToString("yyyy-MM-dd h:mm tt"), 255);

            parametros.Add(paramFechaHasta);

            Query miConsulta = new Query(consulta, parametros);

            miConsulta.ejecutarNonQuery();

            this.Close();
        }
Example #11
0
        private void btnConfirmarBaja_Click(object sender, EventArgs e)
        {
            // Obtenemos la fecha actual (fecha de la baja) del archivo de configuración
            DateTime fechaBajaDefinitiva = ArchivoConfig.obtenerFechaConfig();

            // Damos de baja definitiva el crucero seleccionado (es una baja lógica, se marca un campo)
            List <Parametro> parametros = new List <Parametro>();
            Parametro        paramIdentificadorCrucero = new Parametro("@identificador_crucero", SqlDbType.NVarChar, identificadorCruceroBaja, 255);

            parametros.Add(paramIdentificadorCrucero);
            string    fecha = fechaBajaDefinitiva.ToString("yyyy-MM-dd h:mm tt");
            Parametro paramFechaBajaDefinitiva = new Parametro("@fecha_baja_definitiva", SqlDbType.NVarChar, fecha, 255);

            parametros.Add(paramFechaBajaDefinitiva);
            string consulta = "UPDATE LOS_BARONES_DE_LA_CERVEZA.Cruceros "
                              + "SET "
                              + "baja_vida_util = 1, "
                              + "fecha_baja_vida_util = (CONVERT(DATETIME2(3), @fecha_baja_definitiva, 121)) "
                              + "WHERE identificador = @identificador_crucero";
            Query miConsulta = new Query(consulta, parametros);

            miConsulta.ejecutarNonQuery();
            this.Close();
        }
Example #12
0
        public string Borrar_XMLprn(ArchivoConfig conf)
        {
            try
            {
                string path = conf.PathPRN;

                path = path + conf.ArchivoPRN;

                if (!File.Exists(path))
                    return "No existe archivo ArchivoPRN.";
                else
                    File.Delete(path);

                return null;
            }
            catch (FileNotFoundException)
            {
                return "NoFile";
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }
Example #13
0
        /*** ALTA DE NUEVO CRUCERO ***/

        private void btnAlta_Click(object sender, EventArgs e)
        {
            // 1. Obtenemos los atributos del crucero
            this.cargarCampos();
            DateTime fechaAlta = ArchivoConfig.obtenerFechaConfig();

            // 2. Construimos el objeto crucero
            Crucero crucero;

            try
            {
                crucero = new CruceroBuilder()
                          .setModelo(modelo)
                          .setMarca(marca)
                          .setIdentificador(identificadorA, identificadorB)
                          .setFechaAlta(fechaAlta)
                          .setTipoServicio(this.obtenerTipoServicio())
                          .buildCrucero();
            }
            catch (CamposObligatoriosVaciosException ex)
            {
                ex.mensajeError();
                return;
            }

            // 3. Validamos que el identificador del crucero esté disponible
            if (Crucero.identificadorDisponible(crucero.getIdentificador()).Equals(false))
            {
                MensajeBox.error("El identificador ingresado para el crucero ya se encuentra registrado.");
                return;
            }

            // 4. Validamos que se haya ingresado al menos una cabina
            int cantidadCabinas = calcularCantidadCabinas();

            try
            {
                Cabina.validarCantidadCabinas(cantidadCabinas);
            }
            catch (CruceroSinCabinasException ex)
            {
                ex.mensajeError();
                return;
            }

            // 5. Guardamos las cabinas ingresadas en el objeto crucero
            guardarCabinas(crucero, cantidadCabinas);

            // 6. Validamos que no haya cabinas repetidas (Numero-Piso debería ser único por crucero)
            if (crucero.hayCabinasRepetidas())
            {
                MensajeBox.error("Cabinas repetidas: Hay cabinas con igual número y piso. Revise los datos e intente nuevamente.");
                return;
            }

            // 7. En este punto ya tenemos un crucero correctamente construido y listo para ser INSERTADO (incluyendo sus cabinas)
            try
            {
                crucero.insertar();
                MensajeBox.info("El crucero se dió de alta correctamente.");
            }
            catch (InsertarCruceroException ex)
            {
                ex.mensajeError();
                return;
            }
        }// FIN btnEnviar_Click()
        public int generarReserva()
        {
            List <Parametro> parametros = new List <Parametro>();
            int cantidadCabinas         = 0;

            displayCabinas.ForEach(x => cantidadCabinas += (int)x.cantidadSeleccionadaNumeric.Value);
            //agregamos parametro cantidad de cabinas
            Parametro paramCantidadCabinas = new Parametro("@cantidad_cabinas", SqlDbType.Int, cantidadCabinas);

            parametros.Add(paramCantidadCabinas);

            // Añadimos el parámetro identificador del viaje asociado a la compra
            Parametro paramIdViaje = new Parametro("@id_viaje", SqlDbType.Int, viaje.id_viaje);

            parametros.Add(paramIdViaje);

            Parametro paramIdCliente = new Parametro("@id_cliente", SqlDbType.Int, clienteEditandose.id);

            parametros.Add(paramIdCliente);

            Parametro paramFechaActual = new Parametro("@fecha_reserva", SqlDbType.NVarChar, ArchivoConfig.obtenerFechaConfig().ToShortDateString(), 255);

            parametros.Add(paramFechaActual);

            // Añadimos el parámetro de salida donde obtenemos el id_reserva generado

            Parametro paramIdReserva = new Parametro("@id_reserva", SqlDbType.Int);

            paramIdReserva.esParametroOut();
            parametros.Add(paramIdReserva);

            StoreProcedure spGenerarReserva          = new StoreProcedure("LOS_BARONES_DE_LA_CERVEZA.USP_generar_reserva", parametros);
            int            cantidadFilasActualizadas = spGenerarReserva.ejecutarNonQuery();

            // Comprobamos que la compra se inserte correctamente
            if (!cantidadFilasActualizadas.Equals(1))
            {
                MessageBox.Show("No se genero bien la reserva----filas afectadas= " + cantidadFilasActualizadas.ToString());
            }
            else
            {
                // label9.Text = cantidadFilasActualizadas.ToString();
                MessageBox.Show("Reserva generada bien, el id es = " + paramIdReserva.obtenerValor().ToString());
            }

            return(Int32.Parse(paramIdReserva.obtenerValor().ToString()));
        }
        private void listoButton_Click(object sender, EventArgs e)
        {
            Validaciones.hayCamposObligatoriosNulos();
            string errorMessage = "";

            if (this.dniTextBox.Text.Length < 7)
            {
                errorMessage += "Longitud minima de DNI es 7 digitos\n";
            }
            if (this.dniTextBox.Text.Length > 9)
            {
                errorMessage += "Longitud maxima de DNI es 9 digitos\n";
            }
            if (this.nombreTextBox.Text == "")
            {
                errorMessage += "Ingrese un nombre\n";
            }
            if (this.apellidoTextBox.Text == "")
            {
                errorMessage += "Ingrese un apellido\n";
            }
            if (this.direccionTextBox.Text == "")
            {
                errorMessage += "Ingrese una direccion\n";
            }
            if (this.telefonoTextBox.Text == "")
            {
                errorMessage += "Ingrese un telefono\n";
            }
            if (this.dayTextBox.Text == "")
            {
                errorMessage += "Ingrese un dia\n";
            }
            if (this.mesTextBox.Text == "")
            {
                errorMessage += "Ingrese un mes\n";
            }
            if (this.anioTextBox.Text.Length != 4)
            {
                errorMessage += "Ingrese un anio\n";
            }
            DateTime fechaIngresada;

            try
            {
                fechaIngresada = DateTime.Parse(string.Concat(dayTextBox.Text, "/", mesTextBox.Text, "/", anioTextBox.Text));
                if ((ArchivoConfig.obtenerFechaConfig().Year - fechaIngresada.Year) < 18)
                {
                    errorMessage += "Necesita ser Mayor de 18 para registrarse y hacer un Pago\n";
                }
            }
            catch (Exception aaaa)
            {
                errorMessage += "Fecha no valida\n";
            }

            errorMessage += this.checkDniRepetido();


            if (errorMessage != "")
            {
                MessageBox.Show(errorMessage);
                return;
            }
            this.finalizar();
        }
Example #16
0
        static void Main(string[] args)
        {
            BaseConfig bc = new BaseConfig();

            #region //Prueba de QUINIELA

            TransacQuinielaB jue = new TransacQuinielaB();
            jue.TipoApuesta = new byte[] { 0x06, 0x06, 0x07, 0x06, 0x0b };
            jue.NumeroAp1   = new string[] { "0233", "077", "12", "2411", "33" };
            jue.RangoDesde1 = new byte[] { 0x01, 0x01, 0x01, 0x01, 0x00 };
            jue.RangoHasta1 = new byte[] { 0x01, 0x01, 0x05, 0x14, 0x00 };
            jue.NumeroAp2   = new string[] { null, null, "34", null, "77" };
            jue.NumeroAp3   = new string[] { null, null, null, null, "12" };
            jue.RangoDesde2 = new byte[] { 0x00, 0x00, 0x01, 0x00, 0x00 };
            jue.RangoHasta2 = new byte[] { 0x00, 0x00, 0x0a, 0x00, 0x00 };
            jue.Importe     = new ushort[] { 300, 600, 300, 400, 200 };//en centavos

            //jue.TipoApuesta = new byte[] { 0x06, 0x07 };
            //jue.NumeroAp1 = new string[] { "12", "21" };
            //jue.RangoDesde1 = new byte[] { 0x01, 0x01 };
            //jue.RangoHasta1 = new byte[] { 0x01, 0x01 };
            //jue.NumeroAp2 = new string[] { null, "45" };
            //jue.NumeroAp3 = new string[] { null, null };
            //jue.RangoDesde2 = new byte[] { 0x00, 0x01 };
            //jue.RangoHasta2 = new byte[] { 0x00, 0x05 };
            //jue.Importe = new ushort[] { 1000, 1000 };//en centavos

            #endregion

            try
            {
                Opera         opera = new Opera();
                ArchivoConfig lee   = new ArchivoConfig();

                Errorof errConfig = opera.LeeArchivo(ref lee);
                if (errConfig.Error != 0)
                {
                    Console.WriteLine("Error al leer archivo de configuración.");
                    Console.ReadLine();
                }
                else
                {
                    lee.Port             = 20900;
                    lee.MaskDesenmascara = new byte[] { 0x06, 0x07, 0x05 };
                    lee.MaskEnmascara    = new byte[] { 0x01, 0x03, 0xfc };

                    IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());

                    for (int i = 0; i < ipHostInfo.AddressList.Length; i++)
                    {
                        if (ipHostInfo.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
                        {
                            lee.DefaultServer = ipHostInfo.AddressList[i];
                            break;
                        }
                    }
                }

                Error errBConfig = bc.LeeBaseConfig(ref bc);
                bc.Tarjeta = 53772;

                if (errBConfig.CodError != 0)
                {
                    Console.WriteLine("Error al leer archivo base de configuración.");
                    Console.ReadLine();
                }


                #region //Prueba de paquete A
                Terminal paqA    = new Terminal();
                var      entrada = new BaseConfig();
                var      salida  = bc.LeeBaseConfig(ref entrada);

                if (salida.CodError != 0)
                {
                    Exception ex = new Exception(salida.Descripcion);
                    throw ex;
                }
                else
                {
                    paqA.Tarjeta        = entrada.Tarjeta;
                    paqA.NumeroTerminal = entrada.Terminal;
                    paqA.MacTarjeta     = entrada.MsgMAC;
                }



                byte[] mac = new byte[] { 0xdf, 0x72, 0x0f, 0xae, 0xdf, 0xd4, 0xe9, 0x1e, 0xdf, 0x8e, 0x1f, 0x61 };//{ 0x00, 0xc2, 0x00, 0x71, 0x00, 0x09, 0xb3, 0x5a, 0x00, 0xde, 0xbf, 0x82 };//{  0x8e, 0xe9, 0x0f, 0x72, 0x1f, 0xd4, 0x61, 0x1e }      0xdf, , , 0xae, 0xdf, , , , 0xdf,,,  };


                //paqA.Tarjeta = lee.Tarjeta;//53164;//tarjeta  54781 //58977
                //paqA.NumeroTerminal = lee.Terminal;//terminal
                paqA.FechaHora = DateTime.Now;

                Version assemblyversion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                paqA.Version = (ushort)((assemblyversion.Major * 1000) + (assemblyversion.Minor * 10) + (assemblyversion.Build));//version

                //paqA.MacTarjeta = lee.MsgMAC;//mac
                paqA.Tipo = EnumTerminalModelo.TML; //0x0c;

                #endregion

                MonedaJuego Monedas = new MonedaJuego();

                Comunicacion com = new Comunicacion(bc, lee);

                ProtocoloLib.TransacManager.ProtoConfig.CLAVE_TARJETA = BitConverter.GetBytes(0x8EE9AE721FD4611E).Reverse().ToArray();

                //Error errCxn = Comunicacion.AbrePuerto();


                Error  errCxn = com.Conectar(paqA, EnumModoConexion.ETHERNET);
                Agente agente = new Agente();
                if (errCxn.CodError != 0)
                {
                    Console.Write("Error: " + errCxn.CodError);
                    Console.WriteLine(" " + errCxn.Descripcion + "\n");

                    Console.Read();
                    Environment.Exit(0);
                }
                else
                {
                    IList objsRec = com.InteraccionAB(ref paqA);

                    TransaccionMSG mensaje;
                    if (objsRec.Count == 6)
                    {
                        mensaje = (TransaccionMSG)objsRec[5];
                    }


                    if (objsRec[1] is Agente)
                    {
                        agente = (Agente)objsRec[1];

                        Console.WriteLine("Agencia: " + agente.Nombre + "\nNúmero de Agencia: " + agente.Numero + "\n");
                        Error errOffline = new Error();
                    }

                    IList objsRec3 = new List <object>();
                    IList objsRec2 = new List <object>();

                    TransacQuinielaH  cabeceraAnul = new TransacQuinielaH();
                    TransacQuinielaB  cuerposAnul  = new TransacQuinielaB();
                    AnulReimpQuiniela anulacionQ   = new AnulReimpQuiniela();

                    TransacPoceado   poceadoAnul = new TransacPoceado();
                    AnulReimpPoceado anulacionP  = new AnulReimpPoceado();

                    if (objsRec.Count < 2 && objsRec[0] is Error)
                    {
                        Error err = (Error)objsRec[0];
                        if (err.CodError != 0)
                        {
                            Console.Write("Error: " + err.CodError);
                            Console.WriteLine(" " + err.Descripcion + "\n");
                        }
                    }
                    else if (objsRec.Count > 1)
                    {
                        bool validValue = false;
                        while (!validValue)
                        {
                            Console.WriteLine("Seleccione el tipo de mensaje: ");
                            Console.WriteLine("(1) Quiniela");
                            Console.WriteLine("(x) Salir");

                            ConsoleKeyInfo messageType = Console.ReadKey();
                            Console.WriteLine();

                            switch (messageType.KeyChar.ToString())
                            {
                            case "1":
                                #region
                                objsRec2 = com.InteraccionPQ1(PedidosSorteos.QUINIELA, Convert.ToUInt32(paqA.NumeroTerminal), EnumEstadoParametrosOff.HABILITADO);
                                if (objsRec2.Count > 0 && objsRec2[0] != null && objsRec2[0] is Error)
                                {
                                    Error psQErr = (Error)objsRec2[0];
                                    if (psQErr.CodError != 0)
                                    {
                                        Console.Write("Error: " + psQErr.CodError);
                                        Console.WriteLine(" " + psQErr.Descripcion + "\n");
                                    }
                                    else if (objsRec[1] is Agente && objsRec2[1] is ParamSorteoQuiniela)
                                    {
                                        psQErr = (Error)objsRec2[0];
                                        if (psQErr.CodError != 0)
                                        {
                                            Console.Write("Error: " + psQErr.CodError);
                                            Console.WriteLine(" " + psQErr.Descripcion + "\n");
                                        }
                                        else if (objsRec[1] is Agente && objsRec2[1] is ParamSorteoQuiniela)
                                        {
                                            ParamSorteoQuiniela psQ      = (ParamSorteoQuiniela)objsRec2[1];
                                            TransacQuinielaH    cabecera = new TransacQuinielaH();

                                            cabecera.Sorteo       = (ushort)psQ.SorteosNumeros[0];
                                            cabecera.FechaHora    = DateTime.Now;
                                            cabecera.NroSecuencia = 1;
                                            //cabecera.Entes = psQ.SorteoBmpEntes[0];
                                            byte[] byteEnte = { 1, 2, 3 };
                                            //byte[] bt = Conversiones.SeteaBits(byteEnte, 1, true);
                                            //cabecera.Entes = bt[0];
                                            cabecera.CantApu = 5;


                                            objsRec3 = com.InteraccionPQ2(cabecera, jue, PedidosSorteos.QUINIELA);
                                            if (objsRec3[0] != null && objsRec3[0] is Error)
                                            {
                                                Error TransErr = (Error)objsRec3[0];
                                                if (TransErr.CodError != 0)
                                                {
                                                    Console.Write("Error: " + TransErr.CodError);
                                                    Console.WriteLine(" " + TransErr.Descripcion + "\n");
                                                }
                                                else if (objsRec3[1] is TransacQuinielaH)
                                                {
                                                    TransacQuinielaH transRta = (TransacQuinielaH)objsRec3[1];
                                                    //certifica.CertificadoQuiniela(transRta.Protocolo, bc.MAC, (int)paqA.Tarjeta, (int)paqA.NumeroTerminal, ref transRta.Certificado);

                                                    LogBMTP.LogBuffer(byteToChar(transRta.Protocolo), "Test LoggeLib", transRta.Protocolo.Length, EnumNivelLog.Trace);

                                                    Console.WriteLine("Número de apuesta de QUINIELA: " + transRta.id_ticket + "\n");
                                                    Console.WriteLine("Número de certificado: " + transRta.Certificado + "\n");
                                                    Console.WriteLine("Fecha y hora de Host: " + transRta.Timehost + "\n");

                                                    cabeceraAnul.id_ticket    = transRta.id_ticket;
                                                    cabeceraAnul.Certificado  = transRta.Certificado;
                                                    cabeceraAnul.TipoTransacc = transRta.TipoTransacc;
                                                }
                                            }
                                        }
                                    }
                                }
                                validValue = false;
                                break;
                                #endregion
                            }
                        }

                        validValue = false;

                        while (!validValue)
                        {
                            Console.WriteLine("(x) Salir");

                            ConsoleKeyInfo messageType = Console.ReadKey();
                            Console.WriteLine();
                            Error err = new Error();

                            switch (messageType.KeyChar.ToString())
                            {
                            case "x":
                            case "X":
                                com.Desconectar(false);
                                Environment.Exit(0);
                                validValue = true;
                                break;

                            default:
                                Console.WriteLine("Debe seleccionar un valor válido. Seleccionó: " + messageType.KeyChar.ToString());
                                validValue = false;
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: {0}", e.ToString());
            }
        }
Example #17
0
 public ProtocoloConfig(ArchivoConfig conf)
 {
     CONFIG = conf;
 }
Example #18
0
 public ProtocoloConfig(ArchivoConfig conf)
 {
     CONFIG = conf;
 }
Example #19
0
 public Enmascarador(ArchivoConfig conf)
 {
     Escape = conf.MaskEscape;
     mask   = conf.MaskEnmascara;
     reemp  = conf.MaskDesenmascara;
 }
Example #20
0
        public string Leer_XMLprn(out string nombre1, out string nombre2, out string nombre3, out string port1, out string port2, out string port3, out string tel1, out string tel2, out string tel3, ArchivoConfig conf)
        {
            nombre1 = " ";
            nombre2 = " ";
            nombre3 = " ";
            port1 = " ";
            port2 = "";
            port3 = "";
            tel1 = "";
            tel2 = "";
            tel3 = " ";

            try
            {
                string path = conf.PathPRN;//@"C:\BetmakerTP\Conexion"; //Directory.GetCurrentDirectory();

                path = path + conf.ArchivoPRN;

                XDocument miXML = XDocument.Load(path);

                var seleccionados = from c in miXML.Descendants("PRN") select c.Element("Nombre1").Value;

                foreach (var item in seleccionados)
                {
                    nombre1 = item;
                }

                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Nombre2").Value;

                foreach (var item in seleccionados)
                {
                    nombre2 = item;
                }

                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Nombre3").Value;

                foreach (var item in seleccionados)
                {
                    nombre3 = item;
                }

                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Port1").Value;

                foreach (var item in seleccionados)
                {
                    port1 = item;
                }
                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Port2").Value;

                foreach (var item in seleccionados)
                {
                    port2 = item;
                }
                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Port3").Value;

                foreach (var item in seleccionados)
                {
                    port3 = item;
                }
                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Tel1").Value;

                foreach (var item in seleccionados)
                {
                    tel1 = item;
                }
                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Tel2").Value;

                foreach (var item in seleccionados)
                {
                    tel2 = item;
                }
                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Tel3").Value;

                foreach (var item in seleccionados)
                {
                    tel3 = item;
                }
                return null;

            }
            catch (FileNotFoundException)
            {
                return "NoFile";
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }
Example #21
0
 public Enmascarador(ArchivoConfig conf)
 {
     Escape = conf.MaskEscape;
     mask = conf.MaskEnmascara;
     reemp = conf.MaskDesenmascara;
 }
Example #22
0
        public static void InicializaLog(ArchivoConfig lee, EnumNivelLog lvlLog, string fileName, string tipo = "")
        {
            try
            {
                BASE_DIR                 = lee.LogPath;
                MAX_SIZE_FILE            = lee.LogMaxFileSize;
                NUMERING_WITH_SEQUENTIAL = lee.NumeringWithSecuential;
                LEVEL_LOG                = lvlLog; //(LogLevel)lee.LevelLog;
                FILE_NAME                = fileName;
            }
            catch
            {
            }

            if (!Directory.Exists(BASE_DIR))
            {
                Directory.CreateDirectory(BASE_DIR);
            }

            LoggingConfiguration confLog = new LoggingConfiguration();

            console = new ColoredConsoleTarget
            {
                Name   = "console",
                Layout = "${shortdate} ${level} ${message}"
            };

            fileTargetM = new FileTarget
            {
                FileName         = BASE_DIR + FILE_NAME,
                Layout           = "${message}",
                ArchiveAboveSize = MAX_SIZE_FILE,
                ArchiveNumbering = ArchiveNumberingMode.Sequence
            };

            LogLevel lv = LogLevel.Off;

            switch (LEVEL_LOG)
            {
            case EnumNivelLog.Trace: lv = LogLevel.Trace; break;

            case EnumNivelLog.Debug: lv = LogLevel.Debug; break;

            case EnumNivelLog.Info: lv = LogLevel.Info; break;

            case EnumNivelLog.Error: lv = LogLevel.Error; break;

            case EnumNivelLog.Warn: lv = LogLevel.Warn; break;

            case EnumNivelLog.Fatal: lv = LogLevel.Fatal; break;
            }

            logRuleConsole = new LoggingRule("*", lv, console);
            logRuleFileM   = new LoggingRule("*", lv, fileTargetM);

            confLog.AddTarget("console", console);
            confLog.AddTarget("fileM", fileTargetM);
            confLog.LoggingRules.Add(logRuleConsole);
            confLog.LoggingRules.Add(logRuleFileM);
#if DEBUG
            LogManager.ThrowExceptions = true;
#endif
            LogManager.Configuration = confLog;

            logM += new LogMessageGenerator(LogMensaje);
        }
Example #23
0
        public string crear_XMLprn(string nombre1, string nombre2, string nombre3, string port1, string port2, string port3, string tel1, string tel2, string tel3, ArchivoConfig conf)
        {
            try
            {
                string path = conf.PathPRN; //Directory.GetCurrentDirectory();

                path = path + conf.ArchivoPRN;

                XDocument miXML = new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
                                                new XElement("PRN",
                                                             new XElement("Nombre1", nombre1.Trim()),
                                                             new XElement("Nombre2", nombre2.Trim()),
                                                             new XElement("Nombre3", nombre3.Trim()),
                                                             new XElement("Port1", port1.Trim()), //6000
                                                             new XElement("Port2", port2.Trim()), //6500
                                                             new XElement("Port3", port3.Trim()), //7000
                                                             new XElement("Tel1", tel1.Trim()),
                                                             new XElement("Tel2", tel2.Trim()),
                                                             new XElement("Tel3", tel3.Trim())
                                                             ));
                miXML.Save(@path);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }

            return(null);
        }
Example #24
0
        static void Main(string[] args)
        {
            BaseConfig bc = new BaseConfig();

            #region //Prueba de QUINIELA

            TransacQuinielaB jue = new TransacQuinielaB();
            jue.TipoApuesta = new byte[] { 0x06, 0x06, 0x07, 0x06, 0x0b };
            jue.NumeroAp1 = new string[] { "0233", "077", "12", "2411", "33" };
            jue.RangoDesde1 = new byte[] { 0x01, 0x01, 0x01, 0x01, 0x00 };
            jue.RangoHasta1 = new byte[] { 0x01, 0x01, 0x05, 0x14, 0x00 };
            jue.NumeroAp2 = new string[] { null, null, "34", null, "77" };
            jue.NumeroAp3 = new string[] { null, null, null, null, "12" };
            jue.RangoDesde2 = new byte[] { 0x00, 0x00, 0x01, 0x00, 0x00 };
            jue.RangoHasta2 = new byte[] { 0x00, 0x00, 0x0a, 0x00, 0x00 };
            jue.Importe = new ushort[] { 300, 600, 300, 400, 200 };//en centavos

            //jue.TipoApuesta = new byte[] { 0x06, 0x07 };
            //jue.NumeroAp1 = new string[] { "12", "21" };
            //jue.RangoDesde1 = new byte[] { 0x01, 0x01 };
            //jue.RangoHasta1 = new byte[] { 0x01, 0x01 };
            //jue.NumeroAp2 = new string[] { null, "45" };
            //jue.NumeroAp3 = new string[] { null, null };
            //jue.RangoDesde2 = new byte[] { 0x00, 0x01 };
            //jue.RangoHasta2 = new byte[] { 0x00, 0x05 };
            //jue.Importe = new ushort[] { 1000, 1000 };//en centavos

            #endregion

            try
            {
                Opera opera = new Opera();
                ArchivoConfig lee = new ArchivoConfig();

                Errorof errConfig = opera.LeeArchivo(ref lee);
                Error errBConfig = bc.LeeBaseConfig(ref bc);

                if (errConfig.Error != 0)
                {
                    lee = new ArchivoConfig();

                    #region //PARAMETROS CONFIGURACION PARA CONFIG
                    bc.Terminal = 80732555;//1300000006;
                    bc.Tarjeta = 19511;//50026;
                    bc.TerminalModelo = EnumTerminalModelo.TML;
                    bc.MAC = new byte[] { 0x15, 0xBE, 0x07, 0x91, 0xFD, 0x32, 0xA4, 0xB3 };//{ 0x8b, 0x3d, 0x39, 0xff, 0x6a, 0xdd, 0x16, 0xb8 };//{ 0x5e, 0x01, 0xd2, 0x69, 0x78, 0x8b, 0x7d, 0x02 }; { 0xa0, 0xca, 0x14, 0x1d, 0xba, 0xdf, 0x7b, 0x44 };
                    bc.MsgMAC = new byte[] { 0x00, 0x91, 0x00, 0x07, 0x00, 0x32, 0xBE, 0xB3, 0x00, 0x15, 0xFD, 0xA4};
                    //lee.EncryptMAC = mac;//new byte[] { 0x00 };

                    lee.ImpresoraReportes = "impresoraPDF";
                    lee.ImpresoraTicket = "THERMAL Receipt Printer";

                    lee.MaskEscape = 0xfc;

                    //lee.MaskEnmascara = new byte[] { 0x01, 0x03, 0xfc };
                    //lee.MaskDesenmascara = new byte[] { 0x06, 0x07, 0x05 };

                    lee.MaskEnmascara = new byte[] { 0x01, 0x03, 0x04, 0x10, 0x1e, 0x9e, 0xfc, 0x83, 0x84, 0x0d, 0x8d, 0x90, 0xff };
                    lee.MaskDesenmascara = new byte[] { 0x06, 0x07, 0xdd, 0x0a, 0x09, 0x41, 0x05, 0xde, 0xdf, 0x15, 0x11, 0x0b, 0x08 };

                    lee.LogPath = "C:\\BetmakerTP\\Logs\\";
                    lee.LogFileName = "LogDisp.lg";
                    lee.LogMaxFileSize = 10485760;
                    lee.NumeringWithSecuential = false;
                    lee.LevelLog = EnumMessageType.DEBUG;

                    lee.IpTerminal = IPAddress.Parse("133.61.1.12");
                    lee.IpMask = IPAddress.Parse("255.255.0.0");
                    lee.DW = IPAddress.Parse("133.61.1.30");
                    lee.DNS = IPAddress.Parse("133.61.1.194");

                    lee.PathPRN = "C:\\BetmakerTP\\Conexion\\";
                    lee.ArchivoPRN = "ArchivoPRN.xml";
                    lee.DefaultServer = IPAddress.Parse("133.61.1.71");
                    lee.Host = "Win7x86";
                    lee.Port = 9950; //MENDOZA
                    lee.Telefono = "08006665807";

                    lee.PCName = "PCjorge";

                    lee.FTPServer = IPAddress.Parse("133.61.1.195");
                    lee.FTPport = 21;
                    lee.FTPUser = "******";
                    lee.FTPPassword = "******";
                    lee.FTPWorkingDirectory = "Reportes";

                    #endregion

                    //opera.GeneraArchivo(archivo, lee);
                }

                #region //Prueba de paquete A
                Terminal paqA = new Terminal();
                var entrada = new BaseConfig();
                var salida = bc.LeeBaseConfig(ref entrada);

                if (salida.CodError != 0)
                {
                    Exception ex = new Exception(salida.Descripcion);
                    throw ex;
                }
                else
                {
                    paqA.Tarjeta = entrada.Tarjeta;
                    paqA.NumeroTerminal = entrada.Terminal;
                    paqA.MacTarjeta = entrada.MsgMAC;
                }

                byte[] mac = new byte[] { 0xdf, 0x72, 0x0f, 0xae, 0xdf, 0xd4, 0xe9, 0x1e, 0xdf, 0x8e, 0x1f, 0x61 };//{ 0x00, 0xc2, 0x00, 0x71, 0x00, 0x09, 0xb3, 0x5a, 0x00, 0xde, 0xbf, 0x82 };//{  0x8e, 0xe9, 0x0f, 0x72, 0x1f, 0xd4, 0x61, 0x1e }      0xdf, , , 0xae, 0xdf, , , , 0xdf,,,  };

                //paqA.Tarjeta = lee.Tarjeta;//53164;//tarjeta  54781 //58977
                //paqA.NumeroTerminal = lee.Terminal;//terminal
                paqA.FechaHora = DateTime.Now;

                Version assemblyversion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                paqA.Version = (ushort)((assemblyversion.Major * 1000) + (assemblyversion.Minor * 10) + (assemblyversion.Build));//version

                //paqA.MacTarjeta = lee.MsgMAC;//mac
                paqA.Tipo = EnumTerminalModelo.TML; //0x0c;

                #endregion

                MonedaJuego Monedas = new MonedaJuego();

                Comunicacion com = new Comunicacion(bc, lee);

                ProtocoloLib.TransacManager.ProtoConfig.CLAVE_TARJETA = BitConverter.GetBytes(0x8EE9AE721FD4611E).Reverse().ToArray();

                //Error errCxn = Comunicacion.AbrePuerto();

                Error errCxn = com.Conectar(paqA, EnumModoConexion.ETHERNET);
                Agente agente = new Agente();
                if (errCxn.CodError != 0)
                {
                    Console.Write("Error: " + errCxn.CodError);
                    Console.WriteLine(" " + errCxn.Descripcion + "\n");

                    Environment.Exit(0);
                }
                else
                {
                    IList objsRec = com.InteraccionAB(ref paqA);

                    TransaccionMSG mensaje;
                    if(objsRec.Count == 6)
                        mensaje = (TransaccionMSG)objsRec[5];

                    if (objsRec[1] is Agente)
                    {
                        agente = (Agente)objsRec[1];

                        Console.WriteLine("Agencia: " + agente.Nombre + "\nNúmero de Agencia: " + agente.Numero + "\n");
                        Error errOffline = new Error();
                    }

                    IList objsRec3 = new List<object>();
                    IList objsRec2 = new List<object>();

                    TransacQuinielaH cabeceraAnul = new TransacQuinielaH();
                    TransacQuinielaB cuerposAnul = new TransacQuinielaB();
                    AnulReimpQuiniela anulacionQ = new AnulReimpQuiniela();

                    TransacPoceado poceadoAnul = new TransacPoceado();
                    AnulReimpPoceado anulacionP = new AnulReimpPoceado();

                    if (objsRec.Count < 2 && objsRec[0] is Error)
                    {
                        Error err = (Error)objsRec[0];
                        if (err.CodError != 0)
                        {
                            Console.Write("Error: " + err.CodError);
                            Console.WriteLine(" " + err.Descripcion + "\n");

                        }
                    }
                    else if (objsRec.Count > 1)
                    {
                        bool validValue = false;
                        while (!validValue)
                        {
                            Console.WriteLine("Seleccione el tipo de mensaje: ");
                            Console.WriteLine("(1) Quiniela");
                            Console.WriteLine("(x) Salir");

                            ConsoleKeyInfo messageType = Console.ReadKey();
                            Console.WriteLine();

                            switch (messageType.KeyChar.ToString())
                            {
                                case "1":
                                    #region
                                    objsRec2 = com.InteraccionPQ1(PedidosSorteos.QUINIELA, Convert.ToUInt32(paqA.NumeroTerminal), EnumEstadoParametrosOff.HABILITADO);
                                    if (objsRec2.Count > 0 && objsRec2[0] != null && objsRec2[0] is Error)
                                    {
                                        Error psQErr = (Error)objsRec2[0];
                                        if (psQErr.CodError != 0)
                                        {
                                            Console.Write("Error: " + psQErr.CodError);
                                            Console.WriteLine(" " + psQErr.Descripcion + "\n");
                                        }
                                        else if (objsRec[1] is Agente && objsRec2[1] is ParamSorteoQuiniela)
                                        {
                                            psQErr = (Error)objsRec2[0];
                                            if (psQErr.CodError != 0)
                                            {
                                                Console.Write("Error: " + psQErr.CodError);
                                                Console.WriteLine(" " + psQErr.Descripcion + "\n");
                                            }
                                            else if (objsRec[1] is Agente && objsRec2[1] is ParamSorteoQuiniela)
                                            {

                                                ParamSorteoQuiniela psQ = (ParamSorteoQuiniela)objsRec2[1];
                                                TransacQuinielaH cabecera = new TransacQuinielaH();

                                                cabecera.Sorteo = (ushort)psQ.SorteosNumeros[0];
                                                cabecera.FechaHora = DateTime.Now;
                                                cabecera.NroSecuencia = 1;
                                                //cabecera.Entes = psQ.SorteoBmpEntes[0];
                                                byte[] byteEnte = {1,2,3};
                                                //byte[] bt = Conversiones.SeteaBits(byteEnte, 1, true);
                                                //cabecera.Entes = bt[0];
                                                cabecera.CantApu = 5;

                                                objsRec3 = com.InteraccionPQ2(cabecera, jue, PedidosSorteos.QUINIELA);
                                                if (objsRec3[0] != null && objsRec3[0] is Error)
                                                {
                                                    Error TransErr = (Error)objsRec3[0];
                                                    if (TransErr.CodError != 0)
                                                    {
                                                        Console.Write("Error: " + TransErr.CodError);
                                                        Console.WriteLine(" " + TransErr.Descripcion + "\n");
                                                    }
                                                    else if (objsRec3[1] is TransacQuinielaH)
                                                    {
                                                        TransacQuinielaH transRta = (TransacQuinielaH)objsRec3[1];
                                                        //certifica.CertificadoQuiniela(transRta.Protocolo, bc.MAC, (int)paqA.Tarjeta, (int)paqA.NumeroTerminal, ref transRta.Certificado);

                                                        LogBMTP.LogBuffer(byteToChar(transRta.Protocolo), "Test LoggeLib", transRta.Protocolo.Length, EnumNivelLog.Trace);

                                                        Console.WriteLine("Número de apuesta de QUINIELA: " + transRta.id_ticket + "\n");
                                                        Console.WriteLine("Número de certificado: " + transRta.Certificado + "\n");
                                                        Console.WriteLine("Fecha y hora de Host: " + transRta.Timehost + "\n");

                                                        cabeceraAnul.id_ticket = transRta.id_ticket;
                                                        cabeceraAnul.Certificado = transRta.Certificado;
                                                        cabeceraAnul.TipoTransacc = transRta.TipoTransacc;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    validValue = false;
                                    break;
                                    #endregion
                            }
                        }

                        validValue = false;

                        while (!validValue)
                        {
                            Console.WriteLine("(x) Salir");

                            ConsoleKeyInfo messageType = Console.ReadKey();
                            Console.WriteLine();
                            Error err = new Error();

                            switch (messageType.KeyChar.ToString())
                            {
                                case "x":
                                case "X":
                                    com.Desconectar(false);
                                    Environment.Exit(0);
                                    validValue = true;
                                    break;
                                default:
                                    Console.WriteLine("Debe seleccionar un valor válido. Seleccionó: " + messageType.KeyChar.ToString());
                                    validValue = false;
                                    break;
                            }
                        }
                    }
                }
            }
            catch(Exception e)
            {
                Console.WriteLine("Exception: {0}", e.ToString());
            }
        }
Example #25
0
        public string Leer_XMLprn(out string nombre1, out string nombre2, out string nombre3, out string port1, out string port2, out string port3, out string tel1, out string tel2, out string tel3, ArchivoConfig conf)
        {
            nombre1 = " ";
            nombre2 = " ";
            nombre3 = " ";
            port1   = " ";
            port2   = "";
            port3   = "";
            tel1    = "";
            tel2    = "";
            tel3    = " ";

            try
            {
                string path = conf.PathPRN;//@"C:\BetmakerTP\Conexion"; //Directory.GetCurrentDirectory();

                path = path + conf.ArchivoPRN;

                XDocument miXML = XDocument.Load(path);

                var seleccionados = from c in miXML.Descendants("PRN") select c.Element("Nombre1").Value;

                foreach (var item in seleccionados)
                {
                    nombre1 = item;
                }

                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Nombre2").Value;

                foreach (var item in seleccionados)
                {
                    nombre2 = item;
                }

                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Nombre3").Value;

                foreach (var item in seleccionados)
                {
                    nombre3 = item;
                }

                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Port1").Value;

                foreach (var item in seleccionados)
                {
                    port1 = item;
                }
                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Port2").Value;

                foreach (var item in seleccionados)
                {
                    port2 = item;
                }
                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Port3").Value;

                foreach (var item in seleccionados)
                {
                    port3 = item;
                }
                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Tel1").Value;

                foreach (var item in seleccionados)
                {
                    tel1 = item;
                }
                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Tel2").Value;

                foreach (var item in seleccionados)
                {
                    tel2 = item;
                }
                seleccionados = from c in miXML.Descendants("PRN") select c.Element("Tel3").Value;

                foreach (var item in seleccionados)
                {
                    tel3 = item;
                }
                return(null);
            }
            catch (FileNotFoundException)
            {
                return("NoFile");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }