private void UpdateGroupViewModel(ClientGroupViewModel groupViewModel, ClientGroupDto groupDto) { groupViewModel.Name = groupDto.Name; if (groupDto.Clients != null) { _appDispatcher.Current.BeginInvoke(DispatcherPriority.Background, (Action)(() => { var toRemove = groupViewModel.Clients.ToList(); foreach (var clientId in groupDto.Clients) { var existingClient = groupViewModel.Clients.FirstOrDefault(x => x.ClientId == clientId); if (existingClient != null) { toRemove.Remove(existingClient); } else { groupViewModel.Clients.Add(Clients[clientId]); } } foreach (var clientViewModel in toRemove) { groupViewModel.Clients.Remove(clientViewModel); } })); } }
public async Task <ClientConfigurationDto> DownloadConfiguration(ClientGroupViewModel group, string outputPath) { if (group != null) { _logger.LogInformation("Download client configuration of group {groupId} ({groupName})", group.ClientGroupId, group.Name); } else { _logger.LogInformation("Download global configuration"); } ClientConfigurationDto config; try { config = await ClientConfigurationsResource.GetClientConfiguration(group?.ClientGroupId, _restClient); } catch (RestNotFoundException) { _logger.LogWarning("No configuration for {{groupName}} does exist, skip.", group?.Name); return(null); } var filename = $"mazesettings{group?.ClientGroupId}.json"; _fileSystem.File.WriteAllText(_fileSystem.Path.Combine(outputPath, filename), config.Content); return(config); }
/// <summary> /// Summary View of the data from database. /// </summary> /// <returns></returns> // [TypeFilter(typeof(AuthorizeAction), Arguments = new object[] { "Read" })] public IActionResult Index() { ClientGroupViewModel model = new ClientGroupViewModel(); InitAccessModel(model); return(View(model)); }
/// <summary> /// Add and Update view of the Model /// </summary> /// <returns></returns> // [TypeFilter(typeof(AuthorizeAction), Arguments = new object[] { "Write" })] public IActionResult ClientGroup() { ClientGroupViewModel model = new ClientGroupViewModel { CountryList = _clientGroupService.GetDropdownCountry() }; InitAccessModel(model); return(View(model)); }
/// <summary> /// Add Update data based on their ID /// </summary> /// <param name="model"></param> /// <returns></returns> // [TypeFilter(typeof(AuthorizeAction), Arguments = new object[] { "Write" })] public IActionResult AddUpdate(ClientGroupViewModel model) { JsonResponse resp = new JsonResponse(); if (ModelState.IsValid) { return(Json(_clientGroupService.AddUpdate(model.clientGroup))); } else { resp.Message = Constants.ControllerMessage.All_Fields_Mandatory; return(Json(resp)); } }
public GroupCheckedObserver(ClientGroupViewModel group, IList items) { _group = group; _items = items; if (group.Clients is INotifyCollectionChanged collectionChanged) { collectionChanged.CollectionChanged += CollectionChangedOnCollectionChanged; } if (items is INotifyCollectionChanged collectionChanged2) { collectionChanged2.CollectionChanged += CollectionChangedOnCollectionChanged; } UpdateIsChecked(); }
/// <summary> /// Get the Data based on ID and return to the model to update view. /// </summary> /// <param name="ID"></param> /// <returns></returns> // [TypeFilter(typeof(AuthorizeAction), Arguments = new object[] { "Write" })] public IActionResult UpdateClientGroup(int ID) { ClientGroupViewModel model = new ClientGroupViewModel(); InitAccessModel(model); model.clientGroup = _clientGroupService.GetData(ID); if (model.clientGroup != null) { model.CountryList = _clientGroupService.GetDropdownCountry(); model.StateList = _clientGroupService.GetDropdownState(model.clientGroup.CountryID); model.CityList = _clientGroupService.GetDropdownCity(model.clientGroup.StateID); return(View("ClientGroup", model)); } else { return(View("Index", model)); } }
public GroupPresenterViewModel(ClientGroupViewModel group) { Group = group; OnlineClients = new ListCollectionView((IList)group.Clients); OnlineClients.LiveFilteringProperties.Add(nameof(ClientViewModel.IsSocketConnected)); OnlineClients.IsLiveFiltering = true; OnlineClients.Filter = OnlineClientFilter; OnlineClients.Refresh(); ActiveClients24H = new ListCollectionView((IList)group.Clients); ActiveClients24H.LiveFilteringProperties.Add(nameof(ClientViewModel.IsSocketConnected)); ActiveClients24H.IsLiveFiltering = true; ActiveClients24H.Filter = ActiveClientFilter; ActiveClients24H.Refresh(); ActiveClients7Days = new ListCollectionView((IList)group.Clients); ActiveClients7Days.LiveFilteringProperties.Add(nameof(ClientViewModel.IsSocketConnected)); ActiveClients7Days.IsLiveFiltering = true; ActiveClients7Days.Filter = ActiveClients7DaysFilter; ActiveClients7Days.Refresh(); }