protected void addbutton_Click(object sender, EventArgs e) { bool result = Discount_C.AddDiscount(new Discount("", sdgoodsid.Text.ToString(), disprice.Text.ToString(), sdisstart.Text.ToString(), sdisend.Text.ToString())); if (result) { Response.Write("<script language=javascript>window.alert('插入成功!');</script>"); Response.Redirect("../../Views/DiscountManage/DiscountManager.aspx"); } else { Response.Write("<script language=javascript>window.alert('插入失败!');</script>"); } }
protected void Update_Click(object sender, EventArgs e) { bool result = Discount_C.AlterByD_ID(new Discount(Request.Form["disid"], Request.Form["dgoodsid"], Request.Form["discount"], Request.Form["disstart"], Request.Form["disend"])); if (result) { Response.Write("<script language=javascript>window.alert('修改成功!');</script>"); Response.Redirect("../../Views/DiscountManage/DiscountManager.aspx"); } else { Response.Write("<script language=javascript>window.alert('修改失败!');</script>"); } }
protected void Delete_Click(object sender, EventArgs e) { bool result = Discount_C.DeleteDisaccountByD_ID(disid.Value); if (result) { Response.Write("<script language=javascript>window.alert('删除成功!');</script>"); Response.Redirect("../../Views/DiscountManage/DiscountManager.aspx"); } else { Response.Write("<script language=javascript>window.alert('删除失败!');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { string discountid = Request.QueryString["id"]; discountslist = Discount_C.SelectByD_ID(discountid); if (discountslist != null) { disid.Value = discountslist[0].ID; dgoodsid.Value = discountslist[0].G_ID; discount.Value = discountslist[0].DDiscount.ToString(); disstart.Value = discountslist[0].Start.ToString(); disend.Value = discountslist[0].End.ToString(); } }
protected void searchbutton_Click(object sender, EventArgs e) { if (dgoodsid.Text.ToString() != "") { if (disdate.Text.ToString() == "") { discountslist = Discount_C.SelectByG_ID(dgoodsid.Text.ToString()); } else { discountslist = Discount_C.SelectByIDAndDate(dgoodsid.Text.ToString(), disdate.Text.ToString()); } } else if (disstart.Text.ToString() != "" && disend.Text.ToString() != "") { discountslist = Discount_C.SelectDiscountByDate(disstart.Text.ToString(), disend.Text.ToString()); } else { Response.Write("<script language=javascript>window.alert('请至少输入id或date和id或起止日期!');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { discountslist = Discount_C.SelectAll(); }