// Установка выбранной записи public static void SetSelectedRecord(string componentName, string recordId) { if (AllSelectedRecords == null) { AllSelectedRecords = new Dictionary <string, string>(); } if (SelectedRecords == null) { SelectedRecords = new Dictionary <string, string>(); } if (!SelectedRecords.ContainsKey(componentName)) { SelectedRecords.Add(componentName, recordId); } else { SelectedRecords[componentName] = recordId; } if (!AllSelectedRecords.ContainsKey(componentName)) { AllSelectedRecords.Add(componentName, recordId); } else { AllSelectedRecords[componentName] = recordId; } }
// Восстановление контекста 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"]); } } } }); }); }