Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtusername.Text.Trim().Length == 0)
            {
                strErr += "username不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtage.Text))
            {
                strErr += "age格式错误!\\n";
            }
            if (this.txtaddr.Text.Trim().Length == 0)
            {
                strErr += "addr不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string username = this.txtusername.Text;
            int    age      = int.Parse(this.txtage.Text);
            string addr     = this.txtaddr.Text;

            ncu.mao.Model.t_user model = new ncu.mao.Model.t_user();
            model.username = username;
            model.age      = age;
            model.addr     = addr;

            ncu.mao.BLL.t_user bll = new ncu.mao.BLL.t_user();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Example #2
0
 private void ShowInfo(int userid)
 {
     ncu.mao.BLL.t_user   bll   = new ncu.mao.BLL.t_user();
     ncu.mao.Model.t_user model = bll.GetModel(userid);
     this.lbluserid.Text   = model.userid.ToString();
     this.txtusername.Text = model.username;
     this.txtage.Text      = model.age.ToString();
     this.txtaddr.Text     = model.addr;
 }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         ncu.mao.BLL.t_user bll = new ncu.mao.BLL.t_user();
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             int userid = (Convert.ToInt32(Request.Params["id"]));
             bll.Delete(userid);
             Response.Redirect("list.aspx");
         }
     }
 }