public ActionResult AllPasbaApps() { AppsViewModel viewModel = new AppsViewModel(); viewModel.Apps = dbContext.PasbaApps.ToList(); return(PartialView(viewModel)); }
public JsonResult GetApps(string appCode) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); AppNavigation app = null; app = this.Engine.AppNavigationManager.GetApp(appCode); if (app == null) { result.Success = false; result.Message = "msgGlobalString.NullObjectException"; } else { AppsViewModel model = new AppsViewModel() { AppCode = app.AppCode, Description = app.Description, DisplayName = app.DisplayName, DockOnHomePage = app.DockOnHomePage == OThinker.Data.BoolMatchValue.True, Image = app.IconUrl, ObjectID = app.ObjectID, SortKey = app.SortKey, VisibleOnPortal = app.VisibleOnPortal == OThinker.Data.BoolMatchValue.True, VisibleOnMobile = app.VisibleOnMobile == OThinker.Data.BoolMatchValue.True, WeChatID = app.WeChatID, DingTalkID = app.DingTalkID }; result.Success = true; result.Extend = model; } return Json(result, JsonRequestBehavior.AllowGet); })); }
//TODO: Figure out how to restrict access to these actions //[ChildActionOnly]<-- Can't do this because of the way the action is called public ActionResult MyPasbaApps() { AppsViewModel viewModel = new AppsViewModel(); viewModel.Apps = dbContext.PasbaApps.Where(a => a.IsFavorite == true); return(PartialView("_MyAppsPartial", viewModel)); }
public OpenApp() { InitializeComponent(); BindingContext = viewModel = new AppsViewModel(); App = new Apps { Dir = "Item name", //Description = "This is an item description." }; BindingContext = this; }
public ActionResult Index(int?pageIndex, string sortBy) { var apps = _context.Apps.Include(p => p.AppType).ToList(); var appViewModel = new AppsViewModel { Apps = apps }; //return Content(String.Format("PageIndex = {0} sortBy={1}", pageIndex, sortBy)) return(View(appViewModel)); ; }
private async Task <ActionResult> Show(string domain, string apiToken) { var apiUri = new UriBuilder("https", domain, 443, "api/v2").Uri; var apiClient = new ManagementApiClient(apiToken, apiUri); var appsTask = apiClient.Clients.GetAllAsync(fields: "name,client_id,global"); var rulesTask = apiClient.Rules.GetAllAsync(fields: "name,script,id,enabled,order"); // if we want rules for all stages: //var rulesStages = new[] { "login_success", "login_failure", "pre_authorize", "user_registration", "user_blocked" }; //var rulesTask = // Task.WhenAll( // rulesStages.Select( // stage => apiClient.Rules.GetAllAsync(fields: "name,script,id,enabled,order", stage: stage))) // .ContinueWith(t => t.Result.SelectMany(r => r)); await Task.WhenAll(appsTask, rulesTask); var apps = appsTask.Result // "All Applications" is a special client app, not meant to be managed by the user. .Where(a => a.Name != "All Applications"); var rules = rulesTask.Result; var matches = RulesMatcher.FindMatches(rules, apps); var model = new AppsViewModel() { Clients = apps.Select( c => new ClientToRulesViewModel() { Client = c, Rules = matches.Where( p => p.Value == null || p.Value.MatchedClients.Contains(c)) .Select( p => new RelatedRuleViewModel(p.Key) { SpecificForApp = p.Value != null }) }), Rules = matches }; this.ViewBag.Domain = domain; return(this.View("Index", model)); }
private void New_App_Button_Click(object sender, RoutedEventArgs e) { object element = this.viewModel.RoboViewModel.SelectedNode; if (element != null && element.GetType().Name.Equals("TestSuitViewModel")) { TestSuitViewModel elementModel = (TestSuitViewModel)element; AppsViewModel app = new AppsViewModel(); app.Name = "3rd App"; app.Description = "3rd App desc"; elementModel.AllCollection.Add(app); elementModel.IsExpanded = true; app.IsSelected = true; } else { MessageBox.Show("Please select the suit under which new Web/App to be added.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public bool Serialize(XmlTextWriter w, RoboViewModel robo) { this.writer = w; Type suitCollectionType = new ObservableCollection <TestSuitViewModel>().GetType(); Type sequenceCollectionType = new ObservableCollection <TestSequenceViewModel>().GetType(); Type stepCollectionType = new ObservableCollection <TestStepViewModel>().GetType(); Type appsCollectionType = new ObservableCollection <AppsViewModel>().GetType(); Type dataSourceCollectionType = new ObservableCollection <DataSourceViewModel>().GetType(); Type variableCollectionType = new ObservableCollection <VariableViewModel>().GetType(); Type stringType = string.Empty.GetType(); Type boolType = bool.TrueString.GetType(); Type intType = int.MinValue.GetType(); Type doubleType = double.MinValue.GetType(); Type suitType = new TestSuitViewModel().GetType(); Type seqType = new TestSequenceViewModel().GetType(); Type stepType = new TestStepViewModel().GetType(); Type appType = new AppsViewModel().GetType(); Type dsType = new DataSourceViewModel().GetType(); Type varType = new VariableViewModel().GetType(); Type[] types = { suitCollectionType, sequenceCollectionType, stepCollectionType, appsCollectionType, dataSourceCollectionType, variableCollectionType, stringType, boolType, intType, doubleType, suitType, seqType, stepType, appType, dsType, varType }; writer.WriteStartDocument(true); writer.Formatting = Formatting.Indented; writer.Indentation = 2; writer.WriteStartElement("Suits"); AppendNodeRobo(types, robo); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); return(true); }
public IActionResult Apps() { var model = new AppsViewModel(); return(View(model)); }
public JsonResult SaveApps(AppsViewModel model) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); AppNavigation App = null; if (!string.IsNullOrEmpty(model.ObjectID)) { App = this.Engine.AppNavigationManager.GetApp(model.AppCode); } else { if (!this.AppsAuthorized) { result.Success = false; result.Message = "Apps.NotAuthorized"; } else if (this.Engine.AppNavigationManager.GetApp(model.AppCode) != null || this.Engine.FunctionAclManager.GetFunctionNodeByCode(model.AppCode) != null) { result.Success = false; result.Message = "Apps.CodeExists"; } else { result.Success = true; } if (result.Success) { App = new AppNavigation(); } } if (App != null) { App.AppCode = model.AppCode; App.DisplayName = model.DisplayName; App.WeChatID = model.WeChatID; App.IconUrl = model.Image; App.Description = model.Description; App.SortKey = model.SortKey; //App.Url = txtUrl.Text; App.VisibleOnPortal = model.VisibleOnPortal ? OThinker.Data.BoolMatchValue.True : OThinker.Data.BoolMatchValue.False; App.DockOnHomePage = model.DockOnHomePage ? OThinker.Data.BoolMatchValue.True : OThinker.Data.BoolMatchValue.False; App.VisibleOnMobile = model.VisibleOnMobile ? OThinker.Data.BoolMatchValue.True : OThinker.Data.BoolMatchValue.False; if (string.IsNullOrEmpty(model.ObjectID)) { result.Success = this.Engine.AppNavigationManager.AddApp(App); App = this.Engine.AppNavigationManager.GetApp(model.AppCode); } else { result.Success = this.Engine.AppNavigationManager.UpdateApp(App); } FunctionNode AppsNode = this.Engine.FunctionAclManager.GetFunctionNodeByCode(FunctionNode.Category_Apps_Code); if (AppsNode != null) { result.Extend = new { AppCode = App.AppCode, ParentId = AppsNode.ObjectID } } ; else { result.Extend = new { AppCode = App.AppCode } }; } return Json(result, JsonRequestBehavior.AllowGet); })); }
private static void ComboboxSelectionChnaged(object sender, SelectionChangedEventArgs e) { AppsViewModel DSViewModel = (AppsViewModel)testCaseTreeView.SelectedItem; ComboBox combo = (ComboBox)sender; string app = (string)combo.SelectedValue; DSViewModel.SelectedIndex = combo.SelectedIndex; if (app.Equals("Chrome")) { object o = GetRegKey("chrome.exe"); if (o != null) { setAppPath(o.ToString()); } } if (app.Equals("Firefox")) { object o = GetRegKey("Firefox.exe"); if (o != null) { setAppPath(o.ToString()); } } if (app.Equals("IE")) { object o = GetRegKey("IEXPLORE.EXE"); if (o != null) { setAppPath(o.ToString()); } } if (app.Equals("EDGE")) { setAppPath("MicrosoftEdge"); } if (app.Equals("Safari")) { object o = GetRegKey("Safari.exe"); if (o != null) { setAppPath(o.ToString()); } } if (app.Equals("Outlook")) { object o = GetRegKey("OUTLOOK.EXE"); if (o != null) { setAppPath(o.ToString()); } } else if (app.Equals("Other")) { setAppPath(""); } }
internal static void DealWithAppsSourceViewModel(AppsViewModel TSModel, Grid designer_main_panel_grid, Grid designer_child_panel_grid, TreeView TestCaseTreeView) { main_grid = designer_main_panel_grid; child_grid = designer_child_panel_grid; testCaseTreeView = TestCaseTreeView; string name = TSModel.Name; string desc = TSModel.Description; Label labelName = new Label(); labelName.Content = "Name"; addToGrid(main_grid, labelName, 0, true); TextBox txtName = new TextBox(); txtName.Text = name; txtName.Name = "Name"; addToGrid(main_grid, txtName, 1, false); Label labelDesc = new Label(); labelDesc.Content = "Description"; addToGrid(main_grid, labelDesc, 0, true); TextBox txtDesc = new TextBox(); txtDesc.TextWrapping = TextWrapping.Wrap; txtDesc.Name = "Description"; txtDesc.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; txtDesc.MinHeight = 70; txtDesc.Text = desc; addToGrid(main_grid, txtDesc, 1, false); Label labelType = new Label(); labelType.Content = "Select App"; addToGrid(main_grid, labelType, 0, true); if (TSModel.AppTypes.Count == 0) { TSModel.AppTypes.Add("Chrome"); TSModel.AppTypes.Add("Firefox"); TSModel.AppTypes.Add("IE"); TSModel.AppTypes.Add("EDGE"); TSModel.AppTypes.Add("Safari"); TSModel.AppTypes.Add("Outlook"); TSModel.AppTypes.Add("Other"); } ComboBox comboType = new ComboBox(); comboType.ItemsSource = TSModel.AppTypes; comboType.SelectionChanged += new SelectionChangedEventHandler(ComboboxSelectionChnaged); addToGrid(main_grid, comboType, 1, false); comboType.SelectedIndex = TSModel.SelectedIndex; Label labelHost = new Label(); labelHost.Content = "App Path"; addToGrid(main_grid, labelHost, 0, true); TextBox txtPath = new TextBox(); txtPath.Name = "AppPath"; txtPath.IsEnabled = false; txtPath.Text = TSModel.AppPath; addToGrid(main_grid, txtPath, 1, false); Button browse = new Button(); browse.Content = "Browse"; browse.Click += Browse_Click; addToGrid(main_grid, browse, 2, false); main_grid.LostFocus += new RoutedEventHandler(AppDetailsEdited); }