private static bool IsReadOnlyReferenceBookAttribute(IAttribute attribute, IAttributeFormatParser attributeFormatParser) { if (attribute.Configuration == null) { return(false); } IReferenceBookConfiguration attributeConfiguration; var success = attributeFormatParser.TryParseReferenceBookConfiguration(attribute.Configuration, out attributeConfiguration); return(success && !attributeConfiguration.IsEditable); }
private void ShowReferenceBookView() { IReferenceBookConfiguration configuration; var success = _attributeFormatParser.TryParseReferenceBookConfiguration(Attribute.Configuration, out configuration); if (!success) { return; } if (configuration.Kind == RefBookKind.OrgUnit) { var dialogOptions = _dialogService.NewOptions() .WithAllowChecking(true) .WithAllowMultiSelect(true) .WithOkButtonCaption("Ok") .WithParentWindow(GetActiveWindow()); var selectedPositions = _dialogService.ShowPositionSelectorDialog(dialogOptions); var positionsTitles = selectedPositions.Select(x => GetEffectiveAttributeTitle(x.Id)); Value = string.Join("; ", positionsTitles); return; } var options = _dialogService.NewOptions(); options.WithAllowChecking(true); options.WithParentWindow(GetActiveWindow()); var checkedNodes = _dialogService.ShowReferenceBookDialog(Attribute.Configuration, _type.Name + "-" + Attribute.Name, options).ToList(); if (!checkedNodes.Any()) { return; } var titles = checkedNodes.Select(n => GetEffectiveAttributeTitle(n, configuration.StringFormat)); Value = string.Join("; ", titles); if (checkedNodes.Count() == 1) { foreach (var attribute in checkedNodes.First().Attributes) { AutoComplete.Fill(attribute.Key, attribute.Value); } } }