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

            if (this.txtpassword.Text.Trim().Length == 0)
            {
                strErr += "password不能为空!\\n";
            }
            if (this.txtsex.Text.Trim().Length == 0)
            {
                strErr += "sex不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtage.Text))
            {
                strErr += "age格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtheig.Text))
            {
                strErr += "heig格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtweight.Text))
            {
                strErr += "weight格式错误!\\n";
            }
            if (this.txtbeizhu.Text.Trim().Length == 0)
            {
                strErr += "beizhu不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    username = int.Parse(this.lblusername.Text);
            string password = this.txtpassword.Text;
            string sex      = this.txtsex.Text;
            int    age      = int.Parse(this.txtage.Text);
            int    heig     = int.Parse(this.txtheig.Text);
            int    weight   = int.Parse(this.txtweight.Text);
            string beizhu   = this.txtbeizhu.Text;


            Maticsoft.Model.cccc.user model = new Maticsoft.Model.cccc.user();
            model.username = username;
            model.password = password;
            model.sex      = sex;
            model.age      = age;
            model.heig     = heig;
            model.weight   = weight;
            model.beizhu   = beizhu;

            Maticsoft.BLL.cccc.user bll = new Maticsoft.BLL.cccc.user();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
 private void ShowInfo(int username)
 {
     Maticsoft.BLL.cccc.user   bll   = new Maticsoft.BLL.cccc.user();
     Maticsoft.Model.cccc.user model = bll.GetModel(username);
     this.lblusername.Text = model.username.ToString();
     this.lblpassword.Text = model.password;
     this.lblsex.Text      = model.sex;
     this.lblage.Text      = model.age.ToString();
     this.lblheig.Text     = model.heig.ToString();
     this.lblweight.Text   = model.weight.ToString();
     this.lblbeizhu.Text   = model.beizhu;
 }