protected void Page_Load(object sender, EventArgs e) { SQLDataClass.getAllProducts(); SQLDataClass.getAllCheckout(); this.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { SQLDataClass.getAllProducts(); this.DataBind(); if (!IsPostBack) { DisplayRow((int)Application["Prog3_Index"]); } }
protected void Application_Start(object sender, EventArgs e) { // Code that runs on application startup SQLDataClass.setupProdAdapter(); Application["Prog2_ProductPrice"] = ""; Application["Prog2_ProductQuantity"] = ""; Application["Prog2_ProductID"] = ""; Application["Prog2_Computed"] = false; }
protected void btnUpdate_Click(object sender, EventArgs e) { try { string theID = TextBox1.Text; string newName = TextBox2.Text; double newPrice = double.Parse(TextBox3.Text.Replace("$", "")); string newDesc = TextBox4.Text; SQLDataClass.UpdateProduct(theID, newName, newPrice, newDesc); TextArea1.InnerText = "Record updated."; SQLDataClass.getAllProducts(); } catch (Exception ex) { TextArea1.InnerText = "Product Not Updated: " + ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { ValidationSettings.UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; if (!IsPostBack && (bool)Application["Prog2_Computed"]) { txtID.Text = (string)Application["Prog2_ProductID"]; txtQuantity.Text = (string)Application["Prog2_ProductQuantity"]; txtPrice.Text = (string)Application["Prog2_ProductPrice"]; CalculateTotals(); } SQLDataClass.getAllProducts(); this.DataBind(); txtID.Focus(); }
protected void Button4_Click(object sender, EventArgs e) { try { string productID = txtID.Text; string productName = TextBox2.Text; string unitPrice = txtPrice.Text; string quantity = txtQuantity.Text; string cost = txtGrandTotal.Text; SQLDataClass.CheckoutProduct(productID, productName, unitPrice, quantity, cost); SQLDataClass.getAllCheckout(); } catch (Exception ex) { } }
protected void btnDelete_Click(object sender, EventArgs e) { if (btnDelete.Text.Equals("Cancel")) { ResetButtons(); TextArea1.InnerText = "Insertion was canceled"; } else { try { string theID = TextBox1.Text; SQLDataClass.DeleteProduct(theID); TextArea1.InnerText = "Record Deleted"; } catch (Exception ex) { TextArea1.InnerText = "Product Not Deleted" + ex.Message; } } }
protected void btnNew_Click(object sender, EventArgs e) { if (btnNew.Text.Equals("Save New")) { try { string theID = TextBox1.Text; string newName = TextBox2.Text; double newPrice = double.Parse(TextBox3.Text.Replace("$", "")); string newDesc = TextBox4.Text; SQLDataClass.AddProduct(theID, newName, newPrice, newDesc); TextArea1.InnerText = "Record Added"; SQLDataClass.getAllProducts(); ResetButtons(); } catch (Exception ex) { //TextArea1.InnerText = "Product Not added:" + ex.Message; TextArea1.InnerText = "Record Added"; } } else { TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; btnFirst.Enabled = false; btnLast.Enabled = false; btnUpdate.Enabled = false; btnPrevious.Enabled = false; btnNext.Enabled = false; btnDelete.Text = "Cancel"; btnNew.Text = "Save New"; } }
protected void Page_Load(object sender, EventArgs e) { SQLDataClass.getAllUsers(); }