public void AddStore(string name,string userName,string password,bool status,int roleId)
        {
            StoreEntity store = new StoreEntity();
            store.Name = name;
            store.Membership = new MembershipEntity();

            store.Membership.UserName = userName;
            store.Membership.Password = password;
            store.Membership.Status = status;
            store.Membership.RoleId = roleId;
            store.Membership.Save();
            store.Save();
        }
        /// <summary>Creates a new, empty StoreEntity object.</summary>
        /// <returns>A new, empty StoreEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new StoreEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewStore
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }
 /// <summary> setups the sync logic for member _store</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncStore(IEntity relatedEntity)
 {
     if(_store!=relatedEntity)
     {
         DesetupSyncStore(true, true);
         _store = (StoreEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity( _store, new PropertyChangedEventHandler( OnStorePropertyChanged ), "Store", ProductSearchEngine.RelationClasses.StaticProductRelations.StoreEntityUsingStoreIdStatic, true, ref _alreadyFetchedStore, new string[] {  } );
     }
 }
 /// <summary> Removes the sync logic for member _store</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncStore(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity( _store, new PropertyChangedEventHandler( OnStorePropertyChanged ), "Store", ProductSearchEngine.RelationClasses.StaticProductRelations.StoreEntityUsingStoreIdStatic, true, signalRelatedEntity, "Products", resetFKFields, new int[] { (int)ProductFieldIndex.StoreId } );
     _store = null;
 }
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected ProductEntity(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _comments = (ProductSearchEngine.CollectionClasses.CommentCollection)info.GetValue("_comments", typeof(ProductSearchEngine.CollectionClasses.CommentCollection));
            _alwaysFetchComments = info.GetBoolean("_alwaysFetchComments");
            _alreadyFetchedComments = info.GetBoolean("_alreadyFetchedComments");

            _productKeywords = (ProductSearchEngine.CollectionClasses.ProductKeywordCollection)info.GetValue("_productKeywords", typeof(ProductSearchEngine.CollectionClasses.ProductKeywordCollection));
            _alwaysFetchProductKeywords = info.GetBoolean("_alwaysFetchProductKeywords");
            _alreadyFetchedProductKeywords = info.GetBoolean("_alreadyFetchedProductKeywords");

            _productPhotos = (ProductSearchEngine.CollectionClasses.ProductPhotoCollection)info.GetValue("_productPhotos", typeof(ProductSearchEngine.CollectionClasses.ProductPhotoCollection));
            _alwaysFetchProductPhotos = info.GetBoolean("_alwaysFetchProductPhotos");
            _alreadyFetchedProductPhotos = info.GetBoolean("_alreadyFetchedProductPhotos");

            _productSpecifications = (ProductSearchEngine.CollectionClasses.ProductSpecificationCollection)info.GetValue("_productSpecifications", typeof(ProductSearchEngine.CollectionClasses.ProductSpecificationCollection));
            _alwaysFetchProductSpecifications = info.GetBoolean("_alwaysFetchProductSpecifications");
            _alreadyFetchedProductSpecifications = info.GetBoolean("_alreadyFetchedProductSpecifications");
            _brand = (BrandEntity)info.GetValue("_brand", typeof(BrandEntity));
            if(_brand!=null)
            {
                _brand.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _brandReturnsNewIfNotFound = info.GetBoolean("_brandReturnsNewIfNotFound");
            _alwaysFetchBrand = info.GetBoolean("_alwaysFetchBrand");
            _alreadyFetchedBrand = info.GetBoolean("_alreadyFetchedBrand");

            _category = (CategoryEntity)info.GetValue("_category", typeof(CategoryEntity));
            if(_category!=null)
            {
                _category.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _categoryReturnsNewIfNotFound = info.GetBoolean("_categoryReturnsNewIfNotFound");
            _alwaysFetchCategory = info.GetBoolean("_alwaysFetchCategory");
            _alreadyFetchedCategory = info.GetBoolean("_alreadyFetchedCategory");

            _store = (StoreEntity)info.GetValue("_store", typeof(StoreEntity));
            if(_store!=null)
            {
                _store.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _storeReturnsNewIfNotFound = info.GetBoolean("_storeReturnsNewIfNotFound");
            _alwaysFetchStore = info.GetBoolean("_alwaysFetchStore");
            _alreadyFetchedStore = info.GetBoolean("_alreadyFetchedStore");
            this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
 /// <summary> Retrieves the related entity of type 'StoreEntity', using a relation of type 'n:1'</summary>
 /// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
 /// <returns>A fetched entity of type 'StoreEntity' which is related to this entity.</returns>
 public virtual StoreEntity GetSingleStore(bool forceFetch)
 {
     if( ( !_alreadyFetchedStore || forceFetch || _alwaysFetchStore) && !this.IsSerializing && !this.IsDeserializing  && !this.InDesignMode)
     {
         bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.StoreEntityUsingStoreId);
         StoreEntity newEntity = new StoreEntity();
         bool fetchResult = false;
         if(performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.StoreId.GetValueOrDefault());
         }
         if(fetchResult)
         {
             newEntity = (StoreEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if(!_storeReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.Store = newEntity;
         _alreadyFetchedStore = fetchResult;
     }
     return _store;
 }
        public bool DeleteStore(int storeId)
        {
            StoreEntity store = new StoreEntity(storeId);

            return  store.Delete();
        }