Ejemplo n.º 1
0
        public void LoadData()
        {
            var listMenu = new List <SelectListItem>();

            listMenu.Add(new SelectListItem {
                Value = "0", Text = "---Select a menu---"
            });
            var getListMenu = new List <Menu>();

            getListMenu = MenuController.GetListMenu(SystemMenuLocation.MainMenu, Request.Cookies["lang_client"].Value).Where(a => a.Type == SystemMenuType.Hotel && a.LanguageID == Request.Cookies["lang_client"].Value).ToList();
            foreach (var menu in getListMenu)
            {
                string subTitle = "";
                for (int i = 1; i <= menu.Level; i++)
                {
                    subTitle += "|--";
                }
                menu.Title = subTitle + menu.Title;
            }
            //getListMenu = GetListMenu().Where( a =>
            //  a.Type == SystemMenuType.Hotel).ToList();
            listMenu.AddRange(getListMenu.Select(a => new SelectListItem
            {
                Value =
                    a.ID.ToString(
                        CultureInfo.InvariantCulture),
                Text = a.Title
            }).ToList());
            ViewBag.ListMenu = listMenu;

            var listMenu2 = new List <SelectListItem>();

            listMenu2.Add(new SelectListItem {
                Value = "0", Text = "---Select a menu---"
            });
            var getListMenu2 = new List <Menu>();

            getListMenu2 = MenuController.GetListMenu(SystemMenuLocation.MainMenu, Request.Cookies["LanguageID"].Value).Where(a => a.Type == SystemMenuType.Tour).ToList();
            foreach (var menu in getListMenu2)
            {
                string subTitle = "";
                for (int i = 1; i <= menu.Level; i++)
                {
                    subTitle += "|--";
                }
                menu.Title = subTitle + menu.Title;
            }
            listMenu2.AddRange(getListMenu2.Select(a => new SelectListItem
            {
                Value =
                    a.ID.ToString(
                        CultureInfo.InvariantCulture),
                Text = a.Title
            }).ToList());
            ViewBag.ListMenuLocation = listMenu2;

            List <SelectListItem> listStar = new List <SelectListItem>();

            listStar.Add(new SelectListItem
            {
                Text  = "Select star",
                Value = ""
            });
            listStar.Add(new SelectListItem
            {
                Text  = "2",
                Value = "2"
            });
            listStar.Add(new SelectListItem
            {
                Text  = "3",
                Value = "3"
            });
            listStar.Add(new SelectListItem
            {
                Text  = "4",
                Value = "4"
            });
            listStar.Add(new SelectListItem
            {
                Text  = "5",
                Value = "5"
            });
            ViewBag.ListStar = listStar;
        }