📄 drafttemporary.aspx.cs
字号:
/******************************************************************
* OI INC. *
* Copyright (c) 2003 OI INC. *
* *
* All rights reserved. No part of this program or publication *
* may be reproduced, transmitted, transcribed, stored in a *
* retrieval system,or translated into any language or computer *
* language, in any form or by any means, electronic, mechanical, *
* magnetic, optical, chemical,biological, or otherwise, without *
* the prior written permission. *
* *
******************************************************************/
/******************************************************************
* Source File Name : DraftOnRoad.cs *
* Project Name: OI.csproj *
* Engineer: 黎斌 *
* Date Generated: 2003/12/9 *
* Last Revision Date : *
* Brief Description : 起草未完成文档列表类 *
******************************************************************/
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
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.DraftOut
{
/// <summary>
/// DraftOnRoad 的摘要说明。
/// </summary>
public class DraftOnRoad : OI.PageBase
{
protected System.Web.UI.WebControls.DataGrid DGDocument;
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 ;
}
if (IsPostBack)
return;
BindGrid();
}
private void BindGrid()
{
DataSet dsTemp = new DataSet();
string szSql;
szSql = "SELECT document.DocumentID,document.recordid,"+
"case "+
"when(len(dbo.Document.Subject)<20) "+
"then substring(dbo.Document.Subject,0,20)+'...' "+
"else dbo.Document.Subject "+
"end "+
"as dbo.Document.Subject "+
"dbo.VIEW_DocumentType.DocumentTypeName,dbo.VIEW_DocumentType.DocumentTypeDescription,"
+ "dbo.SecretGread.SecretGreadName,dbo.Document.StreamStatus "
+ "FROM dbo.Document INNER JOIN dbo.VIEW_DocumentType "
+ "ON dbo.Document.DocumentTypeID = dbo.VIEW_DocumentType.DocumentTypeID "
+ "INNER JOIN dbo.SecretGread ON dbo.Document.SecretGreadID = dbo.SecretGread.SecretGreadID "
+ "where StreamStatus ='0' and UserID="+Session["UserID"].ToString();
dsTemp = oConn.getBinding(szSql,"Temp");
DGDocument.DataSource = dsTemp.Tables["Temp"];
DGDocument.DataBind();
// DataColumn c=new DataColumn ("titles",typeof(String));
// c.Expression ="'<a href=\"#\" onclick=oprate('+recordid+ ')>'+title+'</a> '";
// dsTemp.Tables [0].Columns .Add (c);
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.DGDocument.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DGDocument_ItemCommand);
this.DGDocument.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DGDocument_ItemDataBound);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DGDocument_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item .ItemType ==ListItemType.AlternatingItem ||e.Item .ItemType ==ListItemType.Item )
{
e.Item .Cells[1].Text ="<a href=\"DraftStart.aspx?DocumentID="+e.Item.Cells[0].Text +"\">"+e.Item .Cells [1].Text +"</a>";
}
// if(e.Item .ItemType !=ListItemType.Header && e.Item .ItemType ==ListItemType.Footer )
// {
//
// }
}
private void DGDocument_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DGDocument.CurrentPageIndex=e.NewPageIndex;
BindGrid();
}
private void DGDocument_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
System.Collections.ArrayList alist = new ArrayList();
string szSql = "delete from Document_File where RecordID='" + e.Item.Cells[6].Text + "'";
// oConn.ExecuteSQL(szSql);
alist.Add((object)szSql);
szSql = "delete from Document where DocumentID=" + e.Item.Cells[0].Text ;
// oConn.ExecuteSQL(szSql);
alist.Add((object)szSql);
if (oConn.ExecuteTransaction(alist))
{
RegisterStartupScript("","<script>alert('删除成功!');</script>");
}
else
{
RegisterStartupScript("","<script>alert('删除失败!');</script>");
}
BindGrid();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -