예제 #1
0
        private void ProcessCatalog()
        {
            _project = (from project in CurrentDb.Projects where project.ID == _args.ProjectId select project).First();
            var aryaUser             = CurrentDb.Users.First(u => u.ID == _project.CreatedBy);
            var lastUpdatedTimestamp = TimestampRecordType.FromValues(_project.CreatedOn,
                                                                      User.FromAryaUser(aryaUser));

            CurrentLogWriter.Debug("Processing " + _project);
            _productCatalog = new ProductCatalog
            {
                Id                  = _project.ID,
                Company             = _project.ClientDescription,
                Type                = "STANDARD",
                ProductCatalogNames =
                    ProductCatalogProductCatalogName.FromName(_project.SetName),
                TaxonomyMetaDataLanguageVersionss =
                    ProductCatalogTaxonomyMetaDataLanguageVersions.FromAryaProject(
                        _project),
                SchemaMetaDataLanguageVersionss =
                    ProductCatalogSchemaMetaDataLanguageVersions.FromAryaProject(
                        _project),
                LastUpdatedTimestamp = lastUpdatedTimestamp
            };

            var taxonomyNode = TaxonomyNode.FromValues(_project.CreatedOn, _project.ID, _project.ToString(),
                                                       Guid.Empty, _project.ID);

            taxonomyNode.IsRoot = true;
            taxonomyNode.SerializeObject(GetSaveFilePath("Node", _project.ID.ToString()));

            _productCatalog.SerializeObject(GetSaveFilePath("Catalog", _productCatalog.Id.ToString()));

            ProcessTaxonomyNodes();
        }
예제 #2
0
        private void ProcessTaxonomyNode(TaxonomyInfo parent, TaxonomyInfo node)
        {
            try
            {
                StatusMessage = string.Format("Processing {0}", node);

                var taxonomyNode = TaxonomyNode.FromValues(node.TaxonomyData.CreatedOn, node.ID, node.NodeName,
                                                           parent != null ? parent.ID : _project.ID, _project.ID);

                if (node.NodeType == TaxonomyInfo.NodeTypeDerived)
                {
                    //TODO: Convert Query from Arya Format to Bridge Format
                    taxonomyNode.DerivedNodeDefinition = new SkuQueryType
                    {
                        SourceNode =
                            new SkuQueryTypeSourceNode
                        {
                            NodeId =
                                node.ID
                        },
                        SelectionCriterias =
                            new List <SelectionCriteriaType>
                        {
                            new SelectionCriteriaType
                            {
                                lang
                                    =
                                        EnUs,
                                Value
                                    =
                                        (node
                                         .DerivedTaxonomies
                                         .FirstOrDefault
                                             ()
                                         ?? new DerivedTaxonomy
                                             ())
                                        .Expression
                                        .Value
                            }
                        }
                    };
                }

                ProcessTaxonomyMetaDatas(node, taxonomyNode);

                //if (ExportAuditTrail)
                //    ProcessTaxonomyNodeTrail(node);

                ProcessTaxonomySchemas(node);
                ProcessTaxonomySkus(node);
                ProcessTaxonomyChildren(node);

                taxonomyNode.SerializeObject(GetSaveFilePath("Node", node.ID.ToString()));
            }
            catch (Exception exception)
            {
                var message = string.Empty;
                var ex      = exception;
                while (ex != null)
                {
                    message += ex.Message + Environment.NewLine;
                    message += ex.StackTrace + Environment.NewLine;
                    ex       = ex.InnerException;
                }
                CurrentLogWriter.Warn("There was a problem processing node." + Environment.NewLine + message);
            }
        }