예제 #1
0
	}//end of createSearchItems()
	
    private void InitializePagingVars(bool forceRefresh)
    {
        if (!_PagingVarsInitialized || forceRefresh)
        {
			Flower.FlowerShopService flsService = new Flower.FlowerShopService();//holds the flower Service 
			Flower.CartService csService = new Flower.CartService();//holds the flower Shoring Cart Service 
			Flower.GetProductsResponse gprProducts = flsService.getProducts(ConfigurationManager.AppSettings[""], ConfigurationManager.AppSettings[""], strCurrentCate, 1, 1);//holds the all of the products for a category sympathy
			
			//creates a flower shopping cart
			csService.createShoppingCart(ConfigurationManager.AppSettings[""], ConfigurationManager.AppSettings[""], System.Web.HttpContext.Current.Session.SessionID + hfObituatyId.Value);

			//checks if there is any errors
			if (gprProducts.errors.Length > 0)
			{
				//goes around display each of the errors
				foreach (Flower.Error err in gprProducts.errors)
				{
					lblError.Text += "<div>" + err.field + "</div><div>" + err.message + "</div>";
				}//end of foreach
			}//end of if
			else 
			{													
				//displays the results of the number of items this category
				litSearchResultsText.Text = "Your search has produced <span id='lblSearchResultCount'>(" + gprProducts.total  + ")</span> results";
				
				_HiddenPageIndex = Convert.ToInt32(HiddenPageIndex.Value);
				_Count = Convert.ToInt32(gprProducts.total.ToString());
				_LastPageIndex = ((int)Math.Ceiling(((double)_Count / (double)_PageSize))) - 1;
				_PagingVarsInitialized = true;
			}//end of if
        }//end of if
    }//end of InitializePagingVars()
예제 #2
0
    }//end of BindDesignsPanel()
	
	//creates a new search items whent the user search for flowers
	private void createSearchItems(int intStartIndex, int intMaxDisplay)
	{
		try
		{
			//resets the flower error
			litFlowerError.Text = "";
			
			//checks if is lesser then 1 as the API only allows 1 not zero
			if(intStartIndex < 1)
				//floors it to the closes one
				intStartIndex = 1;
													
			Flower.FlowerShopService flsService = new Flower.FlowerShopService();//holds the flower Service 
			Flower.CartService csService = new Flower.CartService();//holds the flower Shoring Cart Service 
			Flower.GetProductsResponse gprProducts = flsService.getProducts(ConfigurationManager.AppSettings[""], ConfigurationManager.AppSettings[""], strCurrentCate, intMaxDisplay, intStartIndex);//holds the all of the products for a category sympathy
			
			//creates a flower shopping cart
			csService.createShoppingCart(ConfigurationManager.AppSettings[""], ConfigurationManager.AppSettings[""], System.Web.HttpContext.Current.Session.SessionID + hfObituatyId.Value);

			//checks if there is any errors
			if (gprProducts.errors.Length > 0)
			{
				//goes around display each of the errors
				foreach (Flower.Error err in gprProducts.errors)
				{
					litFlowerError.Text += "<div>" + err.field + "</div><div>" + err.message + "</div>";
				}//end of foreach
			}//end of if
			else 
			{
				int intFlowerPerRowIndex = 1;//holds number of items per row
				int intFlowerIndexID = 1;//holds unqiue number of items id
				Panel panFlowersDisplayHolderContainer = new Panel();//holds the flower display holder Container
				Panel panFlowersDisplayHolderOuterFooter = new Panel();//holds the flowers display holder Footer

				//adds the classes to the panels and container
				panFlowersDisplayHolderContainer.CssClass = "customContainer divObiturayFlowersDisplayContainer";
				panFlowersDisplayHolderOuterFooter.CssClass = "customFooter divObiturayFlowersDisplayFooter";
				
				//starts the flower display
				phFlowerProducts.Controls.Add(panFlowersDisplayHolderContainer);
				
				//goes around displaying the Flowsers
				foreach (Flower.Product productDetail in gprProducts.products)
				{
					Panel panFlowersDisplayHolder = new Panel();//holds the flower display holder
					Panel panFlowersDisplayButtonContainer = new Panel();//holds the flower display button Container
					Panel panFlowersDisplayButtonHeader = new Panel();//holds the flower display button header
					Panel panFlowersDisplayButtonLeft = new Panel();//holds the flower display button left
					Panel panFlowersDisplayButtonRight = new Panel();//holds the flower display button right
					Panel panFlowersDisplayButtonFooter = new Panel();//holds the flower display button footer
					Label lblFlowerName = new Label();//holds the flower name
					Label lblFlowerPrice = new Label();//holds the flower price
					LinkButton lbBuyNow = new LinkButton();//holds the Buy Now 
					HyperLink hlHeaderDetails = new HyperLink();//holds the Detail link for the header
					HyperLink hlDetails = new HyperLink();//holds the Detail link for the button 
										
					//adds the classes to the Panels
					panFlowersDisplayHolder.CssClass = "customLeft divObiturayFlowersDisplayLeft";
					panFlowersDisplayButtonContainer.CssClass ="customContainer divObiturayFlowersDisplayButtonContainer";
					panFlowersDisplayButtonHeader.CssClass = "customHeader divObiturayFlowersDisplayButtonHeader";
					panFlowersDisplayButtonLeft.CssClass = "customLeft divObiturayFlowersDisplayButtonLeft";
					panFlowersDisplayButtonRight.CssClass = "ustomRight divObiturayFlowersDisplayButtonRight";
					panFlowersDisplayButtonFooter.CssClass = "customFooter divObiturayFlowersDisplayButtonFooter";
					
					//adds to the Flowers Display Button to the Flowers Display Holder
					panFlowersDisplayHolder.Controls.Add(panFlowersDisplayButtonContainer);
					
					//adds the header, left, right and footer Flowers Display Button
					panFlowersDisplayButtonContainer.Controls.Add(panFlowersDisplayButtonHeader);
					panFlowersDisplayButtonContainer.Controls.Add(panFlowersDisplayButtonLeft);
					panFlowersDisplayButtonContainer.Controls.Add(panFlowersDisplayButtonRight);
					panFlowersDisplayButtonContainer.Controls.Add(panFlowersDisplayButtonFooter);
										
					//sets the url and image url to the details page
					hlHeaderDetails.NavigateUrl = "/Obituaries/flower/Details.aspx?person=" + hfPersonId.Value + "&FHPID=" + hfFHPID.Value + "&oid=" + hfObituatyId.Value + "&flowerID=" + Server.UrlEncode(productDetail.code);
					hlHeaderDetails.ImageUrl = productDetail.image;
					
					//adds the HyperLink Image to Flowers Display Button header 
					panFlowersDisplayButtonHeader.Controls.Add(hlHeaderDetails);
					
					//sets the url and image url to the details page
					hlDetails.NavigateUrl = "/Obituaries/flower/Details.aspx?person=" + hfPersonId.Value + "&FHPID=" + hfFHPID.Value + "&oid=" + hfObituatyId.Value + "&flowerID=" + Server.UrlEncode(productDetail.code);
					hlDetails.Text = "Details";
					hlDetails.CssClass = "green-button";
					
					//adds the HyperLink to Flowers Display Button left 
					panFlowersDisplayButtonLeft.Controls.Add(hlDetails);
					
					//sets the flower name, priceing and classes
					lblFlowerName.Text = "<span class='lblFontSize14'><strong>" + productDetail.name + "</strong></span>";
					lblFlowerName.CssClass = "divFlowerName";
					lblFlowerPrice.Text = "$" + string.Format("{0:F2}", productDetail.price.ToString());
					lblFlowerPrice.CssClass = "divFlowerPrice";
					
					//adds the flower name, new line and flower price to Flowers Display Button footer
					panFlowersDisplayButtonFooter.Controls.Add(lblFlowerName);
					panFlowersDisplayButtonFooter.Controls.Add(new LiteralControl("<br />"));
					panFlowersDisplayButtonFooter.Controls.Add(lblFlowerPrice);
					
					//adds text, CommandArgument and OnCommand to the LinkButton
					lbBuyNow.Text = "Buy Now";
					lbBuyNow.ID = "lbBuyNow" + intFlowerIndexID;
					lbBuyNow.CssClass = "green-button";
					lbBuyNow.Command += lbBuyNow_Command;
					lbBuyNow.CommandArgument = productDetail.code;
					
					//adds the linkbutton to Flowers Display Button right 
					panFlowersDisplayButtonRight.Controls.Add(lbBuyNow);
					
					//displays the flower display holder to the screen
					panFlowersDisplayHolderContainer.Controls.Add(panFlowersDisplayHolder);
					
					//checkes if intFlowerItemIndex is more then 3
					if(intFlowerPerRowIndex > 3)
					{				
						Panel panFlowersDisplayHolderFooter = new Panel();//holds the flower display holder Footer
						
						//sets the class for flower display holder Footer
						panFlowersDisplayHolderFooter.CssClass = "customFooter divObiturayFlowersDisplayFooter";
							
						//adds the footer and the container for this row
						panFlowersDisplayHolderContainer.Controls.Add(panFlowersDisplayHolderFooter);																
						phFlowerProducts.Controls.Add(panFlowersDisplayHolderContainer);
						
						//resets the flower display holder Container and class
						panFlowersDisplayHolderContainer = new Panel();
						panFlowersDisplayHolderContainer.CssClass = "customContainer divObiturayFlowersDisplayContainer";				
						
						//resets intFlowerPerRowIndex for the next row
						intFlowerPerRowIndex = 1;
					}//end of if
					else
						intFlowerPerRowIndex++;
						
					intFlowerIndexID++;
				}//end of foreach
				
				//adds the footer and the container for this row
				panFlowersDisplayHolderContainer.Controls.Add(panFlowersDisplayHolderOuterFooter);																
				phFlowerProducts.Controls.Add(panFlowersDisplayHolderContainer);
			}//end of else
		}//end of try
		catch (Exception ex)
		{
			lblError.Text = ex.Message;// + " " + ex.StackTrace;
            lblError.Visible = true;
		}//end of catch
	}//end of createSearchItems()