public PartialViewResult ManageExperiences(int id, int cpsId) { var vm = SchemeModel.GetSchemeExperiences(id); ViewBag.cpsId = cpsId; return(PartialView(vm)); }
public ActionResult GetExperiences([DataSourceRequest] DataSourceRequest request, int containerID) { var vm = SchemeModel.GetSchemeExperiences(containerID); DataSourceResult result = vm.Experiences.ToDataSourceResult(request); return(Json(result)); }
public virtual Task StoreScheme(SchemeModel scheme) { if (!schemes.TryAdd(scheme.Name, scheme)) { throw new InvalidOperationException($"Scheme with name {scheme.Name} already exists."); } return(Task.CompletedTask); }
// GET: /<controller>/ public IActionResult Index() { Model = new SchemeModel() { Name = "Test Scheme" }; return(View("Index", Model)); }
public PartialViewResult CreateNewExperience(ExperienceNodeViewModel experience) { int newId = ExperienceModel.CreateExperience(experience); var vm = SchemeModel.GetSchemeExperiences(experience.SchemeID); vm.CreatedExperienceId = newId; vm.CreatedExperienceName = experience.Name; return(PartialView("ViewExperiences", vm)); }
public IActionResult Update(SchemeModel model) { try { new PropertyAdvsHandler().UpdateNeighborhood(model.Id, model.ToEntity()); TempData.Set <AlertModel>("Alert", new AlertModel($"{model.Name} is updated successfully", AlertModel.AlertType.Success)); } catch (Exception ex) { TempData.Set <AlertModel>("Alert", new AlertModel($"failed to update {model.Name}", AlertModel.AlertType.Error)); } return(RedirectToAction("manage")); }
public void IsValueValiTest() { // Arrange IValidator validator = new RegexValidator(); var scheme = new SchemeModel("^\\d{3}$", "threeNumbers", "Regex"); var value = new ValueModel("threeNumbers", "234"); // Act var valid = validator.IsValueValid(scheme, value); // Assert valid.Should().BeTrue(); }
public SchemeView(SchemeModel schemesModel) { InitializeComponent(); SchemesModel = schemesModel; DataContext = SchemesModel; // TODO: This OptionsStore stuff can be made better! if (SchemesModel.OptionsStore != null) { PreviewRow.Height = !SchemesModel.OptionsStore.IsSchemePreviewVisible ? new GridLength(0) : new GridLength(100); } }
public IActionResult Delete(SchemeModel model) { Neighborhood entity = null; try { entity = new PropertyAdvsHandler().DeleteNeighborhood(model.Id); TempData.Set <AlertModel>("Alert", new AlertModel($"{entity.Name} is deleted successfully", AlertModel.AlertType.Success)); } catch (Exception ex) { TempData.Set <AlertModel>("Alert", new AlertModel($"failed to delete {entity.Name}", AlertModel.AlertType.Error)); } return(RedirectToAction("manage")); }
public Task StoreScheme(SchemeModel scheme) { throw new NotImplementedException(); }
protected override void Initialize() { base.Initialize(); var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // The ToolWindow menu command. var toolWindowCommandId = new CommandID(GuidList.guidTwainsoft_StudioStyler_VSPackageCmdSet, CommandIds.ShowStudioStylesId); var menuToolWin = new MenuCommand(OnShowToolWindow, toolWindowCommandId); mcs.AddCommand(menuToolWin); // The search combobox command. var searchStringCommandId = new CommandID(GuidList.GuidSchemesToolbarCmdSet, CommandIds.SearchStringComboId); var searchStringCommand = new OleMenuCommand(OnSearchString, searchStringCommandId); mcs.AddCommand(searchStringCommand); // The search combobox value list command. var searchStringValuesCommandId = new CommandID(GuidList.GuidSchemesToolbarCmdSet, CommandIds.SearchStringValuesId); var searchSTringValuesCommand = new OleMenuCommand(OnSearchStringValues, searchStringValuesCommandId); mcs.AddCommand(searchSTringValuesCommand); // The clear search command. var clearSearchCommandId = new CommandID(GuidList.GuidSchemesToolbarCmdSet, CommandIds.ClearSearch); var clearSearchCommand = new OleMenuCommand(OnClearSearch, clearSearchCommandId); mcs.AddCommand(clearSearchCommand); // The refresh schemes cache command. var refreshSchemesCacheCommandId = new CommandID(GuidList.GuidSchemesToolbarCmdSet, CommandIds.RefreshSchemesCache); var refreshSchemesCacheCommand = new OleMenuCommand(OnRefreshSchemesCache, refreshSchemesCacheCommandId); mcs.AddCommand(refreshSchemesCacheCommand); // The activate scheme command. var activateSchemeCommandId = new CommandID(GuidList.GuidSchemesToolbarCmdSet, CommandIds.ActivateScheme); var activateSchemeCommand = new OleMenuCommand(OnActivateScheme, activateSchemeCommandId); mcs.AddCommand(activateSchemeCommand); // The history command. var historyCommandId = new CommandID(GuidList.GuidSchemesToolbarCmdSet, CommandIds.SchemesHistory); var historyCommand = new OleMenuCommand(OnHistory, historyCommandId); historyCommand.BeforeQueryStatus += HistoryCommandOnBeforeQueryStatus; mcs.AddCommand(historyCommand); // The first page command. var firstPageCommandId = new CommandID(GuidList.GuidSchemesToolbarCmdSet, CommandIds.FirstPageNavigation); var firstPageCommand = new OleMenuCommand(OnFirstPage, firstPageCommandId); mcs.AddCommand(firstPageCommand); // The previous page command. var previousPageCommandId = new CommandID(GuidList.GuidSchemesToolbarCmdSet, CommandIds.PreviousPageNavigation); var previousPageCommand = new OleMenuCommand(OnPreviousPage, previousPageCommandId); mcs.AddCommand(previousPageCommand); // The next page command. var nextPageCommandId = new CommandID(GuidList.GuidSchemesToolbarCmdSet, CommandIds.NextPageNavigation); var nextPageCommand = new OleMenuCommand(OnNextPage, nextPageCommandId); mcs.AddCommand(nextPageCommand); // The last page command. var lastPageCommandId = new CommandID(GuidList.GuidSchemesToolbarCmdSet, CommandIds.LastPageNavigation); var lastPageCommand = new OleMenuCommand(OnLastPage, lastPageCommandId); mcs.AddCommand(lastPageCommand); } // The general options for this package. var optionsStore = GetDialogPage(typeof(OptionsStore)) as OptionsStore; // Some services that provides important functionalities. StudioStylesService = new StudioStylesService(); SettingsActivator = new SettingsActivator(); // The cache holds all studio styles (called schemes) that are available. SchemeCache = new SchemeCache(StudioStylesService); SchemeHistory = new SchemeHistory(SchemeCache); // Instantiate the models. They are the main classes to interact with the ui and the data. SchemeModel = new SchemeModel(SchemeCache, SchemeHistory, optionsStore, StudioStylesService, SettingsActivator); HistoryModel = new HistoryModel(SchemeHistory, optionsStore, StudioStylesService, SettingsActivator); // Instantiate the views. This are the WPF controls that visualize the styles and the history. SchemeView = new SchemeView(SchemeModel); HistoryView = new HistoryView(HistoryModel); // Some Visual Studio visuals can fire some events so that the model is need very early. Model = SchemeModel; // Save those objects. We need them more than once! Window = FindToolWindow(typeof(SchemeToolWindow), 0, true); if (Window == null || Window.Frame == null) { throw new NotSupportedException(Resources.Resources.CanNotCreateWindow); } var schemesOverview = Window as SchemeToolWindow; if (schemesOverview == null) { throw new InvalidOperationException("Cannot find the SchemesOverviewWindow!"); } SchemeToolWindowView = schemesOverview.Content as SchemeToolWindowView; if (SchemeToolWindowView == null) { throw new InvalidOperationException("Cannot find the StudioStylesView!"); } SchemeToolWindowView.Dock.Children.Add(SchemeView); // Check both model caches (Styles and History) so that saved data is present. SchemeModel.CheckCache(); HistoryModel.CheckCache(); }
public async Task <IActionResult> PostScheme([FromBody] SchemeModel scheme) { await store.StoreScheme(scheme); return(Ok()); }
public PartialViewResult ViewExperiences(int id) { var vm = SchemeModel.GetSchemeExperiences(id); return(PartialView(vm)); }
public PartialViewResult ViewDetails(int id) { var model = SchemeModel.GetSchemeDetails(id); return(PartialView(model)); }
public PartialViewResult ViewVisitorHistorySettings(int id) { var model = SchemeModel.GetSchemeContext(id); return(PartialView(model)); }
virtual public bool IsValueValid(SchemeModel scheme, ValueModel value) { return(Regex.IsMatch(value.Value, scheme.Constraint)); }