/// <summary>Creates a new, empty PackageEntity object.</summary>
        /// <returns>A new, empty PackageEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new PackageEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewPackage
            // __LLBLGENPRO_USER_CODE_REGION_END

            return toReturn;
        }
 public void Insert(ref Auction.Domain.Package package,
                    ref IAuctionTransaction trans)
 {
     var pack = new PackageEntity()
                    {
                        BidderId = package.BidderId,
                        CategoryId = package.CategoryId,
                        ClosedOutBy = package.ClosedOutBy,
                        Code = package.Code,
                        CreatedBy = package.CreatedBy,
                        EndingBid = (decimal?) package.EndingBid,
                        EventId = package.EventId,
                        Name = package.Name,
                        Notes = package.Notes,
                        Paid = package.Paid,
                        StartingBid = (decimal) package.StartingBid,
                        UpdatedBy = package.UpdatedBy
                    };
     if(trans != null)
     {
         trans.Add(pack);
     }
     pack.Save();
 }
 public void Update(ref Auction.Domain.Package package,
                    ref IAuctionTransaction trans)
 {
     using(var records = new PackageCollection())
     {
         var pack = new PackageEntity()
         {
             BidderId = package.BidderId,
             CategoryId = package.CategoryId,
             ClosedOutBy = package.ClosedOutBy,
             Code = package.Code,
             CreatedBy = package.CreatedBy,
             EndingBid = (decimal?)package.EndingBid,
             EventId = package.EventId,
             Name = package.Name,
             Notes = package.Notes,
             Paid = package.Paid,
             StartingBid = (decimal)package.StartingBid,
             UpdatedBy = package.UpdatedBy
         };
         if (trans != null)
         {
             trans.Add(pack);
         }
         records.UpdateMulti(pack, new PredicateExpression(PackageFields.Id == package.Id));
     }
 }
예제 #4
0
 /// <summary> setups the sync logic for member _package</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncPackage(IEntity relatedEntity)
 {
     if(_package!=relatedEntity)
     {
         DesetupSyncPackage(true, true);
         _package = (PackageEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity( _package, new PropertyChangedEventHandler( OnPackagePropertyChanged ), "Package", DonationEntity.Relations.PackageEntityUsingPackageId, true, ref _alreadyFetchedPackage, new string[] {  } );
     }
 }
예제 #5
0
        /// <summary> Initializes the class members</summary>
        private void InitClassMembers()
        {
            _auctionEvent = null;
            _auctionEventReturnsNewIfNotFound = true;
            _alwaysFetchAuctionEvent = false;
            _alreadyFetchedAuctionEvent = false;
            _donor = null;
            _donorReturnsNewIfNotFound = true;
            _alwaysFetchDonor = false;
            _alreadyFetchedDonor = false;
            _package = null;
            _packageReturnsNewIfNotFound = true;
            _alwaysFetchPackage = false;
            _alreadyFetchedPackage = false;
            _user_ = null;
            _user_ReturnsNewIfNotFound = true;
            _alwaysFetchUser_ = false;
            _alreadyFetchedUser_ = false;
            _user = null;
            _userReturnsNewIfNotFound = true;
            _alwaysFetchUser = false;
            _alreadyFetchedUser = false;

            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END

            OnInitClassMembersComplete();
        }
예제 #6
0
 /// <summary> Removes the sync logic for member _package</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 DesetupSyncPackage(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity( _package, new PropertyChangedEventHandler( OnPackagePropertyChanged ), "Package", DonationEntity.Relations.PackageEntityUsingPackageId, true, signalRelatedEntity, "Donation", resetFKFields, new int[] { (int)DonationFieldIndex.PackageId } );
     _package = null;
 }
예제 #7
0
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected DonationEntity(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _auctionEvent = (AuctionEventEntity)info.GetValue("_auctionEvent", typeof(AuctionEventEntity));
            if(_auctionEvent!=null)
            {
                _auctionEvent.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _auctionEventReturnsNewIfNotFound = info.GetBoolean("_auctionEventReturnsNewIfNotFound");
            _alwaysFetchAuctionEvent = info.GetBoolean("_alwaysFetchAuctionEvent");
            _alreadyFetchedAuctionEvent = info.GetBoolean("_alreadyFetchedAuctionEvent");
            _donor = (DonorEntity)info.GetValue("_donor", typeof(DonorEntity));
            if(_donor!=null)
            {
                _donor.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _donorReturnsNewIfNotFound = info.GetBoolean("_donorReturnsNewIfNotFound");
            _alwaysFetchDonor = info.GetBoolean("_alwaysFetchDonor");
            _alreadyFetchedDonor = info.GetBoolean("_alreadyFetchedDonor");
            _package = (PackageEntity)info.GetValue("_package", typeof(PackageEntity));
            if(_package!=null)
            {
                _package.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _packageReturnsNewIfNotFound = info.GetBoolean("_packageReturnsNewIfNotFound");
            _alwaysFetchPackage = info.GetBoolean("_alwaysFetchPackage");
            _alreadyFetchedPackage = info.GetBoolean("_alreadyFetchedPackage");
            _user_ = (UserEntity)info.GetValue("_user_", typeof(UserEntity));
            if(_user_!=null)
            {
                _user_.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _user_ReturnsNewIfNotFound = info.GetBoolean("_user_ReturnsNewIfNotFound");
            _alwaysFetchUser_ = info.GetBoolean("_alwaysFetchUser_");
            _alreadyFetchedUser_ = info.GetBoolean("_alreadyFetchedUser_");
            _user = (UserEntity)info.GetValue("_user", typeof(UserEntity));
            if(_user!=null)
            {
                _user.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _userReturnsNewIfNotFound = info.GetBoolean("_userReturnsNewIfNotFound");
            _alwaysFetchUser = info.GetBoolean("_alwaysFetchUser");
            _alreadyFetchedUser = info.GetBoolean("_alreadyFetchedUser");

            base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
예제 #8
0
        /// <summary> Retrieves the related entity of type 'PackageEntity', 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 'PackageEntity' which is related to this entity.</returns>
        public virtual PackageEntity GetSinglePackage(bool forceFetch)
        {
            if( ( !_alreadyFetchedPackage || forceFetch || _alwaysFetchPackage) && !base.IsSerializing && !base.IsDeserializing  && !base.InDesignMode)
            {
                bool performLazyLoading = base.CheckIfLazyLoadingShouldOccur(DonationEntity.Relations.PackageEntityUsingPackageId);

                PackageEntity newEntity = new PackageEntity();
                if(base.ParticipatesInTransaction)
                {
                    base.Transaction.Add(newEntity);
                }
                bool fetchResult = false;
                if(performLazyLoading)
                {
                    fetchResult = newEntity.FetchUsingPK(this.PackageId.GetValueOrDefault());
                }
                if(fetchResult)
                {
                    if(base.ActiveContext!=null)
                    {
                        newEntity = (PackageEntity)base.ActiveContext.Get(newEntity);
                    }
                    this.Package = newEntity;
                }
                else
                {
                    if(_packageReturnsNewIfNotFound)
                    {
                        if(performLazyLoading || (!performLazyLoading && (_package == null)))
                        {
                            this.Package = newEntity;
                        }
                    }
                    else
                    {
                        this.Package = null;
                    }
                }
                _alreadyFetchedPackage = fetchResult;
                if(base.ParticipatesInTransaction && !fetchResult)
                {
                    base.Transaction.Remove(newEntity);
                }
            }
            return _package;
        }