📄 documentlist.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace OI.DocTemplate
{
/// <summary>
/// DocumentList 的摘要说明。
/// </summary>
public class DocumentList :OI.PageBase
{
public string userName;
private OI.DatabaseOper.DatabaseConnect oConn = new OI.DatabaseOper.DatabaseConnect();
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (Session["userid"]==null)
{
Response.Write ("<script>alert('超时,请重新登录');top.location.href='../userpass.aspx';</script>");
return ;
}
userName=Session["UserName"].ToString();
}
//列出所有模版
public string GetTemplateList(string ObjType,string FileType)
{
string mTemplateList;
mTemplateList="<select name=" + ObjType + ">" ;
mTemplateList+="<option value=''>------不用模版------</option>";
string strSelectCmd="select RecordID,substring(filename,0,len(filename)-3) filename from Template where FileType='" + FileType + "'";
SqlCommand mCommand = new SqlCommand(strSelectCmd,oConn.GetConn());//更改
SqlDataReader mReader =null;
mReader=mCommand.ExecuteReader();
while (mReader.Read())
{
mTemplateList+="<option value='" + mReader["RecordID"].ToString() + "'>" + mReader["filename"].ToString() + "</option>";
}
mReader.Close();
oConn.DataBaseClose();
mTemplateList+="</select>";
return (mTemplateList);
}
public string GetTableContent()
{
string mTableContent="";
string strSelectCmd="select * from Document order by DocumentID desc";
SqlCommand mCommand = new SqlCommand(strSelectCmd, oConn.GetConn());//更改
SqlDataReader mReader =null;
mReader=mCommand.ExecuteReader(CommandBehavior.CloseConnection);
while(mReader.Read())
{
mTableContent+="<tr>";
mTableContent+="<td class=TDStyle>"+mReader["DocumentID"].ToString() +" </td>\n";
mTableContent+="<td class=TDStyle>"+mReader["Subject"].ToString()+" </td>\n";
mTableContent+="<td class=TDStyle>"+mReader["Author"].ToString()+" </td>\n";
mTableContent+="<td class=TDStyle>"+mReader["FileType"].ToString()+" </td>\n";
mTableContent+="<td class=TDStyle>"+mReader["FileDate"].ToString()+" </td>\n";
mTableContent+="<td class=TDStyle nowrap>\n";
mTableContent+="<input type=button onclick=\"javascript:location.href='DocumentEdit.aspx?RecordID="+mReader["RecordID"].ToString() +"&EditType=0&UserName="+userName+"\'\" value=\"查看\">\n";
mTableContent+="<input type=button ";
if (mReader["Status"].ToString().Equals("EDIT"))
{
mTableContent+=" disabled ";
}
mTableContent+="onclick=\"javascript:location.href='DocumentEdit.aspx?RecordID="+mReader["RecordID"].ToString() +"&EditType=2&&UserName="+userName+"\'\" value=\"批改\">\n";
mTableContent+="<input type=button ";
if (mReader["Status"].ToString().Equals("EDIT"))
{
mTableContent+=" disabled ";
}
mTableContent+="onclick=\"javascript:location.href='DocumentEdit.aspx?RecordID="+mReader["RecordID"].ToString() +"&EditType=3&&UserName="+userName+"\'\" value=\"审核\">\n";
mTableContent+="<input type=button ";
if (mReader["HTMLPath"].ToString().Equals(""))
{
mTableContent+=" disabled ";
}
mTableContent+="onclick=\"javascript:window.open('" + mReader["HTMLPath"].ToString() +"');\" value=\"HTML\">\n";
mTableContent+="</td>\n";
mTableContent+="</tr>\n";
}
mReader.Close();
return (mTableContent);
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -