private void cargarSemaforos()
    {
        contratosServicio _contratosServicio = new contratosServicio(Session["idEmpresa"].ToString());
        DataTable tblcontratosServicio = new DataTable();

        tblcontratosServicio = _contratosServicio.ObtenerSemaforoContratosDeServico();
        int conteoBajo = (from s in tblcontratosServicio.AsEnumerable() where s["ALERTA"].ToString()=="BAJO" select s).Count();
        int conteoMedio = (from s in tblcontratosServicio.AsEnumerable() where s["ALERTA"].ToString()=="MEDIO" select s).Count();
        int conteoAlto = (from s in tblcontratosServicio.AsEnumerable() where s["ALERTA"].ToString()=="ALTO" select s).Count();

        var listaFinal = (from s in tblcontratosServicio.AsEnumerable() select new { ALERTA = s["ALERTA"].ToString(), contador = 0 });
        DataTable tablaFinal = new System.Data.DataTable();
        tablaFinal.Columns.Add("ALERTA");
        tablaFinal.Columns.Add("contador");

        foreach (var item in (from s in listaFinal orderby s.ALERTA select s).Distinct().ToList())
        {

            //if ((from s in tablaFinal.AsEnumerable() where s["ALERTA"] == item.ALERTA select s).Count() <= 0)
            //{
                DataRow fila = tablaFinal.NewRow();

                fila["ALERTA"] = item.ALERTA;
                switch (item.ALERTA.ToLower())
                {
                    case "bajo":
                        fila["contador"] = conteoBajo;
                        break;
                    case "medio":
                        fila["contador"] = conteoMedio;
                        break;
                    case "alto":
                        fila["contador"] = conteoAlto;
                        break;
                }

                tablaFinal.Rows.Add(fila);
            //}
        }

        DataView custDV = new DataView(tablaFinal);

        Display(custDV);
    }
    protected void GridView_HOJA_DE_TRABAJO_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView_HOJA_DE_TRABAJO.PageIndex = e.NewPageIndex;

        contratosServicio _contratosServicio = new contratosServicio(Session["idEmpresa"].ToString());
        Cargar(GridView_HOJA_DE_TRABAJO, _contratosServicio.ObtenerSemaforoContratosDeServico());
    }
    private void Buscar()
    {
        DataTable dataTableColor = new DataTable();
        DataRow[] dataRows;
        string alerta = null;
        Configurar(dataTableColor);
        if (DropDownList_BUSCAR.SelectedValue.Equals("Rojo")) alerta = "ALTO";
        if (DropDownList_BUSCAR.SelectedValue.Equals("Amarillo")) alerta = "MEDIO";
        if (DropDownList_BUSCAR.SelectedValue.Equals("Verde")) alerta = "BAJO";

        contratosServicio _contratosServicio = new contratosServicio(Session["idEmpresa"].ToString());
        if (DropDownList_BUSCAR.SelectedValue.ToString() == "")
        {
            dataTableColor = _contratosServicio.ObtenerSemaforoContratosDeServico();
        }
        else
        {
            dataRows = _contratosServicio.ObtenerSemaforoContratosDeServico().Select("ALERTA = '" + alerta + "'");
            foreach (DataRow dataRow in dataRows)
            {
                dataTableColor.ImportRow(dataRow);
            }
        }
        Cargar(GridView_HOJA_DE_TRABAJO, dataTableColor);
    }
    private void Cargar()
    {
        contratosServicio _contratosServicio = new contratosServicio(Session["idEmpresa"].ToString());

        Cargar(GridView_HOJA_DE_TRABAJO, _contratosServicio.ObtenerSemaforoContratosDeServico());
        Cargar(DropDownList_BUSCAR);
    }
        private void cargarSemaforos()
        {
            contratosServicio _contratosServicio = new contratosServicio(Session["idEmpresa"].ToString());
            DataTable tblcontratosServicio = new DataTable();

            tblcontratosServicio = _contratosServicio.ObtenerSemaforoContratosDeServico();

            //var qryLatestInterview = from rows in tblcontratosServicio.AsEnumerable()
            //             orderby rows["ALERTA"] descending
            //             group rows by new { PositionID = rows["ALERTA"]} into grp
            //             select grp.First();

            //var qryLatestInterview = from row in tblcontratosServicio.AsEnumerable()
            //                         group row by row.Field<string>("ALERTA") into sales
            //                         select new
            //                         {
            //                             ALERTA = sales.Key,
            //                             contador = sales.Count()
            //                         };

            //var dtPositionInterviews = qryLatestInterview.CopyToDataTable();

            DataView custDV = new DataView(tblcontratosServicio);

            Display(custDV);
        }