private void SyncSourceMasterGroupMapping(Connector connector)
        {
            List <MasterGroupMapping> listOfProductGroups = masterGroupMappingRepo.GetListOfProductGroupsByConnector(connector.ConnectorID);

            log.DebugFormat("Syncing {0} Source Master Group Mappings", listOfProductGroups.Count);

            listOfProductGroups.ForEach(productGroup =>
            {
                List <MasterGroupMapping> masterGroupMappings = masterGroupMappingRepo.GetListOfMasterGroupMappingsByProductGroupID(productGroup.ProductGroupID);
                if (masterGroupMappings.Count > 0)
                {
                    productGroup.SourceMasterGroupMappingID = masterGroupMappings.First().MasterGroupMappingID;
                    masterGroupMappingRepo.UpdateMasterGroupMapping(productGroup);
                }
            });
        }
示例#2
0
        private void ProcessSyncProductGroups(Connector connector)
        {
            Dictionary <int, List <MasterGroupMappingProduct> > listOfProductsToSync = new Dictionary <int, List <MasterGroupMappingProduct> >();

            // Get Product Groups By Connector + Source MasterGroupMapping
            List <MasterGroupMapping> productGroups = masterGroupMappingRepo
                                                      .GetListOfProductGroupsByConnector(connector.ConnectorID)
                                                      .Where(pg => pg.SourceMasterGroupMappingID != null)
                                                      .ToList();

            if (productGroups.Count > 0)
            {
                // Get Products By ConnectorPublicationRules
                List <VendorProductInfo> products = GetListOfProductsByConnectorConnectorPublicationRules(connector.ConnectorID);

                log.DebugFormat("");
                log.DebugFormat("-----> Start: Get Mapped Products");
                productGroups.ForEach(productGroup =>
                {
                    // Fill syncList with products
                    List <MasterGroupMappingProduct> mappedProductsBySourceMasterGroupMapping = GetListOfMappedProductsBySourceMasterGroupMapping(productGroup, products);
                    listOfProductsToSync.Add(productGroup.MasterGroupMappingID, mappedProductsBySourceMasterGroupMapping);
                });
                log.DebugFormat("-----> End: Get Mapped Products. Count product Groups: {0}, Product To Sync: {1}", listOfProductsToSync.Count, listOfProductsToSync.Values.SelectMany(y => y).Count());

                syncProductService.SyncProductGroup(listOfProductsToSync);
            }
        }
示例#3
0
        public List <MasterGroupMapping> GetListOfProductGroupsWithFlattenHierachy(int connectorID)
        {
            List <MasterGroupMapping> listOfFlattenHierachyProductGroups = masterGroupMappingRepo
                                                                           .GetListOfProductGroupsByConnector(connectorID)
                                                                           .Where(x => x.FlattenHierarchy == true)
                                                                           .ToList();

            return(listOfFlattenHierachyProductGroups);
        }
        public List <MasterGroupMapping> GetListOfProductGroupsWithFilterByParent(Connector connector)
        {
            List <MasterGroupMapping> productGroups = masterGroupMappingRepo
                                                      .GetListOfProductGroupsByConnector(connector.ConnectorID)
                                                      .Where(x => x.FilterByParentGroup == true)
                                                      .ToList()
            ;

            return(productGroups);
        }
        public Dictionary <int, List <Content> > GetListOfContentsPerProductGroupByConnector(Connector connector)
        {
            Dictionary <int, List <Content> > listOfContentsPerProductGroup = new Dictionary <int, List <Content> >();
            List <Content> listOfContents      = contentRepo.GetListOfContentsByConnector(connector);
            var            listOfProductGroups = masterGroupMappingRepo.GetListOfProductGroupsByConnector(connector.ConnectorID);

            listOfProductGroups.ForEach(productGroup => {
                List <MasterGroupMappingProduct> listOfMappedProducts = masterGroupMappingRepo.GetListOfMappedProductsByMasterGroupMapping(productGroup.MasterGroupMappingID);
                List <Content> listOfMappedContents =
                    (
                        from c in listOfContents
                        join p in listOfMappedProducts on c.ProductID equals p.ProductID
                        select c
                    ).ToList();
                listOfContentsPerProductGroup.Add(productGroup.MasterGroupMappingID, listOfMappedContents);
            });
            return(listOfContentsPerProductGroup);
        }
示例#6
0
        public List <MasterGroupMapping> GetListOfProductGroupMapping(Connector connector)
        {
            List <MasterGroupMapping> listOfProductGroupMappings = masterGroupMappingRepo.GetListOfProductGroupsByConnector(connector.ConnectorID);

            return(listOfProductGroupMappings);
        }