protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtid.Text)) { strErr += "id格式错误!\\n"; } if (!PageValidate.IsNumber(txtuserid.Text)) { strErr += "userid格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int id = int.Parse(this.txtid.Text); int userid = int.Parse(this.txtuserid.Text); ncu.mao.Model.user_roles model = new ncu.mao.Model.user_roles(); model.id = id; model.userid = userid; ncu.mao.BLL.user_roles bll = new ncu.mao.BLL.user_roles(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
private void ShowInfo(int rolesid) { ncu.mao.BLL.user_roles bll = new ncu.mao.BLL.user_roles(); ncu.mao.Model.user_roles model = bll.GetModel(rolesid); this.lblid.Text = model.id.ToString(); this.lbluserid.Text = model.userid.ToString(); this.lblrolesid.Text = model.rolesid.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ncu.mao.BLL.user_roles bll = new ncu.mao.BLL.user_roles(); if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { int rolesid = (Convert.ToInt32(Request.Params["id"])); bll.Delete(rolesid); } } }