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

            if (!PageValidate.IsNumber(txtid.Text))
            {
                strErr += "id格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtname.Text))
            {
                strErr += "name格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtpwd.Text))
            {
                strErr += "pwd格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int id   = int.Parse(this.txtid.Text);
            int name = int.Parse(this.txtname.Text);
            int pwd  = int.Parse(this.txtpwd.Text);

            yuhi.Model.user model = new yuhi.Model.user();
            model.id   = id;
            model.name = name;
            model.pwd  = pwd;

            yuhi.BLL.user bll = new yuhi.BLL.user();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
예제 #2
0
 private void ShowInfo()
 {
     yuhi.BLL.user   bll   = new yuhi.BLL.user();
     yuhi.Model.user model = bll.GetModel();
     this.txtid.Text   = model.id.ToString();
     this.txtname.Text = model.name.ToString();
     this.txtpwd.Text  = model.pwd.ToString();
 }