/// <summary>
        /// Populate the Provider dropdown menu.
        /// </summary>
        /// <param name="providerName">The name of the provider to populate the dropdown menu.</param>
        public void InitializeToProvider(string providerName)
        {
            List <VATRPServiceProvider> serviceProviderList = ServiceManager.Instance.ProviderService.GetProviderListFullInfo(); //Get the list of all providers and display in combo box.

            // sort the list and ensure the "Custom" field goes to the bottom.
            serviceProviderList.Sort(delegate(VATRPServiceProvider a, VATRPServiceProvider b) {
                if (string.Equals(a.Label, "Custom"))
                {
                    return(1);
                }
                if (string.Equals(b.Label, "Custom"))
                {
                    return(-1);
                }
                return(a.Label.CompareTo(b.Label)); // Sorting of provider list.
            });
            ProviderList.Clear();
            foreach (VATRPServiceProvider provider in serviceProviderList)
            {
                if (provider.Label == "_nologo") // If in address there is "_nologo" then it will not added in the combo box.
                {
                    continue;
                }
                ProviderList.Add(provider);
            }
            PopulateProviderFields(providerName);
        }
Exemple #2
0
        private void ProvideArticle(RequestItem requestProvidable)
        {
            if (requestProvidable.Quantity <= StockElement.Current)
            {
                //TODO: Create Actor for Withdrawl remove the item on DueTime from Stock.

                if (requestProvidable.IsHeadDemand)
                {
                    Withdraw(requestProvidable);
                }

                if (requestProvidable.ProviderList.Count == 0)
                {
                    requestProvidable.ProviderList = new List <Guid>(ProviderList);
                    ProviderList.Clear();
                }

                // Reduce Stock
                StockElement.Current = StockElement.Current - requestProvidable.Quantity;
                DebugMessage("------------->> items in STOCK: " + StockElement.Current + " Items Requested " + requestProvidable.Quantity);

                // Create Callback for Production
                CreateAndEnqueueInstuction(methodName: DispoAgent.InstuctionsMethods.RequestProvided.ToString(),
                                           objectToProcess: requestProvidable,        // may needs later a more complex answer for now just remove item from stock
                                           targetAgent: requestProvidable.Requester); // its Source Agent becaus this message is the Answer to the Instruction set.

                // Remove from Requester List.
                this.RequestedItems.Remove(requestProvidable);

                // Update Work Item with Provider For
                Statistics.UpdateSimulationWorkSchedule(requestProvidable.ProviderList, requestProvidable.Requester, requestProvidable.OrderId);
                //ProviderList.Clear();
            }
            else
            {
                DebugMessage("Item will be late..............................");
            }
        }