public void DownDigital(int position) { if (position >= DigitalProducts.Count - 1) { return; } DigitalProducts[position].Index++; DigitalProducts[position + 1].Index--; DigitalProducts.Sort((x, y) => x.Index.CompareTo(y.Index)); }
public void UpDigital(int position) { if (position <= 0) { return; } DigitalProducts[position].Index--; DigitalProducts[position - 1].Index++; DigitalProducts.Sort((x, y) => x.Index.CompareTo(y.Index)); }
public void ChangeDigitalProductPosition(int position, int newPosition) { if (position < 0 || position >= DigitalProducts.Count) { return; } var product = DigitalProducts[position]; product.Index = newPosition + 0.5; DigitalProducts.Sort((x, y) => x.Index.CompareTo(y.Index)); RebuildDigitalProductIndexes(); }
public override void Dispose() { DigitalProducts.ForEach(o => o.Dispose()); DigitalProducts.Clear(); StandalonePackage.Dispose(); StandalonePackage = null; DigitalProductSummary = null; base.Dispose(); }
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); }
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); } }