xw_addnews.aspx.cs

来自「办公自动化系统」· CS 代码 · 共 48 行

CS
48
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.BLL;
using COM.OA.Entity;

public partial class linminchao_xw_addNews : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        users loginuser = Session["loginuser"] as users;
        if (loginuser == null)
        {
            this.Response.Write(string.Format(GetRedirect.ALLREDIRECT, "../../login.aspx"));
        }
    }
    protected void submit1_ServerClick(object sender, EventArgs e)
    {
        users loginuser = Session["loginuser"] as users;
        news n = new news();
        //获取新闻参数
        string bt = this.zhuti.Value.ToString();
        string nr = this.FreeTextBox1.Text.ToString();
        n.n_title = bt;
        n.n_content = nr;
        n.n_dept_id = 1;
        n.n_u_id = loginuser.u_id;
        n.n_releasetime = DateTime.Now;
        n.n_state = 1;
        int ii = newsBLL.Insert(n);//调用插入方法
        if (ii < 0)
        {
            Response.Write(string.Format(GetRedirect.WINALERT, "插入成功!"));
            Response.Write(string.Format(GetRedirect.REDIRECT, "xw_lookNews.aspx"));
        }
        else {
            Response.Write(string.Format(GetRedirect.WINALERT, "插入失败!"));
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?