public string LoadProducts(string OrderID)
        {
            try
            {
                if (Context.User.IsInRole("Administrator"))
                {
                    string HTML = "";

                    Guid myOrderID = Guid.Parse(OrderID.Trim());

                    List<OrderProduct> myProductItems = new OrdersLogic().RetrieveItemsByOrderID(myOrderID).ToList();

                    HTML += "<table>";

                    int Counter = 0;

                    foreach (OrderProduct myProductItem in myProductItems)
                    {
                        HTML += "<tr class=\"GridViewTuple\">";

                        HTML += "<td>";
                        HTML += new ProductsLogic().RetrieveProductByID(myProductItem.ProductFK.ToString()).Name;
                        HTML += "</td>";

                        HTML += "<td>";
                        HTML += "<div style=\"padding-top: 4px; float: left;\">x&nbsp;&nbsp;</div><input class=\"CatalogTextBox\" id=\"" + myProductItem.ProductFK + "\" Use=\"Quantity\" type=\"text\" value=\"" + myProductItem.Quantity.ToString() + "\">";
                        HTML += "</td>";

                        HTML += "<td>";
                        HTML += "<input type=\"button\" ProductID=\"" + myProductItem.ProductFK + "\" Use=\"Update\" value=\"Update\">";
                        HTML += "</td>";

                        HTML += "<td>";
                        HTML += "<input type=\"button\" ProductID=\"" + myProductItem.ProductFK + "\" Use=\"Remove\" value=\"Remove\">";
                        HTML += "</td>";

                        HTML += "<td>";
                        HTML += "<div Use=\"ErrorDiv\" ProductID=\"" + myProductItem.ProductFK + "\" class=\"MiniFontBlue\">Not Enough Stock</div>";
                        HTML += "</td>";

                        HTML += "</tr>";

                        Counter++;
                    }

                    HTML += "</table>";

                    return HTML;
                }
                else
                {
                    return "";
                }
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
Ejemplo n.º 2
0
 private void GetProduct(int id)
 {
     ProductsLogic pl = new ProductsLogic();
     Products p = pl.GetProduct(id);
     ProductPanel.Visible = true;
     idProductTextBox.Text = p.ProductID.ToString();
     productNameTextBox.Text = p.ProductName;
 }
        public string AppendProducts(string ParentID, string ChildID, string SearchText, string LoadAll)
        {
            try
            {
                if (Context.User.IsInRole("User"))
                {
                    int myParentID = 0;
                    int myChildID = 0;

                    if ((ParentID.Trim() != "") && (ChildID.Trim() != ""))
                    {
                        myParentID = Convert.ToInt32(ParentID.Trim());
                        myChildID = Convert.ToInt32(ChildID.Trim());
                    }

                    string HTML = "";

                    User myLoggedUser = new UsersLogic().RetrieveUserByUsername(Context.User.Identity.Name);
                    _UserType = myLoggedUser.UserType.Type;

                    Product[] myProducts = null;

                    if (SearchText == "")
                    {
                        if (myChildID == 0)
                        {
                            //parent only
                            myProducts = new ProductsLogic().RetrieveProductsForDisplayByUser(myLoggedUser.UserTypeFK, myParentID, null).ToArray();
                        }
                        else
                        {
                            //child
                            myProducts = new ProductsLogic().RetrieveProductsForDisplayByUser(myLoggedUser.UserTypeFK, null, myChildID).ToArray();
                        }
                    }
                    else
                    {
                        if (LoadAll == "false")
                        {
                            myProducts = new ProductsLogic().RetrieveProductsForDisplayBySearch(myLoggedUser.UserTypeFK, SearchText).ToArray();
                        }
                    }

                    if (LoadAll == "true")
                    {
                        myProducts = new ProductsLogic().RetrieveProductsForDisplayByUserType(myLoggedUser.UserTypeFK).ToArray();
                    }

                    if (myProducts.Length > 0)
                    {
                        for (int i = 1; i <= (myProducts.Length + 4 / 4); i++)
                        {
                            int Counter = i * 4;

                            HTML += "<tr>";

                            for (int j = (Counter - 3); j <= Counter; j++)
                            {
                                HTML += "<td>";

                                HTML += TDContents(myProducts[j - 1]);

                                HTML += "</td>";

                                if (j == myProducts.Length)
                                {
                                    goto LoopEnd;
                                }
                            }

                            HTML += "</tr>";
                        }
                    }

                LoopEnd:

                    return HTML;
                }
                else
                {
                    return "";
                }
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
        public string RetrieveItems()
        {
            try
            {
                if (Context.User.IsInRole("Administrator"))
                {
                    string HTML = "";

                    HTML += "<table id=\"Order\" cellpadding=\"4\">";

                    List<OrderItem> myList = (List<OrderItem>)Session["SupplierOrder"];

                    foreach (OrderItem myOrderItem in myList)
                    {
                        UserType myUserType = new UserTypesLogic().RetrieveUserTypeByName("Wholesaler");
                        UserTypeProduct myPriceType = new PriceTypesLogic().RetrievePriceTypeByID(myUserType.Id, myOrderItem.Id);

                        string PriceOutput = "";

                        if (myPriceType != null)
                        {
                            PriceOutput = myPriceType.Price.ToString("F");
                            double? NewPrice = 0;

                            if ((myPriceType.DiscountDateFrom != null) && (myPriceType.DiscountDateTo != null) && (myPriceType.DiscountPercentage != null))
                            {
                                if ((DateTime.Now >= myPriceType.DiscountDateFrom) && (DateTime.Now <= myPriceType.DiscountDateTo))
                                {
                                    NewPrice = myPriceType.Price - ((myPriceType.DiscountPercentage / 100) * myPriceType.Price);

                                    string myDisplayedNewPrice = Convert.ToDouble(NewPrice).ToString("F");

                                    PriceOutput = myDisplayedNewPrice + " : " + myPriceType.DiscountPercentage + " % Off";
                                }
                            }
                        }

                        HTML += "<tr class=\"GridViewTuple\">";

                        HTML += "<td>";
                        HTML += new ProductsLogic().RetrieveProductByID(myOrderItem.Id.ToString()).Name;
                        HTML += "</td>";

                        HTML += "<td>";
                        HTML += "x " + myOrderItem.Quantity.ToString();
                        HTML += "</td>";

                        HTML += "<td> at </td>";

                        HTML += "<td>";
                        HTML += "€ " + PriceOutput;
                        HTML += "</td>";

                        HTML += "<td>";
                        HTML += "<input type=\"image\" class=\"ProductButton\" alt=\"\" productid=\"" + myOrderItem.Id.ToString() + "\" src=\"/images/Remove.jpg\" onclick=\"return false;\" />";
                        HTML += "</td>";

                        HTML += "</tr>";
                    }

                    double myTotalPrice = new CalculateTotalPrice().CalculateTotal(myList);

                    HTML += "<tr class=\"GridViewHeader\"><td></td><td>Total</td><td>=</td><td><div class=\"MiniFontBlueLeft\">€ " + myTotalPrice.ToString("F") + "<div></td></tr>";

                    HTML += "<table>";

                    return HTML;
                }
                else
                {
                    return "";
                }
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
        public string PopulateProducts(string SupplierID)
        {
            try
            {
                if (Context.User.IsInRole("Administrator"))
                {
                    int mySupplierID = Convert.ToInt32(SupplierID);

                    List<OrderItem> myList = (List<OrderItem>)Session["SupplierOrder"];

                    List<Product> myProducts = new ProductsLogic().RetrieveProductsForDisplayBySupplier(mySupplierID).ToList();
                    string HTML = "<option value=\"0\">Select</option>";

                    foreach (Product myProduct in myProducts)
                    {
                        if (myList.SingleOrDefault(oi => oi.Id == myProduct.Id) == null)
                        {
                            HTML += "<option value=\"" + myProduct.Id + "\">" + myProduct.Name + "</option>";
                        }
                    }

                    return HTML;
                }
                else
                {
                    return "";
                }
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string myProductID = null;

                try
                {
                    myProductID = new Encryption().Decrypt(Request.QueryString[0].ToString());
                }
                catch (Exception)
                {
                    Response.Redirect("~/pagenotfound.aspx");
                }

                Guid myProductGuid;

                if (Guid.TryParse(myProductID, out myProductGuid))
                {
                    Product myProduct = new ProductsLogic().RetrieveProductByID(myProductID);
                    User myLoggedUser = new UsersLogic().RetrieveUserByUsername(Context.User.Identity.Name);
                    UserTypeProduct myPriceType = new PriceTypesLogic().RetrievePriceTypeByID(myLoggedUser.UserTypeFK, myProduct.Id);

                    this.Title = "the Great Supermarket | " + myProduct.Name;
                    txtPageTitle.Text = "Viewing: " + myProduct.Name;

                    hdnProductID.Value = myProduct.Id.ToString();

                    imgProduct.ImageUrl = myProduct.ImageURL;
                    lblProductName.Text = myProduct.Name;
                    lblDescription.Text = myProduct.Description;

                    string Price = "";
                    string Stock = "";

                    if (myProduct.StockQuantity == 0)
                    {
                        Stock = "No Stock";
                        txtQuantity.Visible = false;
                        lblQuantity.Visible = false;
                        _StockAvailable = false;
                    }
                    else if (myProduct.StockQuantity <= myProduct.ReorderLevel)
                    {
                        Stock = "Low Stock";
                    }

                    if (myPriceType != null)
                    {
                        Price = "€" + myPriceType.Price.ToString("F");
                        double? NewPrice = 0;

                        if ((myPriceType.DiscountDateFrom != null) && (myPriceType.DiscountDateTo != null) && (myPriceType.DiscountPercentage != null))
                        {
                            if ((DateTime.Now >= myPriceType.DiscountDateFrom) && (DateTime.Now <= myPriceType.DiscountDateTo))
                            {
                                NewPrice = myPriceType.Price - ((myPriceType.DiscountPercentage / 100) * myPriceType.Price);

                                string myDisplayedNewPrice = Convert.ToDouble(NewPrice).ToString("F");

                                Price = myPriceType.DiscountPercentage + "% Off : €" + myDisplayedNewPrice;
                            }
                        }
                    }

                    lblPrice.Text = Stock + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + Price;
                }
                else
                {
                    Response.Redirect("~/pagenotfound.aspx");
                }
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
        /// <summary>
        /// Occurs when the Products Grid View Selected Index is Changed
        /// Level: External
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvProducts_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                lblImageError.Text = "";
                lblErrorDisplay.Text = "&nbsp;";

                imgProduct.Visible = true;
                btnAdd.Visible = false;
                btnUpdate.Visible = true;
                reqValImage.Visible = false;

                Product myProduct = new ProductsLogic().RetrieveProductByID(gvProducts.SelectedValue.ToString());

                txtName.Text = myProduct.Name;
                txtDescription.Text = myProduct.Description;
                ddlStatus.SelectedValue = myProduct.Status.ToString().ToLower();
                ddlCategory.SelectedValue = myProduct.CategoryFK.ToString();
                ddlSupplier.SelectedValue = myProduct.SupplierFK.ToString();
                txtVatRate.Text = myProduct.Vatrate.Vatrate1.ToString();
                txtReorderLevel.Text = myProduct.ReorderLevel.ToString();
                imgProduct.ImageUrl = Page.ResolveClientUrl(myProduct.ImageURL);
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
        /// <summary>
        /// Occurs when the Products Grid View Row is Deleting
        /// Level: External
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvProducts_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                lblImageError.Text = "";
                lblErrorDisplay.Text = "&nbsp;";

                Product myProduct = new ProductsLogic().RetrieveProductByID(e.Keys[0].ToString());

                string PreviousURL = myProduct.ImageURL;

                if (new ProductsLogic().DeleteProduct(myProduct.Id) == false)
                {
                    lblErrorDisplay.Text = "Product is Bound to One or More Orders and Cannot be Deleted";
                    //deletion error product has orders
                    //lblServerSideError.Text = "Category has Existing Child Categories and Cannot be Deleted";
                }
                else
                {
                    File.Delete(Server.MapPath(PreviousURL));

                    gvProducts.DataSource = new ProductsLogic().RetrieveAllProducts();
                    gvProducts.DataBind();

                    gvProducts.SelectedIndex = -1;
                    btnAdd.Visible = true;
                    btnUpdate.Visible = false;
                    txtName.Text = "";
                    txtDescription.Text = "";
                    txtVatRate.Text = "";
                    txtReorderLevel.Text = "";
                    ddlStatus.SelectedValue = "true";
                    imgProduct.Visible = false;
                    ddlSupplier.SelectedValue = "0";
                    ddlCategory.SelectedValue = "0";
                    reqValImage.Visible = true;
                }
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
        /// <summary>
        /// Occurs when the Product Update Button is Clicked
        /// Level: External
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    lblImageError.Text = "";
                    lblErrorDisplay.Text = "&nbsp;";

                    Tuple<string, UploadResult> myResult = new UploadImage().Upload(fuImage);
                    string PreviousURL = new ProductsLogic().RetrieveProductByID(gvProducts.SelectedValue.ToString()).ImageURL;

                    string ProductID = gvProducts.SelectedValue.ToString();
                    string Name = txtName.Text;
                    string Description = txtDescription.Text;
                    bool Status = Convert.ToBoolean(ddlStatus.SelectedValue);
                    int CategoryID = Convert.ToInt32(ddlCategory.SelectedValue);
                    int SupplierID = Convert.ToInt32(ddlSupplier.SelectedValue);
                    int ReorderLevel = Convert.ToInt32(txtReorderLevel.Text);
                    double VatRate = Convert.ToDouble(txtVatRate.Text);
                    string ImageURL = null;

                    if (myResult.Item2 == UploadResult.InvalidExtension)
                    {
                        lblImageError.Text = "Invalid Image Extension";
                    }
                    else if (myResult.Item2 == UploadResult.NoImageFound)
                    {
                        new ProductsLogic().UpdateProduct(ProductID, Name, Description, ImageURL, Status, CategoryID, VatRate, SupplierID, ReorderLevel);

                        gvProducts.DataSource = new ProductsLogic().RetrieveAllProducts();
                        gvProducts.DataBind();
                    }
                    else
                    {
                        File.Delete(Server.MapPath(PreviousURL));

                        ImageURL = myResult.Item1;

                        new ProductsLogic().UpdateProduct(ProductID, Name, Description, ImageURL, Status, CategoryID, VatRate, SupplierID, ReorderLevel);

                        gvProducts.DataSource = new ProductsLogic().RetrieveAllProducts();
                        gvProducts.DataBind();

                        imgProduct.ImageUrl = Page.ResolveClientUrl(ImageURL);
                    }
                }
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
Ejemplo n.º 10
0
 private void GetDatos()
 {
     ProductsLogic pl = new ProductsLogic();
     GridViewProducts.DataSource = pl.GetAllProducts();
     GridViewProducts.DataBind();
 }
        public string PopulateProducts()
        {
            try
            {
                if (Context.User.IsInRole("Administrator"))
                {
                    List<ProductsView> myProducts = new ProductsLogic().RetrieveAllProducts().ToList();
                    string HTML = "<option value=\"0\"> Select </option>";

                    foreach (ProductsView myProduct in myProducts)
                    {
                        HTML += "<option value=\"" + myProduct.Id + "\">" + myProduct.Name + "</option>";
                    }

                    return HTML;
                }
                else
                {
                    return "";
                }
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
        public string LoadShoppingCartItems()
        {
            try
            {
                if (Context.User.IsInRole("User"))
                {
                    string HTML = "";

                    User myLoggedUser = new UsersLogic().RetrieveUserByUsername(Context.User.Identity.Name);
                    List<ShoppingCart> myShoppingCartItems = new ShoppingCartLogic().RetrieveAllShoppingCartItems(myLoggedUser.Id).ToList();

                    HTML += "<table>";

                    int Counter = 0;

                    foreach (ShoppingCart myShoppingCartItem in myShoppingCartItems)
                    {
                        UserTypeProduct myPriceType = new PriceTypesLogic().RetrievePriceTypeByID(myLoggedUser.UserTypeFK, myShoppingCartItem.ProductFK);

                        string PriceOutput = "";

                        if (myPriceType != null)
                        {
                            PriceOutput = myPriceType.Price.ToString("F");
                            double? NewPrice = 0;

                            if ((myPriceType.DiscountDateFrom != null) && (myPriceType.DiscountDateTo != null) && (myPriceType.DiscountPercentage != null))
                            {
                                if ((DateTime.Now >= myPriceType.DiscountDateFrom) && (DateTime.Now <= myPriceType.DiscountDateTo))
                                {
                                    NewPrice = myPriceType.Price - ((myPriceType.DiscountPercentage / 100) * myPriceType.Price);

                                    string myDisplayedNewPrice = Convert.ToDouble(NewPrice).ToString("F");

                                    PriceOutput = myDisplayedNewPrice + " : " + myPriceType.DiscountPercentage + " % Off";
                                }
                            }
                        }

                        HTML += "<tr class=\"GridViewTuple\">";

                        HTML += "<td>";
                        HTML += new ProductsLogic().RetrieveProductByID(myShoppingCartItem.ProductFK.ToString()).Name;
                        HTML += "</td>";

                        HTML += "<td>";
                        HTML += "<div style=\"padding-top: 4px; float: left;\">x&nbsp;&nbsp;</div><input class=\"CatalogTextBox\" id=\"" + myShoppingCartItem.ProductFK + "\" Use=\"Quantity\" type=\"text\" value=\"" + myShoppingCartItem.Quantity.ToString() + "\">";
                        HTML += "</td>";

                        HTML += "<td> at </td>";

                        HTML += "<td>";
                        HTML += "€ " + PriceOutput;
                        HTML += "</td>";

                        HTML += "<td>";
                        HTML += "<div Use=\"ErrorDiv\" ProductID=\"" + myShoppingCartItem.ProductFK + "\" class=\"MiniFontBlue\">Not Enough Stock</div>";
                        HTML += "</td>";

                        HTML += "</tr>";

                        Counter++;
                    }

                    HTML += "</table>";

                    return HTML;
                }
                else
                {
                    return "";
                }
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Context.User.Identity.IsAuthenticated)
                {
                    string myOrderID = Request.QueryString[0].ToString();
                    Guid myOrderGuid;

                    if (Guid.TryParse(myOrderID, out myOrderGuid))
                    {
                        Order myOrder = new OrdersLogic().RetrieveOrderByID(myOrderGuid);
                        IQueryable<OrderProduct> myOrderItems = new OrdersLogic().RetrieveItemsByOrderID(myOrderGuid);

                        bool HasAccess = false;

                        if(Context.User.IsInRole("Administrator"))
                        {
                            HasAccess = true;
                        }
                        else
                        {
                            if (myOrder.UserFK == new UsersLogic().RetrieveUserByUsername(Context.User.Identity.Name).Id)
                            {
                                HasAccess = true;
                            }
                        }

                        //User has access to the order
                        if (HasAccess)
                        {
                            string HTML = "<table style=\"font-family: Arial;\"  cellpadding=\"6\">";

                            HTML += "<tr>";
                                HTML += "<td>";
                                HTML += "Order ID: ";
                                HTML += "</td>";
                                HTML += "<td>";
                                HTML += myOrder.Id;
                                HTML += "</td>";
                            HTML += "</tr>";

                            if(myOrder.SupplierFK == null)
                            {
                                HTML += "<tr>";
                                HTML += "<td>";
                                HTML += "Name: ";
                                HTML += "</td>";
                                HTML += "<td>";
                                HTML += myOrder.User.Name + " " + myOrder.User.Surname;
                                HTML += "</td>";
                                HTML += "</tr>";

                                string[] Address = myOrder.User.StreetAddress.Split('|');

                                HTML += "<tr>";
                                HTML += "<td>";
                                HTML += "Address: ";
                                HTML += "</td>";
                                HTML += "<td>";
                                HTML += Address[0];
                                HTML += "</td>";
                                HTML += "</tr>";

                                HTML += "<tr>";
                                HTML += "<td>";
                                HTML += "</td>";
                                HTML += "<td>";
                                HTML += Address[1];
                                HTML += "</td>";
                                HTML += "</tr>";

                                HTML += "<tr>";
                                HTML += "<td>";
                                HTML += "Town: ";
                                HTML += "</td>";
                                HTML += "<td>";
                                HTML += myOrder.User.Town.Town1;
                                HTML += "</td>";
                                HTML += "</tr>";

                                HTML += "<tr>";
                                HTML += "<td>";
                                HTML += "Country: ";
                                HTML += "</td>";
                                HTML += "<td>";
                                HTML += myOrder.User.Town.Country.Country1;
                                HTML += "</td>";
                                HTML += "</tr>";
                            }
                            else
                            {
                                HTML += "<tr>";
                                HTML += "<td>";
                                HTML += "Supplier: ";
                                HTML += "</td>";
                                HTML += "<td>";
                                HTML += myOrder.Supplier.Supplier1;
                                HTML += "</td>";
                                HTML += "</tr>";
                            }

                            HTML += "<tr>";
                            HTML += "<td>";
                            HTML += "Status: ";
                            HTML += "</td>";
                            HTML += "<td>";
                            HTML += myOrder.OrderStatus.Status;
                            HTML += "</td>";

                            HTML += "</tr>";
                            HTML += "<tr>";
                            HTML += "<td>";
                            HTML += "Date Placed: ";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += myOrder.OrderDate;
                            HTML += "</td>";

                            HTML += "</tr>";

                            HTML += "</table>";

                            HTML += "<br/>";

                            HTML += "<table style=\"font-family: Arial;\"  cellpadding=\"6\">";

                            HTML += "<tr>";

                            HTML += "<td>";
                            HTML += "Product";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "Quantity";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "Price";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "VAT Rate";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "Discount (Incl.)";
                            HTML += "</td>";

                            HTML += "</tr>";

                            double TotalPrice = 0;
                            double TotalVat = 0;

                            foreach (OrderProduct myOrderItem in myOrderItems)
                            {
                                Product myProduct = new ProductsLogic().RetrieveProductByID(myOrderItem.ProductFK.ToString());

                                User myUser = null;
                                UserTypeProduct myPriceType = null;

                                if (myOrder.UserFK != null)
                                {
                                    myUser = new UsersLogic().RetrieveUserByID(Guid.Parse(myOrder.UserFK.ToString()));
                                    myPriceType = new PriceTypesLogic().RetrievePriceTypeByID(myUser.UserTypeFK, myProduct.Id);
                                }
                                else
                                {
                                    UserType myUserType = new UserTypesLogic().RetrieveUserTypeByName("Wholesaler");
                                    myPriceType = new PriceTypesLogic().RetrievePriceTypeByID(myUserType.Id, myProduct.Id);
                                }

                                HTML += "<tr>";

                                HTML += "<td>";
                                HTML += myProduct.Name;
                                HTML += "</td>";

                                HTML += "<td>";
                                HTML += " x " + myOrderItem.Quantity;
                                HTML += "</td>";

                                HTML += "<td>";
                                HTML += " at € " + myOrderItem.Price.ToString("F");
                                HTML += "</td>";

                                HTML += "<td>";
                                HTML += myProduct.Vatrate.Vatrate1 + "% VAT";
                                HTML += "</td>";

                                TotalPrice += myOrderItem.Price * myOrderItem.Quantity;
                                TotalVat += ((myProduct.Vatrate.Vatrate1 / 100) * (myOrderItem.Price * myOrderItem.Quantity));

                                HTML += "<td>";

                                if((myOrder.OrderDate >= myPriceType.DiscountDateFrom) && (myOrder.OrderDate <= myPriceType.DiscountDateTo))
                                {
                                    HTML += myPriceType.DiscountPercentage + "% Discount";
                                }

                                HTML += "</td>";

                                HTML += "</tr>";
                            }

                            HTML += "<tr>";

                            HTML += "<td>";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "Subtotal : ";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "€ " + (TotalPrice - TotalVat).ToString("F");
                            HTML += "</td>";

                            HTML += "<tr>";

                            HTML += "<td>";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "VAT : ";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "€ " + TotalVat.ToString("F");
                            HTML += "</td>";

                            HTML += "</tr>";

                            HTML += "<tr>";

                            HTML += "<td>";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "Total : ";
                            HTML += "</td>";

                            HTML += "<td>";
                            HTML += "€ " + TotalPrice.ToString("F");
                            HTML += "</td>";

                            HTML += "</tr>";
                            HTML += "</table>";

                            lblOutput.Text = HTML;
                        }
                        else
                        {
                            Response.Redirect("~/default.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("~/default.aspx");
                }

            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }