public void BindData(EntityAttribute attribute, List <EntityRelationshipRole> relationList) { if (attribute.AttributeTypeId != null) { var filterList = FormatTypeList.Where(c => c.FormatParentId == attribute.AttributeTypeId); var formatType = filterList.FirstOrDefault(); if (filterList.Count() > 1) { formatType = filterList.Where(c => c.FormatName == attribute.LogicalType).FirstOrDefault(); } if (formatType != null) { typeLookUpEdit.EditValue = formatType.FormatId; LookUpChanged(formatType.FormatName); if (formatType.FormatName == AttributeTypeEnum.Lookup.ToString()) { var relation = relationList.Where(c => c.EntityRelationship.EntityRelationshipRelationships.First().Relationship.ReferencingAttributeId == attribute.AttributeId); if (relation.Any()) { lookupTargetTypeLookUpEdit.EditValue = relation.First().EntityId; lookupRelationshipTextEdit.Text = relation.First().EntityRelationship.SchemaName; } } } } EntityBindingSource.DataSource = attribute; }
void InitSingleLineTextFormat() { var singleLine = FormatTypeList.Where(c => c.FormatName == AttributeTypeEnum.SingleLineText.ToString()).Select(c => c.FormatId).First(); var singleLineTextFormatItems = FormatTypeList.Where(c => c.FormatParentId == (Guid)singleLine).ToList(); var items = singleLineTextFormatItems.Select(name => new LookupListItem <string> { DisplayName = name.FormatName, Value = name.FormatName }).ToList(); signleLineTextFormatLookUpEdit.Properties.InitializeLookUpEdit(items); }