Пример #1
0
    private void cargar_GridView_MotivosRotacion()
    {
        Decimal ID_EMPRESA = Convert.ToDecimal(HiddenField_ID_EMPRESA.Value);

        MotivoRotacionRetiro _motivo  = new MotivoRotacionRetiro(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString());
        DataTable            tablaCat = _motivo.ObtenerAsociacionMotivosEmpresa(ID_EMPRESA);

        if (tablaCat.Rows.Count <= 0)
        {
            if (_motivo.MensajeError == null)
            {
                Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "No se han configurado las categorías y motivos de rotación y retiro.", Proceso.Advertencia);
            }
            else
            {
                Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, _motivo.MensajeError, Proceso.Error);
            }

            GridView_MotivosRotacion.DataSource = null;
            GridView_MotivosRotacion.DataBind();
        }
        else
        {
            CargarGrillaMotivosRotacionDesdeTabla(tablaCat);

            inhabilitarFilasGrilla(GridView_MotivosRotacion, 0);
        }
    }
Пример #2
0
    private void CargarGrillaMotivosRotacionDesdeTabla(DataTable tablaCat)
    {
        GridView_MotivosRotacion.DataSource = tablaCat;
        GridView_MotivosRotacion.DataBind();

        Int32 contadorDeColor = 0;

        System.Drawing.Color colorActual = System.Drawing.Color.Transparent;
        String TITULO_MAESTRA_ROTACION   = string.Empty;;

        for (int i = 0; i < GridView_MotivosRotacion.Rows.Count; i++)
        {
            DataRow filaTabla = tablaCat.Rows[i];

            if (i == 0)
            {
                contadorDeColor         = 0;
                colorActual             = System.Drawing.ColorTranslator.FromHtml("#" + arregloDeColores[contadorDeColor]);
                TITULO_MAESTRA_ROTACION = filaTabla["TITULO_MAESTRA_ROTACION"].ToString().Trim();
            }

            GridViewRow filaGrilla = GridView_MotivosRotacion.Rows[i];

            CheckBox check = filaGrilla.FindControl("CheckBox_Configurado") as CheckBox;

            if (DBNull.Value.Equals(filaTabla["ID_ROTACION_EMPRESA"]) == false)
            {
                check.Checked = true;
            }

            if (TITULO_MAESTRA_ROTACION == filaTabla["TITULO_MAESTRA_ROTACION"].ToString().Trim())
            {
                filaGrilla.Cells[0].BackColor = colorActual;
            }
            else
            {
                contadorDeColor += 1;
                if (contadorDeColor >= arregloDeColores.Length)
                {
                    contadorDeColor = 0;
                }
                TITULO_MAESTRA_ROTACION = filaTabla["TITULO_MAESTRA_ROTACION"].ToString().Trim();
                colorActual             = System.Drawing.ColorTranslator.FromHtml("#" + arregloDeColores[contadorDeColor]);

                filaGrilla.Cells[0].BackColor = colorActual;
            }
        }
    }
    private void CargarGrillaMotivosRotacionDesdeTabla(DataTable tablaCat)
    {
        GridView_MotivosRotacion.DataSource = tablaCat;
        GridView_MotivosRotacion.DataBind();

        for (int i = 0; i < GridView_MotivosRotacion.Rows.Count; i++)
        {
            DataRow     filaTabla  = tablaCat.Rows[i];
            GridViewRow filaGrilla = GridView_MotivosRotacion.Rows[i];

            CheckBox check = filaGrilla.FindControl("CheckBox_Configurado") as CheckBox;

            if ((DBNull.Value.Equals(filaTabla["ID_DETALLE_ROTACION_EMPLEADO"]) == true) || (filaTabla["ID_DETALLE_ROTACION_EMPLEADO"].ToString().Trim() == "0"))
            {
                check.Checked = false;
            }
            else
            {
                check.Checked = true;
            }
        }
    }