protected void Page_Load(object sender, EventArgs e) { var wuser = Context.User.Identity; if (wuser.IsAuthenticated) { lnkLogin.Visible = false; lnkReg.Visible = false; btnLogout.Visible = true; litWstatus.Visible = true; PwCartModel pwcmodel = new PwCartModel(); string wuserId = HttpContext.Current.User.Identity.GetUserId(); litWstatus.Text = string.Format("{0} ({1})", Context.User.Identity.Name, pwcmodel.GetAmountOfWorders(wuserId)); } else { lnkLogin.Visible = true; lnkReg.Visible = true; btnLogout.Visible = false; litWstatus.Visible = false; } }
protected void btnAdd_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(Request.QueryString["id"])) { string watchcustId = Context.User.Identity.GetUserId(); if (watchcustId != null) { int id = Convert.ToInt32(Request.QueryString["id"]); int amounts = Convert.ToInt32(ddlAmounts.SelectedValue); watchCart watchcart = new watchCart { watchAmount = amounts, watchCustID = watchcustId, watchDateBuy = DateTime.Now, watchIsInCart = true, watchProID = id }; PwCartModel model = new PwCartModel(); lblResults.Text = model.InsertwatchProd(watchcart); } else { lblResults.Text = "You need to Sign In if you want to order this watch or you can register now for free!"; } } }
protected void Page_Load(object sender, EventArgs e) { List <watchCart> wcarts = (List <watchCart>)Session[User.Identity.GetUserId()]; PwCartModel pwcmodel = new PwCartModel(); pwcmodel.MarkWordersAsPaid(wcarts); Session[User.Identity.GetUserId()] = null; }
private void ddlWamount_SelectedIndexChanged(object sender, EventArgs e) { DropDownList selectedWlist = (DropDownList)sender; int wquantity = Convert.ToInt32(selectedWlist.SelectedValue); int watchcartId = Convert.ToInt32(selectedWlist.ID); PwCartModel pwcmodel = new PwCartModel(); pwcmodel.UpdateWquantity(watchcartId, wquantity); Response.Redirect("~/WatchShopCart.aspx"); }
private void Delete_Item(object sender, EventArgs e) { LinkButton selectedWlink = (LinkButton)sender; string wlink = selectedWlink.ID.Replace("del", ""); int watchcartId = Convert.ToInt32(wlink); PwCartModel pwcmodel = new PwCartModel(); pwcmodel.DeletewatchProd(watchcartId); Response.Redirect("~/WatchShopCart.aspx"); }
private void GetPurchasesInWcart(string wuserId) { PwCartModel wmodel = new PwCartModel(); double subWtotal = 0; //to make HTML for each purchase list List <watchCart> purchaseWlist = wmodel.GetOrdersInCart(wuserId); CreateShopTable(purchaseWlist, out subWtotal); //add the total to website page double tax = subWtotal * 0.15; double totalWamount = subWtotal + tax + 10; //to display the value in the website litWtotal.Text = "$ " + subWtotal; litWtax.Text = "$ " + tax; litWtotalAmount.Text = "$ " + totalWamount; }