public void sumOrder(DataTable productall) { promotions = new PromotionList(); DataTable dt = productall; qty = int.Parse(qty_TextBox.Text.ToString()); int price = Convert.ToInt32(dt.Rows[0]["ProductPrice"]); int total = price * qty; string type = Label10.Text.ToString(); int discount = int.Parse(Label9.Text.ToString()); if (type == "Bath") { total = (total - discount); } else if (type == "Percent") { total = ((total * 100) / 100 + discount); } //int qty = int.Parse(DropDownList2.SelectedValue.ToString()); Label2.Text = dt.Rows[0]["ProductName"].ToString(); Label4.Text = qty_TextBox.Text.ToString(); Label6.Text = total.ToString(); }
void selectPromotion() { promotions = new PromotionList(); promotions.selectPromotion(); GridView1.DataSource = promotions.Values; GridView1.DataBind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int promoid = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0]); promotions = new PromotionList(); promotions.deletePromotion(promoid); this.selectPromotion(); }
void fetchSelect() { PromotionList promotions = new PromotionList(); promotions.selectPromotion(); DropDownList2.DataSource = promotions.Values; DropDownList2.DataTextField = "PromotionName"; DropDownList2.DataValueField = "PromotionID"; DropDownList2.DataBind(); }
protected void btnProSearch_Click1(object sender, EventArgs e) { string keyname = TextBox1.Text.ToString(); promotions = new PromotionList(); try { promotions.searchPromotion(keyname); GridView1.DataSource = promotions.Values; GridView1.DataBind(); } catch (Exception) { this.selectPromotion(); } }
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { promotions = new PromotionList(); int promotionid = int.Parse(DropDownList2.SelectedValue.ToString()); promotions.getPromotion(promotionid); var dt = promotions.PromotionAll; var row = dt.Rows[0]; string distype = row["PromotionType"].ToString(); if (distype == "1") { Label10.Text = "Bath"; } else if (distype == "2") { Label10.Text = "Percent"; } Label9.Text = row["PromotionDiscount"].ToString(); }
void addPromotion() { try { string name = promotionname_TextBox.Text.ToString(); int type = int.Parse(DropDownList1.SelectedValue.ToString()); string discount = promotiondiscount_TextBox.Text.ToString(); promotions = new PromotionList(); promotions.addPromotion(name, discount, type); } catch (Exception ex) { string error = ex.Message; } finally { this.selectPromotion(); } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { GridViewRow row = GridView1.Rows[e.RowIndex]; int promotionid = int.Parse((row.FindControl("editid_TextBox") as TextBox).Text); string promotionname = (row.FindControl("editname_TextBox") as TextBox).Text; string promotiondiscount = (row.FindControl("editdiscount_TextBox") as TextBox).Text; int typepromotion = int.Parse((row.FindControl("edittype_TextBox") as TextBox).Text); if (promotionname == "" || promotionname == null) { this.testModal("PromotionName", ""); } else if (promotiondiscount == "" || promotiondiscount == null) { this.testModal("PromotionDiscount", ""); } else { promotions = new PromotionList(); promotions.editPromotion(promotionid, promotionname, promotiondiscount, typepromotion); GridView1.EditIndex = -1; } } catch (Exception ex) { string error = ex.Message; this.testModal("Error", error); } finally { this.selectPromotion(); } }