Пример #1
0
        private void CargarCatalogo(int id_perfil)
        {
            try
            {
                PerfilesCOM perfiles = new PerfilesCOM();
                DataSet     ds       = perfiles.sp_catalogo_perfiles(id_perfil);
                DataTable   dt       = ds.Tables[0];
                grid_perfiles.DataSource = dt;
                grid_perfiles.DataBind();
                if (id_perfil > 0)
                {
                    rtxtperfil.Text = dt.Rows[0]["perfil"].ToString();
                    cbxvertodosempleados.Checked = Convert.ToBoolean(dt.Rows[0]["ver_todos_empleados"]);
                    txtid_perfil.Text            = id_perfil.ToString();
                    DataTable dt_usuarios_original = perfiles.sp_usuarios_perfiles(id_perfil).Tables[0];
                    if (dt_usuarios_original.Rows.Count > 0)
                    {
                        System.Data.DataView  view     = new System.Data.DataView(dt_usuarios_original);
                        System.Data.DataTable selected = view.ToTable("Selected", false, "usuario");
                        ViewState["dt_usuarios"]      = selected;
                        rdllista_empleados.DataSource = dt_usuarios_original;
                        rdllista_empleados.DataBind();
                        CheckValuesListUsuarios();
                    }
                    DataTable dt_widgets_original = perfiles.sp_widgets_perfiles(id_perfil).Tables[0];
                    if (dt_widgets_original.Rows.Count > 0)
                    {
                        System.Data.DataView  view     = new System.Data.DataView(dt_widgets_original);
                        System.Data.DataTable selected = view.ToTable("Selected", false, "id_widget");
                        ViewState["dt_widgets"]     = selected;
                        repeater_widgets.DataSource = dt_widgets_original;
                        repeater_widgets.DataBind();
                        CheckValuesListWidgets();
                    }

                    DataTable dt_menus_original = perfiles.sp_menus_perfiles(id_perfil).Tables[0];
                    if (dt_menus_original.Rows.Count > 0)
                    {
                        System.Data.DataView  view     = new System.Data.DataView(dt_menus_original);
                        System.Data.DataTable selected = view.ToTable("Selected", false, "id_menu");
                        ViewState["dt_menus"]     = selected;
                        repeater_menus.DataSource = dt_menus_original;
                        repeater_menus.DataBind();
                        CheckValuesListMenus();
                    }
                }
            }
            catch (Exception ex)
            {
                Toast.Error("Error al cargar catalogo principal: " + ex.Message, this);
            }
        }
Пример #2
0
        private void CargarListadoPerfiles(string filtro)
        {
            try
            {
                PerfilesCOM perfiles    = new PerfilesCOM();
                DataSet     ds          = perfiles.sp_catalogo_perfiles(0);
                DataTable   dt_original = ds.Tables[0];

                DataTable dt = new DataTable();
                if (filtro == "")
                {
                    dt = dt_original;
                    if (dt.Rows.Count > 0)
                    {
                        ddlperfiles.DataTextField  = "perfil";
                        ddlperfiles.DataValueField = "id_perfil";
                        ddlperfiles.DataSource     = dt;
                        ddlperfiles.DataBind();
                    }
                }
                else
                {
                    if (dt_original.Select("perfil like '%" + filtro + "%'").Length > 0)
                    {
                        dt = filtro == "" ? dt_original : dt_original.Select("perfil like '%" + filtro + "%'").CopyToDataTable();
                    }

                    if (dt.Rows.Count > 0)
                    {
                        ddlperfiles.DataTextField  = "perfil";
                        ddlperfiles.DataValueField = "id_perfil";
                        ddlperfiles.DataSource     = dt;
                        ddlperfiles.DataBind();
                    }
                    else
                    {
                        Toast.Info("No se encontro ninguna coincidencia. Intentelo nuevamente.", "Mensaje del Sistema", this);
                    }
                }
            }
            catch (Exception ex)
            {
                Toast.Error("Error al cargar lista de menus. " + ex.Message, this);
            }
        }