Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSERowQuota"/> class.
 /// </summary>
 /// <param name="itemNumber">The item number.</param>
 /// <param name="articleConfiguration">The article configuration.</param>
 /// <param name="quota">The quota.</param>
 /// <param name="quotaHandler">The quota handler.</param>
 public UPSERowQuota(string itemNumber, UPSEArticleQuotaConfiguration articleConfiguration, UPSEQuota quota, UPSEQuotaHandler quotaHandler)
 {
     this.ArticleConfiguration = articleConfiguration;
     this.Quota        = quota;
     this.QuotaHandler = quotaHandler;
     this.ItemNumber   = itemNumber;
     this.InitialCount = 0;
     this.CurrentCount = 0;
 }
        private void ApplyArticleConfigurationResult(UPCRMResult result)
        {
            int count = result.RowCount;

            this.articleConfigurationDictionary = new Dictionary <string, UPSEArticleQuotaConfiguration>();
            for (int i = 0; i < count; i++)
            {
                UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(i);
                Dictionary <string, object> dict = row.ValuesWithFunctions();
                string itemNumber = dict.ValueOrDefault(this.ItemNumberFunctionName) as string;
                if (string.IsNullOrEmpty(itemNumber))
                {
                    continue;
                }

                if (!this.articleConfigurationDictionary.ContainsKey(itemNumber))
                {
                    UPSEArticleQuotaConfiguration articleConfiguration = new UPSEArticleQuotaConfiguration(itemNumber, dict, row.RootRecordIdentification);
                    this.articleConfigurationDictionary[itemNumber] = articleConfiguration;
                }
            }

            this.LoadQuota();
        }