// Восстановление контекста public static void RestoreContext(List <View> views) { views.ForEach(view => { view.BusObject.BusObjectComponents.ForEach(component => { SetSelectedRecord(component.BusComp.Name, AllSelectedRecords.GetValueOrDefault(component.Name)); SetDisplayedRecords(component.BusComp.Name, AllDisplayedRecords.GetValueOrDefault(component.Name)); if (AllSearchSpecifications != null) { Dictionary <string, dynamic> searchSpecifications = AllSearchSpecifications.GetValueOrDefault(component.Name); if (searchSpecifications != null) { if (searchSpecifications.ContainsKey("SearchSpecArgs")) { SetSearchSpecification(component.Name, SearchSpecTypes.SearchSpecArgs, searchSpecifications["SearchSpecArgs"]); } if (searchSpecifications.ContainsKey("SearchSpecification")) { SetSearchSpecification(component.Name, SearchSpecTypes.SearchSpecification, searchSpecifications["SearchSpecification"]); } if (searchSpecifications.ContainsKey("SearchSpecificationByParent")) { SetSearchSpecification(component.Name, SearchSpecTypes.SearchSpecificationByParent, searchSpecifications["SearchSpecificationByParent"]); } } } }); }); }
// Установка спецификации для фильтрации public static void SetSearchSpecification(string componentName, Enum searchSpecificationName, dynamic searchSpecifiactionValue) { if (SearchSpecifications == null) { SearchSpecifications = new Dictionary <string, Dictionary <string, dynamic> >(); } if (SearchSpecifications.ContainsKey(componentName)) { if (SearchSpecifications[componentName].ContainsKey(searchSpecificationName.ToString())) { SearchSpecifications[componentName][searchSpecificationName.ToString()] = searchSpecifiactionValue; } else { SearchSpecifications[componentName].Add(searchSpecificationName.ToString(), searchSpecifiactionValue); } } else { SearchSpecifications.Add(componentName, new Dictionary <string, dynamic>() { { searchSpecificationName.ToString(), searchSpecifiactionValue } }); } if (AllSearchSpecifications == null) { AllSearchSpecifications = new Dictionary <string, Dictionary <string, dynamic> >(); } if (AllSearchSpecifications.ContainsKey(componentName)) { if (AllSearchSpecifications[componentName].ContainsKey(searchSpecificationName.ToString())) { AllSearchSpecifications[componentName][searchSpecificationName.ToString()] = searchSpecifiactionValue; } else { AllSearchSpecifications[componentName].Add(searchSpecificationName.ToString(), searchSpecifiactionValue); } } else { AllSearchSpecifications.Add(componentName, new Dictionary <string, dynamic>() { { searchSpecificationName.ToString(), searchSpecifiactionValue } }); } }