Beispiel #1
0
        public Menor Recuperar(long Id)
        {
            Menor menor = null;

            menor = (from n in context.Menores
                     where n.Id == Id
                     select n).FirstOrDefault();

            return(menor);
        }
        static void Main(string[] args)
        {
            Menor men = new Menor("Lucas", "Villalba", Menor.eMenu.Milanesa);

            Console.WriteLine(men.ToString());


            Mayor may = new Mayor("Pepe", "Mujica", Mayor.eBebidas.Gaseosa);

            Console.WriteLine(may.ToString());

            Console.ReadLine();
        }
Beispiel #3
0
        public void Crear(Menor menor)
        {
            menor.Id       = IdentifierGenerator.NewId();
            menor.IdSesion = SessionManager.getSessionIdentifier();
            menor.FechaUltimaTransaccion          = DateTime.Now;
            menor.FechaRegistro                   = DateTime.Now;
            menor.EstadoRegistro                  = TipoEstadoRegistro.VigenteNuevoRegistro;
            menor.EstadoSincronizacion            = TipoEstadoSincronizacion.Pendiente;
            menor.DescripcionEstadoSincronizacion = "";

            context.Menores.Add(menor);

            context.SaveChanges();
        }
Beispiel #4
0
        public void Eliminar(long Id)
        {
            Menor menor = null;

            menor = (from n in context.Menores
                     where n.Id == Id
                     select n).FirstOrDefault();

            menor.IdSesion = SessionManager.getSessionIdentifier();
            menor.FechaUltimaTransaccion = DateTime.Now;
            menor.FechaRegistro          = DateTime.Now;
            menor.EstadoRegistro         = TipoEstadoRegistro.BorradoLogico;

            context.SaveChanges();
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            Mesa     miMesa = new Mesa(12);
            Comensal c1     = new Mayor("Juan", "Perez", Mayor.eBebidas.Cerveza);
            Comensal c2     = new Menor("Lucas", "Molina", Menor.eMenu.Hamburguesa);
            Comensal c3     = new Mayor("Miguel", "Silva", Mayor.eBebidas.Vino);
            Comensal c4     = new Menor("Catalina", "Silva", Menor.eMenu.Milanesa);

            miMesa += c1;
            miMesa += c2;
            miMesa += c3;
            miMesa += c4;

            string lista = miMesa;

            Console.WriteLine(lista);

            Console.ReadKey();
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            Mesa  mesa1  = new Mesa(1);
            Mesa  mesa2  = new Mesa(2);
            Menor menor1 = new Menor("Nene1", "ApeNene1", Menor.eMenu.Hamburguesa);
            Menor menor2 = new Menor("Nene2", "ApeNene2", Menor.eMenu.Milanesa);
            Mayor mayor1 = new Mayor("Mayor1", "ApeMayor1", Mayor.eBebidas.Agua);
            Mayor mayor2 = new Mayor("Mayor2", "ApeMayor2", Mayor.eBebidas.Vino);

            mesa1 += menor1;
            mesa1 += menor2;
            mesa1 += menor2;
            mesa1 += mayor1;
            mesa1 += mayor2;
            mesa1 += mayor2;

            Console.WriteLine((string)mesa1);
            Console.ReadKey();
        }
Beispiel #7
0
 private void b_menor_Click(object sender, EventArgs e)
 {
     try
     {
         //crear vehiculo
         veh_ppal = new Vehiculo(tb_placa.Text, cb_marca.Text, cb_modelo.Text, new DateTime(int.Parse(cb_ano.Text), 1, 1));
         Menor nueva_multa = new Menor((Conductor)lb_conductores.SelectedItem, veh_ppal, (Menor.lista_menores)Enum.Parse(typeof(Menor.lista_menores), cb_menor.Text), Springfield.Val_sal_min);
         Springfield.L_multas.Add(nueva_multa);
         //Llevar lista de multas a control
         lb_multas.DataSource = null;
         lb_multas.DataSource = Springfield.L_multas;
         //modificar tb de los totales de las multas
         Presentar_Acomulados();
     }
     catch (Exception error)
     {
         MessageBox.Show("Error al imponer multa menor  " + error);
     }
 }
 /// <summary>
 /// Establece un automata donde contenedremos todas las gramaticas clases que se establecieron
 /// </summary>
 public Lenguaje()
 {
     //Establecemos una lista de las gramaticas que contiene el automata
     gramaticas[0]  = new And();
     gramaticas[1]  = new Boolean_();
     gramaticas[2]  = new Cadena();
     gramaticas[3]  = new Chart();
     gramaticas[4]  = new Colon();
     gramaticas[5]  = new ComentarioUnaLinea();
     gramaticas[6]  = new ComentarioVariasLineas();
     gramaticas[7]  = new Comparacion();
     gramaticas[8]  = new Decimal_();
     gramaticas[9]  = new Desde();
     gramaticas[10] = new Diferente();
     gramaticas[11] = new Disminuir();
     gramaticas[12] = new Division();
     gramaticas[13] = new Entero();
     gramaticas[14] = new Hacer();
     gramaticas[15] = new Hasta();
     gramaticas[16] = new Igual();
     gramaticas[17] = new Incrementar();
     gramaticas[18] = new Incremento();
     gramaticas[19] = new Mayor();
     gramaticas[20] = new MayorIgual();
     gramaticas[21] = new Menor();
     gramaticas[22] = new MenorIgual();
     gramaticas[23] = new Mientras();
     gramaticas[24] = new Multiplicacion();
     gramaticas[25] = new Negacion();
     gramaticas[26] = new Or();
     gramaticas[27] = new ParentesisAbrir();
     gramaticas[28] = new ParentesisCerrar();
     gramaticas[29] = new Resta();
     gramaticas[30] = new Si();
     gramaticas[31] = new Sino();
     gramaticas[32] = new Sino_Si();
     gramaticas[33] = new Suma();
 }
Beispiel #9
0
        static void Main(string[] args)
        {
            string       programa  = "";
            string       opcion    = "Y";
            Menor        Programa1 = new Menor();
            Mayor        Programa2 = new Mayor();
            Ordenamiento Programa3 = new Ordenamiento();

            do
            {
                Console.Clear();
                Console.Write("----Seleccione el programa que desea abrir----\n\n1)Programa de algoritmo recursivo para encontrar el minimo en una sucesion finita de numeros\n2)Programa de algoritmo recursivo para encontrar el maximo en una sucesion finita de numeros\n3)Programa de algoritmo recursivo para invertir un vector\n\nTu eleccion: ");
                programa = Console.ReadLine();
                Console.Clear();
                if (programa == "1")
                {
                    Programa1.RealizaOperacion();
                }
                else if (programa == "2")
                {
                    Programa2.RealizaOperacion();
                }
                else if (programa == "3")
                {
                    Programa3.RealizaOperacion();
                }
                else
                {
                    Console.Write("Ingrese una opcion correcta");
                }

                Console.Write("Desea Realizar otra operacion? (Y/N)");
                opcion = Console.ReadLine().ToUpper();
            } while (opcion == "Y");
            Console.Write("Saliendo del programa. . . ");
            Console.ReadLine();
        }
Beispiel #10
0
        /** Method with the actual generated action code. */
        public TUVienna.CS_CUP.Runtime.Symbol CUP_TinyParser_do_action(
            int CUP_TinyParser_act_num,
            TUVienna.CS_CUP.Runtime.lr_parser CUP_TinyParser_parser,
            System.Collections.Stack xstack1,
            int CUP_TinyParser_top)
        {
            /* Symbol object for return from actions */
            mStack CUP_TinyParser_stack = new mStack(xstack1);

            TUVienna.CS_CUP.Runtime.Symbol CUP_TinyParser_result;

            /* select the action based on the action number */
            switch (CUP_TinyParser_act_num)
            {
            /*. . . . . . . . . . . . . . . . . . . .*/
            case 30: // factor ::= error
            {
                Expresion RESULT = null;

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(13 /*factor*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 29: // factor ::= IDENTIFICADOR
            {
                Expresion        RESULT = null;
                SimboloAbstracto id     = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new Variable(id, id.Linea, id.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(13 /*factor*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 28: // factor ::= LIT_ENTERO
            {
                Expresion        RESULT = null;
                SimboloAbstracto val    = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new NumeroEntero(val, val.Linea, val.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(13 /*factor*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 27: // factor ::= PARENT_IZQ exp PARENT_DER
            {
                Expresion RESULT = null;
                Expresion e      = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;

                RESULT = e;

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(13 /*factor*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 26: // term ::= factor
            {
                Expresion RESULT = null;
                Expresion e      = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = e;

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(12 /*term*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 25: // term ::= term DIVISION factor
            {
                Expresion        RESULT = null;
                Expresion        e1     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value;
                SimboloAbstracto d      = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;
                Expresion        e2     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new Division(e1, e2, d.Linea, d.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(12 /*term*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 24: // term ::= term MULTIPLICACION factor
            {
                Expresion        RESULT = null;
                Expresion        e1     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value;
                SimboloAbstracto m      = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;
                Expresion        e2     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new Multiplicacion(e1, e2, m.Linea, m.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(12 /*term*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 23: // exp_simple ::= term
            {
                Expresion RESULT = null;
                Expresion e      = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = e;

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(11 /*exp_simple*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 22: // exp_simple ::= exp_simple RESTA term
            {
                Expresion        RESULT = null;
                Expresion        e1     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value;
                SimboloAbstracto r      = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;
                Expresion        e2     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new Resta(e1, e2, r.Linea, r.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(11 /*exp_simple*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 21: // exp_simple ::= exp_simple SUMA term
            {
                Expresion        RESULT = null;
                Expresion        e1     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value;
                SimboloAbstracto s      = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;
                Expresion        e2     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new Suma(e1, e2, s.Linea, s.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(11 /*exp_simple*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 20: // exp ::= exp_simple
            {
                Expresion RESULT = null;
                Expresion e      = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = e;

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(10 /*exp*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 19: // exp ::= exp_simple IGUAL exp_simple
            {
                Expresion        RESULT = null;
                Expresion        e1     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value;
                SimboloAbstracto i      = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;
                Expresion        e2     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new Igual(e1, e2, i.Linea, i.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(10 /*exp*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 18: // exp ::= exp_simple MENOR exp_simple
            {
                Expresion        RESULT = null;
                Expresion        e1     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value;
                SimboloAbstracto m      = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;
                Expresion        e2     = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new Menor(e1, e2, m.Linea, m.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(10 /*exp*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 17: // args ::= args COMA exp
            {
                ListaParametros RESULT = null;
                ListaParametros p      = (ListaParametros)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value;
                Expresion       e      = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                p.agregarElemento(e);
                RESULT = p;

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(9 /*args*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 16: // args ::= exp
            {
                ListaParametros RESULT = null;
                Expresion       e      = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new ListaParametros();
                RESULT.agregarElemento(e);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(9 /*args*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 15: // opt_args ::=
            {
                ListaParametros RESULT = null;

                RESULT = new ListaParametros();

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(8 /*opt_args*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 14: // opt_args ::= args
            {
                ListaParametros RESULT = null;
                ListaParametros p      = (ListaParametros)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = p;

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(8 /*opt_args*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 13: // fuction_call ::= IDENTIFICADOR opt_args
            {
                Sentencia        RESULT = null;
                SimboloAbstracto id     = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;
                ListaParametros  p      = (ListaParametros)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new LLamadaFuncion(id, p, id.Linea, id.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(7 /*fuction_call*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 12: // sent_assign ::= IDENTIFICADOR ASIGNACION exp
            {
                Sentencia        RESULT = null;
                SimboloAbstracto id     = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value;
                SimboloAbstracto a      = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;
                Expresion        e      = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new Asignacion(new Variable(id, id.Linea, id.Columna), e, a.Linea, a.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(6 /*sent_assign*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 11: // sent_repeat ::= REPITA secuencia_sent HASTA exp
            {
                Sentencia        RESULT = null;
                SimboloAbstracto r      = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 3)).value;
                ListaSentencia   s      = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value;
                Expresion        c      = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new RepitaHasta(c, s, r.Linea, r.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sent_repeat*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 10: // sent_if ::= SI exp ENTONCES secuencia_sent SINO secuencia_sent FIN
            {
                Sentencia        RESULT = null;
                SimboloAbstracto s      = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 6)).value;
                Expresion        c      = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 5)).value;
                ListaSentencia   en     = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 3)).value;
                ListaSentencia   sn     = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;

                RESULT = new Condicional(c, en, sn, s.Linea, s.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(4 /*sent_if*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 9: // sent_if ::= SI exp ENTONCES secuencia_sent FIN
            {
                Sentencia        RESULT = null;
                SimboloAbstracto s      = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 4)).value;
                Expresion        c      = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 3)).value;
                ListaSentencia   en     = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;

                RESULT = new Condicional(c, en, null, s.Linea, s.Columna);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(4 /*sent_if*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 8: // sent ::= error
            {
                Sentencia RESULT = null;

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 7: // sent ::= fuction_call
            {
                Sentencia RESULT = null;
                Sentencia s      = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;
                RESULT = s;
                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 6: // sent ::= sent_assign
            {
                Sentencia RESULT = null;
                Sentencia s      = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;
                RESULT = s;
                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 5: // sent ::= sent_repeat
            {
                Sentencia RESULT = null;
                Sentencia s      = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;
                RESULT = s;
                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 4: // sent ::= sent_if
            {
                Sentencia RESULT = null;
                Sentencia s      = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;
                RESULT = s;
                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 3: // secuencia_sent ::= sent
            {
                ListaSentencia RESULT = null;
                Sentencia      s      = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new ListaSentencia();
                RESULT.agregarElemento(s);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(2 /*secuencia_sent*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 2: // secuencia_sent ::= secuencia_sent PUNTO_Y_COMA sent
            {
                ListaSentencia RESULT = null;
                ListaSentencia sc     = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value;
                Sentencia      s      = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                sc.agregarElemento(s);
                RESULT = sc;

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(2 /*secuencia_sent*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 1: // programa ::= secuencia_sent
            {
                Programa       RESULT = null;
                ListaSentencia sc     = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value;

                RESULT = new Programa(sc, 1, 0);

                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(1 /*programa*/, RESULT);
            }
                return(CUP_TinyParser_result);

            /*. . . . . . . . . . . . . . . . . . . .*/
            case 0: // $START ::= programa EOF
            {
                object   RESULT    = null;
                Programa start_val = (Programa)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value;
                RESULT = start_val;
                CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(0 /*$START*/, RESULT);
            }
                /* ACCEPT */
                CUP_TinyParser_parser.done_parsing();
                return(CUP_TinyParser_result);

            /* . . . . . .*/
            default:
                throw new System.Exception(
                          "Invalid action number found in internal parse table");
            }
        }
Beispiel #11
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ControlPreliminar = false;

            SoporteCombo.cargarEnumerador(cboTipoDocumentoIdentidad, typeof(TipoDocumentoIdentidad));
            ModeloDepartamento modelodepartamento = new ModeloDepartamento();

            this.cboDepartamento.ItemsSource       = modelodepartamento.Listar();
            this.cboDepartamento.DisplayMemberPath = "Descripcion";
            this.cboDepartamento.SelectedValuePath = "Id";

            if (IdFamilia > 0)
            {
                ModeloFamilia modelofamilia = new ModeloFamilia();
                Familia       familia       = new Familia();

                familia = modelofamilia.Recuperar(IdFamilia);
                this.txtPaternoFamilia.Text = familia.PrimerApellido;
                this.txtMaternoFamilia.Text = familia.SegundoApellido;
            }

            if (IdSeleccionado == 0)
            {
                this.cboTipoDocumentoIdentidad.SelectedIndex = -1;
                this.dtpFechaNacimiento.SelectedDate         = DateTime.Today;
                this.cboDepartamento.SelectedIndex           = -1;
            }
            else
            {
                ModeloMenor modelomenor = new ModeloMenor();

                _menor = modelomenor.Recuperar(IdSeleccionado);
                txtDocumentoIdentidad.Text = _menor.DocumentoIdentidad;
                switch (_menor.TipoDocumentoIdentidad)
                {
                case TipoDocumentoIdentidad.CarnetIdentidad:
                    cboTipoDocumentoIdentidad.SelectedIndex = 0;
                    break;

                case TipoDocumentoIdentidad.CertificadoNacimiento:
                    cboTipoDocumentoIdentidad.SelectedIndex = 1;
                    break;

                case TipoDocumentoIdentidad.Pasaporte:
                    cboTipoDocumentoIdentidad.SelectedIndex = 2;
                    break;
                }
                txtOficialia.Text = _menor.Oficialia;
                txtLibro.Text     = _menor.Libro;
                txtPartida.Text   = _menor.Partida;
                txtFolio.Text     = _menor.Folio;
                txtPaterno.Text   = _menor.PrimerApellido;
                txtMaterno.Text   = _menor.SegundoApellido;
                txtNombres.Text   = _menor.Nombres;
                if (_menor.Sexo == "F")
                {
                    rdbFemenino.IsChecked = true;
                }
                else if (_menor.Sexo == "M")
                {
                    rdbMasculino.IsChecked = true;
                }
                dtpFechaNacimiento.SelectedDate = _menor.FechaNacimiento;
                if (_menor.Defuncion == true)
                {
                    chkDefuncion.IsChecked = true;
                }
                txtLugarNacimiento.Text       = _menor.LocalidadNacimiento;
                cboDepartamento.SelectedValue = _menor.IdDepartamento;
                RecuperarProvincias(_menor.IdDepartamento.ToString());
                cboProvincia.SelectedValue = _menor.IdProvincia;
                RecuperarMunicipios(_menor.IdProvincia.ToString());
                cboMunicipio.SelectedValue = _menor.IdMunicipio;

                ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();

                _grupofamiliar = modelogrupofamiliar.RecuperarPorMenorDeFamilia(IdFamilia, IdSeleccionado);

                if (TipoAccion == TipoAccion.Detalle)
                {
                    txtDocumentoIdentidad.IsEnabled     = false;
                    cboTipoDocumentoIdentidad.IsEnabled = false;
                    txtOficialia.IsEnabled       = false;
                    txtLibro.IsEnabled           = false;
                    txtPartida.IsEnabled         = false;
                    txtFolio.IsEnabled           = false;
                    txtPaterno.IsEnabled         = false;
                    txtMaterno.IsEnabled         = false;
                    txtNombres.IsEnabled         = false;
                    rdbFemenino.IsEnabled        = false;
                    rdbMasculino.IsEnabled       = false;
                    dtpFechaNacimiento.IsEnabled = false;
                    chkDefuncion.IsEnabled       = false;
                    txtLugarNacimiento.IsEnabled = false;
                    cboDepartamento.IsEnabled    = false;
                    cboProvincia.IsEnabled       = false;
                    cboMunicipio.IsEnabled       = false;
                    cmdAceptar.IsEnabled         = false;
                }
            }
            ControlPreliminar = true;
            if ((TipoAccion == TipoAccion.Nuevo) || (TipoAccion == TipoAccion.Edicion))
            {
                this.txtDocumentoIdentidad.Focus();
            }
        }
Beispiel #12
0
        //procedimiento recursivo que genera el arbol
        private void generar(NodoArbol nodoActual)
        {
            //Valido nodos nulos para evitar incluir condicionales en generacion de nodos cuando es nulo
            if (nodoActual == null)
            {
                return;
            }

            if (nodoActual.GetType() == typeof(Programa))
            {
                Programa n = (Programa)nodoActual;
                generar(n.Sentencias);
            }
            else if (nodoActual.GetType() == typeof(ListaSentencia))
            {
                ListaSentencia ls = (ListaSentencia)nodoActual;
                foreach (Sentencia sent in ls.getLista())
                {
                    generar(sent);
                }
            }
            else if (nodoActual.GetType() == typeof(Condicional))
            {
                Emit.LocalBuilder tmpVarLogico;
                Condicional       n = (Condicional)nodoActual;

                generar(n.Condicion);

                this.il.Emit(Emit.OpCodes.Ldc_I4_0); //Ingreso constante 0
                this.il.Emit(Emit.OpCodes.Ceq);      //Comparo si es falso (es 0)
                //Almaceno este resultado en una variable temporal
                tmpVarLogico = this.il.DeclareLocal(typeof(bool));
                this.il.Emit(Emit.OpCodes.Stloc, tmpVarLogico);
                //cargo el resultado de la variable temporal
                this.il.Emit(Emit.OpCodes.Ldloc, tmpVarLogico);
                Emit.Label bloqueFalso = this.il.DefineLabel();
                //salto en caso que sea verdadero el resultado es decir es cero la evaluacion del (pila==0) hago el sino
                this.il.Emit(Emit.OpCodes.Brtrue, bloqueFalso);

                generar(n.Entonces);

                Emit.Label finSi = this.il.DefineLabel();
                this.il.Emit(Emit.OpCodes.Br, finSi);
                this.il.MarkLabel(bloqueFalso);

                generar(n.Sino);

                this.il.MarkLabel(finSi);
            }
            else if (nodoActual.GetType() == typeof(RepitaHasta))
            {
                RepitaHasta       n = (RepitaHasta)nodoActual;
                Emit.LocalBuilder tmpCondicion;
                tmpCondicion = this.il.DeclareLocal(typeof(bool));
                Emit.Label sentenciasRepita = this.il.DefineLabel();
                this.il.MarkLabel(sentenciasRepita);
                this.il.Emit(Emit.OpCodes.Nop);         //emito primera sentencia vacia

                generar(n.Sentencias);

                generar(n.Condicion);

                this.il.Emit(Emit.OpCodes.Stloc, tmpCondicion);  //almaceno resultado de condicion del mientras
                this.il.Emit(Emit.OpCodes.Ldloc, tmpCondicion);  //cargo resultado de condicion del mientras
                this.il.Emit(Emit.OpCodes.Brfalse, sentenciasRepita);
            }
            else if (nodoActual.GetType() == typeof(Asignacion))
            {
                Asignacion n = (Asignacion)nodoActual;

                generar(n.Expr);

                Almacenar(n.Id.Nombre.Texto, this.il);
            }
            else if (nodoActual.GetType() == typeof(LLamadaFuncion)) //Leer, Escribir
            {
                LLamadaFuncion    n    = (LLamadaFuncion)nodoActual;
                List <FuncionDef> funs = NucleoLenguaje.Instancia.getFuncBasicas();
                //En la lista de definiciones de funciones estandar busco la definicion de la llamada para funcion deseada
                foreach (FuncionDef fun in funs)
                {
                    if (n.Id.Texto.Equals(fun.Nombre.Texto))
                    {
                        fun.ejecutarMetodo(il, n.Params);
                    }
                }
            }
            else if (nodoActual.GetType() == typeof(NumeroEntero))
            {
                NumeroEntero n = (NumeroEntero)nodoActual;
                this.il.Emit(Emit.OpCodes.Ldc_I4, convertir_a_entero(n.Token.Texto));
            }
            else if (nodoActual.GetType() == typeof(Variable))
            {
                Variable n = (Variable)nodoActual;
                if (!TablaDireccionesSimbolos.ContainsKey(n.Nombre.Texto))
                {
                    throw new System.Exception("ERROR-0008 fallo en analisis semantico Variable no declarada encontrada durante generacion '" + n.Nombre.Texto + "'");
                }
                else
                {
                    this.il.Emit(Emit.OpCodes.Ldloc, TablaDireccionesSimbolos[n.Nombre.Texto]);
                }
            }
            else if (nodoActual.GetType() == typeof(Suma))
            {
                Suma n = (Suma)nodoActual;
                generar(n.ExprIzq);
                generar(n.ExprDer);
                this.il.Emit(Emit.OpCodes.Add);
            }
            else if (nodoActual.GetType() == typeof(Resta))
            {
                Resta n = (Resta)nodoActual;
                generar(n.ExprIzq);
                generar(n.ExprDer);
                this.il.Emit(Emit.OpCodes.Sub);
            }
            else if (nodoActual.GetType() == typeof(Multiplicacion))
            {
                Multiplicacion n = (Multiplicacion)nodoActual;
                generar(n.ExprIzq);
                generar(n.ExprDer);
                this.il.Emit(Emit.OpCodes.Mul);
            }
            else if (nodoActual.GetType() == typeof(Division))
            {
                Division n = (Division)nodoActual;
                generar(n.ExprIzq);
                generar(n.ExprDer);
                this.il.Emit(Emit.OpCodes.Div);
            }
            else if (nodoActual.GetType() == typeof(Menor))
            {
                Menor n = (Menor)nodoActual;
                generar(n.ExprIzq);
                generar(n.ExprDer);
                this.il.Emit(Emit.OpCodes.Clt);
            }
            else if (nodoActual.GetType() == typeof(Igual))
            {
                Igual n = (Igual)nodoActual;
                generar(n.ExprIzq);
                generar(n.ExprDer);
                this.il.Emit(Emit.OpCodes.Ceq);
            }
            else
            {
                Console.WriteLine("ERROR-0006 Error tipo de Nodo no identificado");
            }
        }
Beispiel #13
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            CantidadDeControles = 12;

            ////this.lblDepartamento.Content = "";
            ////this.lblEstablecimiento.Content = "";

            ModeloMenor modelomenor = new ModeloMenor();
            Menor       menor       = new Menor();

            menor = modelomenor.Recuperar(IdSeleccionado);

            if (menor != null)
            {
                this.lblNombresMenor.Content         = menor.PrimerApellido + " " + menor.SegundoApellido + " " + menor.Nombres;
                this.lblFechaNacimientoMenor.Content = string.Format("{0:dd/MM/yyyy}", menor.FechaNacimiento);
            }
            else
            {
                this.lblNombresMenor.Content         = "";
                this.lblFechaNacimientoMenor.Content = "";
            }

            ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();

            _grupofamiliar      = modelogrupofamiliar.RecuperarTitularHabilitado(IdFamilia);
            _grupofamiliarmadre = modelogrupofamiliar.RecuperarMadreDeFamilia(IdFamilia);

            if (_grupofamiliar != null)
            {
                if (_grupofamiliar.TipoGrupoFamiliar == TipoGrupoFamiliar.Madre)
                {
                    ModeloMadre modelomadre = new ModeloMadre();
                    Madre       madre       = new Madre();

                    madre = modelomadre.Recuperar(_grupofamiliar.IdMadre.Value);
                    this.lblNombreTitular.Content = madre.NombreCompleto;

                    this.lblParentescoTitular.Content = "MADRE";
                }
                else if (_grupofamiliar.TipoGrupoFamiliar == TipoGrupoFamiliar.Tutor)
                {
                    ModeloTutor modelotutor = new ModeloTutor();
                    Tutor       tutor       = new Tutor();
                    tutor = modelotutor.Recuperar(_grupofamiliar.IdTutor.Value);
                    this.lblNombreTitular.Content = tutor.NombreCompleto;

                    ModeloTipoParentesco modelotipoparentesco = new ModeloTipoParentesco();
                    TipoParentesco       tipoparentesco       = new TipoParentesco();

                    tipoparentesco = modelotipoparentesco.Recuperar(_grupofamiliar.IdTipoParentesco.Value);
                    this.lblParentescoTitular.Content = tipoparentesco.Descripcion;
                }
                else
                {
                    this.lblNombreTitular.Content     = "";
                    this.lblParentescoTitular.Content = "";
                }
            }
            else
            {
                this.lblNombreTitular.Content     = "";
                this.lblParentescoTitular.Content = "";
            }

            ModeloCorresponsabilidadMenor modelocorresponsabilidadmenor = new ModeloCorresponsabilidadMenor();

            IdCorresponsabilidadMenor = modelocorresponsabilidadmenor.RecuperarLaUltimaCorresponsabilidadValidaDeMenor(IdSeleccionado);

            ValoresPorDefecto();

            if (IdCorresponsabilidadMenor > 0)
            {
                RecuperarCorresponsabilidadMenor();
            }
            else
            {
                this.txtCodigoFormulario.IsEnabled = true;
                this.dtpFechaInscripcion.IsEnabled = true;
                this.rdbNueva.IsEnabled            = true;
                this.rdbTransferencia.IsEnabled    = true;
                this.cmdGuardar.IsEnabled          = true;
            }

            if (TipoAccion == TipoAccion.Detalle)
            {
                this.txtCodigoFormulario.IsEnabled    = false;
                this.dtpFechaInscripcion.IsEnabled    = false;
                this.dtpFechaSalida.IsEnabled         = false;
                this.chkSalida.IsEnabled              = false;
                this.rdbCumplimiento.IsEnabled        = false;
                this.rdbFallecimiento.IsEnabled       = false;
                this.rdbIncumplimiento.IsEnabled      = false;
                this.rdbNueva.IsEnabled               = false;
                this.rdbTransferencia.IsEnabled       = false;
                this.rdbTransferenciaSalida.IsEnabled = false;
                this.txtAutorizado.IsEnabled          = false;
                this.txtCargo.IsEnabled               = false;
                this.cmdGuardar.IsEnabled             = false;
            }
        }
Beispiel #14
0
 private void grdMenor_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     this.Cursor = Cursors.Wait;
     menor       = this.grdMenor.SelectedItem as Menor;
     this.Cursor = Cursors.Arrow;
 }