public FormProductInfo(ProductInfoType type, DigitalProduct product)
        {
            InitializeComponent();
            _type    = type;
            _product = product;

            simpleLabelItemTitle.Text = String.Format("<size=+2><i>{0}</i></size>", product.FullName);

            switch (_type)
            {
            case ProductInfoType.Targeting:
                Text = "Targeting Options";
                pictureEditLogo.Image = Resources.TargetButton;
                break;

            case ProductInfoType.RichMedia:
                Text = "Rich Media Options";
                pictureEditLogo.Image = Resources.RichMediaButton;
                break;
            }
            foreach (var group in _product.AddtionalInfo.Where(pi => pi.Type == type).Select(pi => pi.Group).Distinct())
            {
                xtraTabControlGroups.TabPages.Add(new DigitalProductInfoGroup(_product.AddtionalInfo.Where(pi => pi.Type == type && pi.Group == group))
                {
                    Text = group
                });
            }

            layoutControlItemLogo.MaxSize   = RectangleHelper.ScaleSize(layoutControlItemLogo.MaxSize, Utilities.GetScaleFactor(CreateGraphics().DpiX));
            layoutControlItemLogo.MinSize   = RectangleHelper.ScaleSize(layoutControlItemLogo.MinSize, Utilities.GetScaleFactor(CreateGraphics().DpiX));
            layoutControlItemOK.MaxSize     = RectangleHelper.ScaleSize(layoutControlItemOK.MaxSize, Utilities.GetScaleFactor(CreateGraphics().DpiX));
            layoutControlItemOK.MinSize     = RectangleHelper.ScaleSize(layoutControlItemOK.MinSize, Utilities.GetScaleFactor(CreateGraphics().DpiX));
            layoutControlItemCancel.MaxSize = RectangleHelper.ScaleSize(layoutControlItemCancel.MaxSize, Utilities.GetScaleFactor(CreateGraphics().DpiX));
            layoutControlItemCancel.MinSize = RectangleHelper.ScaleSize(layoutControlItemCancel.MinSize, Utilities.GetScaleFactor(CreateGraphics().DpiX));
        }
Exemplo n.º 2
0
        public void CheckDifferentMethodProducts()
        {
            PhysicalProduct physicalProduct = new PhysicalProduct("Product", 100, 100, "New Product");
            DigitalProduct  digitalProduct  = new DigitalProduct("Product", 100, 100, "New Product");

            Assert.IsFalse(physicalProduct.TransportMethod().Equals(digitalProduct.TransportMethod()));
        }
Exemplo n.º 3
0
        public void AddCartItem_NoShippingForDigital_ChangesBool()
        {
            // Arrange
            Sale    testSale = new Sale();
            Product digitaal = new DigitalProduct("download", 15f, "hier mee kan je iets downloaden", "www.blah.nl");

            // Act
            testSale.AddItem(digitaal, "69");
            var heeftFysiek = testSale.ContainsPhysical();

            // Assert
            Assert.AreEqual(false, heeftFysiek);
        }
Exemplo n.º 4
0
        //[DataRow("-1")]
        public void AddItem_QuantityMoreThenZero_AddsNewCartItem(string quantity)
        {
            // Arrange
            Sale    testSale = new Sale();
            Product fysiek   = new PhysicalProduct("fiets", 9.99f, "dit is een fietsje", new Tuple <float, float, float>(1, 2, 3), 7);
            Product digitaal = new DigitalProduct("download", 15f, "hier mee kan je iets downloaden", "www.blah.nl");

            // Act
            //testSale.AddItem(fysiek, quantity);
            testSale.AddItem(digitaal, quantity);

            // Assert
            Assert.AreEqual(false, testSale.IsFilled());
        }
Exemplo n.º 5
0
        public void ShippingForPhysical()
        {
            string[]     allLines     = File.ReadAllLines("Database.txt", Encoding.UTF8);
            int[]        allProducts  = new int[allLines.Length];
            ShoppingCart shoppingCart = new ShoppingCart(allProducts);

            shoppingCart.AddToCart(1, 8);
            shoppingCart.AddToCart(4, 10);
            Parser          parser          = new Parser();
            PhysicalProduct one             = (PhysicalProduct)parser.GetProductFromIndex(1);
            DigitalProduct  two             = (DigitalProduct)parser.GetProductFromIndex(4);
            int             noShippingPrice = 8 * one.productPrice + 10 * two.productPrice;

            Assert.IsTrue(noShippingPrice < shoppingCart.PriceOfCart(OrderType.Inland));
        }
Exemplo n.º 6
0
        public void MakeOrder_PaymentIsCompleted_PaymentStateCompleted()
        {
            // Arrange
            Sale    testSale = new Sale();
            Product fysiek   = new PhysicalProduct("fiets", 9.99f, "dit is een fietsje", new Tuple <float, float, float>(1, 2, 3), 7);
            Product digitaal = new DigitalProduct("download", 15f, "hier mee kan je iets downloaden", "www.blah.nl");

            // Act
            testSale.AddItem(fysiek, "1");
            testSale.AddItem(digitaal, "69");
            testSale.SetCustomerInfo("Floris", "*****@*****.**", CustomerInfo.PaymentMethod.CreditCard, "Utrecht", "Androsdreef 88", "3562XC");
            var value = Payment.state;

            // Assert
            Assert.AreEqual(PaymentState.Completed, value);
        }
Exemplo n.º 7
0
        // method name syntax: 'subject'_'condition'_'event'
        public void IsFilled_after_addtion()
        {
            // Arrange
            Sale    testSale = new Sale();
            Product fysiek   = new PhysicalProduct("fiets", 9.99f, "dit is een fietsje", new Tuple <float, float, float>(1, 2, 3), 7);
            Product digitaal = new DigitalProduct("download", 15f, "hier mee kan je iets downloaden", "www.blah.nl");

            // Act
            testSale.AddItem(fysiek, "3");
            testSale.AddItem(digitaal, "5");
            var value = testSale.IsFilled();

            // Assert

            Assert.AreEqual(true, value);
        }
Exemplo n.º 8
0
        public void GetPrice_AfterDeletingCart_Zero()
        {
            // Arrange
            Sale    testSale = new Sale();
            Product fysiek   = new PhysicalProduct("fiets", 9.99f, "dit is een fietsje", new Tuple <float, float, float>(1, 2, 3), 7);
            Product digitaal = new DigitalProduct("download", 15f, "hier mee kan je iets downloaden", "www.blah.nl");

            // Act
            testSale.AddItem(fysiek, "3");
            testSale.AddItem(digitaal, "5");
            testSale.Cancel();
            var value = testSale.GetPrice();

            // Assert

            Assert.AreEqual(0, value);
        }
		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.º 10
0
		public FormProductInfo(ProductInfoType type, DigitalProduct product)
		{
			InitializeComponent();
			_type = type;
			_product = product;
			labelControlTitle.Text = product.FullName;
			switch (_type)
			{
				case ProductInfoType.Targeting:
					Text = "Targeting Options";
					pictureBoxInfoType.Image = Resources.TargetButton;
					break;
				case ProductInfoType.RichMedia:
					Text = "Rich Media Options";
					pictureBoxInfoType.Image = Resources.RichMediaButton;
					break;
			}
			foreach (var group in _product.AddtionalInfo.Where(pi => pi.Type == type).Select(pi => pi.Group).Distinct())
				xtraTabControlGroups.TabPages.Add(new DigitalProductInfoGroup(_product.AddtionalInfo.Where(pi => pi.Type == type && pi.Group == group)) { Text = group });
		}
Exemplo n.º 11
0
        public void LoadData(DigitalProduct sourceProduct)
        {
            _sourceProduct            = sourceProduct;
            simpleLabelItemIndex.Text = String.Format("{0}.", _sourceProduct.Index);
            simpleLabelItemTitle.Text = String.Format("<b>{0}</b>{1}({2}{3})",
                                                      _sourceProduct.Name,
                                                      Environment.NewLine,
                                                      _sourceProduct.Category,
                                                      !String.IsNullOrEmpty(_sourceProduct.SubCategory) ? String.Format("/{0}", _sourceProduct.SubCategory) : String.Empty);
            simpleLabelItemSites.Text     = !String.IsNullOrEmpty(_sourceProduct.OutputData.Websites) ? String.Format("<b>Sites: </b>{0}", _sourceProduct.OutputData.Websites) : String.Empty;
            memoEditDescription.EditValue = _sourceProduct.OutputData.Description;

            var impressionValue = _sourceProduct.OutputData.Impressions.HasValue ? _sourceProduct.OutputData.Impressions.Value.ToString("#,##0") : String.Empty;

            if (!String.IsNullOrEmpty(impressionValue))
            {
                simpleLabelItemImpressionsValue.Text     = String.Format("Impressions: <b>{0}</b>", impressionValue);
                layoutControlGroupImpressions.Visibility = LayoutVisibility.Always;
                checkEditImpressions.Checked             = sourceProduct.ShowSummaryImpressions;
            }
            else
            {
                layoutControlGroupImpressions.Visibility = LayoutVisibility.Never;
                checkEditImpressions.Checked             = false;
            }

            var investmentValue = _sourceProduct.OutputData.Investments.HasValue ? _sourceProduct.OutputData.Investments.Value.ToString("$#,##0") : String.Empty;

            if (!String.IsNullOrEmpty(investmentValue))
            {
                simpleLabelItemInvestmentsValue.Text     = String.Format("Investment: <b>{0}</b>", investmentValue);
                layoutControlGroupInvestments.Visibility = LayoutVisibility.Always;
                checkEditInvestments.Checked             = sourceProduct.ShowSummaryInvestments;
            }
            else
            {
                layoutControlGroupInvestments.Visibility = LayoutVisibility.Never;
                checkEditInvestments.Checked             = false;
            }

            var cpmValue = _sourceProduct.OutputData.CPM.HasValue ? _sourceProduct.OutputData.CPM.Value.ToString("$#,##0.00") : String.Empty;

            if (!String.IsNullOrEmpty(cpmValue))
            {
                simpleLabelItemCPMValue.Text     = String.Format("CPM: <b>{0}</b>", cpmValue);
                layoutControlGroupCPM.Visibility = LayoutVisibility.Always;
                checkEditCPM.Checked             = sourceProduct.ShowSummaryCPM;
            }
            else
            {
                layoutControlGroupCPM.Visibility = LayoutVisibility.Never;
                checkEditCPM.Checked             = false;
            }

            if (!String.IsNullOrEmpty(_sourceProduct.InvestmentDetails))
            {
                simpleLabelItemInvestmentsValue.Text           = String.Format("Investment Details: <b>{0}</b>", _sourceProduct.InvestmentDetails);
                layoutControlGroupInvestmentDetails.Visibility = LayoutVisibility.Always;
                checkEditInvDetails.Checked = sourceProduct.ShowSummaryInvestmentDetails;
            }
            else
            {
                layoutControlGroupInvestmentDetails.Visibility = LayoutVisibility.Never;
                checkEditInvDetails.Checked = false;
            }

            layoutControlGroupToggles.Visibility = !String.IsNullOrEmpty(impressionValue) ||
                                                   !String.IsNullOrEmpty(investmentValue) || !String.IsNullOrEmpty(cpmValue) ||
                                                   !String.IsNullOrEmpty(_sourceProduct.InvestmentDetails)
                                ? LayoutVisibility.Always
                                : LayoutVisibility.Never;
        }
Exemplo n.º 12
0
        /// <summary>
        /// The execute.
        /// </summary>
        /// <param name="arg">
        /// The argument.
        /// </param>
        /// <param name="context">
        /// The context.
        /// </param>
        /// <returns>
        /// A list of <see cref="Entitlement"/>.
        /// </returns>
        public override async Task <IEnumerable <Entitlement> > Run(IEnumerable <Entitlement> arg, CommercePipelineExecutionContext context)
        {
            var entitlements = arg as List <Entitlement> ?? arg.ToList();

            Condition.Requires(entitlements).IsNotNull($"{this.Name}: The entitlements can not be null");

            var argument = context.CommerceContext.GetObjects <ProvisionEntitlementsArgument>().FirstOrDefault();

            if (argument == null)
            {
                return(entitlements.AsEnumerable());
            }

            var customer = argument.Customer;
            var order    = argument.Order;

            if (order == null)
            {
                return(entitlements.AsEnumerable());
            }

            var digitalTags          = context.GetPolicy <KnownEntitlementsTags>().DigitalProductTags;
            var lineWithDigitalGoods = order.Lines.Where(line => line != null &&
                                                         line.GetComponent <CartProductComponent>().HasPolicy <AvailabilityAlwaysPolicy>() &&
                                                         line.GetComponent <CartProductComponent>().Tags.Select(t => t.Name).Intersect(digitalTags, StringComparer.OrdinalIgnoreCase).Any()).ToList();

            if (!lineWithDigitalGoods.Any())
            {
                return(entitlements.AsEnumerable());
            }

            var hasErrors = false;

            foreach (var line in lineWithDigitalGoods)
            {
                foreach (var index in Enumerable.Range(1, (int)line.Quantity))
                {
                    try
                    {
                        var entitlement = new DigitalProduct();
                        var id          = Guid.NewGuid().ToString("N");
                        entitlement.Id         = $"{CommerceEntity.IdPrefix<DigitalProduct>()}{id}";
                        entitlement.FriendlyId = id;
                        entitlement.SetComponent(
                            new ListMembershipsComponent
                        {
                            Memberships =
                                new List <string>
                            {
                                $"{CommerceEntity.ListName<DigitalProduct>()}",
                                $"{CommerceEntity.ListName<Entitlement>()}"
                            }
                        });
                        entitlement.Order = new EntityReference(order.Id, order.Name);
                        if (customer != null)
                        {
                            entitlement.Customer = new EntityReference(customer.Id, customer.Name);
                        }

                        await this._persistEntityPipeline.Run(new PersistEntityArgument(entitlement), context);

                        entitlements.Add(entitlement);
                        context.Logger.LogInformation(
                            $"DigitalProduct Entitlement Created - Order={order.Id}, LineId={line.Id}, EntitlementId={entitlement.Id}");
                    }
                    catch
                    {
                        hasErrors = true;
                        context.Logger.LogError(
                            $"DigitalProduct Entitlement NOT Created - Order={order.Id}, LineId={line.Id}");
                        break;
                    }
                }

                if (hasErrors)
                {
                    break;
                }
            }

            if (!hasErrors)
            {
                return(entitlements.AsEnumerable());
            }

            context.Abort(
                context.CommerceContext.AddMessage(
                    context.GetPolicy <KnownResultCodes>().Error,
                    "ProvisioningEntitlementErrors",
                    new object[] { order.Id },
                    $"Error(s) occurred provisioning entitlements for order '{order.Id}'"),
                context);
            return(null);
        }
Exemplo n.º 13
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);
            }
        }
		public ProductPackageRecord(DigitalProduct parent) : base(parent.Parent.ScheduleSettings)
		{
			Parent = parent;
			ResetToDefault();
		}
		public void Release()
		{
			_sourceProduct = null;
		}
		public void LoadData(DigitalProduct sourceProduct)
		{
			_sourceProduct = sourceProduct;
			labelControlNumber.Text = String.Format("{0}.", _sourceProduct.Index);
			labelControlTitle.Text = String.Format("<b>{0}</b>{1}({2}{3})",
				_sourceProduct.Name,
				Environment.NewLine,
				_sourceProduct.Category,
				!String.IsNullOrEmpty(_sourceProduct.SubCategory) ? String.Format("/{0}", _sourceProduct.SubCategory) : String.Empty);
			labelControlSites.Text = !String.IsNullOrEmpty(_sourceProduct.OutputData.Websites) ? String.Format("<b>Sites: </b>{0}", _sourceProduct.OutputData.Websites) : String.Empty;
			memoEditDescription.EditValue = _sourceProduct.OutputData.Description;

			var impressionValue = _sourceProduct.OutputData.Impressions.HasValue ? _sourceProduct.OutputData.Impressions.Value.ToString("#,##0") : String.Empty;
			if (!String.IsNullOrEmpty(impressionValue))
			{
				checkEditImpressions.Text = String.Format("Impressions: <b>{0}</b>", impressionValue);
				checkEditImpressions.Visible = true;
				checkEditImpressions.Checked = sourceProduct.ShowSummaryImpressions;
				checkEditImpressions.BringToFront();
			}
			else
			{
				checkEditImpressions.Visible = false;
				checkEditImpressions.Checked = false;
			}

			var investmentValue = _sourceProduct.OutputData.Investments.HasValue ? _sourceProduct.OutputData.Investments.Value.ToString("$#,##0") : String.Empty;
			if (!String.IsNullOrEmpty(investmentValue))
			{
				checkEditInvestments.Text = String.Format("Investment: <b>{0}</b>", investmentValue);
				checkEditInvestments.Visible = true;
				checkEditInvestments.Checked = sourceProduct.ShowSummaryInvestments;
				checkEditInvestments.BringToFront();
			}
			else
			{
				checkEditInvestments.Visible = false;
				checkEditInvestments.Checked = false;
			}

			var cpmValue = _sourceProduct.OutputData.CPM.HasValue ? _sourceProduct.OutputData.CPM.Value.ToString("$#,##0.00") : String.Empty;
			if (!String.IsNullOrEmpty(cpmValue))
			{
				checkEditCPM.Text = String.Format("CPM: <b>{0}</b>", cpmValue);
				checkEditCPM.Visible = true;
				checkEditCPM.Checked = sourceProduct.ShowSummaryCPM;
				checkEditCPM.BringToFront();
			}
			else
			{
				checkEditCPM.Visible = false;
				checkEditCPM.Checked = false;
			}

			if (!String.IsNullOrEmpty(_sourceProduct.InvestmentDetails))
			{
				checkEditInvDetails.Text = String.Format("Investment Details: <b>{0}</b>", _sourceProduct.InvestmentDetails);
				checkEditInvDetails.Visible = true;
				checkEditInvDetails.Checked = sourceProduct.ShowSummaryInvestmentDetails;
				checkEditInvDetails.BringToFront();
			}
			else
			{
				checkEditInvDetails.Visible = false;
				checkEditInvDetails.Checked = false;
			}
		}
Exemplo n.º 17
0
        public static void AppendOneSheet(this PowerPointProcessor target, DigitalProduct source, Theme theme, Presentation destinationPresentation = null)
        {
            try
            {
                var thread = new Thread(delegate()
                {
                    var presentationTemplatePath = MasterWizardManager.Instance.SelectedWizard.GetOnlineOneSheetFile(source.OutputData.GetSlideSource());
                    if (string.IsNullOrEmpty(presentationTemplatePath))
                    {
                        return;
                    }
                    if (!File.Exists(presentationTemplatePath))
                    {
                        return;
                    }

                    MessageFilter.Register();
                    var presentation = target.PowerPointObject.Presentations.Open(presentationTemplatePath, WithWindow: MsoTriState.msoFalse);
                    foreach (Slide slide in presentation.Slides)
                    {
                        foreach (Shape shape in slide.Shapes)
                        {
                            for (int i = 1; i <= shape.Tags.Count; i++)
                            {
                                switch (shape.Tags.Name(i))
                                {
                                    #region Top Part
                                case "HEADER":
                                    shape.TextFrame.TextRange.Text = String.Format(source.OutputData.Header, shape.TextFrame.TextRange.Text);
                                    break;

                                case "WEBSITEURL":
                                    shape.TextFrame.TextRange.Text = source.OutputData.Websites;
                                    break;

                                case "DATETAG":
                                    shape.TextFrame.TextRange.Text = source.OutputData.PresentationDate;
                                    break;

                                case "ADVERTISER":
                                    shape.TextFrame.TextRange.Text = source.OutputData.BusinessName;
                                    break;

                                case "DECMKR":
                                    shape.TextFrame.TextRange.Text = source.OutputData.DecisionMaker;
                                    break;

                                case "CAMPVALUE":
                                    shape.TextFrame.TextRange.Text = source.OutputData.FlightDates;
                                    break;

                                case "WEBPRODUCT":
                                    shape.TextFrame.TextRange.Text = source.OutputData.ProductName;
                                    break;

                                case "WEBDESCRIPT":
                                    shape.TextFrame.TextRange.Text = source.OutputData.Description;
                                    break;
                                    #endregion

                                case "MTHIMPLABEL":
                                    shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Any() ? source.OutputData.MonthlyData.ElementAt(0).Name : String.Empty;
                                    break;

                                case "MONTHLYIMPVALUE":
                                    shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Any() ? source.OutputData.MonthlyData.ElementAt(0).Code : String.Empty;
                                    break;

                                case "MONTHINVLBL":
                                    shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Count() > 1 ? source.OutputData.MonthlyData.ElementAt(1).Name : String.Empty;
                                    break;

                                case "MONTHINVVALUE":
                                    shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Count() > 1 ? source.OutputData.MonthlyData.ElementAt(1).Code : String.Empty;
                                    break;

                                case "MCPM":
                                    shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Count() > 2 ? source.OutputData.MonthlyData.ElementAt(2).Name : String.Empty;
                                    break;

                                case "MCPMVALUE":
                                    shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Count() > 2 ? source.OutputData.MonthlyData.ElementAt(2).Code : String.Empty;
                                    break;

                                case "TTLIMPLABEL":
                                    shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Any() ? source.OutputData.TotalData.ElementAt(0).Name : String.Empty;
                                    break;

                                case "TOTALIMPVALUE":
                                    shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Any() ? source.OutputData.TotalData.ElementAt(0).Code : String.Empty;
                                    break;

                                case "TOTINVLBL":
                                    shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Count() > 1 ? source.OutputData.TotalData.ElementAt(1).Name : String.Empty;
                                    break;

                                case "TOTINVVALUE":
                                    shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Count() > 1 ? source.OutputData.TotalData.ElementAt(1).Code : String.Empty;
                                    break;

                                case "TCPM":
                                    shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Count() > 2 ? source.OutputData.TotalData.ElementAt(2).Name : String.Empty;
                                    break;

                                case "TCPMVALUE":
                                    shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Count() > 2 ? source.OutputData.TotalData.ElementAt(2).Code : String.Empty;
                                    break;

                                case "INVDET":
                                    shape.TextFrame.TextRange.Text = source.OutputData.InvestmentDetails;;
                                    break;

                                case "CMNTVALUE":
                                    shape.TextFrame.TextRange.Text = source.OutputData.Comment;;
                                    break;
                                }
                            }
                        }
                    }
                    if (theme != null)
                    {
                        presentation.ApplyTheme(theme.GetThemePath());
                    }
                    target.AppendSlide(presentation, -1, destinationPresentation);
                    presentation.Close();
                });
                thread.Start();

                while (thread.IsAlive)
                {
                    Application.DoEvents();
                }
            }
            catch
            {
            }
            finally
            {
                MessageFilter.Revoke();
            }
        }
Exemplo n.º 18
0
 public static void PrepareScheduleEmail(this PowerPointProcessor target, string fileName, DigitalProduct product, Theme theme)
 {
     target.PreparePresentation(fileName, presentation => target.AppendOneSheet(product, theme, presentation));
 }
Exemplo n.º 19
0
		public void PrepareScheduleEmail(string fileName, DigitalProduct product, Theme theme)
		{
			PreparePresentation(fileName, presentation => AppendOneSheet(product, theme, presentation));
		}
Exemplo n.º 20
0
		public void AppendOneSheets(DigitalProduct[] sources, Theme theme, Presentation destinationPresentation = null)
		{
			foreach (var source in sources)
				AppendOneSheet(source, theme, destinationPresentation);
		}
Exemplo n.º 21
0
 public void Release()
 {
     _sourceProduct = null;
 }
		public DigitalProductOutputData(DigitalProduct parent)
		{
			_source = parent;
		}
Exemplo n.º 23
0
		public void AppendOneSheet(DigitalProduct source, Theme theme, Presentation destinationPresentation = null)
		{
			try
			{
				var thread = new Thread(delegate ()
				{
					var presentationTemplatePath = MasterWizardManager.Instance.SelectedWizard.GetOnlineOneSheetFile(source.OutputData.GetSlideSource());
					if (string.IsNullOrEmpty(presentationTemplatePath)) return;
					if (!File.Exists(presentationTemplatePath)) return;

					MessageFilter.Register();
					var presentation = PowerPointObject.Presentations.Open(presentationTemplatePath, WithWindow: MsoTriState.msoFalse);
					foreach (Slide slide in presentation.Slides)
					{
						foreach (Shape shape in slide.Shapes)
						{
							for (int i = 1; i <= shape.Tags.Count; i++)
							{
								switch (shape.Tags.Name(i))
								{
										#region Top Part
										case "HEADER":
										shape.TextFrame.TextRange.Text = String.Format(source.OutputData.Header, shape.TextFrame.TextRange.Text);
										break;
									case "WEBSITEURL":
										shape.TextFrame.TextRange.Text = source.OutputData.Websites;
										break;
									case "DATETAG":
										shape.TextFrame.TextRange.Text = source.OutputData.PresentationDate;
										break;
									case "ADVERTISER":
										shape.TextFrame.TextRange.Text = source.OutputData.BusinessName;
										break;
									case "DECMKR":
										shape.TextFrame.TextRange.Text = source.OutputData.DecisionMaker;
										break;
									case "CAMPVALUE":
										shape.TextFrame.TextRange.Text = source.OutputData.FlightDates;
										break;
									case "WEBPRODUCT":
										shape.TextFrame.TextRange.Text = source.OutputData.ProductName;
										break;
									case "WEBDESCRIPT":
										shape.TextFrame.TextRange.Text = source.OutputData.Description;
										break;
										#endregion

										case "MTHIMPLABEL":
										shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Any() ? source.OutputData.MonthlyData.ElementAt(0).Name : String.Empty;
										break;
									case "MONTHLYIMPVALUE":
										shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Any() ? source.OutputData.MonthlyData.ElementAt(0).Code : String.Empty;
										break;
									case "MONTHINVLBL":
										shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Count() > 1 ? source.OutputData.MonthlyData.ElementAt(1).Name : String.Empty;
										break;
									case "MONTHINVVALUE":
										shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Count() > 1 ? source.OutputData.MonthlyData.ElementAt(1).Code : String.Empty;
										break;
									case "MCPM":
										shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Count() > 2 ? source.OutputData.MonthlyData.ElementAt(2).Name : String.Empty;
										break;
									case "MCPMVALUE":
										shape.TextFrame.TextRange.Text = source.OutputData.MonthlyData.Count() > 2 ? source.OutputData.MonthlyData.ElementAt(2).Code : String.Empty;
										break;

									case "TTLIMPLABEL":
										shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Any() ? source.OutputData.TotalData.ElementAt(0).Name : String.Empty;
										break;
									case "TOTALIMPVALUE":
										shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Any() ? source.OutputData.TotalData.ElementAt(0).Code : String.Empty;
										break;
									case "TOTINVLBL":
										shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Count() > 1 ? source.OutputData.TotalData.ElementAt(1).Name : String.Empty;
										break;
									case "TOTINVVALUE":
										shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Count() > 1 ? source.OutputData.TotalData.ElementAt(1).Code : String.Empty;
										break;
									case "TCPM":
										shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Count() > 2 ? source.OutputData.TotalData.ElementAt(2).Name : String.Empty;
										break;
									case "TCPMVALUE":
										shape.TextFrame.TextRange.Text = source.OutputData.TotalData.Count() > 2 ? source.OutputData.TotalData.ElementAt(2).Code : String.Empty;
										break;

									case "INVDET":
										shape.TextFrame.TextRange.Text = source.OutputData.InvestmentDetails; ;
										break;

									case "CMNTVALUE":
										shape.TextFrame.TextRange.Text = source.OutputData.Comment; ;
										break;
								}
							}
						}
					}
					if (theme != null)
						presentation.ApplyTheme(theme.GetThemePath());
					AppendSlide(presentation, -1, destinationPresentation);
					presentation.Close();
				});
				thread.Start();

				while (thread.IsAlive)
					Application.DoEvents();
			}
			catch
			{
			}
			finally
			{
				MessageFilter.Revoke();
			}
		}
		public void Dispose()
		{
			_source = null;
		}
 public void Release()
 {
     Product = null;
 }