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); }
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); }
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); } }
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); }