Inheritance: INotifyPropertyChanging, INotifyPropertyChanged
Esempio n. 1
0
        private string PrepareApiForSend(CdnSend send)
        {
            var workingScac = _loadIdPrefix;

            if (IsKeyByScacLookupMode)
            {
                var ccScac = send.CdnSendLoad.ContractedCarrierScac;
                if (string.IsNullOrWhiteSpace(ccScac))
                {
                    throw new ArgumentException("ContractedCarrierScac must always be populated when using a SCAC/ApiKey lookup list");
                }
                if (!_apiKeysByScac.ContainsKey(ccScac))
                {
                    throw new ArgumentException(string.Format("apiKeyScacList did not contain an entry for SCAC '{0}'", ccScac));
                }

                workingScac = ccScac;
                Api.ApiKey  = _apiKeysByScac[ccScac];
            }

            // Return the prefixed load Id we'll use for this send
            if (!string.IsNullOrWhiteSpace(send.LoadId) &&
                !string.IsNullOrWhiteSpace(workingScac) &&
                !send.LoadId.StartsWith(workingScac))
            {
                return(string.Format("{0}{1}{2}", workingScac, LoadIdPrefixEnd, send.LoadId));
            }
            return(send.LoadId);
        }
Esempio n. 2
0
        private string PrepareApiForSend(CdnSend send)
        {
            var workingScac = _loadIdPrefix;

            if (IsKeyByScacLookupMode)
            {
                var ccScac = send.CdnSendLoad.ContractedCarrierScac;
                if (string.IsNullOrWhiteSpace(ccScac))
                    throw new ArgumentException("ContractedCarrierScac must always be populated when using a SCAC/ApiKey lookup list");
                if (!_apiKeysByScac.ContainsKey(ccScac))
                    throw new ArgumentException(string.Format("apiKeyScacList did not contain an entry for SCAC '{0}'", ccScac));

                workingScac = ccScac;
                Api.ApiKey = _apiKeysByScac[ccScac];
            }

            // Return the prefixed load Id we'll use for this send
            if (!string.IsNullOrWhiteSpace(send.LoadId) &&
                !string.IsNullOrWhiteSpace(workingScac) &&
                !send.LoadId.StartsWith(workingScac))
            {
                return string.Format("{0}{1}{2}", workingScac, LoadIdPrefixEnd, send.LoadId);
            }
            return send.LoadId;
        }
 partial void UpdateCdnSend(CdnSend instance);
 partial void DeleteCdnSend(CdnSend instance);
 partial void InsertCdnSend(CdnSend instance);