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

            if (!PageValidate.IsNumber(txtID.Text))
            {
                strErr += "ID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtMessageID.Text))
            {
                strErr += "MessageID格式错误!\\n";
            }
            if (this.txtAnswer.Text.Trim().Length == 0)
            {
                strErr += "Answer不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    ID        = int.Parse(this.txtID.Text);
            int    MessageID = int.Parse(this.txtMessageID.Text);
            string Answer    = this.txtAnswer.Text;

            eChartProject.Model.eChart.Server_Contents_Answers model = new eChartProject.Model.eChart.Server_Contents_Answers();
            model.ID        = ID;
            model.MessageID = MessageID;
            model.Answer    = Answer;

            eChartProject.BLL.eChart.Server_Contents_Answers bll = new eChartProject.BLL.eChart.Server_Contents_Answers();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Esempio n. 2
0
 private void ShowInfo()
 {
     eChartProject.BLL.eChart.Server_Contents_Answers   bll   = new eChartProject.BLL.eChart.Server_Contents_Answers();
     eChartProject.Model.eChart.Server_Contents_Answers model = bll.GetModel();
     this.txtID.Text        = model.ID.ToString();
     this.txtMessageID.Text = model.MessageID.ToString();
     this.txtAnswer.Text    = model.Answer;
 }