private void Save() { try { using (var prestoWcf = new PrestoWcf <IBaseService>()) { this.GlobalSetting = prestoWcf.Service.SaveGlobalSetting(this.GlobalSetting); } } catch (FaultException ex) { ViewModelUtility.MainWindowViewModel.AddUserMessage(ex.Message); ShowUserMessage(ex.Message, ViewModelResources.ItemNotSavedCaption); return; } using (var prestoWcf = new PrestoWcf <IBaseService>()) { prestoWcf.Service.SaveLogMessage(string.Format(CultureInfo.CurrentCulture, "Global settings updated. Freeze all installations is now {0}.", this.GlobalSetting.FreezeAllInstallations)); } ViewModelUtility.MainWindowViewModel.AddUserMessage(ViewModelResources.GlobalSettingsSaved); }
public Application SaveApplication(Application application) { using (var prestoWcf = new PrestoWcf <IApplicationService>()) { return(prestoWcf.Service.SaveApplication(application)); } }
private void SetInstallationSummaryListBasedOnUserInput() { using (var prestoWcf = new PrestoWcf <IInstallationSummaryService>()) { if (this.ApplicationServer != null && this.Application != null) { this.InstallationSummaryList = new Collection <InstallationSummary>( prestoWcf.Service.GetMostRecentByStartTimeServerAndApplication(50, this.ApplicationServer.Id, this.Application.Id, DateTime.Now).ToList()); return; } if (this.ApplicationServer != null) { this.InstallationSummaryList = new Collection <InstallationSummary>( prestoWcf.Service.GetMostRecentByStartTimeAndServer(50, this.ApplicationServer.Id, DateTime.Now).ToList()); return; } if (this.Application != null) { this.InstallationSummaryList = new Collection <InstallationSummary>( prestoWcf.Service.GetMostRecentByStartTimeAndApplication(50, this.Application.Id, DateTime.Now).ToList()); return; } // No filter; just get the most recent. this.InstallationSummaryList = new Collection <InstallationSummary>(prestoWcf.Service.GetMostRecentByStartTime(50, DateTime.Now).ToList()); } }
//[Functionality(FunctionalityName = "GetApps")] // Disable for now because MES KLM Developers Contract also needs access. public IEnumerable <ApplicationDtoSlim> Get(bool includeArchivedApps) { using (var prestoWcf = new PrestoWcf <IApplicationService>()) { return(prestoWcf.Service.GetAllApplicationsSlim(includeArchivedApps).OrderBy(x => x.Name)); } }
private void SaveVariableGroup(Action actionIfSaveFails) { string selectedGroupName = this.SelectedCustomVariableGroup.Name; try { using (var prestoWcf = new PrestoWcf <ICustomVariableGroupService>()) { var savedGroup = prestoWcf.Service.SaveGroup(this.SelectedCustomVariableGroup); UpdateCacheWithSavedItem(savedGroup); this.SelectedCustomVariableGroup = savedGroup; } InitializeCustomVariableGroupsCollectionView(() => ApplyDisabledFilterToCustomVariableGroups()); } catch (FaultException ex) { ViewModelUtility.MainWindowViewModel.AddUserMessage(ex.Message); ShowUserMessage(ex.Message, ViewModelResources.ItemNotSavedCaption); if (actionIfSaveFails != null) { actionIfSaveFails.Invoke(); } return; } ViewModelUtility.MainWindowViewModel.AddUserMessage(string.Format(CultureInfo.CurrentCulture, ViewModelResources.ItemSaved, selectedGroupName)); }
private void DeleteVariableGroup() { if (!UserConfirmsDelete(this.SelectedCustomVariableGroup.Name)) { return; } if (string.IsNullOrEmpty(this.SelectedCustomVariableGroup.Id)) { // Group hasn't ever been saved. Just remove it from the list. this.CustomVariableGroups.Remove(this.SelectedCustomVariableGroup); return; } try { CustomVariableGroup deletedGroup = this.CustomVariableGroups.FirstOrDefault(x => x.Id == this.SelectedCustomVariableGroup.Id); using (var prestoWcf = new PrestoWcf <ICustomVariableGroupService>()) { prestoWcf.Service.DeleteGroup(deletedGroup); } this.CustomVariableGroups.Remove(deletedGroup); } catch (Exception ex) { ViewModelUtility.MainWindowViewModel.AddUserMessage(ex.Message); ShowUserMessage(ex.Message, ViewModelResources.ItemCannotBeDeletedCaption); return; } }
private async void HydrateServerPingDtoList() { if (this.ServerPingDtoList == null) { IEnumerable allServers = await Task.Run(() => { using (var prestoWcf = new PrestoWcf <IServerService>()) { return(prestoWcf.Service.GetAllServers(false)); } }); var localDtoList = new List <ServerPingDto>(); foreach (ApplicationServer server in allServers) { localDtoList.Add(new ServerPingDto() { ApplicationServer = server }); } this.ServerPingDtoList = new PrestoObservableCollection <ServerPingDto>(); this.ServerPingDtoList.ClearItemsAndNotifyChangeOnlyWhenDone(); this.ServerPingDtoList.AddRange(localDtoList); NotifyPropertyChanged(() => this.ServerPingDtoList); Refresh(null); _pingsLoaded = true; NotifyPropertyChanged(() => ShowWaitCursor); } }
public GlobalSetting Save(GlobalSetting globalSetting) { using (var prestoWcf = new PrestoWcf <IBaseService>()) { var savedGlobalSetting = prestoWcf.Service.SaveGlobalSetting(globalSetting); return(savedGlobalSetting); } }
public GlobalSetting Get() { using (var prestoWcf = new PrestoWcf <IBaseService>()) { var globalSetting = prestoWcf.Service.GetGlobalSettingItem(); return(globalSetting); } }
private static void HydrateTaskApps(ApplicationWithOverrideVariableGroup appWithGroupBundle) { // See ReadMe_AppWithGroupMapping.docx, in the same folder as this class, for a diagram overview. // When this method is complete, the innermost appWithGroup should have all of the CVGs in it, // because that is what gets passed to the tasks that execute. When a taskApp runs, it calls // this.AppWithGroup.Install(...). That means the tasks don't have access to the bundle; just // the appWithGroup within it. // The override CVGs will go here: innermostAppWithGroup.CVGs // All other CVGs will go here: innermostAppWithGroup.App.CVGs // TaskApp tasks are stored with only the IDs for the Application and CustomVariableGroup properties. // Hydrate those before installing. foreach (var task in appWithGroupBundle.Application.Tasks.Where(x => x.PrestoTaskType == TaskType.App)) { var taskApp = task as TaskApp; if (taskApp.AppWithGroup.Application == null) { using (var prestoWcf = new PrestoWcf <IApplicationService>()) { taskApp.AppWithGroup.Application = prestoWcf.Service.GetById(taskApp.AppWithGroup.ApplicationId); } } /*********************************************************************************************************** * Normal CVGs * ***********************************************************************************************************/ // Add the bundle's app's CVGs to the taskApp appWithGroupBundle.Application.CustomVariableGroups.ForEach(x => taskApp.AppWithGroup.Application.CustomVariableGroups.Add(x)); // For each task app in the bundle, add its CVGs to the taskApp. if (taskApp.AppWithGroup.CustomVariableGroups != null) { foreach (var cvg in taskApp.AppWithGroup.CustomVariableGroups) { taskApp.AppWithGroup.Application.CustomVariableGroups.Add(cvg); } } /*********************************************************************************************************** * OVERRIDES * ***********************************************************************************************************/ // It's not possible to have overrides on taskApp.AppWithGroup.CustomVariableGroups because the overrides // are set with the bundle. So let's initialize the CVGs so we can store the bundle's overrides here. taskApp.AppWithGroup.CustomVariableGroups = new PrestoObservableCollection <CustomVariableGroup>(); // These are the overrides. if (appWithGroupBundle.CustomVariableGroups != null) { taskApp.AppWithGroup.CustomVariableGroups.AddRange(appWithGroupBundle.CustomVariableGroups); } } }
public Application Get(string id) { // Because RavenDB has a slash in the ID. The caller replaced it with ^^. id = id.Replace("^^", "/"); using (var prestoWcf = new PrestoWcf <IApplicationService>()) { return(prestoWcf.Service.GetById(id)); } }
public ActionResult GetAppById(string appId) { Application app = null; using (var prestoWcf = new PrestoWcf <IApplicationService>()) { app = prestoWcf.Service.GetById(appId); } JsonResult jsonResult = new JsonResult(); jsonResult.Data = app; return(jsonResult); }