public CardWrapper( ICardTypeDataAccess cardTypeDataAccess, IImageDataAccess imageDataAccess, IHardLinkDataAccess hardLinkDataAccess, IPropertyDataAccess propertyDataAccess, int cardId, int cardTypeId, int?primaryImageId) { _cardType = new PropWrapper <CardType>( () => cardTypeDataAccess.Get(cardTypeId)); _primaryImage = new PropWrapper <Image>( () => primaryImageId.HasValue ? imageDataAccess.Get(primaryImageId.Value) : null); _additionalImages = new PropWrapper <List <Image> >( () => new List <Image>(imageDataAccess.GetByCardId(cardId))); _hardLinks = new PropWrapper <List <HardLink> >( () => new List <HardLink>(hardLinkDataAccess.GetHardLinksByOriginId(cardId))); _referencedBy = new PropWrapper <List <HardLink> >( () => new List <HardLink>(hardLinkDataAccess.GetHardLinksByTargetId(cardId))); _props = new PropWrapper <List <Property> >( () => new List <Property>(propertyDataAccess.GetPropertiesByCardId(cardId))); }
public CardTypeWrapper(IImageDataAccess imageDataAccess, IPropertyTypeDataAccess propertyTypeDataAccess, int cardTypeId, int imageId) { Id = cardTypeId; _image = new PropWrapper <Image>(() => imageDataAccess.Get(imageId)); _propertyTypes = new PropWrapper <List <PropertyType> >(() => new List <PropertyType>(propertyTypeDataAccess.GetPropertyTypesByCardTypeId(Id.Value))); }
public PropertyWrapper( ICardDataAccess cardDataAccess, IPropertyTypeDataAccess propertyTypeDataAccess, int ownerId, int propertyTypeId) { _owner = new PropWrapper <Card>(() => cardDataAccess.Get(ownerId)); _propertyType = new PropWrapper <PropertyType>(() => propertyTypeDataAccess.Get(propertyTypeId)); }
public CardSpaceCardWrapper(ICardDataAccess cardDataAccess, int cardId, ICardSpaceDataAccess cardSpaceDataAccess, int cardSpaceId) { var cardContext = new CardContext() { DataAccess = cardDataAccess, CardId = cardId }; _card = new PropWrapper <Card>( cardContext, o => ((CardContext)o).DataAccess.Get(((CardContext)o).CardId)); var spaceContext = new CardSpaceContext() { DataAccess = cardSpaceDataAccess, CardSpaceId = cardSpaceId }; _cardSpace = new PropWrapper <CardSpace>( spaceContext, o => ((CardSpaceContext)o).DataAccess.Get(((CardSpaceContext)o).CardSpaceId)); }
public HardLinkWrapper(ICardDataAccess cardDataAccess, int originId, int targetId) { CardDataAccess = cardDataAccess; _origin = new PropWrapper <Card>(() => cardDataAccess.Get(originId)); _target = new PropWrapper <Card>(() => cardDataAccess.Get(targetId)); }
public void UpdateNode(CswNbtNode Node, bool ForceUpdate) { // BZ 10240 if ((Node.PendingUpdate || ForceUpdate) && Node.getObjectClass().ObjectClass == CswEnumNbtObjectClass.EquipmentClass) { ((CswNbtObjClassEquipment)Node).SyncEquipmentToAssembly(); } // Case 30126 if (null != Node.getObjectClass().getPropertySet()) { if ((Node.PendingUpdate || ForceUpdate) && Node.getObjectClass().getPropertySet().Name == CswEnumNbtPropertySetName.MaterialSet) { ((CswNbtPropertySetMaterial)Node).onUpdatePropertyValue(); } } // Update all out of date values for a given node foreach (CswNbtNodePropWrapper PropWrapper in Node.Properties) { if (PropWrapper.PendingUpdate || Node.PendingUpdate || ForceUpdate) { switch (PropWrapper.getFieldTypeValue()) { case CswEnumNbtFieldType.Composite: CswNbtNodePropComposite CompositeProp = PropWrapper.AsComposite; CompositeProp.RecalculateCompositeValue(); break; case CswEnumNbtFieldType.Location: CswNbtNodePropLocation LocationProp = PropWrapper.AsLocation; LocationProp.RefreshNodeName(); break; case CswEnumNbtFieldType.LogicalSet: CswNbtNodePropLogicalSet LogicalSetProp = PropWrapper.AsLogicalSet; LogicalSetProp.RefreshStringValue(SetPendingUpdate: false); break; case CswEnumNbtFieldType.NodeTypeSelect: CswNbtNodePropNodeTypeSelect NodeTypeSelectProp = PropWrapper.AsNodeTypeSelect; NodeTypeSelectProp.RefreshSelectedNodeTypeNames(); break; case CswEnumNbtFieldType.PropertyReference: CswNbtNodePropPropertyReference PropertyReferenceProp = PropWrapper.AsPropertyReference; PropertyReferenceProp.RecalculateReferenceValue(); break; case CswEnumNbtFieldType.Quantity: CswNbtNodePropQuantity QuantityProp = PropWrapper.AsQuantity; QuantityProp.RefreshNodeName(); break; case CswEnumNbtFieldType.Relationship: CswNbtNodePropRelationship RelationshipProp = PropWrapper.AsRelationship; RelationshipProp.RefreshNodeName(); break; case CswEnumNbtFieldType.ViewPickList: CswNbtNodePropViewPickList ViewPickListProp = PropWrapper.AsViewPickList; ViewPickListProp.RefreshViewName(); break; case CswEnumNbtFieldType.ViewReference: CswNbtNodePropViewReference ViewReferenceProp = PropWrapper.AsViewReference; ViewReferenceProp.RefreshViewName(); break; case CswEnumNbtFieldType.MTBF: CswNbtNodePropMTBF MTBFProp = PropWrapper.AsMTBF; MTBFProp.RefreshCachedValue(); break; default: if (PropWrapper.PendingUpdate) { PropWrapper.setPendingUpdate(false); } break; } // switch (PropWrapper.FieldType.FieldType) } // if(PropWrapper.PendingUpdate) } // foreach (CswNbtNodePropWrapper PropWrapper in Node.Properties) if (Node.PendingUpdate) { Node.PendingUpdate = false; } } // UpdateNode()