Exemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //Proyecto p = new Proyecto();
            //int proId = p.ObtenerId(DropDownList1.Text);
            Caso      c     = new _IPC2_Proyecto2.Caso();
            ArrayList carga = new ArrayList();

            carga = c.datosCompletosdeCaso(DropDownList1.Text);

            cn  = Conexion.conectar();
            cmd = new SqlCommand("SELECT * FROM Caso Where titulo ='" + DropDownList1.Text + "'", cn.getSqlConnection());
            sda = new SqlDataAdapter(cmd);
            sda.Fill(tblData);
            GridView1.DataSource = (tblData);
            GridView1.DataBind();
            cn.finalizar();
            int i = 0;

            foreach (string item in carga)
            {
                switch (i)
                {
                case 2:
                    //Creador
                    cn  = Conexion.conectar();
                    cmd = new SqlCommand("SELECT * FROM Usuarios Where idUsuario ='" + item + "'", cn.getSqlConnection());
                    sda = new SqlDataAdapter(cmd);
                    sda.Fill(tblData1);
                    GridView2.DataSource = (tblData1);
                    GridView2.DataBind();
                    break;

                case 3:
                    //Datos Proyecto
                    cn  = Conexion.conectar();
                    cmd = new SqlCommand("SELECT * FROM Proyectos Where idProyecto ='" + item + "'", cn.getSqlConnection());
                    sda = new SqlDataAdapter(cmd);
                    sda.Fill(tblData2);
                    GridView3.DataSource = (tblData2);
                    GridView3.DataBind();
                    break;

                case 6:
                    //Datos del editor
                    cn  = Conexion.conectar();
                    cmd = new SqlCommand("SELECT * FROM Usuarios Where idUsuario ='" + item + "'", cn.getSqlConnection());
                    sda = new SqlDataAdapter(cmd);
                    sda.Fill(tblData3);
                    GridView4.DataSource = (tblData3);
                    GridView4.DataBind();
                    break;

                case 7:
                    //estado
                    cn  = Conexion.conectar();
                    cmd = new SqlCommand("SELECT * FROM Estado Where idEstado ='" + item + "'", cn.getSqlConnection());
                    sda = new SqlDataAdapter(cmd);
                    sda.Fill(tblData4);
                    GridView7.DataSource = (tblData4);
                    GridView7.DataBind();
                    break;

                case 8:
                    //situacion
                    cn  = Conexion.conectar();
                    cmd = new SqlCommand("SELECT * FROM Situacion Where idSituacion ='" + item + "'", cn.getSqlConnection());
                    sda = new SqlDataAdapter(cmd);
                    sda.Fill(tblData5);
                    GridView8.DataSource = (tblData5);
                    GridView8.DataBind();
                    break;

                case 9:
                    //Categoria
                    cn  = Conexion.conectar();
                    cmd = new SqlCommand("SELECT * FROM Categoria Where idCategoria ='" + item + "'", cn.getSqlConnection());
                    sda = new SqlDataAdapter(cmd);
                    sda.Fill(tblData6);
                    GridView5.DataSource = (tblData6);
                    GridView5.DataBind();
                    break;

                case 10:
                    //Prioridad
                    cn  = Conexion.conectar();
                    cmd = new SqlCommand("SELECT * FROM Prioridad Where idPrioridad ='" + item + "'", cn.getSqlConnection());
                    sda = new SqlDataAdapter(cmd);
                    sda.Fill(tblData7);
                    GridView6.DataSource = (tblData7);
                    GridView6.DataBind();
                    break;
                }
                i++;
            }
            //Creador
            //Proyecto
            //Ultimo Editor
            //Estado
            //Situacion
            //Categoria
            //Prioridad
        }
 protected void Button1_Click(object sender, EventArgs e)
 {
     //--------------------------------BUGS
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Bugs' "
                          + " From Caso "
                          + " Where categoria = 1", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData);
     GridView1.DataSource = (tblData);
     GridView1.DataBind();
     //--------------------------------Mejoras
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Mejoras' "
                          + " From Caso "
                          + " Where categoria = 2", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData2);
     GridView2.DataSource = (tblData2);
     GridView2.DataBind();
     //--------------------------------INVESTIGACIONES
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Investigaciones' "
                          + " From Caso "
                          + " Where categoria = 3", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData3);
     GridView3.DataSource = (tblData3);
     GridView3.DataBind();
     //--------------------------------Actividades
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Actividades' "
                          + " From Caso "
                          + " Where categoria = 4", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData4);
     GridView4.DataSource = (tblData4);
     GridView4.DataBind();
     //--------------------------------Activos
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos Activos' "
                          + " From Caso "
                          + " Where estado = 1", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData5);
     GridView5.DataSource = (tblData5);
     GridView5.DataBind();
     //--------------------------------Reactivados
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos Reactivados' "
                          + " From Caso "
                          + " Where estado = 2", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData6);
     GridView6.DataSource = (tblData6);
     GridView6.DataBind();
     //--------------------------------Cerrados
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos Cerrados' "
                          + " From Caso "
                          + " Where estado = 3", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData7);
     GridView7.DataSource = (tblData7);
     GridView7.DataBind();
     //--------------------------------Reactivados
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos Resueltos' "
                          + " From Caso "
                          + " Where estado = 4", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData8);
     GridView8.DataSource = (tblData8);
     GridView8.DataBind();
     //--------------------------------Criticos
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos Criticos' "
                          + " From Caso "
                          + " Where prioridad = 1", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData9);
     GridView9.DataSource = (tblData9);
     GridView9.DataBind();
     //--------------------------------Deben Arreglarse
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos que Deben Arreglarse' "
                          + " From Caso "
                          + " Where prioridad = 2", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData10);
     GridView10.DataSource = (tblData10);
     GridView10.DataBind();
     //--------------------------------Arreglarse si hay tiempo
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos que Deben Arreglarse si hay tiempo' "
                          + " From Caso "
                          + " Where prioridad = 3", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData11);
     GridView11.DataSource = (tblData11);
     GridView11.DataBind();
     //--------------------------------Reactivados
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos que no deben arreglarse' "
                          + " From Caso "
                          + " Where prioridad = 4", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData12);
     GridView12.DataSource = (tblData12);
     GridView12.DataBind();
 }