Exemplo n.º 1
0
        public void AddDigital(string categoryName)
        {
            var digitalProduct = new DigitalProduct(this)
            {
                Index    = DigitalProducts.Count + 1,
                Category = categoryName
            };
            var subCategories = Dictionaries.ListManager.Instance.ProductSources
                                .Where(productSource =>
                                       productSource.Category != null &&
                                       productSource.Category.Name.Equals(categoryName) &&
                                       !String.IsNullOrEmpty(productSource.SubCategory))
                                .Select(x => x.SubCategory)
                                .Distinct()
                                .ToList();

            if (subCategories.Count <= 1)
            {
                digitalProduct.SubCategory = subCategories.FirstOrDefault();
            }
            DigitalProducts.Add(digitalProduct);
        }
Exemplo n.º 2
0
        public override void Deserialize(XmlNode rootNode)
        {
            base.Deserialize(rootNode);

            var node = rootNode.SelectSingleNode(@"ProgramSchedule");

            if (node != null)
            {
                InitProgramSchedule();
                ProgramSchedule.Deserialize(node);
            }

            node = rootNode.SelectSingleNode(@"WeeklySection");
            if (node != null && SelectedSpotType == SpotType.Week)
            {
                InitProgramSchedule();
                ProgramSchedule.DeserializeSection(node);
            }

            node = rootNode.SelectSingleNode(@"MonthlySection");
            if (node != null && SelectedSpotType == SpotType.Month)
            {
                InitProgramSchedule();
                ProgramSchedule.DeserializeSection(node);
            }

            node = rootNode.SelectSingleNode(@"DigitalProducts");
            if (node != null)
            {
                foreach (XmlNode productNode in node.ChildNodes)
                {
                    var product = new DigitalProduct();
                    product.Deserialize(productNode);
                    DigitalProducts.Add(product);
                }
            }

            node = rootNode.SelectSingleNode(@"DigitalProductSummary");
            if (node != null)
            {
                DigitalProductSummary.Deserialize(node);
            }

            node = rootNode.SelectSingleNode(@"Snapshots");
            if (node != null)
            {
                foreach (XmlNode snapshotNode in node.ChildNodes)
                {
                    var snapshot = new Snapshot.Snapshot(this);
                    snapshot.Deserialize(snapshotNode);
                    Snapshots.Add(snapshot);
                }
            }

            node = rootNode.SelectSingleNode(@"SnapshotSummary");
            if (node != null)
            {
                SnapshotSummary.Deserialize(node);
            }

            node = rootNode.SelectSingleNode(@"Options");
            if (node != null)
            {
                foreach (XmlNode optionSetNode in node.ChildNodes)
                {
                    var optionSet = new OptionSet(this);
                    optionSet.Deserialize(optionSetNode);
                    Options.Add(optionSet);
                }
            }

            node = rootNode.SelectSingleNode(@"OptionsSummary");
            if (node != null)
            {
                OptionsSummary.Deserialize(node);
            }
        }