Example #1
0
        //Lấy danh sách menu khi thay đổi hotel
        public List <MenuCheck> LoadData(string menuIDs, string languageID)
        {
            //check logged
            var         menuIsSelect = new List <MenuCheck>();
            List <Menu> listMenu     =
                MenuController.GetListMenu(SystemMenuLocation.ListLocationMenu().ToList()[0].LocationId, languageID);
            var listMenuIds = new int[1];

            if (string.IsNullOrEmpty(menuIDs) == false)
            {
                listMenuIds =
                    menuIDs.Substring(0, menuIDs.Length - 1)
                    .Split(',')
                    .Select(n => Convert.ToInt32(n))
                    .ToArray();
            }
            menuIsSelect =
                listMenu.Select(a => new MenuCheck
            {
                Checked = listMenuIds.Contains(a.ID) ? "checked" : "",
                Level   = (int)a.Level,
                ID      = a.ID,
                Title   = a.Title
            }).ToList();
            return(menuIsSelect);
        }
Example #2
0
        public void LoadData()
        {
            var listMenu = new List <SelectListItem>();

            listMenu.Add(new SelectListItem {
                Value = "0", Text = "---Select a menu---"
            });
            List <Menu> getListMenu =
                MenuController.GetListMenu(SystemMenuLocation.ListLocationMenu().ToList()[0].LocationId,
                                           Request.Cookies["lang_client"].Value)
                .Where(a => a.Type == SystemMenuType.Tour && a.Level == 1)
                .ToList();

            foreach (Menu menu in getListMenu)
            {
                string subTitle = "";
                for (int i = 1; i <= menu.Level; i++)
                {
                    subTitle += "|--";
                }
                menu.Title = subTitle + menu.Title;
            }
            listMenu.AddRange(getListMenu.Select(a => new SelectListItem
            {
                Value =
                    a.ID.ToString(
                        CultureInfo.InvariantCulture),
                Text = a.Title
            }).ToList());
            ViewBag.ListMenu = listMenu;
        }
Example #3
0
        public SystemMenuLocation GetLocaltion(int locationId)
        {
            SystemMenuLocation menuLocation =
                SystemMenuLocation.ListLocationMenu().ToList().FirstOrDefault(m => m.LocationId == locationId);

            if (menuLocation != null)
            {
                return(menuLocation);
            }
            string aliasMenu = Request.QueryString["location"];

            if (string.IsNullOrEmpty(aliasMenu) == false)
            {
                return(SystemMenuLocation.ListLocationMenu().ToList().FirstOrDefault(m => m.AliasMenu == aliasMenu));
            }
            return(new SystemMenuLocation {
                AliasMenu = "MainMenu", TitleMenu = "Main menu", LocationId = 1
            });
        }
Example #4
0
        public JsonResult GetListMenu(int typeMenu, string languageID)
        {
            //check logged
            var listMenu = new List <Menu>();

            listMenu = MenuController.GetListMenu(SystemMenuLocation.ListLocationMenu().ToList()[0].LocationId, languageID);
            listMenu = listMenu.Where(a => a.Type == typeMenu).ToList();

            foreach (Menu menu in listMenu)
            {
                string titleMenu = "";
                for (int i = 1; i <= menu.Level; i++)
                {
                    titleMenu += "|--";
                }
                menu.Title = titleMenu + menu.Title;
            }
            return(Json(new { Result = "OK", ListMenu = listMenu.Select(a => new { MenuId = a.ID, a.Title }).ToList() }));
        }
Example #5
0
        public void LoadData2()
        {
            var listMenu = new List <SelectListItem>();

            listMenu.Add(new SelectListItem {
                Value = "0", Text = "---Select a menu---"
            });
            List <Menu> getListMenu =
                MenuController.GetListMenu(SystemMenuLocation.ListLocationMenu().ToList()[0].LocationId,
                                           Request.Cookies["lang_client"].Value)
                .Where(a => a.Type == SystemMenuType.Tour && a.Status)
                .ToList();

            listMenu.AddRange(getListMenu.Select(a => new SelectListItem
            {
                Value =
                    a.ID.ToString(
                        CultureInfo.InvariantCulture),
                Text = a.Title
            }).ToList());
            ViewBag.ListMenu3 = listMenu;
        }