private TreeNode LoadTreeNode(ProductSectionEntity childSection)
        {
            TreeNode childNode = new TreeNode();
            childNode.Value = childSection.Id.ToString();
            childNode.Text = childSection.Name;
            childNode.SelectAction = TreeNodeSelectAction.Select;

            foreach (ProductSectionEntity pse in ProductSectionEntity.GetChildSections(childSection.Id))
            {
                childNode.ChildNodes.Add(LoadTreeNode(pse));
            }

            return childNode;
        }
        /// <summary> setups the sync logic for member _productSection</summary>
        /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
        private void SetupSyncProductSection(IEntity2 relatedEntity)
        {
            DesetupSyncProductSection(true);
            if(relatedEntity!=null)
            {
                _productSection = (ProductSectionEntity)relatedEntity;
                _productSection.ActiveContext = base.ActiveContext;
                _productSection.AfterSave+=new EventHandler(OnEntityAfterSave);
                base.SetEntitySyncInformation("ProductSection", _productSection, ProductSectionEntity.Relations.ProductSectionEntityUsingParentSectionId);

            }
        }
        /// <summary> Removes the sync logic for member _productSection</summary>
        /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
        private void DesetupSyncProductSection(bool signalRelatedEntity)
        {
            if(_productSection != null)
            {

                _productSection.AfterSave-=new EventHandler(OnEntityAfterSave);
                base.UnsetEntitySyncInformation("ProductSection", _productSection, ProductSectionEntity.Relations.ProductSectionEntityUsingParentSectionId);
                if(signalRelatedEntity)
                {
                    _productSection.UnsetRelatedEntity(this, "ProductSection_");
                }
                SetNewFieldValue((int)ProductSectionFieldIndex.ParentSectionId, null);
                _productSection = null;
            }
        }
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _product = null;
            _productSection_ = null;

            _productSection = null;

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
 /// <summary>Sets the field on index fieldIndex to the new value value. Marks also the fields object as dirty.</summary>
 /// <param name="fieldIndex">Index of field to set the new value of</param>
 /// <param name="value">Value to set</param>
 /// <returns>true if the value is actually set, false otherwise.</returns>
 /// <remarks>Dereferences a related object in an 1:1/m:1 relation if the field is an FK field and responsible for the reference of that particular related object.</remarks>
 /// <exception cref="ArgumentOutOfRangeException">When fieldIndex is smaller than 0 or bigger than the number of fields in the fields collection.</exception>
 public override bool SetNewFieldValue(int fieldIndex, object value)
 {
     bool toReturn = base.SetNewFieldValue (fieldIndex, value, false);
     if(toReturn && Enum.IsDefined(typeof(ProductSectionFieldIndex), fieldIndex))
     {
         switch((ProductSectionFieldIndex)fieldIndex)
         {
             case ProductSectionFieldIndex.ParentSectionId:
                 DecoupleEventsProductSection();
                 _productSection = null;
                 break;
             default:
                 break;
         }
         base.PostFieldValueSetAction(toReturn);
         switch((ProductSectionFieldIndex)fieldIndex)
         {
             case ProductSectionFieldIndex.Id:
                 OnIdChanged();
                 break;
             case ProductSectionFieldIndex.ParentSectionId:
                 OnParentSectionIdChanged();
                 break;
             case ProductSectionFieldIndex.Uri:
                 OnUriChanged();
                 break;
             case ProductSectionFieldIndex.Name:
                 OnNameChanged();
                 break;
             default:
                 break;
         }
     }
     return toReturn;
 }
        protected ProductSectionEntity(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _product = (EntityCollection)info.GetValue("_product", typeof(EntityCollection));
            _productSection_ = (EntityCollection)info.GetValue("_productSection_", typeof(EntityCollection));

            _productSection = (ProductSectionEntity)info.GetValue("_productSection", typeof(ProductSectionEntity));
            if(_productSection!=null)
            {
                _productSection.AfterSave+=new EventHandler(OnEntityAfterSave);
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
        /// <summary>Creates a new ProductSectionEntity instance but uses a special constructor which will set the Fields object of the new
        /// IEntity2 instance to the passed in fields object. Implement this method to support multi-type in single table inheritance.</summary>
        /// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
        /// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
        public virtual IEntity2 Create(IEntityFields2 fields)
        {
            IEntity2 toReturn = new ProductSectionEntity(fields);

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewProductSectionUsingFields
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }
        /// <summary>Creates a new, empty ProductSectionEntity object.</summary>
        /// <returns>A new, empty ProductSectionEntity object.</returns>
        public virtual IEntity2 Create()
        {
            IEntity2 toReturn = new ProductSectionEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewProductSection
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }
Example #9
0
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _specialOffer = null;
            _productVariation = null;

            _productSection = null;

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
Example #10
0
 /// <summary>Sets the field on index fieldIndex to the new value value. Marks also the fields object as dirty.</summary>
 /// <param name="fieldIndex">Index of field to set the new value of</param>
 /// <param name="value">Value to set</param>
 /// <returns>true if the value is actually set, false otherwise.</returns>
 /// <remarks>Dereferences a related object in an 1:1/m:1 relation if the field is an FK field and responsible for the reference of that particular related object.</remarks>
 /// <exception cref="ArgumentOutOfRangeException">When fieldIndex is smaller than 0 or bigger than the number of fields in the fields collection.</exception>
 public override bool SetNewFieldValue(int fieldIndex, object value)
 {
     bool toReturn = base.SetNewFieldValue (fieldIndex, value, false);
     if(toReturn && Enum.IsDefined(typeof(ProductFieldIndex), fieldIndex))
     {
         switch((ProductFieldIndex)fieldIndex)
         {
             case ProductFieldIndex.SectionId:
                 DecoupleEventsProductSection();
                 _productSection = null;
                 break;
             default:
                 break;
         }
         base.PostFieldValueSetAction(toReturn);
         switch((ProductFieldIndex)fieldIndex)
         {
             case ProductFieldIndex.Id:
                 OnIdChanged();
                 break;
             case ProductFieldIndex.Name:
                 OnNameChanged();
                 break;
             case ProductFieldIndex.Description:
                 OnDescriptionChanged();
                 break;
             case ProductFieldIndex.Price:
                 OnPriceChanged();
                 break;
             case ProductFieldIndex.PriceIncludesVat:
                 OnPriceIncludesVatChanged();
                 break;
             case ProductFieldIndex.ImageName:
                 OnImageNameChanged();
                 break;
             case ProductFieldIndex.SectionId:
                 OnSectionIdChanged();
                 break;
             case ProductFieldIndex.ExtraInformation:
                 OnExtraInformationChanged();
                 break;
             case ProductFieldIndex.DeliveryPrice:
                 OnDeliveryPriceChanged();
                 break;
             case ProductFieldIndex.PriceIsFrom:
                 OnPriceIsFromChanged();
                 break;
             case ProductFieldIndex.SortIndex:
                 OnSortIndexChanged();
                 break;
             case ProductFieldIndex.Enabled:
                 OnEnabledChanged();
                 break;
             default:
                 break;
         }
     }
     return toReturn;
 }
 public static ProductSectionEntity LoadRootSection(string name)
 {
     ProductSectionEntity rootSection = new ProductSectionEntity(RootSectionId);
     rootSection.Name = name;
     return rootSection;
 }