示例#1
0
        public Resultados UnResultadosdeCompetencia(String detll, string tri, string grupo)
        {
            Resultados t = null;

            Sql = "SELECT r.ID,r.DESCRIPCION,r.ID_COMPETENCIA,t.duracion FROM RESULTADOS r, trimestre t  WHERE DESCRIPCION = '" + detll + "' and t.idresultado=r.ID";
            if (!tri.Equals(null))
            {
                Sql = "SELECT r.ID,r.DESCRIPCION,r.ID_COMPETENCIA,t.duracion FROM RESULTADOS r, trimestre t  WHERE DESCRIPCION = '" + detll + "' and t.idresultado=r.ID and t.trimestre=" + tri + "";
            }
            if (conprovar(grupo, detll).Equals(true) && !string.IsNullOrEmpty(grupo))
            {
                Sql = "SELECT r.ID,r.DESCRIPCION,r.ID_COMPETENCIA,(select t.DURACION from TIEMPO_RESULTADOS t, RESULTADOS r   where r.ID=t.ID_RESULTADO and ID_GRUPO=" + grupo + " and r.DESCRIPCION='" + detll + "') FROM RESULTADOS r, trimestre t  WHERE DESCRIPCION = '" + detll + "' and t.idresultado=r.ID and t.trimestre=" + tri + "";
            }
            try
            {
                conectar.AbrirConexion();
                ejecutar1 = new SqlCommand(Sql, conectar.GetConexion);
                leer      = ejecutar1.ExecuteReader();
                while (leer.Read())
                {
                    t                = new Resultados();
                    t.Codigo         = leer[0].ToString();
                    t.Descripcion    = leer[1].ToString();
                    t.ID_Competencia = leer[2].ToString();
                    t.Duracion       = leer[3].ToString();
                }
                leer.Close();
                conectar.CerrarConexion();
            }
            catch (SqlException) { }


            return(t);
        }
示例#2
0
        public List <Resultados> TodosLosResultadosdeCompetencia(String idcomp, String grupo, string tri)
        {
            List <Resultados> rt = new List <Resultados>();
            List <String>     lr = new List <String>();

            Sql = "SELECT ID_RESULTADO FROM HORARIO WHERE ID_GRUPO = '" + grupo + "'";
            try
            {
                conectar.AbrirConexion();
                ejecutar1 = new SqlCommand(Sql, conectar.GetConexion);
                leer      = ejecutar1.ExecuteReader();
                while (leer.Read())
                {
                    lr.Add(leer[0].ToString());
                }
                leer.Close();
                conectar.CerrarConexion();
            }
            catch (Exception ex) { System.Windows.Forms.MessageBox.Show("" + ex); }


            Sql = "SELECT r.ID, r.DESCRIPCION,r.ID_COMPETENCIA,t.duracion FROM RESULTADOS r, trimestre t WHERE ID_COMPETENCIA = '" + idcomp + "' and r.ID=t.idresultado and t.trimestre=" + tri + "";
            try
            {
                conectar.AbrirConexion();
                ejecutar1 = new SqlCommand(Sql, conectar.GetConexion);
                leer      = ejecutar1.ExecuteReader();
                while (leer.Read())
                {
                    Resultados t = new Resultados();
                    t.Codigo         = leer[0].ToString();
                    t.Descripcion    = leer[1].ToString();
                    t.ID_Competencia = leer[2].ToString();
                    t.Duracion       = leer[3].ToString();
                    int o  = 0;
                    int up = 0;

                    for (int i = 0; i < lr.Count; i++)
                    {
                        if (lr[i] == t.Codigo)
                        {
                            up++;
                        }
                    }

                    if ((up * 12) < Convert.ToInt16(t.Duracion))
                    {
                        rt.Add(t);
                    }
                }
                leer.Close();
                conectar.CerrarConexion();
            }
            catch (SqlException) { }



            return(rt);
        }