Beispiel #1
0
 private void ShowInfo(int userId)
 {
     Maticsoft.BLL.user   bll   = new Maticsoft.BLL.user();
     Maticsoft.Model.user model = bll.GetModel(userId);
     this.lbluserId.Text   = model.userId.ToString();
     this.lblusername.Text = model.username;
     this.lblpassword.Text = model.password;
     this.lbladdress.Text  = model.address;
 }
Beispiel #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtuserId.Text))
            {
                strErr += "userId格式错误!\\n";
            }
            if (this.txtusername.Text.Trim().Length == 0)
            {
                strErr += "username不能为空!\\n";
            }
            if (this.txtpassword.Text.Trim().Length == 0)
            {
                strErr += "password不能为空!\\n";
            }
            if (this.txtaddress.Text.Trim().Length == 0)
            {
                strErr += "address不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    userId   = int.Parse(this.txtuserId.Text);
            string username = this.txtusername.Text;
            string password = this.txtpassword.Text;
            string address  = this.txtaddress.Text;

            Maticsoft.Model.user model = new Maticsoft.Model.user();
            model.userId   = userId;
            model.username = username;
            model.password = password;
            model.address  = address;

            Maticsoft.BLL.user bll = new Maticsoft.BLL.user();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }