Ejemplo n.º 1
0
        public virtual MenuDescription ToMenuDescription()
        {
            var toReturn = new MenuDescription();

            base.Fill(toReturn);
            if (this.Caption != null)
            {
                toReturn.Properties["Caption"] = this.Caption;
            }
            if (this.LongCaption != null)
            {
                toReturn.Properties["LongCaption"] = this.LongCaption;
            }
            if (this.Icon != null)
            {
                toReturn.Properties["Icon"] = this.Icon;
            }
            if (this.Command != null)
            {
                var command = this.Command.GetPropertyText();
                toReturn.Properties["Command"] = $"@MvxBind:{command}";
            }

            return(toReturn);
        }
Ejemplo n.º 2
0
        public virtual MenuDescription ToMenuDescription()
        {
            var toReturn = new MenuDescription();

            base.Fill(toReturn);
            if (Caption != null)
            {
                toReturn.Properties["Caption"] = Caption;
            }
            if (LongCaption != null)
            {
                toReturn.Properties["LongCaption"] = LongCaption;
            }
            if (Icon != null)
            {
                toReturn.Properties["Icon"] = Icon;
            }
            if (Command != null)
            {
                var command = Command.GetPropertyText();
                toReturn.Properties["Command"] = string.Format("@MvxBind:{0}", command);
            }

            return(toReturn);
        }
Ejemplo n.º 3
0
        private Vector2 ButtonPosition(MenuDescription xml)
        {
            float high = 0;

            foreach (MenupartDescription i in xml.MenuParts)
            {
                if (i.Name == "Score" && style == 0)
                {
                    foreach (ButtonDescription g in i.Buttons)
                    {
                        if (high < g.height)
                        {
                            high = g.height;
                        }
                    }
                }
                else
                {
                    if (i.Name == "OptionList" && style == 1)
                    {
                        foreach (ButtonDescription g in i.Buttons)
                        {
                            if (high < g.height)
                            {
                                high = g.height;
                            }
                        }
                    }
                }
            }
            return(this.Position + new Vector2(0, BoxHeight));
        }
Ejemplo n.º 4
0
        public MainList(ICanyonShooterGame game, string menuName, MenuDescription menuXml, bool hori)
            : base(game as ICanyonShooterGame)
        {
            this.menuXml = menuXml;
            init(menuName, hori);
            this.menuName = menuName;

            foreach (MenupartDescription i in menuXml.MenuParts)
            {
                if (i.Name == menuName)
                {
                    Vector2 ButtonMessure = new Vector2();
                    for (int g = 0; g < i.ButtonCount; g++)
                    {
                        ButtonMessure.X += i.Buttons[g].width;
                        ButtonMessure.Y += i.Buttons[g].height;
                    }
                    this.leftshift = new Button(game, "LeftShift", new Rectangle((int)((game.Graphics.Device.Viewport.Width
                                                                                        - 398 + (i.StartPosition.X - 398)) - 23 - i.ShiftOffset.X), (int)i.StartPosition.Y, 23, 72),
                                                "shift_left", true, this);
                    this.rightshift = new Button(game, "RightShift", new Rectangle((int)(
                                                                                       (game.Graphics.Device.Viewport.Width - 398 + (i.StartPosition.X - 398 - 3))
                                                                                       + i.ShiftOffset.X + ButtonMessure.X + ((i.ButtonCount - 1) * i.Spacer.X)),
                                                                                   (int)i.StartPosition.Y, 23, 72), "shift_right", true, this);
                }
            }
        }
Ejemplo n.º 5
0
 public NormalList(ICanyonShooterGame game, string menuName, MenuDescription menuXml, bool hori)
     : base(game as ICanyonShooterGame)
 {
     this.menuXml  = menuXml;
     this.menuName = menuName;
     init(menuName, hori);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Constructor for Including Score
        ///
        /// </summary>
        public Menu(ICanyonShooterGame game, string name, bool score)
            : base(game as Game)
        {
            assetName        = "Config\\" + name + ".xml";
            this.game        = game;
            this.currentMenu = name;
            menuXml          = game.Content.Load <MenuDescription>("Content\\Menu\\" + name);
            this.visible     = true;
            this.isActive    = true;

            steuerung = new MenuControl(this, game);

            //Erstellung des Hauptmenüs
            MainList Menu = new MainList(game, name, menuXml, true);

            CurrentList  = Menu;
            shifts       = Menu;
            this.scoring = score;
            if (score)
            {
                this.startscoring = true;
                this.score        = game.GameStates.Score;
            }

            this.DrawOrder = (int)DrawOrderType.Menu;
        }
Ejemplo n.º 7
0
        private void RegisterMenu(string name, dynamic value)
        {
            VariableDescription?variableToAssign = null;

            if (value.variable_name != null)
            {
                if (_userVariablesDescriptions.ContainsKey(value.variable_name))
                {
                    variableToAssign = _userVariablesDescriptions[value.variable_name];

                    if (value.menu_to_open == null)
                    {
                        throw new ArgumentNullException("menu_to_open", "menu_to_open can't be null if menu is for variable input");
                    }
                }
                else
                {
                    throw new KeyNotFoundException($"{value.variable_name} variable not found.");
                }
            }

            _menusDescriptions[name] = new MenuDescription(
                name: name,
                startMessage: value.start_message,
                layoutName: value.layout,
                variableToAssign: variableToAssign,
                menuToOpenAfterAssign: variableToAssign == null ? null : value.menu_to_open);
        }
Ejemplo n.º 8
0
        public Listbox(ICanyonShooterGame game, Vector2 pos, bool scroll, MenuDescription xml, int district, Dictionary <string, object> Data, Dictionary <string, string> Format, List <string> Names)
            : base(district)
        {
            this.isActive = true;
            this.visible  = true;
            this.game     = game;
            this.style    = 1;

            this.Position   = pos;
            this.scrollable = scroll;

            this.data = Data;

            this.BoxContentPosition = new Vector2(Position.X + 7, Position.Y + 30);
            this.BoxContentHeight   = this.BoxHeight - 30 - 31;
            this.Titel = "Optionen: ";

            switch (difficulty)
            {
            case 0:
                this.Titel += "Spielereinstellungen";
                break;

            case 1:
                this.Titel += "Grafik";
                break;

            case 2:
                this.Titel += "Sound";
                break;

            case 3:
                this.Titel += "Steuerung";
                break;

            default:
                break;
            }

            //Building the Member for the Buttons and Scores
            this.List    = new OptionList(game, game.Content.Load <OptionDescription>("Content\\Menu\\OptionMenu"), district, BoxContentPosition, Data, Format, Names, false, this);
            this.Buttons = new NormalList(game, ButtonPosition(xml), "OptionList", xml, true);
            this.Scrolling();
            this.intializeScrollbar();

            slideBars = new Dictionary <string, HSlideBar>();
            int counter = Names.Count;

            foreach (Button g in this.List)
            {
                HSlideBar hsb = getSlideBar(g, Names[Names.Count - counter]);
                if (hsb != null)
                {
                    slideBars.Add(g.getButtonName(), hsb);
                }

                counter--;
            }
        }
Ejemplo n.º 9
0
 public NormalList(ICanyonShooterGame game, Vector2 pos, string menuName, MenuDescription menuXml, bool hori)
     : base(game as ICanyonShooterGame)
 {
     this.menuXml       = menuXml;
     this.menuName      = menuName;
     this.Startposition = pos;
     init(menuName, hori);
 }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ConnectDatabase alayer = new ConnectDatabase();
            SqlDataReader   reader;
            int             num = 0;
            string          GroupNo, MenuName = "", ImagePath, MenuPrice, MenuDescription, Mode;

            if (Request.QueryString["Menu_Name"] != null)
            {
                MenuName = Request.QueryString["Menu_Name"];
            }
            if (Request.QueryString["Menu_Group"] != null)
            {
                GroupNo            = Request.QueryString["Menu_Group"];
                Label_Groupno.Text = GroupNo;
                num = Convert.ToInt32(GroupNo.ToString());
            }
            reader = alayer.GetAllMenuTableFromDB(num, MenuName);
            if (reader != null)
            {
                while (reader.HasRows)
                {
                    MenuName  = reader.GetName(0);
                    MenuPrice = reader.GetName(1);

                    while (reader.Read())
                    {
                        MenuName        = reader.GetString(0);
                        MenuPrice       = reader.GetString(1);
                        ImagePath       = reader.GetString(2);
                        MenuDescription = reader.GetString(3);

                        ImagePath       = ImagePath.Trim();
                        MenuDescription = MenuDescription.Trim();

                        Label3.Text             = MenuName;
                        Image1.ImageUrl         = ImagePath;
                        txtMenuName.Text        = MenuName;
                        txtMenuPrice.Text       = MenuPrice;
                        Session["ImagePath"]    = ImagePath;
                        txtMenuDescription.Text = MenuDescription;
                    }
                    reader.NextResult();
                }
            }
            else
            {
                Response.Write("<script>alert('Can not get data from database');window.location='ViewUserPage.aspx';</script>");
                return;
            }
            reader.Close();
        }
Ejemplo n.º 11
0
        private void CreateMenuFile(string menusDirectory, MenuDescription menuDescription)
        {
            MenuTemplate menuTemplate = new MenuTemplate()
            {
                Session = new Dictionary <string, object> {
                    ["generator"]       = this,
                    ["menuDescription"] = menuDescription
                }
            };

            menuTemplate.Initialize();

            File.WriteAllText($@"{menusDirectory}\{menuDescription.Name}.cs", menuTemplate.TransformText());
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 打开菜单
        /// </summary>
        /// <param name="menuDesc"></param>
        private void OpenMenuFun(MenuDescription menuDesc)
        {
            if (string.IsNullOrEmpty(menuDesc.DocumnetType))
            {
                MessageBoxService.ShowMessage("文档未设置");
                return;
            }

            var document = this.DocumentManagerService.FindDocumentByIdOrCreate(menuDesc.DocumnetType, (service) =>
            {
                return(service.CreateDocument(menuDesc.DocumnetType, menuDesc, this));
            });

            document.Title          = menuDesc.MenuTitle;
            document.DestroyOnClose = true;
            document.Show();
        }
Ejemplo n.º 13
0
 // Konstuktor
 // Dieser Konstruktor kann von außen nicht erreicht werden.
 public HighscoreMenu(ICanyonShooterGame game, string MenuName, int difficulty)
     : base(game as Game)
 {
     this.game        = game;
     this.visible     = true;
     this.Active      = true;
     this.xml         = game.Content.Load <MenuDescription>("Content\\Menu\\Hauptmenu");
     this.currentmenu = MenuName;
     foreach (MenupartDescription i in xml.MenuParts)
     {
         if (i.Name == MenuName)
         {
             this.Scorelist = new Listbox(game, new Vector2(i.MenuPosition.X, i.MenuPosition.Y), true, xml, difficulty);
         }
     }
     steuerung = new MenuControl((Menu)game.GameStates.Menu, game);
 }
Ejemplo n.º 14
0
        public virtual MenuDescription ToMenuDescription()
        {
            var toReturn = new MenuDescription();
            base.Fill(toReturn);
            if (Caption != null)
                toReturn.Properties["Caption"] = Caption;
            if (LongCaption != null)
                toReturn.Properties["LongCaption"] = LongCaption;
            if (Icon != null)
                toReturn.Properties["Icon"] = Icon;
            if (Command != null)
            {
                var command = Command.GetPropertyText();
                toReturn.Properties["Command"] = $"@MvxBind:{command}";
            }

            return toReturn;
        }
Ejemplo n.º 15
0
        public virtual MenuDescription ToMenuDescription()
        {
            var toReturn = new MenuDescription();
            base.Fill(toReturn);
            if (Caption != null)
                toReturn.Properties["Caption"] = Caption;
            if (LongCaption != null)
                toReturn.Properties["LongCaption"] = LongCaption;
            if (Icon != null)
                toReturn.Properties["Icon"] = Icon;
            if (Command != null)
            {
                var command = Command.GetPropertyText();
                toReturn.Properties["Command"] = string.Format("@MvxBind:{{'Path':'{0}'}}", command);
            }

            return toReturn;
        }
Ejemplo n.º 16
0
        //Konstruktor
        public Listbox(ICanyonShooterGame game, Vector2 pos, bool scroll, MenuDescription xml, int difficulty)
            : base(difficulty)
        {
            this.isActive = true;
            this.visible  = true;
            this.game     = game;
            this.style    = 0;

            this.Position   = pos;
            this.scrollable = scroll;

            this.BoxContentPosition = new Vector2(Position.X + 7, Position.Y + 30);
            this.BoxContentHeight   = this.BoxHeight - 30 - 31;
            this.Titel = "Bestenliste: ";

            switch (difficulty)
            {
            case 0:
                this.Titel += "Rooky";
                break;

            case 1:
                this.Titel += "Standard";
                break;

            case 2:
                this.Titel += "Elite";
                break;

            default:
                break;
            }

            //Building the Member for the Buttons and Scores
            this.List    = new HighscoreList(game, "ScoreList", BoxContentPosition, game.Content.Load <HighscoreDescription>("Content\\Menu\\HighscoreMenu"), false, this);
            this.Buttons = new NormalList(game, ButtonPosition(xml), "Score", xml, true);
            this.Scrolling();
            this.intializeScrollbar();
        }
Ejemplo n.º 17
0
        //Constructor
        public Menu(ICanyonShooterGame game, string name)
            : base(game as Game)
        {
            assetName        = "Config\\" + name + ".xml";
            this.game        = game;
            this.currentMenu = name;
            menuXml          = game.Content.Load <MenuDescription>("Content\\Menu\\" + name);
            this.visible     = true;
            this.isActive    = true;

            steuerung = new MenuControl(this, game);

            //Prompts = PromptCollection.getInstance();

            //Erstellung des Hauptmenüs
            MainList Menu = new MainList(game, name, menuXml, true);

            CurrentList = Menu;
            shifts      = Menu;

            //this.OptionMenu = new Option(game,this.menuXml);

            this.DrawOrder = (int)DrawOrderType.Menu;
        }
Ejemplo n.º 18
0
        public static void CreateAccessSecurity(IApplicationBuilder app)
        {
            using (var scope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                Assembly assembly = typeof(Security).Assembly;

                SecurityDescription attribute     = null;
                MenuDescription     menuAttribute = null;

                Dictionary <MenuDescription, object> menues = new Dictionary <MenuDescription, object>();
                ArrayList items = new ArrayList();

                GQ_AccesosDto itemClass  = null;
                GQ_AccesosDto itemMethod = null;

                ///
                ///
                /// CREACION DE ROLES
                ///
                ///

                if (ROLES.Length > 0)
                {
                    for (int i = 0; i < ROLES.Length; i++)
                    {
                        if (roles.ContainsKey(ROLES[i]) == false)
                        {
                            roles.Add(ROLES[i], null);
                        }
                    }
                }

                var RolColl = MySQLService.Instance.GetSession <GQ_Perfiles>().findBy(x => true).ToList();

                for (int i = 0; i < roles.Keys.Count; i++)
                {
                    string key = roles.Keys.ElementAt(i);
                    var    rol = RolColl.Where(x => x.KeyName == key).FirstOrDefault();

                    if (rol == null)
                    {
                        rol            = new GQ_Perfiles();
                        rol.Nombre     = key;
                        rol.KeyName    = key;
                        rol.Estado     = Constantes.ESTADO_ACTIVO;
                        rol.Creado     = DateTime.Now;
                        rol.Modificado = DateTime.Now;

                        MySQLService.Instance.GetSession <GQ_Perfiles>().Insert(rol);
                    }

                    roles[key] = new GQ_PerfilesDto(rol);
                }

                ///
                ///
                /// CREACION DE ACCESOS
                ///
                ///

                var elementsType = (from iface in assembly.GetTypes()
                                    where iface.Namespace != null && iface.Namespace.Contains("Controller")
                                    select iface);

                foreach (Type item in elementsType)
                {
                    menuAttribute = (MenuDescription)item.GetCustomAttribute(typeof(MenuDescription), true);
                    if (menuAttribute != null)
                    {
                        menues.Add(menuAttribute, item);
                    }
                    attribute = (SecurityDescription)item.GetCustomAttribute(typeof(SecurityDescription), true);

                    if (attribute != null)
                    {
                        itemClass           = new GQ_AccesosDto();
                        itemClass.ClassName = getNameObject(item);

                        if (attribute.Estado == SecurityDescription.SeguridadEstado.Activo)
                        {
                            itemClass.MethodName = null;
                            itemClass.Nombre     = attribute.Name;
                            itemClass.extra      = attribute;

                            //obtenerProfiles(attribute, roles);

                            items.Add(itemClass);
                        }

                        foreach (MethodInfo method in item.GetMethods())
                        {
                            menuAttribute = (MenuDescription)method.GetCustomAttribute(typeof(MenuDescription), true);
                            if (menuAttribute != null)
                            {
                                menues.Add(menuAttribute, method);
                            }

                            attribute = (SecurityDescription)method.GetCustomAttribute(typeof(SecurityDescription), true);
                            if (attribute != null && attribute.Estado == SecurityDescription.SeguridadEstado.Activo)
                            {
                                itemMethod            = new GQ_AccesosDto();
                                itemMethod.ClassName  = itemClass.ClassName;
                                itemMethod.MethodName = method.Name;
                                itemMethod.Nombre     = attribute.Name;
                                itemMethod.extra      = attribute;

                                //obtenerProfiles(attribute, roles);

                                items.Add(itemMethod);
                            }
                        }
                    }
                }

                var AccesoColl = MySQLService.Instance.GetSession <GQ_Accesos>().findBy(x => true).ToList();

                foreach (GQ_AccesosDto ii in items)
                {
                    var data = AccesoColl.Where(x => x.ClassName == ii.ClassName && x.MethodName == ii.MethodName).FirstOrDefault();
                    if (data == null)
                    {
                        data            = new GQ_Accesos();
                        data.ClassName  = ii.ClassName;
                        data.MethodName = ii.MethodName;
                        data.Nombre     = ii.Nombre;

                        MySQLService.Instance.GetSession <GQ_Accesos>().Insert(data);
                    }
                    else
                    {
                        data.Nombre = ii.Nombre;
                        MySQLService.Instance.GetSession <GQ_Accesos>().Update(data);
                    }

                    attribute = (SecurityDescription)ii.extra;
                    if (attribute.Perfiles != null && attribute.Perfiles.Length > 0)
                    {
                        for (int i = 0; i < attribute.Perfiles.Length; i++)
                        {
                            var rol = roles[attribute.Perfiles[i]];
                            var ar  = rol.PerfilesAccesos.Where(x => x.AccesoId == data.Id).FirstOrDefault();

                            if (ar == null)
                            {
                                ar = new GQ_Perfiles_AccesosDto {
                                    PerfilId = rol.Id.Value, AccesoId = data.Id.Value, Permite = true
                                };
                                rol.PerfilesAccesos.Add(ar);
                                rol.Modificado = DateTime.Now;
                            }
                        }
                    }
                }

                foreach (var item in roles.Values)
                {
                    foreach (var itemA in item.PerfilesAccesos)
                    {
                        var itemInsert = itemA.GetEntity();
                        MySQLService.Instance.GetSession <GQ_Perfiles_Accesos>().Update(itemInsert);
                    }
                }

                ///
                ///
                /// CREACION DE USUARIO ADMINISTRADOR
                ///
                ///
                var UsuarioColl = MySQLService.Instance.GetSession <GQ_Usuarios>().findBy(x => true);

                var usuario = UsuarioColl.Where(x => x.NombreUsuario == "admin").FirstOrDefault();

                if (usuario == null)
                {
                    usuario = new GQ_Usuarios
                    {
                        Nombre             = "Admin",
                        Apellido           = "Admin",
                        NombreUsuario      = "admin",
                        Password           = Constantes.Encriptar("admin1234"),
                        RequiereContraseña = false,
                        Email      = "",
                        Estado     = Constantes.ESTADO_ACTIVO,
                        Creado     = DateTime.Now,
                        Modificado = DateTime.Now
                    };

                    MySQLService.Instance.GetSession <GQ_Usuarios>().Insert(usuario);

                    var up = new GQ_Usuarios_Perfiles
                    {
                        UsuarioId = usuario.Id.Value,
                        PerfilId  = roles[Security.ROL_ADMI].Id.Value,
                    };

                    MySQLService.Instance.GetSession <GQ_Usuarios_Perfiles>().Insert(up);
                }

                ///
                ///
                /// CREACION DE MENUES
                ///
                ///

                var MenuColl = MySQLService.Instance.GetSession <GQ_Menues>().findBy(x => true).ToList();

                var menu = MenuColl.Where(x => x.KeyName == MENU_CONFIG_ID).FirstOrDefault();

                if (menu == null)
                {
                    menu = new GQ_Menues();
                    menu.MenuPosition = MENU_CONFIG_ID;
                    menu.KeyName      = MENU_CONFIG_ID;
                    menu.Nombre       = "menu_configuracion";
                    menu.MenuIcono    = "fa fa-fw fa-cogs";
                    menu.Creado       = DateTime.Now;
                    menu.Modificado   = DateTime.Now;
                    menu.Estado       = Constantes.ESTADO_ACTIVO;
                    MySQLService.Instance.GetSession <GQ_Menues>().Insert(menu);
                }

                menu = MenuColl.Where(x => x.KeyName == MENU_ESTADISTICAS_ID).FirstOrDefault();

                if (menu == null)
                {
                    menu = new GQ_Menues();
                    menu.MenuPosition = MENU_ESTADISTICAS_ID;
                    menu.KeyName      = MENU_ESTADISTICAS_ID;
                    menu.Nombre       = "menu_tablero_control";
                    menu.MenuIcono    = "fa fa-fw fa-dashboard";
                    menu.Creado       = DateTime.Now;
                    menu.Modificado   = DateTime.Now;
                    menu.Estado       = Constantes.ESTADO_ACTIVO;
                    MySQLService.Instance.GetSession <GQ_Menues>().Insert(menu);
                }

                foreach (var m in menues.Keys)
                {
                    menu = MenuColl.Where(x => x.KeyName == m.Id).FirstOrDefault();
                    if (menu == null)
                    {
                        var obj = menues[m];

                        menu = new GQ_Menues();
                        menu.MenuPosition = m.Id;
                        menu.KeyName      = m.Id;
                        menu.Nombre       = m.Description;
                        menu.MenuIcono    = "";
                        menu.MenuPadre    = m.IdParent;
                        menu.Creado       = DateTime.Now;
                        menu.Modificado   = DateTime.Now;
                        menu.Estado       = Constantes.ESTADO_ACTIVO;

                        if (obj is Type)
                        {
                            menu.MenuUrl = ((Type)obj).Name.Replace("Controller", "");
                        }
                        else if (obj is MethodInfo)
                        {
                            menu.MenuUrl = ((MethodInfo)obj).ReflectedType.Name.Replace("Controller", "") + @"/" + ((MethodInfo)obj).Name;
                        }

                        MySQLService.Instance.GetSession <GQ_Menues>().Insert(menu);
                    }
                }
            }
        }
Ejemplo n.º 19
0
        public static void CreateAccessSecurity()
        {
            using (var transaction = Services.session.BeginTransaction())
            {
                Assembly assembly = typeof(Security).GetTypeInfo().Assembly;

                SecurityDescription attribute     = null;
                MenuDescription     menuAttribute = null;

                Dictionary <string, Gq_perfiles>     roles  = new Dictionary <string, Gq_perfiles>();
                Dictionary <MenuDescription, object> menues = new Dictionary <MenuDescription, object>();
                ArrayList items = new ArrayList();

                Gq_accesosDto itemClass  = null;
                Gq_accesosDto itemMethod = null;

                #region CREACION DE ROLES

                if (ROLES.Length > 0)
                {
                    for (int i = 0; i < ROLES.Length; i++)
                    {
                        if (roles.ContainsKey(ROLES[i]) == false)
                        {
                            roles.Add(ROLES[i], null);
                        }
                    }
                }

                for (int i = 0; i < roles.Keys.Count; i++)
                {
                    string key = roles.Keys.ElementAt(i);
                    var    rol = Services.Get <ServGq_perfiles>().findBy(x => x.KeyName == key).FirstOrDefault();

                    if (rol == null)
                    {
                        rol               = new Gq_perfiles();
                        rol.Nombre        = key;
                        rol.KeyName       = key;
                        rol.Estado        = Constantes.ESTADO_ACTIVO;
                        rol.Creado        = DateTime.Now;
                        rol.Modificado    = DateTime.Now;
                        rol.CreadoPor     = -1;
                        rol.ModificadoPor = -1;

                        Services.Get <ServGq_perfiles>().Agregar(rol);

                        rol = Services.Get <ServGq_perfiles>().findBy(x => x.KeyName == key).FirstOrDefault();
                    }

                    roles[key] = rol;
                }
                #endregion

                #region CREACION DE ACCESOS

                var elementsType = (from iface in assembly.GetTypes()
                                    where iface.Namespace != null && iface.Namespace.Contains("Controllers")
                                    select iface);

                foreach (Type item in elementsType)
                {
                    menuAttribute = (MenuDescription)item.GetTypeInfo().GetCustomAttribute(typeof(MenuDescription), false);
                    if (menuAttribute != null)
                    {
                        menues.Add(menuAttribute, item);
                    }
                    attribute = (SecurityDescription)item.GetTypeInfo().GetCustomAttribute(typeof(SecurityDescription), false);

                    if (attribute != null)
                    {
                        itemClass       = new Gq_accesosDto();
                        itemClass.Clase = getNameObject(item);

                        if (attribute.Estado == SecurityDescription.SeguridadEstado.Activo)
                        {
                            itemClass.Metodo      = null;
                            itemClass.Nombre      = attribute.Name;
                            itemClass.extra       = attribute;
                            itemClass.Descripcion = "Class :" + attribute.Name;

                            //obtenerProfiles(attribute, roles);

                            items.Add(itemClass);
                        }

                        foreach (MethodInfo method in item.GetMethods())
                        {
                            menuAttribute = (MenuDescription)method.GetCustomAttribute(typeof(MenuDescription), true);
                            if (menuAttribute != null)
                            {
                                menues.Add(menuAttribute, method);
                            }

                            attribute = (SecurityDescription)method.GetCustomAttribute(typeof(SecurityDescription), true);
                            if (attribute != null && attribute.Estado == SecurityDescription.SeguridadEstado.Activo)
                            {
                                itemMethod             = new Gq_accesosDto();
                                itemMethod.Clase       = itemClass.Clase;
                                itemMethod.Metodo      = method.Name;
                                itemMethod.Nombre      = attribute.Name;
                                itemMethod.Descripcion = "Method :" + attribute.Name;
                                itemMethod.extra       = attribute;

                                //obtenerProfiles(attribute, roles);

                                items.Add(itemMethod);
                            }
                        }
                    }
                }

                foreach (Gq_accesosDto ii in items)
                {
                    var data = Services.Get <ServGq_accesos>().findBy(x => x.Clase == ii.Clase && x.Metodo == ii.Metodo).FirstOrDefault();
                    if (data == null)
                    {
                        data             = new Gq_accesos();
                        data.Clase       = ii.Clase;
                        data.Metodo      = ii.Metodo;
                        data.Descripcion = ii.Descripcion;
                        data.Nombre      = ii.Nombre;

                        Services.Get <ServGq_accesos>().Agregar(data);


                        data = Services.Get <ServGq_accesos>().findBy(x => x.Clase == ii.Clase && x.Metodo == ii.Metodo).FirstOrDefault();
                    }
                    else
                    {
                        data.Nombre = ii.Nombre;

                        Services.Get <ServGq_accesos>().Actualizar(data);
                    }

                    attribute = (SecurityDescription)ii.extra;
                    if (attribute.Perfiles != null && attribute.Perfiles.Length > 0)
                    {
                        for (int i = 0; i < attribute.Perfiles.Length; i++)
                        {
                            var dataPerfiles = Services.Get <ServGq_perfiles_accesos>().findBy(x => x.AccesoId == data.AccesoId && x.PerfilId == roles[attribute.Perfiles[i]].PerfilId).FirstOrDefault();
                            if (dataPerfiles == null)
                            {
                                dataPerfiles                = new Gq_perfiles_accesos();
                                dataPerfiles.AccesoId       = data.AccesoId.Value;
                                dataPerfiles.PerfilId       = roles[attribute.Perfiles[i]].PerfilId.Value;
                                dataPerfiles.GrantPermition = "1";
                                dataPerfiles.Estado         = "A";
                                dataPerfiles.Creado         = DateTime.Now;
                                dataPerfiles.Modificado     = DateTime.Now;
                                dataPerfiles.CreadoPor      = dataPerfiles.ModificadoPor = -1;

                                Services.Get <ServGq_perfiles_accesos>().Agregar(dataPerfiles);
                            }
                        }
                    }
                }


                #endregion

                #region CREACION DE USUARIO ADMINISTRADOR

                var usuario = Services.Get <ServGq_usuarios>().findBy(x => x.Usuario == "admin").FirstOrDefault();

                if (usuario == null)
                {
                    usuario = new Gq_usuarios
                    {
                        Nombre        = "Admin",
                        Apellido      = "Admin",
                        Usuario       = "admin",
                        Clave         = Encriptacion.Encriptar("admin1234", Constantes.CLAVE_ENCRIPTACION),
                        Email         = "",
                        Estado        = Constantes.ESTADO_ACTIVO,
                        PerfilId      = roles[ROL_ADMI].PerfilId.Value,
                        Creado        = DateTime.Now,
                        Modificado    = DateTime.Now,
                        CreadoPor     = -1,
                        ModificadoPor = -1,
                        RequiereClave = "N",
                    };

                    Services.Get <ServGq_usuarios>().Agregar(usuario);
                }


                #endregion

                #region CREACION DE MENUES

                var menu = Services.Get <ServGq_menu>().findBy(x => x.KeyName == MENU_CONFIG_ID).FirstOrDefault();

                if (menu == null)
                {
                    menu = new Gq_menu();
                    menu.MenuPosition  = MENU_CONFIG_ID;
                    menu.KeyName       = MENU_CONFIG_ID;
                    menu.Nombre        = "Menu";
                    menu.MenuIcono     = "fa fa-fw fa-cogs";
                    menu.Creado        = DateTime.Now;
                    menu.Modificado    = DateTime.Now;
                    menu.CreadoPor     = -1;
                    menu.ModificadoPor = -1;
                    menu.Estado        = Constantes.ESTADO_ACTIVO;

                    Services.Get <ServGq_menu>().Agregar(menu);
                }

                foreach (var m in menues.Keys)
                {
                    menu = Services.Get <ServGq_menu>().findBy(x => x.KeyName == m.Id).FirstOrDefault();
                    if (menu == null)
                    {
                        var obj = menues[m];

                        menu = new Gq_menu();
                        menu.MenuPosition  = m.Id;
                        menu.Nombre        = m.Description;
                        menu.KeyName       = m.Id;
                        menu.MenuIcono     = "";
                        menu.MenuPadre     = m.IdParent;
                        menu.Creado        = DateTime.Now;
                        menu.Modificado    = DateTime.Now;
                        menu.CreadoPor     = -1;
                        menu.ModificadoPor = -1;
                        menu.Estado        = Constantes.ESTADO_ACTIVO;

                        if (obj is Type)
                        {
                            menu.MenuUrl = ((Type)obj).Name.Replace("Controller", "");
                        }
                        else if (obj is MethodInfo)
                        {
                            menu.MenuUrl = ((MethodInfo)obj).DeclaringType.Name.Replace("Controller", "") + @"/" + ((MethodInfo)obj).Name;
                        }

                        Services.Get <ServGq_menu>().Agregar(menu);
                    }
                }
                #endregion

                transaction.Commit();
            }
        }