SenBiTeSolution.UI/ManageWeb/AddNews.aspx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using SenBiTeSolution.DAL;
using SenBiTeSolution.Common;

namespace SenBiTeSolution.UI.ManageWeb
{
    public partial class AddNews:BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        //提交
        protected void btn_AddNews_Click(object sender, EventArgs e)
        {
            string newsTitle = txt_NewsTitle.Text.Trim();
            string text = Context.Request.Form["textcontent"];
                
            //if (string.IsNullOrEmpty(newsTitle))
            //{
            //    MessageBox.Show(this, "标题不可以为空!");
            //    return;
            //}
            //if (string.IsNullOrEmpty(text))
            //{
            //    MessageBox.Show(this, "新闻内容不可以为空!");
            //    return;
            //}

            SenBiTeSolution.DAL.tbl_News news = new SenBiTeSolution.DAL.tbl_News();
            SenBiTeSolution.Model.tbl_News newsModel = new SenBiTeSolution.Model.tbl_News();

            newsModel =news.GetNewsModel(newsTitle, text, System.DateTime.Now.ToShortDateString());

            int rows=news.AddNews(newsModel);
            if (rows>0)
            {
                MessageBox.Show(this,"添加成功!");
            }
            else
            {
                MessageBox.Show(this, "添加失败!");
            }
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。