public Auction.Domain.Package Get(long Id, ref IAuctionTransaction trans) { using (var records = new PackageCollection()) { var filter = new PredicateExpression(PackageFields.Id == Id); if (trans != null) { trans.Add(records); } records.GetMulti(filter, 1); var r = records.FirstOrDefault(); return new Package() { BidderId = r.BidderId, CategoryId = r.CategoryId, ClosedOutBy = r.ClosedOutBy, Code = r.Code, CreatedBy = r.CreatedBy, EndingBid = r.EndingBid, EventId = r.EventId, Id = r.Id, Name = r.Name, Notes = r.Notes, Paid = (bool) r.Paid, StartingBid = r.StartingBid, UpdatedBy = r.UpdatedBy }; } }
/// <summary> /// Loads the packages. /// </summary> private void LoadPackages( ) { PackageCollection.Clear( ); PackageCache.Clear( ); foreach (Package package in Package.GetPackages(Application.ApplicationId)) { PackageCollection.Add(package); PackageCache.Add(package); } IEnumerable <TenantActivatedPackage> activatedPackages = TenantActivatedPackage.GetTenantActivatedPackages( ); foreach (TenantActivatedPackage activation in activatedPackages) { Package p = PackageCollection.FirstOrDefault(pkg => pkg.AppVerId == activation.AppVerId); Tenant tenant = p?.TenantCollection.FirstOrDefault(t => t.EntityId == activation.TenantId); if (tenant != null) { p.TenantCollection.Remove(tenant); } } if (PackageCollection.Count == 1) { SelectedPackage = PackageCollection[0]; } }