public void AddItem(Category category)
		{
			var packageRecord = new StandalonePackageRecord(this);
			packageRecord.Category = category.Name;
			var subCategories = Dictionaries.ListManager.Instance.ProductSources
				.Where(productSource =>
					productSource.Category != null &&
					productSource.Category.Name.Equals(category.Name) &&
					!String.IsNullOrEmpty(productSource.SubCategory))
				.Select(x => x.SubCategory)
				.Distinct()
				.ToList();
			if (subCategories.Count <= 1)
				packageRecord.SubCategory = subCategories.FirstOrDefault();
			Items.Add(packageRecord);
		}
		public void AddProduct(Category category)
		{
			Content.AddDigital(category.Name);
			RefreshDigitalAfterAddProduct();
		}
Exemplo n.º 3
0
		private void GetCategories(XmlNode node, ref Category category)
		{
			foreach (XmlAttribute attribute in node.Attributes)
			{
				switch (attribute.Name)
				{
					case "Name":
						category.Name = attribute.Value;
						break;
					case "Logo":
						if (string.IsNullOrEmpty(attribute.Value))
							category.Logo = null;
						else
							category.Logo = new Bitmap(new MemoryStream(Convert.FromBase64String(attribute.Value)));
						break;
					case "TooltipTitle":
						category.TooltipTitle = attribute.Value;
						break;
					case "TooltipValue":
						category.TooltipValue = attribute.Value;
						break;
				}
			}
		}
Exemplo n.º 4
0
		private void LoadOnlineStrategy(StorageFile listsSourceFile)
		{
			SlideHeaders.Clear();
			Websites.Clear();
			Strengths.Clear();
			Categories.Clear();
			ProductSources.Clear();
			if (!listsSourceFile.ExistsLocal()) return;
			var document = new XmlDocument();
			document.Load(listsSourceFile.LocalPath);

			var node = document.SelectSingleNode(@"/OnlineStrategy");
			if (node == null) return;
			foreach (XmlNode childeNode in node.ChildNodes)
			{
				switch (childeNode.Name)
				{
					case "Header":
						foreach (XmlAttribute attribute in childeNode.Attributes)
						{
							switch (attribute.Name)
							{
								case "Value":
									if (!string.IsNullOrEmpty(attribute.Value) && !SlideHeaders.Contains(attribute.Value))
										SlideHeaders.Add(attribute.Value);
									break;
							}
						}
						break;
					case "Site":
						foreach (XmlAttribute attribute in childeNode.Attributes)
						{
							switch (attribute.Name)
							{
								case "Value":
									if (!string.IsNullOrEmpty(attribute.Value) && !Websites.Contains(attribute.Value))
										Websites.Add(attribute.Value);
									break;
							}
						}
						break;
					case "Strength":
						foreach (XmlAttribute attribute in childeNode.Attributes)
						{
							switch (attribute.Name)
							{
								case "Value":
									if (!string.IsNullOrEmpty(attribute.Value) && !Strengths.Contains(attribute.Value))
										Strengths.Add(attribute.Value);
									break;
							}
						}
						break;
					case "PricingStrategy":
						foreach (XmlAttribute attribute in childeNode.Attributes)
						{
							switch (attribute.Name)
							{
								case "Value":
									if (!string.IsNullOrEmpty(attribute.Value) && !PricingStrategies.Contains(attribute.Value))
										PricingStrategies.Add(attribute.Value);
									break;
							}
						}
						break;
					case "PositionColumn":
						foreach (XmlAttribute attribute in childeNode.Attributes)
						{
							switch (attribute.Name)
							{
								case "Value":
									if (!string.IsNullOrEmpty(attribute.Value) && !ColumnPositions.Contains(attribute.Value))
										ColumnPositions.Add(attribute.Value);
									break;
							}
						}
						break;
					case "DefaultFormula":
						switch (childeNode.InnerText.ToLower().Trim())
						{
							case "cpm":
								DefaultFormula = FormulaType.CPM;
								break;
							case "investment":
								DefaultFormula = FormulaType.Investment;
								break;
							case "impressions":
								DefaultFormula = FormulaType.Impressions;
								break;
						}
						break;
					case "LockedMode":
						{
							bool temp;
							if (Boolean.TryParse(childeNode.InnerText, out temp))
								LockedMode = temp;
						}
						break;
					case "SpecialLinksEnable":
						{
							bool temp;
							if (Boolean.TryParse(childeNode.InnerText, out temp))
								SpecialLinksEnable = temp;
						}
						break;
					case "SpecialButtonsGroupName":
						SpecialLinksGroupName = childeNode.InnerText;
						break;
					case "SpecialButtonsGroupLogo":
						if (string.IsNullOrEmpty(childeNode.InnerText))
							SpecialLinksGroupLogo = null;
						else
							SpecialLinksGroupLogo = new Bitmap(new MemoryStream(Convert.FromBase64String(childeNode.InnerText)));
						break;
					case "Browser":
						SpecialLinkBrowsers.Add(childeNode.InnerText);
						break;
					case "SpecialButton":
						var specialLinkButton = new SpecialLinkButton();
						GetSpecialButton(childeNode, ref specialLinkButton);
						if (!String.IsNullOrEmpty(specialLinkButton.Name) && !String.IsNullOrEmpty(specialLinkButton.Type) && specialLinkButton.Paths.Any())
							SpecialLinkButtons.Add(specialLinkButton);
						break;
					case "Targeting":
						{
							var productInfo = new ProductInfo { Type = ProductInfoType.Targeting };
							productInfo.Deserialize(childeNode);
							TargetingRecods.Add(productInfo);
						}
						break;
					case "RichMedia":
						{
							var productInfo = new ProductInfo { Type = ProductInfoType.RichMedia };
							productInfo.Deserialize(childeNode);
							RichMediaRecods.Add(productInfo);
						}
						break;
					case "Category":
						var category = new Category();
						GetCategories(childeNode, ref category);
						if (!string.IsNullOrEmpty(category.Name))
							Categories.Add(category);
						break;
					case "Product":
						var productSource = new ProductSource();
						GetProductProperties(childeNode, ref productSource);
						if (!string.IsNullOrEmpty(productSource.Name))
							ProductSources.Add(productSource);
						break;
					case "Status":
						foreach (XmlAttribute attribute in childeNode.Attributes)
							switch (attribute.Name)
							{
								case "Value":
									if (!Statuses.Contains(attribute.Value))
										Statuses.Add(attribute.Value);
									break;
							}
						break;
					case "DefaultHomeViewSettings":
						DefaultHomeViewSettings.Deserialize(childeNode);
						break;
					case "DefaultDigitalProductSettings":
						DefaultDigitalProductSettings.Deserialize(childeNode);
						break;
					case "DefaultDigitalProductPackageSettings":
						DefaultDigitalProductPackageSettings.Deserialize(childeNode);
						break;
					case "DefaultDigitalStandalonePackageSettings":
						DefaultDigitalStandalonePackageSettings.Deserialize(childeNode);
						break;
					case "DigitalControlsConfiguration":
						DefaultControlsConfiguration =
							JsonConvert.DeserializeObject<DigitalControlsConfiguration>(Encoding.Unicode.GetString(Convert.FromBase64String(childeNode.InnerText)), new JsonImageConverter());
						break;
				}
			}
		}