Пример #1
0
 /*
  * Esta función es para el combobox de Ids, en el apartado de consulta.
  * Toma el número elegido en el combobox y lo compara con los Id almacenados
  * en la lista, y despliega la información del item con que haya hecho match.
  *
  */
 private void CmbIdentif_SelectedIndexChanged(object sender, EventArgs e)
 {
     PnlData.Visible = true;
     foreach (var t in ClsTrabajo.trabajos)
     {
         if (CmbIdentif.SelectedIndex == t.IdTrabajo)
         {
             DgvInformacion.Rows.Clear();
             DgvInformacion.Refresh();
             DgvInformacion.Rows[0].Cells[0].Value = t.IdTrabajo;
             DgvInformacion.Rows[0].Cells[1].Value = t.Descripcion;
             DgvInformacion.Rows[0].Cells[2].Value = t.TiempoEst;
             if (t is ClsHistoria h)
             {
                 DgvInformacion.Columns[3].Visible     = true;
                 DgvInformacion.Columns[3].Width       = 70;
                 DgvInformacion.Columns[3].HeaderText  = "Puntos";
                 DgvInformacion.Rows[0].Cells[3].Value = h.Puntos;
                 DgvInformacion.Rows[0].Cells[4].Value = "Historia";
             }
             else if (t is ClsBug b)
             {
                 DgvInformacion.Columns[3].Visible     = true;
                 DgvInformacion.Columns[3].HeaderText  = "Caso";
                 DgvInformacion.Rows[0].Cells[3].Value = b.CasoPrueba;
                 DgvInformacion.Rows[0].Cells[4].Value = "Bug";
             }
             else if (t is ClsCajaT c)
             {
                 DgvInformacion.Columns[3].Visible     = false;
                 DgvInformacion.Rows[0].Cells[4].Value = "Caja Tiempo";
             }
         }
     }
 }
Пример #2
0
        /*
         * Esta función es la que se lanza cuando se elige un tipo de trabajo en el combobox
         * de consultas. Lo que hace es recorrer toda la lista y buscar un match con el tipo
         * de trabajo elegido, en cuyo caso imprime la información en el datagridview.
         */
        private void CmbTrab_SelectedIndexChanged(object sender, EventArgs e)
        {
            PnlData.Visible = true;
            DgvInformacion.Columns[4].Visible = false;
            TrabajoCons = CmbTrab.SelectedIndex;
            int n;

            switch (TrabajoCons)
            {
            case 0:
                DgvInformacion.Rows.Clear();
                DgvInformacion.Refresh();
                foreach (var t in ClsTrabajo.trabajos)
                {
                    if (t is ClsHistoria h)
                    {
                        DgvInformacion.Columns[3].Visible    = true;
                        DgvInformacion.Columns[3].Width      = 70;
                        DgvInformacion.Columns[3].HeaderText = "Puntos";
                        n = DgvInformacion.Rows.Add();
                        DgvInformacion.Rows[n].Cells[0].Value = h.Id;
                        DgvInformacion.Rows[n].Cells[1].Value = h.Descripcion;
                        DgvInformacion.Rows[n].Cells[2].Value = h.TiempoEst;
                        DgvInformacion.Rows[n].Cells[3].Value = h.Puntos;
                    }
                }
                break;

            case 1:
                DgvInformacion.Rows.Clear();
                DgvInformacion.Refresh();
                foreach (var t in ClsTrabajo.trabajos)
                {
                    if (t is ClsCajaT c)
                    {
                        DgvInformacion.Columns[3].Visible = false;
                        n = DgvInformacion.Rows.Add();
                        DgvInformacion.Rows[n].Cells[0].Value = c.Id;
                        DgvInformacion.Rows[n].Cells[1].Value = c.Descripcion;
                        DgvInformacion.Rows[n].Cells[2].Value = c.TiempoEst;
                    }
                }
                break;

            case 2:
                DgvInformacion.Rows.Clear();
                DgvInformacion.Refresh();
                foreach (var t in ClsTrabajo.trabajos)
                {
                    if (t is ClsBug b)
                    {
                        DgvInformacion.Columns[3].Visible    = true;
                        DgvInformacion.Columns[3].HeaderText = "Caso";
                        n = DgvInformacion.Rows.Add();
                        DgvInformacion.Rows[n].Cells[0].Value = b.Id;
                        DgvInformacion.Rows[n].Cells[1].Value = b.Descripcion;
                        DgvInformacion.Rows[n].Cells[2].Value = b.TiempoEst;
                        DgvInformacion.Rows[n].Cells[3].Value = b.CasoPrueba;
                    }
                }
                break;

            default:
                break;
            }
            PnlData.Visible = true;
        }