}//end of Page_Load()
	
	protected void lbRemoveItem_Command(object sender, CommandEventArgs e)
	{
		try
		{
			Flower.CartService csService = new Flower.CartService();//holds the flower Shoring Cart Service 
			Flower.FlowerShopService flsService = new Flower.FlowerShopService();//holds the flower Service 
			Flower.GetProductResponse gprProduct = flsService.getProduct(ConfigurationManager.AppSettings[""], ConfigurationManager.AppSettings[""], e.CommandArgument.ToString());//holds the details for this flower
			//checks if there is any errors
			if (gprProduct.errors.Length > 0)
			{
				//goes around display each of the errors
				foreach (Flower.Error err in gprProduct.errors)
				{
					lblError.Text += "<div>" + err.field + "</div><div>" + err.message + "</div>";
				}//end of foreach
			
				//turns on the error
				lblError.Visible = true;
			}//end of if
			else
			{
				Flower.OrderItem orProduct = new Flower.OrderItem();//holds the order item will enter into shopping cart
				
				//sets the proties for the OrderItem
				orProduct.code = gprProduct.product.code;
				orProduct.price = gprProduct.product.price;
				
				Flower.RemoveItemShoppingCartResponse riscrProduct = csService.removeItemShoppingCart(ConfigurationManager.AppSettings[""], ConfigurationManager.AppSettings[""], System.Web.HttpContext.Current.Session.SessionID + hfObituatyId.Value, orProduct);//holes the response of removes the flower to the cart
				
				//checks if there is any errors
				if (riscrProduct.errors.Length > 0)
				{
					//goes around display each of the errors
					foreach (Flower.Error err in riscrProduct.errors)
					{
						lblError.Text += "<div>" + err.field + "</div><div>" + err.message + "</div>";
					}//end of foreach
			
					//turns on the error
					lblError.Visible = true;
				}//end of if
				else
					//reloads the page to display the new cart
					Response.Redirect("/Obituaries/flower/ordering.aspx?person=" + hfPersonId.Value + "&FHPID=" + hfFHPID.Value + "&oid=" + hfObituatyId.Value, true);
			}//end of else
		}//end of try
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
            lblError.Visible = true;
        }//end of catch
	}//end of lbRemoveItem_Command()
Ejemplo n.º 2
0
	}//end of Page_Load()
	
	protected void lbBuyNow_Command(object sender, CommandEventArgs e)
	{
		try
		{
			string strFlowerCode = (string)e.CommandArgument;//holds the value of the flower of what the user has selected
			Flower.CartService csService = new Flower.CartService();//holds the flower Shoring Cart Service 
			Flower.FlowerShopService flsService = new Flower.FlowerShopService();//holds the flower Service 
			Flower.GetProductResponse gprProduct = flsService.getProduct(ConfigurationManager.AppSettings[""], ConfigurationManager.AppSettings[""], strFlowerCode);//holds the details for this flower
			
			//checks if there is any errors
			if (gprProduct.errors.Length > 0)
			{
				//goes around display each of the errors
				foreach (Flower.Error err in gprProduct.errors)
				{
					litFlowerError.Text += "<div>" + err.field + "</div><div>" + err.message + "</div>";
				}//end of foreach
			}//end of if
			else
			{
				Flower.OrderItem orProduct = new Flower.OrderItem();//holds the order item enter into the shopping cart
							
				//sets the proties for the OrderItem
				orProduct.code = gprProduct.product.code;
				orProduct.price = gprProduct.product.price;
				
				Flower.AddItemShoppingCartResponse aiscrProduct = csService.addItemShoppingCart(ConfigurationManager.AppSettings[""], ConfigurationManager.AppSettings[""], System.Web.HttpContext.Current.Session.SessionID + hfObituatyId.Value, orProduct);//holes the response of adding the flower to the cart
							
				//checks if there is any errors
				if (aiscrProduct.errors.Length > 0)
				{
					//goes around display each of the errors
					foreach (Flower.Error err in aiscrProduct.errors)
					{
						lblError.Text += "<div>" + err.field + "</div><div>" + err.message + "</div>";
					}//end of foreach
				}//end of if
				else
					//goes to that cart
					Response.Redirect("/Obituaries/flower/ordering.aspx?person=" + hfPersonId.Value + "&FHPID=" + hfFHPID.Value + "&oid=" + hfObituatyId.Value, true);
			}//end of else
		}//end of try
		catch (Exception ex)
		{
			lblError.Text = ex.Message;// + " " + ex.StackTrace;
			lblError.Visible = true;
		}//end of catch
	}//end of lbBuyNow_Command()
    }//end of Page_PreRender()
	
	protected void lbAddCart_Click(object sender, EventArgs e)
    {
		Flower.CartService csService = new Flower.CartService();//holds the flower Shoring Cart Service 
		Flower.FlowerShopService flsService = new Flower.FlowerShopService();//holds the flower Service 
		Flower.GetProductResponse gprProduct = flsService.getProduct(ConfigurationManager.AppSettings[""], ConfigurationManager.AppSettings[""], hfFlowerId.Value);//holds the details for this flower
		
		//checks if there is any errors
		if (gprProduct.errors.Length > 0)
		{
			//goes around display each of the errors
			foreach (Flower.Error err in gprProduct.errors)
			{
				lblError.Text += "<div>" + err.field + "</div><div>" + err.message + "</div>";
			}//end of foreach
		}//end of if
		else
		{
			Flower.OrderItem orProduct = new Flower.OrderItem();//holds the order item will enter into the shopping cart
			
			//sets the proties for the OrderItem
			orProduct.code = gprProduct.product.code;
			orProduct.price = gprProduct.product.price;
			
			Flower.AddItemShoppingCartResponse aiscrProduct = csService.addItemShoppingCart(ConfigurationManager.AppSettings[""], ConfigurationManager.AppSettings[""], System.Web.HttpContext.Current.Session.SessionID + hfObituatyId.Value, orProduct);//holes the response of adding the flower to the cart
						
			//checks if there is any errors
			if (aiscrProduct.errors.Length > 0)
			{
				//goes around display each of the errors
				foreach (Flower.Error err in aiscrProduct.errors)
				{
					lblError.Text += "<div>" + err.field + "</div><div>" + err.message + "</div>";
				}//end of foreach
			}//end of if
			else
				//goes to that cart
				Response.Redirect("/Obituaries/flower/ordering.aspx?person=" + hfPersonId.Value + "&FHPID=" + hfFHPID.Value + "&oid=" + hfObituatyId.Value, true);
		}//end of else
	}//end of lbAddCart_Click()