예제 #1
0
        private void registro_button_Click(object sender, EventArgs e)
        {
            csModulo Modulo = Modulos.Where(x => x.nombre_Form == "registro_button").Single();

            for (int x = 0; x < Modulo.subModulos.Count; x++)
            {
                foreach (Control c in this.Controls)
                {
                    foreach (Control _c in c.Controls)
                    {
                        if (_c.GetType().Name == "Label")
                        {
                            var v = Modulo.subModulos.Where(s => s.titulo_Button == _c.Name).ToList();

                            if (!(v.Count > 0))
                            {
                                _c.Visible = false;
                            }
                            else
                            {
                                _c.Visible = true;
                            }
                        }
                    }
                }
            }

            submenu_clientes_panel.Visible  = true;
            submenu_clientes_panel.Location = new Point(fondo_submenu_panel.Location.X, fondo_submenu_panel.Location.Y);
            submenu_pagos_panel.Visible     = false;
            submenu_reportes_panel.Visible  = false;
            mostrar_submenu("mostrar");
        }
예제 #2
0
        public List <csModulo> CreateAccesos()
        {
            db_sporting_gymContainer contexto          = new db_sporting_gymContainer();
            List <Generales_Accesos> generales_accesos = contexto.Generales_Accesos.Select(a => a).OrderBy(a => a.orden).ToList();

            csSubModuloHandler SubModuloHandler = new csSubModuloHandler();
            csModulo           tempModulo       = new csModulo();
            List <csModulo>    Modulos          = new List <csModulo>();

            int posGeneralesAccesos   = 0;
            int LengthSistema         = 0;
            int countGeneralesAccesos = generales_accesos.Count;

            for (int x = 0; x < countGeneralesAccesos; x++)
            {
                int strNodoLength = generales_accesos[x].orden.Trim().Length;

                if (generales_accesos[x].padre == 1)
                {
                    if (tempModulo.subModulos.Count > 0)
                    {
                        Modulos.Add(tempModulo);
                        tempModulo = new csModulo();
                    }

                    tempModulo.id_General_Acceso = generales_accesos[x].id_acceso;
                    tempModulo.nombre_Acceso     = generales_accesos[x].nombre_acceso.Trim();
                    tempModulo.nombre_Form       = generales_accesos[x].nombre_form.Trim();

                    LengthSistema = strNodoLength;
                }
                else if (strNodoLength > LengthSistema)
                {
                    tempModulo.subModulos = this.AccesoMayor(generales_accesos, x, tempModulo.subModulos, out posGeneralesAccesos);
                    x = posGeneralesAccesos;

                    LengthSistema = strNodoLength;
                }
                else if (strNodoLength == LengthSistema)
                {
                    tempModulo.subModulos = this.AccesoMayor(generales_accesos, x, tempModulo.subModulos, out posGeneralesAccesos);
                    x             = posGeneralesAccesos;
                    LengthSistema = strNodoLength;
                }
                //else if (strNodoLength < LengthSistema)
                //{
                //    if (generales_accesos[x].padre == 1)
                //        x--;
                //    else
                //        tempModulo.subModulos.Add(SubModuloHandler.AddSubModulos(generales_accesos[x]));

                //    LengthSistema = strNodoLength;
                //}
            }

            if (tempModulo.subModulos.Count > 0)
            {
                Modulos.Add(tempModulo);
            }

            return(Modulos);
        }