📄 draftfinished.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 : DraftFinished.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;
using ZHENGYI;
namespace OI.DraftOut
{
/// <summary>
/// DraftFinished 的摘要说明。
/// </summary>
public class DraftFinished : OI.PageBase
{
protected System.Web.UI.WebControls.DataGrid DGDocument;
OI.DatabaseOper.DatabaseConnect oConn = new OI.DatabaseOper.DatabaseConnect();
public string mRecordID;
protected System.Web.UI.WebControls.Label Label_Warn;
protected DataGridNavigation DataGridNavigation1 ;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (Session["userid"]==null)
{
Response.Write ("<script>alert('超时,请重新登录');top.location.href='../userpass.aspx';</script>");
return ;
}
ImageButton imgbtnDel=(ImageButton) DGDocument.FindControl ("imgbtnDel");
if (imgbtnDel !=null)
{
imgbtnDel.Attributes ["onclick"]="return confirm('你是否确定要删除?');";
}
// if (IsPostBack)
// return;
ZHENGYI.BindDataDelegate f =new ZHENGYI.BindDataDelegate (BindGrid);//修改这个dataBind,让f 指向你的方法。
DataGridNavigation1.SetTarget(DGDocument,f,15);
if(!Page.IsPostBack) {
BindGrid();
}
Label_Warn.Text = "";
}
private void BindGrid()
{
OI.cs.readStream oReadStream = new OI.cs.readStream();
DataSet dsTemp = new DataSet();
string szSql;
//排除暂存StreamStatus <>'0',排除已处理完文档CompleteSign=0
// szSql = "SELECT dbo.Document.DocumentID,dbo.Document.Subject,dbo.Document.RecordID,dbo.VIEW_DocumentType.DocumentTypeName,dbo.VIEW_DocumentType.DocumentTypeDescription,"
// + "dbo.SecretGread.SecretGreadName,dbo.Document.StreamStatus,case dbo.DocumentTransact.BackState when 1 then '是' else '否' end as szBackState, "
// + " dbo.Document.StreamID,dbo.Document.CurrentStepID "
// + " FROM dbo.Document INNER JOIN dbo.VIEW_DocumentType "
// + "ON dbo.Document.DocumentTypeID = dbo.VIEW_DocumentType.DocumentTypeID "
// + "INNER JOIN dbo.DocumentTransact ON dbo.Document.DocumentID = dbo.DocumentTransact.DocumentID "
// + "INNER JOIN dbo.SecretGread ON dbo.Document.SecretGreadID = dbo.SecretGread.SecretGreadID "
// + " where Author='"+Session["userName"].ToString()+"' and CompleteSign=0 and StreamStatus <>'0'";//modified by lb at 12.17
//// + "where StreamStatus <>'0' and CurrentStepID=-1 or CurrentStepID=3 and UserID="+Session["UserID"].ToString();
//排除暂存StreamStatus <>'0',排除已处理完文档CompleteSign=0
szSql = "select documentid,title,currentstepid,userid,streamid,recordid,"+
"case "+
"when(len(subject)>20) "+
"then substring(subject,0,20)+'...' "+
"else subject "+
"end "+
"as subject "+
",author,streamstatus,"+
"documenttypename,documenttypedescription,secretgreadname,exigencedegreename,streamname,"+
"completesign,draftdepartment,filedate,stream "+
"from V_Document "
+ " where Author='"+Session["userName"].ToString()+"' and CompleteSign=0 and StreamStatus <>'0' order by FileDate desc";//modified by lb at 12.17
dsTemp = oConn.getBinding(szSql,"Temp");
//排除当前节点不是公文起草的行 modified by lb at 12.17
foreach(DataRow dr in dsTemp.Tables["Temp"].Rows)
{
oReadStream.StreamID = Convert.ToInt32(dr["StreamID"]);
if (dr["CurrentStepID"].ToString() != oReadStream.GetNodeIdByType("公文起草"))
dr.Delete();
}
dsTemp.Tables["Temp"].AcceptChanges ();
//添加回退文档
// szSql = "select * from VIEWdocument where Author='"+Session["userName"].ToString()+"' and CompleteSign=0 and StreamStatus <>'0' and BackState <> 0";
// dsBack = oConn.getBinding(szSql,"Temp");
//
// foreach(DataRow dr in dsBack.Tables["Temp"].Rows)
// {
// dsTemp.Tables["Temp"].Rows.Add(dr);
// }
DGDocument.DataSource = dsTemp.Tables["Temp"];
DGDocument.DataBind();
}
#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.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DGDocument_DeleteCommand);
this.DGDocument.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DGDocument_ItemDataBound);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DGDocument_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// string datakey =e.Item. DGDocument.DataKeys[e.Item.ItemIndex]);
//更换下以节点处理人员
if (e.CommandName == "Chg")
{
//Response.Redirect("../stream/changeusers.aspx?documentid="+e.Item.Cells[0].Text,true);
string javascript="window.open('../stream/changeusers.aspx?documentid="+e.Item.Cells[0].Text+"','changePerson','top=100,left=100,toolbar=0,,status=1,menubar=0,scrollbars=1,resizable=1,width=700,height=300')";
Response.Write ("<script>"+javascript+"</script>");
}
//提交已起草公文
if (e.CommandName == "Select")
{
OI.cs.getUsersByNextID Un=new OI.cs.getUsersByNextID (int.Parse (e.Item.Cells[0].Text)) ;
if (!Un.hasUserByNextID ())//判断下一节点是否有处理人
{
Page.RegisterStartupScript ("","<script>alert('请选择下一节点的处理人')</script>");
return ;
}
int nBackState;
string szSql;
System.Collections.ArrayList alistSql = new ArrayList();
DateTime oDatetime = DateTime.Now;
OI.cs.readStream oreadStream = new OI.cs.readStream();
oreadStream.doucmentID = Convert.ToInt32(e.Item.Cells[0].Text);
//向DocumentTransact表添加记录
szSql = "select * from Document where DocumentID=" + e.Item.Cells[0].Text;
ArrayList alist = oConn.getData(szSql);
szSql = "select max(backstate) from documenttransact where documentid=" + e.Item.Cells[0].Text;
if (oConn.GetValueBySql(szSql) == "")
nBackState = 0;
else
nBackState = Convert.ToInt32(oConn.GetValueBySql(szSql)) + 1;
szSql = "insert into DocumentTransact (StepID,DocumentID,ManageID,UserID,TransactSign,ReadDate,TransactDate,BackState,Idea)"
+ " values(" + alist[14].ToString() + "," + e.Item.Cells[0].Text + ",1," + Session["userid"].ToString() + ",0,"
+ "'" + oDatetime + "','" + oDatetime + "'," + nBackState + ",'')";
alistSql.Add((object)szSql);
//设置流程的下一个结点
szSql = "select DepartmentID from Accounts_Users where UserID=" + Session["userid"].ToString();//设置发送单位
string mDepartment = oConn.GetValueBySql(szSql);
string mCurrentStepID = oreadStream.GetNodeIdByType("公文起草");
int nCurrentStepID = Convert.ToInt32(oreadStream.GetNextNodeIdByID(mCurrentStepID));
szSql = "update Document set CurrentStepID=" + nCurrentStepID + ",SendDepartment='" + mDepartment + "'"
+ " where DocumentID=" + Convert.ToInt32(e.Item.Cells[0].Text);
alistSql.Add((object)szSql);
//给流程的下一节点的用户发信息
// string[] szArray = oreadStream.GetCurrentNodeUsersByID(Convert.ToString(nCurrentStepID));
// string szContent = "公文《" + alist[24].ToString() + "》起草完毕,请处理!";
// foreach(string szUserID in szArray)
// {
// szSql = "insert into Message (SendTime,SendUserId,ReceiveUserId,DocumentId,FileTable,MessageContent,state)"
// + "values('" + oDatetime + "',"
// + Session["userid"].ToString() +","
// + szUserID + ","
// + e.Item.Cells[0].Text + ","
// + "'Document',"
// + "'" + szContent + "',"
// + "0)";
// alistSql.Add((object)szSql);
// }
//蒲丰6.8修改这儿,更改消息小精灵的发送
int documentid=int.Parse (e.Item.Cells[0].Text);
int senduserid=int.Parse (Session["userid"].ToString ());
OI.cs .transactDocumentStream tds=new OI.cs.transactDocumentStream (documentid);
tds.SendMessageToNextNode ("公文《" + alist[24].ToString() + "》起草完毕,请处理!",senduserid,alist[24].ToString() );
cs.Message message=new OI.cs.Message ();
message.finishOprate (int.Parse (Session["userid"].ToString ()),documentid,"回退公文");
//执行事务
if (oConn.ExecuteTransaction(alistSql))
{
// RegisterStartupScript("","<script>alert('公文提交成功!');</script>");
Label_Warn.Text = "公文《"+alist[24].ToString()+"》提交成功!";
//Label_Warn.Text = "提交成功!";
//重新绑定
BindGrid();
}
else
{
// RegisterStartupScript("","<script>alert('公文提交失败!');</script>");
Label_Warn.Text = "公文《"+alist[24].ToString()+"》提交失败!";
BindGrid();
}
//把流程设置的用户添加到 transactUsers 表中
/* OI.cs.moveUsers mU = new OI.cs.moveUsers(Convert.ToInt32(e.Item.Cells[0].Text));
mU.MoveUsers();
*/
}
}
private void DGDocument_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DGDocument.CurrentPageIndex=e.NewPageIndex;
BindGrid();
}
private void DGDocument_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
System.Collections.ArrayList alist = new ArrayList();
string szSql = "delete from Document_File where RecordID='" + e.Item.Cells[7].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);
szSql=" delete documenttransact where DocumentID=" + e.Item.Cells[0].Text ;
alist.Add((object)szSql);
if (oConn.ExecuteTransaction(alist))
{
cs.Message message=new OI.cs.Message ();
message.finishOprate (int.Parse (Session["userid"].ToString ()),int.Parse (e.Item.Cells[0].Text),"回退公文");
RegisterStartupScript("","<script>alert('删除成功!');</script>");
}
else
{
RegisterStartupScript("","<script>alert('删除失败!');</script>");
}
BindGrid();
}
private void DGDocument_SelectedIndexChanged(object sender, System.EventArgs e) {
}
private void DGDocument_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
// ImageButton chg =new ImageButton ();
// chg=(ImageButton)e.Item .FindControl ("Imagebutton_Chg");
// chg.Attributes["onclick"]="return ss() "; // return OpenFind('../stream/changeusers.aspx?documentid="+e.Item.Cells[0].Text +"')";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -