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

            if (!PageValidate.IsNumber(txtId.Text))
            {
                strErr += "Id格式错误!\\n";
            }
            if (this.txtName.Text.Trim().Length == 0)
            {
                strErr += "Name不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    Id   = int.Parse(this.txtId.Text);
            string Name = this.txtName.Text;

            OLBookstore.Model.UserStates model = new OLBookstore.Model.UserStates();
            model.Id   = Id;
            model.Name = Name;

            OLBookstore.BLL.UserStatesManager bll = new OLBookstore.BLL.UserStatesManager();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Example #2
0
 private void ShowInfo()
 {
     OLBookstore.BLL.UserStatesManager bll   = new OLBookstore.BLL.UserStatesManager();
     OLBookstore.Model.UserStates      model = bll.GetModel();
     this.lblId.Text   = model.Id.ToString();
     this.lblName.Text = model.Name;
 }