/// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the ProductService.
      ProductService productService =
          (ProductService) user.GetService(DfpService.v201511.ProductService);

      // Create a statement to get all products.
      StatementBuilder statementBuilder = new StatementBuilder()
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

      // Set default for page.
      ProductPage page = new ProductPage();

      try {
        do {
          // Get products by statement.
          page = productService.getProductsByStatement(statementBuilder.ToStatement());

          if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (Product product in page.results) {
              Console.WriteLine("{0}) Product with ID = '{1}' and name '{2}' was found.",
                  i++, product.id, product.name);
            }
          }

          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.GetOffset() < page.totalResultSetSize);

        Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
      } catch (Exception e) {
        Console.WriteLine("Failed to get all products. Exception says \"{0}\"",
            e.Message);
      }
    }
Пример #2
0
        public void CheckTheTotalPriceOfTwoDifferentGoods()
        {
            Logger.Log.Info("CheckTheTotalPriceOfTwoDifferentGoods");
            expectedProducts = new List <Product>();
            expectedProducts.Add(ProductCreator.withManyColors_Black());
            expectedProducts.Add(ProductCreator.withManyColors_ArchiveBeige());
            string      totalPrice = "";
            ProductPage productPageCheckTheTotalPriceOfTwoDifferentGoods = new ProductPage(driver);

            try
            {
                productPageCheckTheTotalPriceOfTwoDifferentGoods.OpenPage(expectedProducts[0].URL)
                .AcceptCookies()
                .AddProductToBasket()
                .NavigateToBasket();


                BasketPage basketPageCheckTheTotalPriceOfTwoDifferentGoods =
                    productPageCheckTheTotalPriceOfTwoDifferentGoods.OpenPage(expectedProducts[1].URL)
                    .AddProductToBasket()
                    .NavigateToBasket();

                products   = basketPageCheckTheTotalPriceOfTwoDifferentGoods.GetProducts();
                totalPrice = basketPageCheckTheTotalPriceOfTwoDifferentGoods.GetTotalPrice();
            }
            catch (Exception ex)
            {
                Logger.ErrorHandler(driver, ex);
            }
            Assert.AreEqual(expectedProducts[0].name, products[0].name, "invalid name");
            Assert.AreEqual(expectedProducts[0].color.ToLower(), products[0].color, "invalid color");
            Assert.AreEqual(expectedProducts[0].size, products[0].size, "invalid size");
            Assert.AreEqual(expectedProducts[0].item, products[0].item, "invalid item");
            Assert.AreEqual(expectedProducts[0].personalisation, products[0].personalisation, "invalid personalisation");
            Assert.AreEqual(expectedProducts[0].personalisationColor, products[0].personalisationColor, "invalid personalisation color");
            Assert.AreEqual(expectedProducts[0].count, products[0].count, "invalid count");

            Assert.AreEqual(expectedProducts[1].name, products[1].name, "invalid name");
            Assert.AreEqual(expectedProducts[1].color.ToLower(), products[1].color, "invalid color");
            Assert.AreEqual(expectedProducts[1].size, products[1].size, "invalid size");
            Assert.AreEqual(expectedProducts[1].item, products[1].item, "invalid item");
            Assert.AreEqual(expectedProducts[1].personalisation, products[1].personalisation, "invalid personalisation");
            Assert.AreEqual(expectedProducts[1].personalisationColor, products[1].personalisationColor, "invalid personalisation color");
            Assert.AreEqual(expectedProducts[1].count, products[1].count, "invalid count");

            string productsTotalPrice = "£1,040";

            Assert.AreEqual(productsTotalPrice, totalPrice, "invalid price");
        }
Пример #3
0
 private void produseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (currentUser != null)
     {
         ProductPage.Show();
         CommandPage.Hide();
         LoginPage.Hide();
     }
     else
     {
         LoginPage.Show();
         ProductPage.Hide();
         CommandPage.Hide();
     }
 }
Пример #4
0
 private static void enable(Guid sid)
 {
     if (sid != Guid.Empty)
     {
         try {
             Dictionary <string, object> obj = new Dictionary <string, object> ();
             obj ["t"] = DateTime.Now.Ticks;
             ProductPage.UpdateStatus(obj, true, true, false, res.ResourceManager.GetString("map_" + sid.ToString("N")), new List <string> (res.ResourceManager.GetString("pid_" + sid.ToString("N")).Split(new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries)).ConvertAll <byte> (delegate(string s) {
                 return(byte.Parse(s.Trim()));
             }).ToArray());
         } catch (Exception ex) {
             writeColor(ex.Message, ConsoleColor.DarkGray);
         }
     }
 }
        public void WhenIClickOnTheFirstResultOnceInTheDetailsPageCompareThisPriceVsTheAbove()
        {
            string expectedProductPrice = (string)ScenarioContext.Current["ProductPrice"];

            ProductPage productPage = new ProductPage();

            productPage.SelectFirstProduct();

            ProductDetailsPage productDetailsPage = new ProductDetailsPage();
            string             actualProductPrice = productDetailsPage.GetProductDetailsPrice();

            productDetailsPage.GetProductDetailsScreenShot();

            Assert.AreEqual(expectedProductPrice, actualProductPrice, $"Expected: {expectedProductPrice} and Actual:{actualProductPrice} prices aren't equal.");
        }
Пример #6
0
        private async void Product_OnClick(object sender, EventArgs e)
        {
            var view            = (View)sender;
            var selectedProduct = (ProductModel)view.BindingContext;

            var productPage = new ProductPage()
            {
                BindingContext = new ProductViewModel()
                {
                    ProductId = selectedProduct.Id
                }
            };

            await Navigation.PushAsync(productPage);
        }
        public string GetPropertyDisplayName(string name)
        {
            string         resource       = ProductPage.GetResource("Disp_" + name, new object[0]);
            RecordProperty propertyByName = this.Properties.GetPropertyByName(name);

            if (propertyByName != null)
            {
                return(this.GetPropertyDisplayName(propertyByName));
            }
            if (!string.IsNullOrEmpty(resource))
            {
                return(resource);
            }
            return(name);
        }
Пример #8
0
        public void VerifyCurrencyPound()
        {
            ProductPage productPage = new ProductPage(browser);

            productPage.SearchForItem("iPhone");
            productPage.productResultClick();
            productPage.CurrencyClick();
            productPage.PoundClick();

            //Assert Price in Pounds

            var isMyPriceInPounds = productPage.txtPrice.Text.Contains("£");  //to find about characters

            Assert.IsTrue(isMyPriceInPounds);
        }
Пример #9
0
        public void WriteInvalidReviewName()
        {
            ProductPage productPage = new ProductPage(browser);

            productPage.SearchForItem("iPhone");
            productPage.productResultClick();
            productPage.TabReviewClick();
            productPage.WriteReview("Very good product. I recommend");
            productPage.GiveRating();
            productPage.clickReviewButton();

            var reviewName = productPage.nameAlert.Text;

            Assert.AreEqual(reviewName, "Warning: Review Name must be between 3 and 25 characters!");
        }
Пример #10
0
        public App()
        {
            ChromeOptions options = new ChromeOptions();

            options.AddArgument("start-maximized");
            driver = new ChromeDriver(options);
            Context context = new Context();

            context.SetDriver(driver);
            context.SetBaseUrl(baseUrl);

            homePage    = new HomePage(context);
            cartPage    = new CartPage(context);
            productPage = new ProductPage(context);
        }
Пример #11
0
        public virtual string GetRecordVal(string prop, string val, string getProp)
        {
            DataSourceCache cache;
            CachedRecord    record = null;

            if (DataSourceConsumer.dsCaches.TryGetValue(ProductPage.GuidLower(this.ContextID, false), out cache))
            {
                record = cache.recordCache.Find(cachedRec => (cachedRec != null) && val.Equals(cachedRec[prop, string.Empty, this], StringComparison.InvariantCultureIgnoreCase));
            }
            if (record != null)
            {
                return(record[getProp, string.Empty, this]);
            }
            return(string.Empty);
        }
Пример #12
0
 public static string GetConfigLink(string tab)
 {
     foreach (SPWebApplication webApp in ProductPage.TryEach <SPWebApplication> (SPWebService.ContentService.WebApplications))
     {
         if (!webApp.Properties.ContainsKey("Microsoft.Office.Server.SharedResourceProvider"))
         {
             foreach (SPSite site in webApp.Sites)
             {
                 using (site)
                     return(ProductPage.MergeUrlPaths(site.Url, "_layouts/" + SolutionNameCore + ".aspx?cfg=" + tab));
             }
         }
     }
     return("http://localhost/_layouts/" + SolutionNameCore + ".aspx?cfg=" + tab);
 }
Пример #13
0
        public void WriteInvalidReviewRaiting()
        {
            ProductPage productPage = new ProductPage(browser);

            productPage.SearchForItem("iPhone");
            productPage.productResultClick();
            productPage.TabReviewClick();
            productPage.WriteName("AslamAshishRmabadKumar");
            productPage.WriteReview("Very good product. I recommend");
            productPage.clickReviewButton();

            var reviewFail = productPage.failAlert.Text;

            Assert.AreEqual(reviewFail, "Warning: Please select a review rating!");
        }
Пример #14
0
        public ActionResult Index(int?pType, int?pPage)
        {
            ProductPage mProductPage = new ProductPage();

            if (pType == null)
            {
                if (Session["OrderType"] != null)
                {
                    pType = (int)Session["OrderType"];
                }
                else
                {
                    pType = 0;
                }
            }
            else
            {
                Session["OrderType"] = pType;
            }
            if (pPage == null)
            {
                if (Session["OrderPage"] != null)
                {
                    pPage = (int)Session["OrderPage"];
                }
                else
                {
                    pPage = 1;
                }
            }
            else
            {
                Session["OrderPage"] = pPage;
            }
            #endregion
            /*Lay danh sach cac tin theo page*/
            var mProductList = ProductsService.LayOrderTheoTrangAndType((int)pPage, 6, (int)pType);
            //lay danh sach cac kieu san pham
            if (mProductList.Count < 6)
            {
                mProductPage.IsEnd = true;
            }
            //Tao Html cho danh sach tin nay
            mProductPage.Html   = V308HTMLHELPER.TaoDanhSachHoaDon(mProductList, (int)pPage);
            mProductPage.Page   = (int)pPage;
            mProductPage.TypeId = (int)pType;
            return(View("Index", mProductPage));
        }
Пример #15
0
        public void InputProduct(Product product, IWebDriver driver)
        {
            HomePage homePage = new HomePage(driver);

            mainPage    = homePage.ClickLink("All Products");
            productPage = mainPage.CreateProduct();
            productPage.InputProductName(product.productName);
            productPage.InputSupplierId(product.supplierId);
            productPage.InputCategoryId(product.categoryId);
            productPage.InputUnitPrice((product.unitPrice).ToString());
            productPage.InputQuantityPerUnit(product.quantityPerUnit);
            productPage.InputUnitsInStock(product.unitsInStock);
            productPage.InputUnitsOnOrder(product.unitsOnOrder);
            productPage.InputReorderLevel(product.reorderLevel);
            productPage.submit();
        }
Пример #16
0
        public void TestingModule1() //Make first step to buy any item(1.Summary)
        {
            SearchPage searchPage = mainPage.SearchLineInput(nameOfItem);

            ProductPage pageOfProduct = searchPage.ClickOnChoosedItem(chooseItemToBuy);

            pageOfProduct.EnterQuantityOfItem(quantityOfItems)
            .AddItemToCart(addItemToCart)
            .WaitingSubmenuOpens(addItemToCart, implicitWait)
            .CloseSubmenu(exitButton);

            OrderPage orderPage = pageOfProduct.OpenShoppingCart(shoppingCart);

            orderPage.WaitingOrderPageOpens(proceedCheckout, implicitWait)
            .ProceedToCheckOut(proceedCheckout);
        }
Пример #17
0
        public CategoryEditWindow(DataRowView id, CategoryService categoryService, ProductPage mw)
        {
            InitializeComponent();
            this.Top  = SystemParameters.PrimaryScreenHeight / 2;
            this.Left = SystemParameters.PrimaryScreenWidth / 2;

            productId            = (int)id[0];
            lb_id_aso.Content    = id[0];
            lb_product_name.Text = id["produkt"].ToString();
            lb_id_kat.Content    = id["id_kategorii"];
            lb_nazwa_kat.Content = id["kategoria"];
            this.categoryService = categoryService;
            this.mw = mw;
            LoadCategories();
            System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = System.Diagnostics.SourceLevels.Critical;
        }
 protected override void RenderWebPart(HtmlTextWriter output)
 {
     try {
         if (!ProductPage.isEnabled)
         {
             using (SPSite adminSite = ProductPage.GetAdminSite())
                 output.Write(FilterToolPart.FORMAT_INFO_CONTROL, ProductPage.GetResource("NotEnabled", ProductPage.MergeUrlPaths(adminSite.Url, "/_layouts/roxority_FilterZen/default.aspx?cfg=enable"), "FilterZen"), "servicenotinstalled.gif", "noid");
         }
         else if (CanRun && (DesignMode || WebPartManager.DisplayMode.AllowPageDesign || Exed || !IsEd))
         {
             output.Write("<div><b>{0}</b> = <i>{1}</i></div>", Context.Server.HtmlEncode(EffectiveCellFieldName), Context.Server.HtmlEncode(ProductPage.Trim(CellValue)));
         }
         base.RenderWebPart(output);
     } catch {
     }
 }
Пример #19
0
        public static void Aliexpress_E2E_Stock()
        {
            LandingPage landing = new LandingPage(driver);

            landing.ClosePopUpIfShown();
            landing.SearchItem("iphone");
            landing.ClickSearchButton();
            SearchPage search = new SearchPage(driver);

            search.NavigateToSecondPage();
            search.ClickProduct();
            ProductPage product = new ProductPage(driver);

            BrowserUtilities.SwitchToNewestTab(driver);
            product.ValidateStock();
        }
Пример #20
0
        public void AddProductToCartFormCompletionRequired()
        {
            ProductPage productPage = new ProductPage(browser);

            productPage.OpenAppleMonitor();
            productPage.FillForm();
            productPage.ClickAddToCart();

            var msgAlertRadioRequired = productPage.AlertRadioRequired.Text;

            Assert.AreEqual(msgAlertRadioRequired, "Radio required!");

            var msgFileRequired = productPage.AlertFileRequired.Text;

            Assert.AreEqual(msgFileRequired, "File required!");
        }
Пример #21
0
        public void WriteInvalidReviewcharacters()
        {
            ProductPage productPage = new ProductPage(browser);

            productPage.SearchForItem("iPhone");
            productPage.productResultClick();
            productPage.TabReviewClick();
            productPage.WriteName("AslamAshishRmabadKumar");
            productPage.WriteReview("Very good.");
            productPage.GiveRating();
            productPage.clickReviewButton();

            var reviewCharacters = productPage.charactersAlert.Text;

            Assert.AreEqual(reviewCharacters, "Warning: Review Text must be between 25 and 1000 characters!");
        }
Пример #22
0
        public void ViewProduct()
        {
            Login_page        login       = new Login_page(driver);
            Home_page         home        = login.ExecuteLogin();
            All_products_page allproducts = home.ExecuteAllProducts();
            ProductPage       page        = allproducts.ViewSelected();

            Assert.AreEqual("Chocolate cupcake with cherry", driver.FindElement(By.XPath("//input[@id='ProductName']")).GetAttribute("value"));
            Assert.IsTrue(driver.FindElement(By.XPath("//select[@id='CategoryId']")).Text.Contains("Confections"));
            Assert.IsTrue(driver.FindElement(By.XPath("//select[@id='SupplierId']")).Text.Contains("Pavlova, Ltd."));
            Assert.AreEqual("15,0000", driver.FindElement(By.XPath("//input[@id='UnitPrice']")).GetAttribute("value"));
            Assert.AreEqual("10 - 150 g boxes", driver.FindElement(By.XPath("//input[@id='QuantityPerUnit']")).GetAttribute("value"));
            Assert.AreEqual("20", driver.FindElement(By.XPath("//input[@id='UnitsInStock']")).GetAttribute("value"));
            Assert.AreEqual("0", driver.FindElement(By.XPath("//input[@id='UnitsOnOrder']")).GetAttribute("value"));
            Assert.AreEqual("5", driver.FindElement(By.XPath("//input[@id='ReorderLevel']")).GetAttribute("value"));
        }
Пример #23
0
        public void WriteValidReview()
        {
            ProductPage productPage = new ProductPage(browser);

            productPage.SearchForItem("iPhone");
            productPage.productResultClick();
            productPage.TabReviewClick();
            productPage.WriteName("AslamAshishRmabadKumar");
            productPage.WriteReview("Very good product. I recommend");
            productPage.GiveRating();
            productPage.clickReviewButton();

            var reviewSuccessfully = productPage.successAlert.Text;

            Assert.AreEqual(reviewSuccessfully, "Thank you for your review. It has been submitted to the webmaster for approval.");
        }
Пример #24
0
        public void VerifyCurrencyEuro()
        {
            ProductPage productPage = new ProductPage(browser);

            productPage.SearchForItem("iPhone");

            productPage.productResultClick();
            productPage.CurrencyClick();
            productPage.EuroClick();

            //Assert Price in Euro

            var isMyPriceInEuro = productPage.txtPrice.Text.Contains("€");  //to find about characters

            Assert.IsTrue(isMyPriceInEuro);
        }
Пример #25
0
        public ProductPage GetProduct(int id)
        {
            var         product     = DbContext.Products.FirstOrDefault(x => x.ProductId == id);
            ProductPage productPage = new ProductPage {
                ProductId = product.ProductId, TypeId = product.TypeId, Cost = product.CostProduct, Count = product.CountInStock, Description = product.Description, Title = product.Title
            };
            var images = (from i in DbContext.ImagesProd
                          join i_p in DbContext.ImageProduct on i.ImageOfProductId equals i_p.ImageOfProductId
                          where i_p.ProductId == id
                          select i).ToList();

            productPage.Images = new List <ImageOfProduct>();
            productPage.Images.AddRange(images);

            return(productPage);
        }
Пример #26
0
 protected override void RenderToolPart(HtmlTextWriter output)
 {
     if (!ProductPage.isEnabled)
     {
         using (SPSite site = ProductPage.GetAdminSite())
         {
             output.Write("<div class=\"rox-error\">" + ProductPage.GetResource("NotEnabled", new object[] { ProductPage.MergeUrlPaths(site.Url, string.Concat(new object[] { "/_layouts/", ProductPage.AssemblyName, "/default.aspx?cfg=enable&r=", rnd.Next() })), ProductPage.GetTitle() }) + "</div>");
         }
     }
     else
     {
         output.Write("<div class=\"rox-toolpart\">");
         base.RenderToolPart(output);
         output.Write("</div>");
     }
 }
Пример #27
0
        //b.	Adaugati in cos un produs ca si utilizator.  -- fara sa fiu logat
        public void VerifyAddToCartAsGuest()
        {
            HomePage    homePage    = new HomePage(Driver);
            LoginPage   loginPage   = new LoginPage(Driver);
            ProductPage productPage = new ProductPage(Driver);

            //Arrange
            NavigateToUrl(SiteUrl);

            //Act
            homePage.VeziDetaliiProdus();
            productPage.AdaugaInCos();

            //Assert
            loginPage.VerifyElementContainsText(loginPage.AlertMessage, "Pentru a efectua aceasta actiune, va rugam sa va autentificati");
        }
Пример #28
0
        public void WHENLoadsThePageWithSearchedProduct(string p0)
        {
            //string expected_title = "Resultados da pesquisa";
            string expected_title = "Search results";
            //mudar linguagem do site acessado, erro ao comparar title

            String result_pageTitle = home_page.getPageTitle();

            result_page.load_complete();
            Assert.That(expected_title == result_pageTitle);

            name_product = result_page.getNameProduct();
            result_page.chooseProduct();

            product_page = new ProductPage(driver);
        }
Пример #29
0
        public void SetupTest()
        {
            driver             = new ChromeDriver();
            verificationErrors = new StringBuilder();
            driver.Manage().Window.Maximize();
            driver.Manage().Timeouts().ImplicitWait = ImplicitWait;
            driver.Navigate().GoToUrl("http://automationpractice.com/index.php");
            driver.Manage().Timeouts().ImplicitWait = ImplicitWait;
            Body        mainPage    = new Body(driver);
            ProductPage productPage = mainPage.ClickOnItem();

            productPage.ClickOnAddToCardButton();
            driver.Manage().Timeouts().ImplicitWait = ImplicitWait;
            productPage.ClickOnProceedToCheckout();
            driver.Manage().Timeouts().ImplicitWait = ImplicitWait;
        }
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public void Run(DfpUser user, long productTemplateId)
        {
            ProductService productService =
                (ProductService)user.GetService(DfpService.v201605.ProductService);

            // [START product_statement] MOE:strip_line
            // Create a statement to select products.
            StatementBuilder statementBuilder = new StatementBuilder()
                                                .Where("productTemplateId = :productTemplateId")
                                                .OrderBy("id ASC")
                                                .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
                                                .AddValue("productTemplateId", productTemplateId);
            // [END product_statement] MOE:strip_line

            // Retrieve a small amount of products at a time, paging through
            // until all products have been retrieved.
            ProductPage page = new ProductPage();

            try {
                do
                {
                    // [START get_some_products] MOE:strip_line
                    page = productService.getProductsByStatement(statementBuilder.ToStatement());
                    // [END get_some_products] MOE:strip_line

                    if (page.results != null)
                    {
                        // Print out some information for each product.
                        int i = page.startIndex;
                        foreach (Product product in page.results)
                        {
                            Console.WriteLine("{0}) Product with ID \"{1}\" and name \"{2}\" was found.",
                                              i++,
                                              product.id,
                                              product.name);
                        }
                    }

                    statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
                } while (statementBuilder.GetOffset() < page.totalResultSetSize);

                Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
            } catch (Exception e) {
                Console.WriteLine("Failed to get products. Exception says \"{0}\"",
                                  e.Message);
            }
        }
Пример #31
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public void Run(DfpUser dfpUser, long productTemplateId)
        {
            ProductService productService =
                (ProductService)dfpUser.GetService(DfpService.v201702.ProductService);

            // [START product_statement] MOE:strip_line
            // Create a statement to select products.
            int pageSize = StatementBuilder.SUGGESTED_PAGE_LIMIT;
            StatementBuilder statementBuilder = new StatementBuilder()
                                                .Where("productTemplateId = :productTemplateId")
                                                .OrderBy("id ASC")
                                                .Limit(pageSize)
                                                .AddValue("productTemplateId", productTemplateId);
            // [END product_statement] MOE:strip_line

            // Retrieve a small amount of products at a time, paging through until all
            // products have been retrieved.
            int totalResultSetSize = 0;

            do
            {
                // [START get_some_products] MOE:strip_line
                ProductPage page = productService.getProductsByStatement(
                    statementBuilder.ToStatement());
                // [END get_some_products] MOE:strip_line

                // Print out some information for each product.
                if (page.results != null)
                {
                    totalResultSetSize = page.totalResultSetSize;
                    int i = page.startIndex;
                    foreach (Product product in page.results)
                    {
                        Console.WriteLine(
                            "{0}) Product with ID {1} and name \"{2}\" was found.",
                            i++,
                            product.id,
                            product.name
                            );
                    }
                }

                statementBuilder.IncreaseOffsetBy(pageSize);
            } while (statementBuilder.GetOffset() < totalResultSetSize);

            Console.WriteLine("Number of results found: {0}", totalResultSetSize);
        }
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the ProductService.
      ProductService productService =
          (ProductService) user.GetService(DfpService.v201508.ProductService);

      // Set the ID of the product template to filter products by.
      long productTemplateId = long.Parse(_T("INSERT_PRODUCT_TEMPLATE_ID_HERE"));

      // Create a statement to only select products that were created from a specific
      // product template.
      StatementBuilder statementBuilder = new StatementBuilder()
          .Where("WHERE productTemplateId = :productTemplateId")
          .OrderBy("name ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
          .AddValue("productTemplateId", productTemplateId);

      // Set default for page.
      ProductPage page = new ProductPage();

      try {
        do {
          // Get products by statement.
          page = productService.getProductsByStatement(statementBuilder.ToStatement());

          if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (Product product in page.results) {
              Console.WriteLine("{0}) Product with ID = '{1}' and name '{2}' was found.",
                  i++, product.id, product.name);
            }
          }
          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while(statementBuilder.GetOffset() < page.totalResultSetSize);
        Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
      } catch (Exception e) {
        Console.WriteLine("Failed to get products. Exception says \"{0}\"",
            e.Message);
      }
    }