public DataHandlerBase(SiteRules rules, CartExtractor cart, ExtractorProgress progress, DataGroup group)
 {
     _cart = cart;
     _rules = rules;
     _progress = progress;
     _group = group;
     _exportDate = DateTime.Now;
     _exportDateInitialized = false;
     _migrationSlave = _rules.MigrationRules != null && _rules.MigrationRules.Enabled
                                         && !_rules.MigrationRules.IsMigrationMaster;
     Reset();
 }
 public SalesHandler(SiteRules rules, CartExtractor cart, ExtractorProgress progress)
     : base(rules, cart, progress, DataGroup.Sales)
 {
 }
        private Dictionary<string, ParentItem> _parentProducts; //key is product id

        #endregion Fields

        #region Constructors

        public CatalogHandler(SiteRules rules, CartExtractor cart, ExtractorProgress progress)
            : base(rules, cart, progress, DataGroup.Catalog)
        {
        }
 public AttributeHandler(SiteRules rules, CartExtractor cart, ExtractorProgress progress, DataGroup group)
     : base(rules, cart, progress, group)
 {
 }
 public InventoryHandler(SiteRules rules, CartExtractor cart, ExtractorProgress progress)
     : base(rules, cart, progress, DataGroup.Inventory)
 {
 }
        public void ProcessMap()
        {
            if (!Enabled || !IsMigrationMaster) return;

            _migrationCart = CartExtractor.GetCart(OldRules);
            if (_migrationCart == null)
            {
                if (BoostLog.Instance != null)
                    BoostLog.Instance.WriteEntry(EventLogEntryType.Error, "Unable to create migration cart", "", Alias);
                return;
            }
            _migrationCart.SetMigrationSlave(this);
            Progress.SetMigrationProgress(_migrationCart.Progress);
            Progress.IsMigrating = true;

            //if there is a ToField then Master Map was created when master catalog was pulled
            if (!string.IsNullOrEmpty(MapToField))
            {
                Progress.StartTable("Master Migration Map", "items");
                if (MigrationSubMap == null || !MigrationSubMap.Any())
                    Progress.EndTable(0, "none");
                else
                    Progress.EndTable(MigrationSubMap.Count, "completed");
            }

            //If there is a FromField then need to pull the Slave Catalog to get the Slave Map
            if (!string.IsNullOrEmpty(MapFromField))
            {
                Progress.StartTable("Slave Migration Map", "items");
                _migrationCart.GetData(CartExtractor.ExtractType.Catalog);
                var slaveMap = _migrationCart.Rules.MigrationRules.MigrationSubMap;
                if (slaveMap == null || !slaveMap.Any())
                    Progress.EndTable(0, "none");
                else
                    Progress.EndTable(slaveMap.Count, "completed");
            }

            //Replacements are created by combining master and slave maps or by using an optional direct map file
            Progress.StartTable("Full Migration Map", "items");
            int itemCount;
            var status = CreateFullMap(out itemCount);
            Progress.EndTable(itemCount, status);

            //Now get sales data
            // --dates will be limited by the migration start date
            // --sales data product ids will be replaced automatically
            Progress.StartTable("Migration Sales", "records");
            if (Use4TellSales)
                GetAllSales(ref itemCount);
            else
            {
                _migrationCart.GetData(CartExtractor.ExtractType.Sales);
                itemCount = _migrationCart.TotalSales;
            }
            Progress.EndTable(itemCount, "Complete");

            //Now get clickstream data
            // --dates will be limited by the migration start date
            // --clickstream data product ids will be replaced using the migration map
            Progress.StartTable("Migration ClickStream", "records");
            GetAllClickStream(ref itemCount);
            Progress.EndTable(itemCount, "Complete");

            //TODO: can't really migrate customers unless we are going to use an alternate id based on address or creditcard, etc
            //if (_migrationCart.Rules.ExtractCustomerData)
            //{
            //  Progress.StartTable("Migration Customers", "records");
            //  _migrationCart.GetData(CartExtractor.ExtractType.Customers);
            //  itemCount = _migrationCart.TotalCustomers;
            //  Progress.EndTable(itemCount, "Complete");
            //}

            Progress.IsMigrating = false;
        }
 public CustomerHandler(SiteRules rules, CartExtractor cart, ExtractorProgress progress)
     : base(rules, cart, progress, DataGroup.Customers)
 {
 }