protected void Page_Load(object sender, EventArgs e) { AddProduct p = sc.GetProduct(Convert.ToInt32(Request.QueryString["ID"])); if (Session["Name"] != null) { ADDTOCART.Visible = false; string display = ""; display += "<div class='col-sm-4'><div class='product-image-wrapper'>"; display += "<div class='single-products'><div class='productinfo text-center'>"; display += "<a href='#'>"; display += "<img src='" + p.imgurl + "' alt='' /><h2>R" + p.price + "</h2></a>"; display += "<h>Name: " + p.name + "</h><br><h>Description: " + p.desc + "</h><br><a href='Cart.aspx?ProductID=" + Convert.ToInt32(Request.QueryString["ID"]) + "&Qty=1'>AddToCart</a></div></div></div></div>"; display += "<br/>"; display += "<br/>"; display += "<br/>"; Session["ProductID"] = Convert.ToInt32(Request.QueryString["ID"]); product.InnerHtml += display; } else { string display = ""; display += "<div class='col-sm-4'><div class='product-image-wrapper'>"; display += "<div class='single-products'><div class='productinfo text-center'>"; display += "<a href='#'>"; display += "<img src='" + p.imgurl + "' alt='' /><h2>R" + p.price + "</h2></a>"; display += "<h>Name: " + p.name + "</h><br><h>Description: " + p.desc + "</h></div></div></div></div>"; display += "<br/>"; display += "<br/>"; display += "<br/>"; product.InnerHtml += display; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Name"] == null) { Response.Redirect("Home.aspx"); } else { if (!Session["UserType"].Equals("Manager")) { Response.Redirect("Home.aspx"); } else { if (!IsPostBack) { AddProduct part = sc.GetProduct(Convert.ToInt32(Request.QueryString["A"])); pname.Value = part.name; price.Value = Convert.ToString(part.price); quantity.Value = part.Quant; col.Value = part.Col; desc.Value = part.desc; type.Value = part.type; img.Value = part.imgurl; } } } }
protected void Page_Load(object sender, EventArgs e) { string display = ""; int Random(int min, int max) { Random random = new Random(); return(random.Next(min, max)); } // display += "< div class='col-md-4 clearfix'>"; display += "<div class='logo pull-left'>"; display += "<img src='images/GameRigHome/c619d286-b4ef-4dfb-ba9f-96cd7f82bd5e_200x200.png' style='margin-left:0px' width='100' height='100' />"; display += "<p style=' margin-left:0px'>Email:" + "*****@*****.**" + "</p>"; display += "<p style=' margin-left:0px'>Cell:" + "0607870139" + "</p>"; display += "</div>"; display += "</div>"; display += "<br/>"; display += "<br/>"; display += "<br/>"; display += "<br/>"; display += "<br/>"; display += "<br/>"; display += "<br/>"; display += "<br/>"; display += "<h1 style ='text-align:center;text-decoration:underline'>INVOICE</h1>"; display += "<br/>"; display += "<p style='text-align:center'>Username:"******"email"] + "</p>"; display += "<p style='text-align:center'>Names:" + Session["Name"] + " " + Session["surname"] + "</p>"; display += "<p style ='text-align:center'>Date:" + DateTime.Today + "</p>"; display += "<p style='text-align:center'>InvoiceNo:" + Random(1, 2000) + "</p>"; display += "<p style='text-align:center'>Cell Number:" + Session["contact"] + "</p>"; //display += "<p style ='text - align:center'>Products</p>"; var items = sc.getAllProducts(); List <CartClass> cart = (List <CartClass>)Session["CartProducts"]; //AddProduct single = sc.GetProduct(cart.ProID); foreach (CartClass ct in cart) { AddProduct single = sc.GetProduct(ct.ProID); display += "<tbody> <tr> <td class='cart_product'>"; display += " <td style='margin-left:0px; padding:0'><h4 >" + single.name + "</h4>"; display += "<td class='cart_description'><h4 >" + single.desc + "</h4>"; display += "</td><td class='cart_price'><p id='price'>" + ct.Quantity + "</p></td>"; display += "</td><td class='cart_price'><p id='price'>R" + Math.Round((Convert.ToDecimal(ct.Quantity) * single.price), 2) + "</p></td>"; display += "<td class='cart_quantity'>"; // display += "<a class='cart_quantity_down' href='#'>-</a>"; // display += "<input class='cart_quantity_input' id='quantity' style='margin-left:35px' type='text' name='quantity' value='1' autocomplete='off' size='2'/>"; // display += "<a class='cart_quantity_up' href='IncrementProduct.aspx?ID="+pr.ProductId+"&QU="+qua+"'>+</a>"; //display += "</div></td><td class='cart_total'>"; // String total = Convert.ToString(3 * pr.Price2); // Session["TOTAL"] = total; //display += "<td class='cart_delete'>"; display += "</td></tr>"; /*display += "<tr>"; * display += "<td>"+single.name+"</td>"; * display += "<td>" + single.desc + "</td>"; * display += "<td>" + ct.Quantity + "</td>"; * display += "<td>" + single.price + "</td>"; * display += " </tr>"; * /* display += "<tbody> <tr> <td class='cart_product'>"; * display += "<td class='cart_description'><h4 style='margin-left:20px'>Name: " + single.name+ "</h4></td>"; * display += "<td class='cart_description'><h4 style='margin-left:20px'>Description: " + single.desc + "</h4></td>"; * display += "<td class='cart_price'><h4 style='margin-left:20px'>Quantity: " + ct.Quantity + "</h4></td>"; * display += "<td class='cart_price'><h4 style='margin-left:20px'>Price: R" +single.price + "</h4></td>";*/ display += "<br/>"; display += "<br/>"; display += "<br/>"; } display += "<td class='cart_price'><h4 style='margin-left:20px'>Discount: R" + Request.QueryString["Discount"] + "</h4></td>"; display += "<td class='cart_price'><h4 style='margin-left:20px'>Total Price: R" + Request.QueryString["ProductTotal"] + "</h4></td>"; invo.InnerHtml = display; }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["ProductID"] != null && Request.QueryString["Qty"] != null) { int ProdID = Convert.ToInt32(Request.QueryString["ProductID"]); AddProduct fetchedProduct = sc.GetProduct(ProdID); int providedQuantity = Convert.ToInt32(Request.QueryString["Qty"]); if (providedQuantity < 1) { providedQuantity = 1; } if (Convert.ToInt32(fetchedProduct.Quant) <= providedQuantity) { AddProdToCart(Convert.ToInt32(Request.QueryString["ProductID"]), Convert.ToInt32(fetchedProduct.Quant)); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alertMessage", "notifyUser()", true); } else { AddProdToCart(Convert.ToInt32(Request.QueryString["ProductID"]), providedQuantity); } } List <CartClass> itemsCount = (List <CartClass>)Session["CartProducts"]; int exists = itemsCount.Count; if (exists > 0) { checkoutDiv.Visible = true; } else { checkoutDiv.Visible = false; vatValue.InnerHtml = null; delivery.InnerHtml = null; vat.InnerHtml = null; subtotal.InnerHtml = null; } if (Request.QueryString["removeID"] != null) { int ID = Convert.ToInt32(Request.QueryString["removeID"]); RemoveProduct(ID); } String display = ""; double total = 0; if (Session["CartProducts"] != null) { List <CartClass> items = (List <CartClass>)Session["CartProducts"]; foreach (CartClass pr in items) { AddProduct single = sc.GetProduct(pr.ProID); total += Convert.ToInt64(single.price) * pr.Quantity; int id = sc.getProId(single.name); display += "<tr class='text-center'>"; display += $"<td class='product-remove'><a href='cart.aspx?removeID={id}' ><span class='ion-ios-close'></span></a></td>"; display += $"<td class='image-prod'><div class='img' style='background-image:url({single.imgurl});'></div></td>"; display += "<td class='product-name'>"; display += $"<h3>{single.name}</h3>"; display += "</td>"; display += $"<td class='price'>R{single.price}</td>"; display += "<td class='quantity'>"; display += "<div class='input-group mb-3'>"; display += $"<input type='number' name='quantity' id='{id}' class='quantity form-control input-number' value='{pr.Quantity}'>"; display += "</div>"; display += "</td>"; display += "<td>"; display += $"<a onclick='updateQty({id});' style='padding: 0 0.5rem 0 0.5rem;' class='btn btn-primary py-3 px-4'>update cart</a>"; display += "</td>"; display += "<td>"; display += $"<a onclick='RemoveProduct({id});' href='remove.aspx?={id}' style='padding: 0 0.5rem 0 0.5rem;' class='btn btn-primary py-3 px-4'>Remove</a>"; display += "</td>"; display += $"<td class='total'>R{Convert.ToInt64(single.price) * pr.Quantity}</td>"; display += "</tr>"; } theCart.InnerHtml = display; vat.InnerHtml = "VAT: "; //+ Convert.ToString(0.15 * 100) + "%"; vatValue.InnerHtml = "R" + Math.Round(total * 0.15, 2); delivery.InnerHtml = "R" + Convert.ToString(70); subtotal.InnerHtml = "R" + Math.Round(total, 2); FarmUtilities.setSubtotal(total); string display2 = null; double id1; double id2; if (total >= 400 && coupon.Value.Equals("CM010")) { delivery.InnerHtml = "R0.00"; totalPrice.InnerHtml = "R" + Math.Round(total * 0.15 + total - (total * 0.1), 2); discount.InnerHtml = "R0.00"; FarmUtilities.setTotal(total * FarmUtilities.getVat() + total); FarmUtilities.setDeliveryFee(0); id1 = Math.Round(total * 0.15 + total - (total * 0.1), 2); id2 = total * 0.1; display2 += " <a class='btn btn-default check_out' href='InvoicePage.aspx?ProductTotal=" + id1 + " &Discount=" + id2 + "'id='checkout'>Check Out</a> "; } else if (total >= 400 && coupon.Value.Equals("")) { delivery.InnerHtml = "R0.00"; totalPrice.InnerHtml = "R" + Math.Round(total * 0.15 + total, 2); discount.InnerHtml = "R0.00"; id2 = 0; id1 = Math.Round(total * 0.15 + total, 2); display2 += " <a class='btn btn-default check_out' href='InvoicePage.aspx?ProductTotal=" + id1 + " &Discount=" + id2 + "'id='checkout'>Check Out</a> "; } else if (total < 400 && coupon.Value.Equals("CM010")) { discount.InnerHtml = 0 + "%"; totalPrice.InnerHtml = "R" + Math.Round(total * 0.15 + total + 70, 2); id1 = Math.Round(total * 0.15 + total + 70 - (total * 0.1), 2); id2 = total * 0.1; display2 += " <a class='btn btn-default check_out' href='InvoicePage.aspx?ProductTotal=" + id1 + " &Discount=" + id2 + "'id='checkout'>Check Out</a> "; } else { discount.InnerHtml = 0 + "%"; totalPrice.InnerHtml = "R" + Math.Round(total * 0.15 + total + 70, 2); // id1 = Math.Round(total * 0.15 + total + 70 , 2); id2 = 0; id1 = Math.Round(total * 0.15 + total + 70, 2); display2 += " <a class='btn btn-default check_out' href='InvoicePage.aspx?ProductTotal=" + id1 + " &Discount=" + id2 + "'id='checkout'>Check Out</a> "; } display2 += "<br/>"; display2 += "<br/>"; checkoutDiv.InnerHtml = display2; } }