protected void Button1_Click(object sender, EventArgs e) { Model.MenuInfoModel model = new Model.MenuInfoModel(); model.MenuName = this.txtMenuName.Text; model.MenuUrl = this.txtMenuUrl.Text; model.OrderId = Common.TypeHelper.ObjectToInt(this.txtOrderId.Text, 100); model.Bid = Common.TypeHelper.ObjectToInt(this.ddlBid.SelectedValue, 0); model.StatusId = Common.TypeHelper.ObjectToInt(this.radStatusId.SelectedValue, 0); int id = Common.TypeHelper.ObjectToInt(this.hidId.Value, 0); model.MenuId = id; if (id > 0) { if (dal.Update(model) > 0) { JScript.Loction("p", "admin_Menu.aspx?action=add&" + menuUrl, this.Page); } } else { if (dal.Add(model) > 0) { JScript.Loction("p", "admin_Menu.aspx?action=add&" + menuUrl, this.Page); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request["action"] == "add") { Model.MenuInfoModel model = new Model.MenuInfoModel(); model.MenuName = Request["menuName"]; model.MenuUrl = Request["menuUrl"]; model.OrderId = Common.TypeHelper.ObjectToInt(Request["OrderId"], 0); model.Bid = Common.TypeHelper.ObjectToInt(Request["bid"], 0); model.StatusId = Common.TypeHelper.ObjectToInt(Request["StatusId"], 0); int i = dal.Add(model); if (i > 0) { JScript.alert("ok", "操作成功", this.Page, "admin_menu.aspx?" + menuUrl); } else { } } }