示例#1
0
        public static int NuevoEstado(char c, int intEstadoActual, ref bool bandera)
        {
            int Estado = 0;

            using (SqlConnection con = ConexionMatriz.ObtenerConexion(Servidor))
            {
                SqlCommand    comando = new SqlCommand("EXEC NUEVOESTADO '" + c + "'," + intEstadoActual + "", con);
                SqlDataReader estado  = comando.ExecuteReader();
                if (estado.Read())
                {
                    if (!estado.IsDBNull(0))
                    {
                        Estado = estado.GetInt32(0);
                    }
                    else
                    {
                        throw new Exception("Se encontró un error en la línea ");
                    }
                }
                comando = new SqlCommand("SELECT TOKEN FROM TRANSICION WHERE ESTADO = " + Estado, con);
                estado  = comando.ExecuteReader();
                if (estado.Read())
                {
                    if (!estado.IsDBNull(0))
                    {
                        bandera = true;
                    }
                }
            }
            return(Estado);
        }
示例#2
0
        public static int CaracterPorCaracter(char c, int intEstadoActual)
        {
            int Estado = 0;

            using (SqlConnection con = ConexionMatriz.ObtenerConexion(Servidor))
            {
                SqlCommand    comando = new SqlCommand("EXEC NUEVOESTADO '" + c + "'," + intEstadoActual + "", con);
                SqlDataReader estado  = comando.ExecuteReader();
                if (estado.Read())
                {
                    if (!estado.IsDBNull(0))
                    {
                        Estado = estado.GetInt32(0);
                    }
                    else
                    {
                        throw new Exception();
                    }
                }
                comando = new SqlCommand("SELECT TOKEN FROM TRANSICION WHERE ESTADO = " + Estado, con);
                estado  = comando.ExecuteReader();
                if (estado.Read())
                {
                    if (!estado.IsDBNull(0))
                    {
                        return(Estado);
                    }
                }
            }
            return(Estado);
        }
示例#3
0
 public static void CrearMatriz()
 {
     //Obtener Matriz
     using (SqlConnection con = ConexionMatriz.ObtenerConexion(MetodosAL.Servidor))
     {
         SqlCommand    comm = new SqlCommand("SELECT * FROM ReglasSemanticas order by DATALENGTH(Combinacion) ASC", con);
         SqlDataReader red  = comm.ExecuteReader();
         Matriz.Load(red);
     }
 }
示例#4
0
        public static string ObtenerToken(int intEstadoActual)
        {
            string token = "";

            using (SqlConnection con = ConexionMatriz.ObtenerConexion(Servidor))
            {
                SqlCommand    comando = new SqlCommand("select token from transicion where estado = " + intEstadoActual, con);
                SqlDataReader tok     = comando.ExecuteReader();
                if (tok.Read())
                {
                    if (!tok.IsDBNull(0))
                    {
                        token = tok.GetString(0).Trim();
                    }
                }
            }
            return(token);
        }