⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 notebook.aspx.cs

📁 这是一个OA企业办公自动化网站,是采用c#+asp编写的,很值得一看
💻 CS
字号:
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;

public partial class BaseInfo_noteBook : System.Web.UI.Page
{
    BaseClass bc = new BaseClass();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["loginName"] == null) Server.Transfer("..\\Index.aspx");
        if (!IsPostBack)
        {
            GridView1.DataSource = bc.GetDataSet("select * from note where notePerson ='" + Session["loginName"].ToString() + "'order by noteTime desc", "note");
            GridView1.DataKeyNames = new String[] { "ID" };
            GridView1.DataBind();
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (bc.ExecSQL("INSERT INTO note (title, content, noteTime, notePerson)VALUES('" + TextBox1.Text + "','" + TextBox2.Text + "','" + DateTime.Today + "','" + Session["loginName"].ToString() + "')"))
        {
            Response.Write(bc.MessageBox("数据提交成功!"));
            GridView1.DataSource = bc.GetDataSet("select * from note where notePerson ='" + Session["loginName"].ToString() + "'order by noteTime desc", "note");
            GridView1.DataKeyNames = new String[] { "ID" };
            GridView1.DataBind();
        }
        else
        {
            Response.Write(bc.MessageBox("数据提交失败!"));
        }
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        bool bl = bc.ExecSQL("delete from note where ID='" + this.GridView1.DataKeys[e.RowIndex].Value.ToString() + "'");
        GridView1.DataSource = bc.GetDataSet("select * from note where notePerson ='" + Session["loginName"].ToString() + "'order by noteTime desc", "note");
        GridView1.DataBind();
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Cells[3].Text = Convert.ToDateTime(e.Row.Cells[3].Text).ToShortDateString();
        }
    }
}

⌨️ 快捷键说明

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