private decimal Porcentaje(int Zona,int Plantel) { decimal Reprobadas = -1; mySQLTemp.mySQL db = new mySQLTemp.mySQL(); DbConnection cnn = db.Connection; try { DbCommand cmd = cnn.CreateCommand(); DbParameter param; cmd.CommandText = "mySQL.Porcentaje_Captura"; cmd.CommandType = System.Data.CommandType.StoredProcedure; param = cmd.CreateParameter(); param.ParameterName = "Plantel"; param.Value = Plantel; cmd.Parameters.Add(param); param = cmd.CreateParameter(); param.ParameterName = "Zona"; param.Value = Zona; cmd.Parameters.Add(param); cnn.Open(); object res = (object)cmd.ExecuteScalar(); Reprobadas = decimal.Parse(res.ToString()); } catch { return -2; } finally { cnn.Close(); } return Reprobadas; }
private int MateriasReprobadas(string Matricula, string Ciclo) { int Reprobadas = -1; mySQLTemp.mySQL db = new mySQLTemp.mySQL(); DbConnection cnn = db.Connection; try { DbCommand cmd = cnn.CreateCommand(); DbParameter param; cmd.CommandText = "mySQL.spEXEMateriasReprobadas"; cmd.CommandType = System.Data.CommandType.StoredProcedure; param = cmd.CreateParameter(); param.ParameterName = "cMatricula"; param.Value = Matricula; cmd.Parameters.Add(param); param = cmd.CreateParameter(); param.ParameterName = "cCiclo"; param.Value = Ciclo; cmd.Parameters.Add(param); cnn.Open(); object res = (object)cmd.ExecuteScalar(); Reprobadas = int.Parse(res.ToString()); } catch { } finally { cnn.Close(); } return Reprobadas; }
private bool TieneMateriasReprobadas(string Matricula) { bool TieneReprobadas = true; mySQLTemp.mySQL db = new mySQLTemp.mySQL(); //object res = db.ExecuteFunction<object>("spEXEMateriasReprobadas", new ObjectParameter("cMatricula", "0940320029"), new ObjectParameter("cCiclo", "2013A")); DbConnection cnn = db.Connection; try { DbCommand cmd = cnn.CreateCommand(); DbParameter param; cmd.CommandText = "mySQL.spEXEMateriasReprobadas"; cmd.CommandType = System.Data.CommandType.StoredProcedure; param = cmd.CreateParameter(); param.ParameterName = "cMatricula"; param.Value = Matricula; cmd.Parameters.Add(param); param = cmd.CreateParameter(); param.ParameterName = "cCiclo"; param.Value = "2013B"; cmd.Parameters.Add(param); cnn.Open(); object res = (object)cmd.ExecuteScalar(); int Mat = int.Parse(res.ToString()); TieneReprobadas = Mat != 0; } catch { } finally { cnn.Close(); } return TieneReprobadas; }