protected void acceptButtonImage_Click(object sender, ImageClickEventArgs e) { string productsName = ""; decimal totalPrice = 0; string note; bool type = true; int ClientId = 0; for (int i = 0; i < BasketGrid.Rows.Count; i++) { GridViewRow row = (GridViewRow)BasketGrid.Rows[i]; productsName += row.Cells[1].Text.ToString() + ","; totalPrice += Convert.ToDecimal(row.Cells[3].Text); } note = TextBoxNoteID.Text.ToString(); if (payementType.SelectedValue.ToString() == "kredi") { type = false; } else { type = true; } EClient usr = (EClient)Session["user"]; ClientId = usr.id; BLLPurchase.CreatePurchase(totalPrice, productsName, note, type, ClientId); using (System.IO.StreamWriter file = new System.IO.StreamWriter(submittedFilePath, true)) { file.WriteLine("[" + DateTime.Now + "] DB PURCHASE CREATED"); } for (int i = 0; i < BasketGrid.Rows.Count; i++) { GridViewRow row = (GridViewRow)BasketGrid.Rows[i]; string tempkey = row.Cells[4].Text.ToString(); int key = Convert.ToInt32(tempkey); BLLBasket.DeleteBasket(key); using (System.IO.StreamWriter file = new System.IO.StreamWriter(submittedFilePath, true)) { file.WriteLine("[" + DateTime.Now + "] DB BASKET DELETED"); } } FillGrid(); Response.Redirect("~/Purchase.aspx"); }
protected void Page_Load(object sender, EventArgs e) { EClient usr = (EClient)Session["user"]; if (usr != null) { PurchaseGrid.DataSource = BLLPurchase.GetPurchase_ClientID(usr.id); using (System.IO.StreamWriter file = new System.IO.StreamWriter(submittedFilePath, true)) { file.WriteLine("[" + DateTime.Now + "] DB PURCHASE PULLED"); } PurchaseGrid.DataBind(); } else { Response.Redirect("~/Default.aspx"); } }