protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string act = Request.QueryString["act"]; if (act == "edit") { string code = Request.QueryString["code"]; BLibraryPro.Category CatBLL = new BLibraryPro.Category(code); txtCategoryName.Text = CatBLL.CategoryDesc; txtRemarks.Text = CatBLL.remarks; } else if (act == "del") { string code = Request.QueryString["code"]; BLibraryPro.Category CatBLL = new BLibraryPro.Category(code); CatBLL.CategoryCode = code; CatBLL.DeleteCatagory(); Response.Redirect("~/GUI/Setup/Category.aspx?act=list&show=1"); } else if (act == "list") { if (Request.QueryString["show"] == "1") { btnFilter_Click(sender, new EventArgs()); } btnFilter_Click(sender, new EventArgs()); } } }
protected void btnSave_Click(object sender, EventArgs e) { string act = Request.QueryString["act"]; BLibraryPro.Category BCatagory = new BLibraryPro.Category(); BCatagory.CategoryDesc = txtCategoryName.Text; BCatagory.remarks = txtRemarks.Text; if (act == "add") { msgBox.Message = BCatagory.SaveCategory(); } else if (act == "edit") { BCatagory.CategoryCode = Request.QueryString["code"]; msgBox.Message = BCatagory.UpdateCategory(); } else if (act == "del") { BCatagory.CategoryCode = Request.QueryString["code"]; msgBox.Message = BCatagory.DeleteCatagory(); } Response.Redirect("~/GUI/Setup/Category.aspx?act=list"); }