public TextViewModel(SystemAdminSubMenu subMenu) { if (subMenu == null) { throw new ArgumentNullException(nameof(subMenu)); } Title = subMenu.Name(); StringBuilder newData = new StringBuilder(); string data = subMenu.Data(); for (int i = 0; i < data.Length; i++) { char character = data[i]; switch (character) { case ' ': newData.Append(" "); break; case '\t': newData.Append(" "); break; case '\n': newData.Append("<br />"); break; case '<': newData.Append("<"); break; case '>': newData.Append(">"); break; case '\r': break; default: newData.Append(character); break; } } Text = newData.ToString(); BreadCrumb = $"<ul><li><a href=\"/SystemAdmin/\">System Admin</a></li><li><a href=\"/SystemAdmin/Index/" + $"{subMenu.ParentMenu.UniqueId}\">{subMenu.ParentMenu.Name()}</a></li><li>{Title}</li></ul>"; }
public IActionResult Text(int id) { SystemAdminSubMenu subMenu = _systemAdminHelperService.GetSubMenuItem(id); if (subMenu == null) { return(Redirect("/SystemAdmin")); } return(View(new TextViewModel(subMenu))); }
public IActionResult Grid(int id) { SystemAdminSubMenu subMenu = _systemAdminHelperService.GetSubMenuItem(id); if (subMenu == null) { return(Redirect("/SystemAdmin/")); } return(View(new GridViewModel(GetModelData(), subMenu))); }
public IActionResult TextEx(int id) { SystemAdminSubMenu subMenu = _systemAdminHelperService.GetSubMenuItem(id); if (subMenu == null) { return(Redirect("/SystemAdmin")); } return(View(new TextExViewModel(GetModelData(), _settingsProvider, subMenu))); }
public MapViewModel(SystemAdminSubMenu subMenu) { if (subMenu == null) { throw new ArgumentNullException(nameof(subMenu)); } Title = subMenu.Name(); MapLocationData = subMenu.Data(); ISettingsProvider settingsProvider = (ISettingsProvider)Classes.PluginClass.GetServiceProvider.GetRequiredService <IPluginClassesService>(); SystemAdminSettings settings = settingsProvider.GetSettings <SystemAdminSettings>("SystemAdmin"); GoogleMapApiKey = settings.GoogleMapApiKey; BreadCrumb = $"<ul><li><a href=\"/SystemAdmin/\">System Admin</a></li><li><a href=\"/SystemAdmin/Index/" + $"{subMenu.ParentMenu.UniqueId}\">{subMenu.ParentMenu.Name()}</a></li><li>{Title}</li></ul>"; }
public GridViewModel(SystemAdminSubMenu subMenu) { if (subMenu == null) { throw new ArgumentNullException(nameof(subMenu)); } Title = subMenu.Name(); // data has to have the header on first row, each column seperated by a pipe | // the data is on all following lines and is also seperated by pipe | // each line is seperated with \r string[] allLines = subMenu.Data().Split('\r'); // must have a header at the very least! if (allLines.Length == 0) { throw new ArgumentNullException(nameof(subMenu.Data)); } Headers = allLines[0].Split('|'); int columnCount = Headers.Length; Items = new List <string[]>(); for (int i = 1; i < allLines.Length; i++) { string[] line = allLines[i].Split('|'); if (line.Length != Headers.Length) { throw new InvalidOperationException("column count much match header column count"); } Items.Add(line); } BreadCrumb = $"<ul><li><a href=\"/SystemAdmin/\">System Admin</a></li><li><a href=\"/SystemAdmin/Index/" + $"{subMenu.ParentMenu.UniqueId}\">{subMenu.ParentMenu.Name()}</a></li><li>{Title}</li></ul>"; }
public TextExViewModel(SystemAdminSubMenu subMenu) { if (subMenu == null) { throw new ArgumentNullException(nameof(subMenu)); } Title = subMenu.Name(); ISettingsProvider settingsProvider = (ISettingsProvider)Classes.PluginClass.GetServiceProvider.GetRequiredService <IPluginClassesService>(); SystemAdminSettings settings = settingsProvider.GetSettings <SystemAdminSettings>("SystemAdmin"); if (settings.DisableFormattedText) { Text = "Formatted Text is not enabed"; } else { Text = subMenu.Data(); } BreadCrumb = $"<ul><li><a href=\"/SystemAdmin/\">System Admin</a></li><li><a href=\"/SystemAdmin/Index/" + $"{subMenu.ParentMenu.UniqueId}\">{subMenu.ParentMenu.Name()}</a></li><li>{Title}</li></ul>"; }