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

            if (this.txtTitle.Text.Trim().Length == 0)
            {
                strErr += "标题不能为空!\\n";
            }
            if (this.txtContent.Text.Trim().Length == 0)
            {
                strErr += "内容不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtTime.Text))
            {
                strErr += "发布时间格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtClick.Text))
            {
                strErr += "点击数格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtMark.Text))
            {
                strErr += "Mark格式错误!\\n";
            }
            if (this.txtS1.Text.Trim().Length == 0)
            {
                strErr += "S1不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      ID      = int.Parse(this.lblID.Text);
            string   Title   = this.txtTitle.Text;
            string   Content = this.txtContent.Text;
            DateTime Time    = DateTime.Parse(this.txtTime.Text);
            bool     IsOpen  = this.chkIsOpen.Checked;
            int      Click   = int.Parse(this.txtClick.Text);
            int      No      = int.Parse(this.lblNo.Text);
            int      Mark    = int.Parse(this.txtMark.Text);
            string   S1      = this.txtS1.Text;


            Maticsoft.Model.Evaluate model = new Maticsoft.Model.Evaluate();
            model.ID      = ID;
            model.Title   = Title;
            model.Content = Content;
            model.Time    = Time;
            model.IsOpen  = IsOpen;
            model.Click   = Click;
            model.No      = No;
            model.Mark    = Mark;
            model.S1      = S1;

            Maticsoft.BLL.Evaluate bll = new Maticsoft.BLL.Evaluate();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Maticsoft.BLL.Evaluate bll = new Maticsoft.BLL.Evaluate();
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             int ID = (Convert.ToInt32(Request.Params["id"]));
             bll.Delete(ID);
         }
     }
 }
Beispiel #3
0
 private void ShowInfo(int ID)
 {
     Maticsoft.BLL.Evaluate   bll   = new Maticsoft.BLL.Evaluate();
     Maticsoft.Model.Evaluate model = bll.GetModel(ID);
     this.lblID.Text        = model.ID.ToString();
     this.txtTitle.Text     = model.Title;
     this.txtContent.Text   = model.Content;
     this.txtTime.Text      = model.Time.ToString();
     this.chkIsOpen.Checked = model.IsOpen;
     this.txtClick.Text     = model.Click.ToString();
     this.lblNo.Text        = model.No.ToString();
     this.txtMark.Text      = model.Mark.ToString();
     this.txtS1.Text        = model.S1;
 }
Beispiel #4
0
 private void ShowInfo(int ID)
 {
     Maticsoft.BLL.Evaluate   bll   = new Maticsoft.BLL.Evaluate();
     Maticsoft.Model.Evaluate model = bll.GetModel(ID);
     this.lblID.Text      = model.ID.ToString();
     this.lblTitle.Text   = model.Title;
     this.lblContent.Text = model.Content;
     this.lblTime.Text    = model.Time.ToString();
     this.lblIsOpen.Text  = model.IsOpen?"是":"否";
     this.lblClick.Text   = model.Click.ToString();
     this.lblNo.Text      = model.No.ToString();
     this.lblMark.Text    = model.Mark.ToString();
     this.lblS1.Text      = model.S1;
 }