public ActionResult Add() { NavModel model = new NavModel(); Load(); return(View(model)); }
public ActionResult Add(NavModel model) { if (model.Pid != 0 && AdminNavs.GetNavById(model.Pid) == null) { ModelState.AddModelError("Pid", "父导航不存在"); } if (ModelState.IsValid) { NavInfo navInfo = new NavInfo() { Pid = model.Pid, Name = model.NavName, Title = model.NavTitle == null ? "" : model.NavTitle, Url = model.NavUrl, Target = model.Target, DisplayOrder = model.DisplayOrder }; AdminNavs.CreateNav(navInfo); AddMallAdminLog("添加导航", "添加导航,导航为:" + model.NavName); return(PromptView("导航添加成功")); } Load(); return(View(model)); }
public ActionResult List() { String sql = @"SELECT * FROM Nav"; List <NavModel> list = new List <NavModel>(); AccessSqlHelper accHpler = new AccessSqlHelper(); OleDbDataReader reader = accHpler.ExecuteReader(sql, null); if (reader.HasRows) { while (reader.Read()) { NavModel navModel = new NavModel(); navModel.nID = reader.GetInt32(0); object titel = reader.IsDBNull(1) ? null : reader.GetString(1); navModel.title = titel == null ? string.Empty : Convert.ToString(titel); object url = reader.IsDBNull(2) ? null : reader.GetString(2); navModel.url = url == null ? string.Empty : Convert.ToString(url); navModel.order = reader.GetInt32(3); list.Add(navModel); } } ViewBag.list = list; return(View()); }
public ActionResult Edit(NavModel model, int id = -1) { NavInfo navInfo = AdminNavs.GetNavById(id); if (navInfo == null) return PromptView("导航不存在"); if (model.Pid == navInfo.Id) ModelState.AddModelError("Pid", "不能将自己作为父导航"); if (model.Pid != 0 && AdminNavs.GetNavById(model.Pid) == null) ModelState.AddModelError("Pid", "父导航不存在"); if (model.Pid != 0 && AdminNavs.GetSubNavList(navInfo.Id).Exists(x => x.Id == model.Pid)) ModelState.AddModelError("Pid", "不能将导航调整到自己子导航下"); if (ModelState.IsValid) { int oldPid = navInfo.Pid; navInfo.Pid = model.Pid; navInfo.Name = model.NavName; navInfo.Title = model.NavTitle == null ? "" : model.NavTitle; navInfo.Url = model.NavUrl; navInfo.Target = model.Target; navInfo.DisplayOrder = model.DisplayOrder; AdminNavs.UpdateNav(navInfo, oldPid); AddAdminOperateLog("修改导航", "修改导航,导航ID为:" + id); return PromptView("导航修改成功"); } Load(); return View(model); }
void Start() { forwardBtn.onClick.AddListener(ForwardClicked); backBtn.onClick.AddListener(BackClicked); leftBtn.onClick.AddListener(LeftClicked); rightBtn.onClick.AddListener(RightClicked); navModel = navController.GetNavModel(); UpdateViews(); }
public IActionResult Data() { var _all = sysNav.List(x => x.Deleted == false).ToList(); var ReturnData = new NavModel() { tip = "操作成功", @is = true, count = _all.Count, code = 0, msg = "", data = _all }; return(Json(ReturnData)); }
public void LanguageChanges(string lang) { switch (lang) { case "en": NavModel.Culture = CultureLanguage.EN; NavModel.Refresh(); ViewData["LangDes"] = "语言: 英语"; break; default: NavModel.Culture = CultureLanguage.CH; NavModel.Refresh(); ViewData["LangDes"] = "Language: English"; break; } }
public ActionResult Edit(int id = -1) { NavInfo navInfo = AdminNavs.GetNavById(id); if (navInfo == null) return PromptView("导航不存在"); NavModel model = new NavModel(); model.Pid = navInfo.Pid; model.NavName = navInfo.Name; model.NavTitle = navInfo.Title; model.NavUrl = navInfo.Url; model.Target = navInfo.Target; model.DisplayOrder = navInfo.DisplayOrder; Load(); return View(model); }
public NavModel <FlowHandleMenu> InitMenus(Guid instanceId) { var menus = GetFlowHandleBtnNames(instanceId); var model = new NavModel <FlowHandleMenu>(); menus.ForEach(menu => { if (menu.ClassList.Count == 0) { menu.ClassList.Add("nav-btn_primary"); } if (string.IsNullOrEmpty(menu.Url)) { menu.Url = "/flowform/handle"; } }); model.Menus = menus; return(model); }
void Start() { forwardBtn.onClick.AddListener(ForwardClicked); backBtn.onClick.AddListener(BackClicked); leftBtn.onClick.AddListener(LeftClicked); rightBtn.onClick.AddListener(RightClicked); navModel = navController.GetNavModel(); //float xPos = navModel.GetPositionX(); //float yPos = navModel.GetPositionY(); //for(int i=0; i < 10; i++) // { // Button temp = Instantiate(gridButt, new Vector3(i+(-111.9F), 34.2F, 0), Quaternion.identity); //temp.transform.SetParent(display.transform); //} UpdateViews(); }
void Awake() { navModel = new NavModel(); }
void Start() { navModel = navController.GetNavModel(); UpdateViews(); }
private static NavModel GetDefaultNavModel() { var groups = new { FormControls = new NavGroup("Form Controls", 1), Navigation = new NavGroup("Navigation", 2), Layout = new NavGroup("Layout", 3), ButtonsAndIndicators = new NavGroup("Buttons & Indicators", 4), PopupsAndModals = new NavGroup("Popups & Modals", 5), DataTable = new NavGroup("Data Table", 6), Other = new NavGroup("Other", 10), }; var navItems = new[] { new NavItem() { Name = "Validation via EditContext", Url = "EditContext", Group = groups.FormControls, Order = 1 }, new NavItem() { Name = "Autocomplete", Url = "Autocomplete", Group = groups.FormControls, }, new NavItem() { Name = "AutocompleteList", Url = "AutocompleteList", Group = groups.FormControls, }, new NavItem() { Name = "Checkbox", Url = "Checkbox", Group = groups.FormControls, }, new NavItem() { Name = "TextField", Url = "TextField", Group = groups.FormControls, }, new NavItem() { Name = "RadioButton", Url = "RadioButton", Group = groups.FormControls, }, new NavItem() { Name = "Select", Url = "Select", Group = groups.FormControls, }, new NavItem() { Name = "SelectItem", Url = "SelectItem", Group = groups.FormControls, }, new NavItem() { Name = "SelectValue", Url = "SelectValue", Group = groups.FormControls, }, new NavItem() { Name = "Slider", Url = "Slider", Group = groups.FormControls, }, new NavItem() { Name = "SlideToggle", Url = "SlideToggle", Group = groups.FormControls, }, new NavItem() { Name = "Drawer", Url = "Drawer", Group = groups.Navigation }, new NavItem() { Name = "AppBar", Url = "AppBar", Group = groups.Navigation }, new NavItem() { Name = "ButtonLink", Url = "ButtonLink", Group = groups.Navigation }, new NavItem() { Name = "Dialog", Url = "Dialog", Group = groups.PopupsAndModals }, new NavItem() { Name = "Snackbar", Url = "Snackbar", Group = groups.PopupsAndModals }, new NavItem() { Name = "Menu", Url = "Menu", Group = groups.Layout }, new NavItem() { Name = "Card", Url = "Card", Group = groups.Layout }, new NavItem() { Name = "Divider", Url = "Divider", Group = groups.Layout }, new NavItem() { Name = "List", Url = "List", Group = groups.Layout }, new NavItem() { Name = "TreeView", Url = "TreeView", Group = groups.Layout }, new NavItem() { Name = "Button", Url = "Button", Group = groups.ButtonsAndIndicators }, new NavItem() { Name = "Ripple", Url = "Ripple", Group = groups.ButtonsAndIndicators }, new NavItem() { Name = "IconButton", Url = "IconButton", Group = groups.ButtonsAndIndicators }, new NavItem() { Name = "Icon", Url = "Icon", Group = groups.ButtonsAndIndicators }, new NavItem() { Name = "Chip", Url = "Chip", Group = groups.ButtonsAndIndicators }, new NavItem() { Name = "ProgressBar", Url = "ProgressBar", Group = groups.ButtonsAndIndicators }, new NavItem() { Name = "ProgressCircle", Url = "ProgressCircle", Group = groups.ButtonsAndIndicators }, new NavItem() { Name = "Paper & Elevation", Url = "Paper", Group = groups.Layout }, new NavItem() { Name = "Typography", Url = "Typography", Group = groups.Layout }, new NavItem() { Name = "Layout Grid", Url = "LayoutGrid", Group = groups.Layout }, new NavItem() { Name = "Tab", Url = "Tab", Group = groups.Layout }, new NavItem() { Name = "DatePicker", Url = "DatePicker", Group = groups.FormControls }, new NavItem() { Name = "FileUpload", Url = "FileUpload", Group = groups.FormControls }, new NavItem() { Name = "Themes", Url = "Themes", Group = groups.Layout }, new NavItem() { Name = "FAB", Url = "FAB", Group = groups.ButtonsAndIndicators }, new NavItem() { Name = "Expansion Panel", Url = "ExpansionPanel", Group = groups.Layout }, new NavItem() { Name = "Toast", Url = "Toast", Group = groups.PopupsAndModals }, new NavItem() { Name = "Tooltip", Url = "Tooltip", Group = groups.PopupsAndModals }, new NavItem() { Name = "Hidden", Url = "Hidden", Group = groups.Layout }, new NavItem() { Name = "NumericUpDownField", Url = "NumericUpDownField", Group = groups.FormControls }, new NavItem() { Name = "Nav Menu", Url = "NavMenu", Group = groups.Navigation }, new NavItem() { Name = "Table", Url = "Table", Group = groups.DataTable }, new NavItem() { Name = "Paginator", Url = "Paginator", Group = groups.DataTable }, new NavItem() { Name = "SortHeader", Url = "SortHeader", Group = groups.DataTable }, // new NavItem() // { // Name = "DataTable", // Url = "DataTable", // Group = groups.DataTable // }, new NavItem() { Name = "BaseComponent", Url = "BaseComponent", Group = groups.Other }, new NavItem() { Name = "ForwardRef & RefBack", Url = "ForwardRef", Group = groups.Other }, new NavItem() { Name = "Virtual Scroll", Url = "VirtualScroll", Group = groups.Layout }, new NavItem() { Name = "ForwardRefContext", Url = "ForwardRefContext", Group = groups.Other }, new NavItem() { Name = "DialogService", Url = "DialogService", Group = groups.PopupsAndModals }, // new NavItem() // { // Name = "Test", // Url = "Test", // Group = groups.Other // }, }; var model = new NavModel("MatBlazor - Material Design components for Blazor and Razor Components") { NavGroups = navItems .GroupBy(i => i.Group) .OrderBy(i => i.Key.Order) .ThenBy(i => i.Key.Name) .Select(g => { return(new NavGroupModel() { Group = g.Key, Items = g .OrderBy(i => i.Order) .ThenBy(i => i.Name) .ToArray(), }); }) .ToArray() }; return(model); }
/// <summary> /// A helper method to create pagination form submits using transparent buttons /// </summary> /// <param name="html"> A HtmlHelper class</param> /// <param name="pagingModel"> A view model that contains the pagination information</param> /// <param name="pageRange">How many page links should be displayed adjacent to the current page</param> /// <returns>A MvcHtmlString of form submits</returns> public static MvcHtmlString PageLinks(this HtmlHelper html, NavModel pagingModel, int pageRange = 2) { StringBuilder result = new StringBuilder(); if (pageRange < 1) { pageRange = 1; } if (pageRange > 5) { pageRange = 5; } // if there is is only one page, don't show pagination if (pagingModel.MaxPage() == 1) { return(MvcHtmlString.Create(String.Empty)); } // always include the first page if ((pagingModel.CurrentPage - pageRange) > 1) { result.Append(CreateTag(false, 1)); if ((pagingModel.CurrentPage - pageRange) > 2) { result.Append(CreateEllipsis()); } } int min = pagingModel.CurrentPage - pageRange; if (min < 1) { min = 1; } int max = pagingModel.CurrentPage + pageRange; if (max > pagingModel.MaxPage()) { max = pagingModel.MaxPage(); } for (int i = min; i <= max; i++) { result.Append(CreateTag(pagingModel.CurrentPage == i, i)); } // always include the final page if ((pagingModel.CurrentPage + pageRange) < pagingModel.MaxPage()) { if ((pagingModel.CurrentPage + pageRange) < (pagingModel.MaxPage() - 1)) { result.Append(CreateEllipsis()); } result.Append(CreateTag(false, pagingModel.MaxPage())); } return(MvcHtmlString.Create(result.ToString())); }