Example #1
0
        public void Initialize(IExecutionLogLogger executionLogLogger, int feedId)
        {
            _executionLogLogger = executionLogLogger;

            // Instantiate the IFeedGeneratorIndigoCategoryService
            _feedGeneratorCategoryService = new FeedGeneratorIndigoCategoryService(_indigoCategoryService, _googleCategoryService, Log);

            // First get rules associated with this feed
            _runnerFeed = new GooglePlaFeedRuleHelper(_feedRuleService, _feedGeneratorCategoryService, _feedCmsProductArciveEntryService, Log, AllowRuleOptimizations, AllowRuleEntryRemovals, AllowIEnumerableRuleEvaluations);
            _runnerFeed.Initialize(GooglePlaFeedId, false, null, executionLogLogger.GetExecutionStartTime(), GoogleRunFeedType.Google);
        }
        public void Initialize(IExecutionLogLogger executionLogLogger, int plaFeedId, bool isIncremental, DateTime?fromTime, DateTime?effectiveFromTime, DateTime executionTime)
        {
            _executionLogLogger = executionLogLogger;
            _isIncrementalRun   = isIncremental;
            _effectiveFromTime  = effectiveFromTime;

            // Instantiate the IFeedGeneratorIndigoCategoryService
            _feedGeneratorCategoryService = new FeedGeneratorIndigoCategoryService(_indigoCategoryService, _googleCategoryService, Log);

            // First get rules associated with this feed
            _runnerFeedRulesHelper = new GooglePlaFeedRuleHelper(_feedRuleService, _feedGeneratorCategoryService, _feedCmsProductArchiveEntryService, Log, AllowRuleOptimizations, AllowRuleEntryRemovals, AllowIEnumerableRuleEvaluations);
            _runnerFeedRulesHelper.Initialize(plaFeedId, isIncremental, fromTime, executionTime, GoogleRunFeedType.Google);
        }
        public void Initialize(IExecutionLogLogger executionLogLogger, IExecutionLogLogger secondaryExecutionLogger, int feedId, int?secondaryRunId)
        {
            _executionLogLogger          = executionLogLogger;
            _executionLogLoggerSecondary = secondaryExecutionLogger;
            _feedId = feedId;

            // Instantiate the IFeedGeneratorIndigoCategoryService
            _feedGeneratorCategoryService = new FeedGeneratorIndigoCategoryService(_indigoCategoryService, _googleCategoryService, Log);

            // First get rules associated with this feed
            _runnerFeed = new GooglePlaFeedRuleHelper(_feedRuleService, _feedGeneratorCategoryService, _feedCmsProductArciveEntryService, Log, AllowRuleOptimizations, AllowRuleEntryRemovals, AllowIEnumerableRuleEvaluations);
            _runnerFeed.Initialize(feedId, false, null, executionLogLogger.GetExecutionStartTime(), GoogleRunFeedType.Google);
            if (secondaryRunId.HasValue)
            {
                _runMode             = RunMode.PrimaryAndSecondary;
                _runnerFeedSecondary = new GooglePlaFeedRuleHelper(_feedRuleService, _feedGeneratorCategoryService, _feedCmsProductArciveEntryService, Log, AllowRuleOptimizations, AllowRuleEntryRemovals, AllowIEnumerableRuleEvaluations);
                _runnerFeedSecondary.Initialize(secondaryRunId.Value, false, null, executionLogLogger.GetExecutionStartTime(), GoogleRunFeedType.Yahoo);
            }
        }
Example #4
0
        // If there's a value for the canonical data element in config, and if the product is canonical, then send that value in
        // custom label 4
        public static string GetCustomLabel4Value(IGooglePlaFeedRuleHelper runnerFeed, IProductData productData, StringDictionary dict, IDataRecord reader)
        {
            string customLabelValue = null;

            if (!string.IsNullOrWhiteSpace(CanonicalProductDataValue) && dict.ContainsKey("isCanonical"))
            {
                bool databaseValue = false;
                bool.TryParse(reader[dict["isCanonical"]].ToString(), out databaseValue);
                if (databaseValue)
                {
                    customLabelValue = CanonicalProductDataValue;
                }
            }

            if (string.IsNullOrWhiteSpace(customLabelValue))
            {
                var ruleValue = runnerFeed.GetCustomLabelValue(productData, FeedRuleType.Custom_Label_4);
                customLabelValue = ruleValue != null ? ruleValue.Value : null;
            }

            return(customLabelValue);
        }
Example #5
0
        public static string GetCpcValue(IGooglePlaFeedRuleHelper runnerFeed, IProductData productData, out bool isDefaultMatch)
        {
            isDefaultMatch = false;
            var cpcValue = string.Empty;

            if (runnerFeed.GetRunFeedType() != GoogleRunFeedType.Yahoo)
            {
                return(cpcValue);
            }

            var cpcResult = runnerFeed.GetCpcValue(productData);

            if (cpcResult == null)
            {
                isDefaultMatch = true;
                return(string.Format(CpcValueFormat, DefaultCpcValue));
            }

            // Ensure proper cpc value
            var value = cpcResult.Value;

            isDefaultMatch = cpcResult.IsDefaultMatch || string.IsNullOrWhiteSpace(value);

            if (string.IsNullOrWhiteSpace(value))
            {
                value = DefaultCpcValue;
            }
            else
            {
                try
                {
                    var parts = value.Split(new[] { ',', '.' }, StringSplitOptions.None);
                    if (parts.Length == 1)
                    {
                        value = value.Replace(",", string.Empty).Replace(".", string.Empty) + ".00";
                    }

                    if (parts.Length == 2)
                    {
                        if (string.IsNullOrWhiteSpace(parts[0]))
                        {
                            value = "0" + value;
                        }

                        var cents = parts[1];
                        if (string.IsNullOrWhiteSpace(cents))
                        {
                            value += "00";
                        }
                        else
                        {
                            if (parts[1].Length == 1)
                            {
                                value += "0";
                            }
                            else if (cents.Length > 2)
                            {
                                value = parts[0] + "." + cents.Substring(0, 2);
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    value          = DefaultCpcValue;
                    isDefaultMatch = true;
                }
            }

            return(string.Format(CpcValueFormat, value));
        }
Example #6
0
        public static string GetCustomLabelValue(IGooglePlaFeedRuleHelper runnerFeed, IProductData productData, FeedRuleType feedRuleType)
        {
            var customLabelValue = runnerFeed.GetCustomLabelValue(productData, feedRuleType);

            return(customLabelValue != null ? customLabelValue.Value : null);
        }
Example #7
0
        public static string GetDynamicMerchLabelValue(IGooglePlaFeedRuleHelper runnerFeed, IProductData productData)
        {
            var value = runnerFeed.GetDynamicMerchLabelValue(productData);

            return(value != null ? value.Value : null);
        }