📄 sendfile.aspx.cs
字号:
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.SendMessage
{
/// <summary>
/// SendFile 的摘要说明。
/// </summary>
public class SendFile : OI.PageBase
{
protected System.Web.UI.HtmlControls.HtmlInputText DeptName;
protected System.Web.UI.HtmlControls.HtmlInputHidden DeptID;
protected System.Web.UI.WebControls.DropDownList DropDownListType;
protected System.Web.UI.WebControls.DropDownList DropDownListExigence;
protected System.Web.UI.WebControls.TextBox TextBoxNum;
protected System.Web.UI.WebControls.Label LabelMainSelect;
protected System.Web.UI.WebControls.Label LabelCopySelect;
protected System.Web.UI.WebControls.Label LabelDate;
protected System.Web.UI.WebControls.ImageButton ImageButtonOK;
private OI.DatabaseOper.DatabaseConnect dc;
protected System.Web.UI.WebControls.Label dispType;
protected System.Web.UI.WebControls.Label dispExigence;
protected System.Web.UI.HtmlControls.HtmlSelect secret;
public string mSubject;
public string mStatus;
public string mAuthor;
public string mFileName;
public string mFileDate;
public string mHTMLPath;
public string mDisabled;
public string mHttpUrl;
public string mScriptName;
public string mServerName;
public string mClientName;
public string mServerUrl;
public string mClientUrl;
public string mRecordID;
public string mTemplate;
public string mFileType;
public string mEditType;
public string mUserName;
public string mWriterId;
//
public string PTitle;
public string Pword ;
public string PSendDate;
public string Psecretgreadname;
public string Pdocumenttypename ;
public string Pexigencedegreename ;
public string PCuenceNodeId;
protected System.Web.UI.HtmlControls.HtmlInputHidden DocID;
public string PdocumentID;
public string mWord;
public string mExcel;
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(!Page.IsPostBack )
{
int nDocumentID=-1;
try
{
nDocumentID = int.Parse(Request.QueryString ["DocumentID"].ToString ());
}
catch
{
Response.Redirect ("SendFileList.aspx");
}
this.BindDataNew(nDocumentID);
ViewState["DocumentID"]=nDocumentID.ToString ();
DocID.Value =nDocumentID.ToString ();
}
}
private void BindDataNew(int nDocID)
{
dc=new OI.DatabaseOper.DatabaseConnect ();
string strUserId=Session["userid"].ToString ();
if(strUserId==null||strUserId=="")
{
Page.RegisterStartupScript ("","<script>alert(\"请重新登录\")</script>");
return;
}
//where DepartmentId in (select Departmentid from dbo.Accounts_Users where Userid='"+strUserId+"')
//发文种类
string strSql="SELECT FileSortName FROM FileSort where departmentid='"+Session["departmentid"]+"'"+" or departmentid='0' order by filesortid desc";
dispType.Text ="<SELECT id=\"DropDownListType\" name=\"DropDownListType\">";
ArrayList alTemp=dc.getData (strSql);
for(int i=0;i<alTemp.Count ;i++)
{
dispType.Text +="<OPTION value=\""+alTemp[i].ToString ()+"\">"+alTemp[i].ToString ()+"</OPTION>";
}
dispType.Text +="</SELECT>";
dispType.Text+="[<INPUT id=\"TextBoxYear\" type=\"text\" name=\"TextBoxYear\" style=\"border:0;width:40px;border-bottom:1 solid #000000\" >]";
dispType.Text+="<INPUT id=\"TextBoxNo\" type=\"text\" name=\"TextBoxNo\" style=\"border:0;width:40px;border-bottom:1 solid #000000\">";
dispType.Text+="<input type=hidden name=DocumentID value="+nDocID+" width=1px>号";
if(alTemp.Count ==0)
{
Page.RegisterStartupScript ("","<script>alert(\"你所在部门没有发文种类,请在控制面板里设置!\")</script>");
}
//绑定文档数据
strSql="select Title,CurrentStepID,StreamID,RecordID,FileType,Status,TopicWord,ExigenceDegreeID,SecretGreadid from dbo.Document where DocumentID="+nDocID;
ArrayList al=dc.getData (strSql);
string strStepID="";
string strStreamID="";
if(al.Count >0)
{
PTitle =al[0].ToString ();
strStepID=al[1].ToString ();
strStreamID=al[2].ToString ();
mRecordID=al[3].ToString ();
mFileType=al[4].ToString ();
mStatus=al[5].ToString ();
Pword=al[6].ToString ();
DataTable dt=secret_Source();
secret.DataSource =dt;
secret.DataTextField=dt.Columns ["SecretGreadname"].ToString ();
secret.DataValueField =dt.Columns ["SecretGreadid"].ToString ();
secret.DataBind ();
secret.Items .FindByValue(al[8].ToString ()).Selected =true;
strSql="select ExigenceDegreeID,ExigenceDegreeName from dbo.ExigenceDegree ";//紧急程度
dispExigence.Text ="<SELECT id=\"DropDownListExigence\" name=\"DropDownListExigence\">";
alTemp.Clear ();
alTemp=dc.getData (strSql);
string strID="";
for(int i=0;i<alTemp.Count ;i++)
{
if(i%2==0)
{
strID=alTemp[i].ToString ();
}
else
{
if(al[7].ToString()==strID)
{
dispExigence.Text +="<OPTION selected value=\""+strID+"\">"+alTemp[i].ToString ()+"</OPTION>";
}
else
{
dispExigence.Text +="<OPTION value=\""+strID+"\">"+alTemp[i].ToString ()+"</OPTION>";
}
}
}
dispExigence.Text +="</SELECT>";
alTemp.Clear ();
}
else
return;
OI.cs.readStream rs=new OI.cs.readStream ();
rs.StreamID =Convert.ToInt32 (strStreamID);
rs.doucmentID=nDocID;
int nPrivateNodID=rs.GetPrivateNodeID (strStepID);
if(rs.GetNodeTypeByID (nPrivateNodID.ToString ())=="公文签发")
{
strSql="select top 1 TransactDate,UserID from dbo.DocumentTransact "+
"where DocumentID='"+nDocID+"' and StepID='"+nPrivateNodID+"' order by TransactID desc";
al=dc.getData (strSql);
string strDoDate="";
if(al.Count >0)
{
strDoDate=al[0].ToString ();
mWriterId=al[1].ToString ();
}
if(strDoDate!="")
{
LabelDate.Text =strDoDate;
PSendDate =strDoDate;
}
}
else
LabelDate.Text ="没有签发节点";
mHTMLPath="";
mDisabled="";
mScriptName="documentdetail.aspx";
mServerName="webdocserver.aspx";
mClientName="../FairyWebOfficeocx.ocx";
mHttpUrl="http://" + Request.ServerVariables["HTTP_HOST"] + Request.ServerVariables["SCRIPT_NAME"];
mHttpUrl=mHttpUrl.Substring(0,mHttpUrl.Length -mScriptName.Length);
if(System.Web.HttpRuntime.AppDomainAppVirtualPath=="")
mServerUrl="http://"+Request.ServerVariables["HTTP_HOST"] +"/DocTemplate/" + mServerName;
else
mServerUrl="http://"+Request.ServerVariables["HTTP_HOST"] +System.Web.HttpRuntime.AppDomainAppVirtualPath+"/DocTemplate/" + mServerName;
mClientUrl=mHttpUrl + mClientName;
mEditType="2";
mFileName=mRecordID+mFileType;
mUserName=Session["userName"].ToString ();
}
private DataTable secret_Source()
{
string sql ="select SecretGreadname,SecretGreadid from SecretGread ";
DataTable dt;
try
{
dt=dc.getBinding (sql,"t").Tables [0];
return dt;
}
catch
{
return null;
}
}
#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 + -