Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtname.Text.Trim().Length == 0)
            {
                strErr += "name不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtage.Text))
            {
                strErr += "age格式错误!\\n";
            }
            if (this.txtpictureurl.Text.Trim().Length == 0)
            {
                strErr += "pictureurl不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string name       = this.txtname.Text;
            int    age        = int.Parse(this.txtage.Text);
            string pictureurl = this.txtpictureurl.Text;

            Ncu.jsj.Model.Student model = new Ncu.jsj.Model.Student();
            model.name       = name;
            model.age        = age;
            model.pictureurl = pictureurl;

            Ncu.jsj.BLL.Student bll = new Ncu.jsj.BLL.Student();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Esempio n. 2
0
 private void ShowInfo(int id)
 {
     Ncu.jsj.BLL.Student   bll   = new Ncu.jsj.BLL.Student();
     Ncu.jsj.Model.Student model = bll.GetModel(id);
     this.lblid.Text         = model.id.ToString();
     this.lblname.Text       = model.name;
     this.lblage.Text        = model.age.ToString();
     this.lblpictureurl.Text = model.pictureurl;
 }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Ncu.jsj.BLL.Student bll = new Ncu.jsj.BLL.Student();
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             int id = (Convert.ToInt32(Request.Params["id"]));
             bll.Delete(id);
             Response.Redirect("list.aspx");
         }
     }
 }