예제 #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(txtCollegeId.Text))
            {
                strErr+="CollegeId格式错误!\\n";
            }

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

            Eva.Model.Major model=new Eva.Model.Major();
            model.Name=Name;
            model.CollegeId=CollegeId;

            Eva.BLL.Major bll=new Eva.BLL.Major();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
예제 #2
0
 private void ShowInfo(int Id)
 {
     Eva.BLL.Major bll=new Eva.BLL.Major();
     Eva.Model.Major model=bll.GetModel(Id);
     this.lblId.Text=model.Id.ToString();
     this.lblName.Text=model.Name;
     this.lblCollegeId.Text=model.CollegeId.ToString();
 }