Beispiel #1
0
        private void HandleOwnerResult(UPCRMResult result)
        {
            int count = result.RowCount;

            if (count > 0)
            {
                List <UPSEListingOwner> relatedOwnersForCurrentOwner = new List <UPSEListingOwner>();
                for (int i = 0; i < count; i++)
                {
                    UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(i);
                    string         recordIdentification = row.RecordIdentificationAtIndex(1);
                    if (string.IsNullOrEmpty(recordIdentification))
                    {
                        continue;
                    }

                    UPSEListingOwner relatedOwner = this.listingOwners.ValueOrDefault(row.RecordIdentificationAtIndex(1));
                    if (relatedOwner == null)
                    {
                        relatedOwner = new UPSEListingOwner((UPCRMResultRow)result.ResultRowAtIndex(i), 1, this.ListingOwnerMapping, this);
                        this.loadQueue.Add(relatedOwner);
                        this.listingOwners.SetObjectForKey(relatedOwner, relatedOwner.RecordIdentification);
                    }

                    relatedOwnersForCurrentOwner.Add(relatedOwner);
                }

                this.currentLoadedOwner.RelatedOwners = relatedOwnersForCurrentOwner;
            }

            this.LoadNextItemFromQueue();
        }
Beispiel #2
0
        private bool LoadListingForOwnerContext(UPSEListingOwner owner, object context)
        {
            if (owner.ListingsLoaded)
            {
                this.TheDelegate?.ListingControllerContextDidReturnListingForOwner(this, context, owner);

                return(true);
            }

            if (!this.ownersLoaded)
            {
                this.TheDelegate?.ListingControllerContextDidFailWithError(this, context, new Exception("ownersNotLoaded"));

                return(false);
            }

            bool startNextListing = false;

            lock (this.loadQueue)
            {
                if (this.currentLoadRequest == null && this.loadQueue.Count == 0)
                {
                    startNextListing = true;
                }

                this.loadQueue.Add(new UPSEListingLoadRequest(owner, context));
            }

            if (startNextListing)
            {
                this.LoadNextListingFromQueue();
            }

            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// Possibles the values.
        /// </summary>
        /// <returns>
        /// The <see cref="!:Dictionary" />.
        /// </returns>
        public Dictionary <string, string> PossibleValues()
        {
            Dictionary <string, string> listingDictionary = new Dictionary <string, string>(this.listingOwners.Count);

            foreach (string key in this.listingOwners.Keys)
            {
                UPSEListingOwner owner = this.listingOwners[key];
                if (!owner.TransparentOwner)
                {
                    listingDictionary[key] = owner.Label;
                }
            }

            return(listingDictionary);
        }
Beispiel #4
0
        /// <summary>
        /// Handles the listing loaded for owner context.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="context">The context.</param>
        public void HandleListingLoadedForOwnerContext(UPSEListingOwner owner, object context)
        {
            if (this.loadStep == 3)
            {
                if (this.loadQueue.Count == 0)
                {
                    this.loadStep = 0;
                    this.LoadSerialEntryInformation();
                    this.TheDelegate?.ListingControllerContextDidReturnOwner(this, context, owner);
                }
                else
                {
                    this.LoadNextListingFromQueue();
                }

                return;
            }

            this.TheDelegate?.ListingControllerContextDidReturnListingForOwner(owner.ListingController, context, owner);

            this.LoadNextListingFromQueue();
        }
Beispiel #5
0
 private void LoadNextItemFromQueue()
 {
     if (this.loadQueue.Count > 0)
     {
         this.currentLoadedOwner = this.loadQueue[0] as UPSEListingOwner;
         this.loadStep           = 2;
         this.currentQuery       = new UPContainerMetaInfo(this.RelatedListingOwnersSearch, null);
         this.currentQuery.SetLinkRecordIdentification(this.currentLoadedOwner.RecordIdentification);
         this.loadQueue.RemoveAt(0);
         this.currentQuery.Find(this.SerialEntry.RequestOption, this, false);
     }
     else
     {
         this.currentQuery       = null;
         this.currentLoadedOwner = null;
         this.ownersLoaded       = true;
         this.loadStep           = 3;
         foreach (UPSEListingOwner currentOwner in this.listingOwners.Values)
         {
             this.LoadListingForOwnerContext(currentOwner, null);
         }
     }
 }
Beispiel #6
0
 /// <summary>
 /// Handles the listing load for owner context did finish with error.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="context">The context.</param>
 /// <param name="error">The error.</param>
 public void HandleListingLoadForOwnerContextDidFinishWithError(UPSEListingOwner owner, object context, Exception error)
 {
     this.TheDelegate?.ListingControllerContextDidFailWithError(owner.ListingController, context, error);
 }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSEListingLoadRequest"/> class.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="context">The context.</param>
 public UPSEListingLoadRequest(UPSEListingOwner owner, object context)
 {
     this.Owner   = owner;
     this.Context = context;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSEListing"/> class.
 /// </summary>
 /// <param name="resultRow">The result row.</param>
 /// <param name="mapping">The mapping.</param>
 /// <param name="owner">The owner.</param>
 public UPSEListing(UPCRMResultRow resultRow, Dictionary <string, UPConfigFieldControlField> mapping, UPSEListingOwner owner)
 {
     this.ListingOwner         = owner;
     this.RecordIdentification = resultRow.RootRecordIdentification;
     this.ValueDictionary      = mapping.ValuesFromResultRow(resultRow);
 }