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

📄 displaydocument.aspx.cs

📁 协同办公系统.含权限短信项目,适合咨询服务性企业
💻 CS
📖 第 1 页 / 共 2 页
字号:
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 UDS.Components;
using System.Data.SqlClient;

namespace UDS.SubModule.UnitiveDocument.DocumentFlow
{
	/// <summary>
	/// SignDocument 的摘要说明。
	/// </summary>
	public class SignDocument : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Button cmdSignIn;
		protected System.Web.UI.WebControls.Table tabDispDocument;
		protected System.Web.UI.HtmlControls.HtmlForm PostilDocument;
		protected System.Web.UI.WebControls.Button cmdCancelSignIn;
		protected System.Web.UI.WebControls.Button cmdPostilFinish;
		protected System.Web.UI.WebControls.Button cmdPostilFaile;
		protected System.Web.UI.WebControls.Button cmdPostilNext;
		private int DisplayStatus;
		private string UserName;
		protected System.Web.UI.HtmlControls.HtmlTable tabReturn;

		private int ReturnPage;
		protected System.Web.UI.WebControls.Button cmdBack;
		protected System.Web.UI.WebControls.Button cmdReturn;
		
		private		long	DocID;
		private		long	ProjectID=-1;
		protected System.Web.UI.HtmlControls.HtmlInputHidden PID;
		protected System.Web.UI.HtmlControls.HtmlSelect ddlProject;
		private		bool	FlowState;
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面

			DocID = Int32.Parse(Request.QueryString["DocID"].ToString());		
			UserName = Request.Cookies["UserName"].Value.ToString();
			ReturnPage = Request.QueryString["ReturnPage"]!=null?Int32.Parse(Request.QueryString["ReturnPage"].ToString()):1;
			InitControl();
			Bind();
		}

		private void InitControl()
		{
			UDS.Components.DocumentFlow df	= new UDS.Components.DocumentFlow();
 
			DisplayStatus = df.GetDocumentStatus(DocID,UserName);
			
			//移动表单的位置
			tabDispDocument.Style["Left"]	= "0px";
			tabDispDocument.Style["Top"]	= "0px";

			if(DisplayStatus==0)		//签收状态
			{
				cmdSignIn.Visible		= true;
				cmdCancelSignIn.Visible = false;
				cmdPostilNext.Visible	= false;
				cmdPostilFaile.Visible	= false;
				cmdPostilFinish.Visible	= false;
				cmdBack.Visible			= false;

				FlowState				= false;

			}
			else if(DisplayStatus==1)	//一般批阅状态
			{
				cmdSignIn.Visible		= false;
				cmdCancelSignIn.Visible = true;
				cmdPostilNext.Visible	= true;
				cmdPostilFaile.Visible	= true;
				cmdPostilFinish.Visible = true;
				cmdBack.Visible			= true;

				FlowState				= true;

			}
			else if(DisplayStatus==2)	//撤消状态,现在已经没有撤消状态了,只有文档是草稿才能删除
			{
				cmdSignIn.Visible		= true;
				cmdCancelSignIn.Visible = false;
				cmdPostilNext.Visible	= false;
				cmdPostilFaile.Visible	= false;
				cmdPostilFinish.Visible	= false;
				cmdBack.Visible			= false;

				FlowState				= false;
			}
			else if(DisplayStatus==4)	//会签状态批阅
			{
				cmdSignIn.Visible		= false;
				cmdCancelSignIn.Visible = true;
				cmdPostilNext.Visible	= true;
				cmdPostilFaile.Visible	= true;
				cmdPostilFinish.Visible = false;
				cmdBack.Visible			= true;

				FlowState				= true;

			}
			else						//查看状态
			{
				cmdSignIn.Visible		= false;
				cmdCancelSignIn.Visible = false;
				cmdPostilNext.Visible	= false;
				cmdPostilFaile.Visible	= false;
				cmdPostilFinish.Visible = false;
				cmdBack.Visible			= false;

				FlowState				= false;
			}
			df = null;

			tabDispDocument.Style.Add("BORDER-COLLAPSE","collapse");
		}


		private void Bind()
		{	
			UDS.Components.DocumentFlow df	= new UDS.Components.DocumentFlow();				
			Database	mySQL				= new Database();

			long			FlowID;
			long			StepID;

			DataTable	dt;

			FlowID	= df.GetDocumentFlowID(DocID);
			StepID	= df.GetDocumentStepID(DocID);
			
			cmdPostilFinish.Visible  =cmdPostilFinish.Visible&&df.GetStepRightToFinish(FlowID,StepID) == 1?true:false;
			ProjectID = Int32.Parse(PID.Value);

			//流程批阅状态并且按照项目流转
			if(FlowState==true&&df.IsProject(UserName,DocID))
			{				
				if(!Page.IsPostBack)
				{
					ddlProject.Visible = true;
					ddlProject.Items.Clear();

					df.GetProject(UserName,out dt);

					ddlProject.DataSource		= dt.DefaultView;
					ddlProject.DataTextField	= "ClassName";
					ddlProject.DataValueField	= "ClassID";
					ddlProject.DataBind();
					
					if(ddlProject.Items.Count>0)
					{
						PID.Value = ddlProject.Items[0].Value; 
					}
					else
						PID.Value = "-1";
				}

			}
			else
			{
				ddlProject.Visible = false;
			}

			df.GetDocumentInfo(DocID,out dt);
			
			AddRow(tabDispDocument,"基本信息");

			AddRow(tabDispDocument,"流程:",dt.Rows[0]["flow_name"].ToString());
			AddRow(tabDispDocument,"发送者:",dt.Rows[0]["realname"].ToString());
			AddRow(tabDispDocument,"发送日期:",dt.Rows[0]["doc_added_date"].ToString());
			AddRow(tabDispDocument,"当前步骤:","<a href='DisplayTacheMember.aspx?DocID=" + DocID.ToString() + "&ReturnPage=" + ReturnPage.ToString() + "'>" + dt.Rows[0]["Step_name"].ToString() + "</a>");

			AddRow(tabDispDocument,"详细表单");

			if(dt.Rows.Count >0)
			{

				FlowID = Int32.Parse(dt.Rows[0]["flow_id"].ToString());
				
				HtmlForm PostilDocument   = (HtmlForm)this.Page.FindControl("PostilDocument");

				//=============================//
				//			添加正文
				//=============================//				
				DataTable dtSheet;
				df.GetStyleDescription(FlowID,0,out dtSheet);

				for(int i =0;i<dtSheet.Rows.Count;i++)				
				{			
					AddRow(tabDispDocument,dtSheet.Rows[i]["Field_Description"].ToString() + ":",dt.Rows[0][dtSheet.Rows[i]["Field_Name"].ToString()].ToString());
				}
				
				dtSheet = null;

				//=============================//
				//			添加附件
				//=============================//				
				AddAttach(DocID);
			
				//=============================//
				//			添加批注
				//=============================//
				DataTable dtPostil;
				df.GetDocumentPostil(DocID,out dtPostil); 
				
				if(dtPostil.Rows.Count>0)
				{
					AddRow(tabDispDocument,"审批意见");
					AddPostitleHead(tabDispDocument);

					for(int i=0;i<dtPostil.Rows.Count;i++)					
					{
						AddRow(tabDispDocument,dtPostil.Rows[i]["RealName"].ToString(),dtPostil.Rows[i]["Postil_Date"].ToString(),dtPostil.Rows[i]["Postil_Content"].ToString(),Int32.Parse(dtPostil.Rows[i]["Postil_Type"].ToString() ),dtPostil.Rows[i]["FileName"].ToString(),dtPostil.Rows[i]["FileVisualPath"].ToString(),dtPostil.Rows[i]["usedtime"].ToString());
					}
				}
							
				dtPostil = null;

				AddProjectControl();
				AddControl(tabDispDocument);
				
			}	
						
		}
		private void AddAttachControl()
		{
			string Template;
			long FlowID;
			UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
			FlowID = df.GetDocumentFlowID(DocID);
			Template = df.GetStyleTemplate(FlowID);
			if(Template!="")
			{
				TableRow  tr	= new TableRow();
				TableCell td	= new TableCell();
				TableCell tc	= new TableCell();
				Literal	  lt	= new Literal();


				lt.Text  = "<a href='" + Template + "' style='text-decoration: underline' titile='模板下载' target='_blank'>模板</a>:";
				tc.HorizontalAlign = HorizontalAlign.Right;
				tc.Width = Unit.Percentage(20);
				tc.Controls.Add(lt);
				

				td.HorizontalAlign = HorizontalAlign.Left;
				td.ColumnSpan = 5;
				
			
				System.Web.UI.HtmlControls.HtmlInputFile hif = new System.Web.UI.HtmlControls.HtmlInputFile();
				hif.ID				= "fileTemplate";
				hif.Name			= "fileTemplate";
				hif.Style["width"]	= Unit.Percentage(70).ToString();
				hif.Style["Class"]	= "Input3";
								
				td.Controls.Add(hif);				

				tr.Cells.Add(tc);
				tr.Cells.Add(td);
				
				
				tabDispDocument.Rows.Add(tr);

				td = null;
				tr = null;

			}

			df = null;

		}
		private void AddAttach(long DocID)
		{

			UDS.Components.DocumentFlow df	= new UDS.Components.DocumentFlow();
			DataTable dt					= new DataTable();

			df.GetDocumentAttach(DocID,out dt);
			for(int i=0;i<dt.Rows.Count;i++)
			{
				TableRow  tr		= new TableRow();
				TableCell td		= new TableCell();
				TableCell tc		= new TableCell();

				td.Text ="附件:";
				td.HorizontalAlign	= HorizontalAlign.Right;

				string FilePath		= dt.Rows[i]["FileVisualPath"].ToString() + dt.Rows[i]["FileName"].ToString();

				tc.Text				= "<a href='" +"." + FilePath.Replace("\\","/") +"' target='_blank'>" + dt.Rows[i]["FileName"].ToString() + "</a>";
				tc.HorizontalAlign	= HorizontalAlign.Left;
				tc.ColumnSpan		= 5;

				tr.Cells.Add(td);			
				tr.Cells.Add(tc);
				
				tr.Height			= 22;
				tr.HorizontalAlign	= HorizontalAlign.Center;

				tabDispDocument.Rows.Add(tr);
			}

			dt = null;
			df = null;


		}
		private void AddProjectControl()
		{
			
			if(ddlProject.Visible == true)
			{
				TableRow  tr	= new TableRow();
				TableCell td	= new TableCell();
				TableCell tl	= new TableCell();

				td.Text				= "请选择所属项目:";
				td.HorizontalAlign	= HorizontalAlign.Right;
				td.ColumnSpan		= 5;
				td.Width			= Unit.Percentage(20);
				td.BackColor		= Color.FromArgb(0xe8,0xf4,0xff);	
				tr.Cells.Add(td);
				
				ddlProject.Style["Width"]	= "100%";
				ddlProject.Style["Class"]	= "Input3";
				tr.EnableViewState = true;
				
				tl.Width					= Unit.Percentage(80);
				tl.Controls.Add(ddlProject);	
			
				tr.Cells.Add(tl);
				
				tabDispDocument.Rows.Add(tr);

				td = null;
				tr = null;

			}
			

		}		
		private void AddRow(Table tab,string Caption,string Content)
		{
			TableRow tr		= new TableRow();
			TableCell tl	= new TableCell();
			TableCell tc	= new TableCell();

			//标题栏目
			tl.Text				= Caption; 
			tl.Width			= Unit.Percentage(20);
			tl.HorizontalAlign	= HorizontalAlign.Right;			
			tl.BackColor		= Color.FromArgb(0xe8,0xf4,0xff);			

			//内容正文
			tc.Text			= Content;
			tc.Width		= Unit.Percentage(80);
			tc.ColumnSpan	= 5;			

			tr.Height		= 22;

			tr.Cells.Add(tl);
			tr.Cells.Add(tc);

			tab.Rows.Add(tr);

			tc = null;
			tl = null;
			tr = null;			
		}

		private void AddRow(Table tab,string Caption)
		{
			TableRow tr		= new TableRow();
			TableCell tl	= new TableCell();
			
			tl.Text			= Caption;	
			tl.ColumnSpan	= 6 ;
			tl.Width		= Unit.Percentage(100);
			tl.HorizontalAlign  = HorizontalAlign.Center;
			tl.Attributes["background"]="../../../Images/treetopbg.jpg";			
			//tl.BackColor = Color.FromArgb(0xff,0xff,0xef);

			tr.Height		= 28;
			tr.Cells.Add(tl);

			tab.Rows.Add(tr);

			tl = null;
			tr = null;			
		}
		private void AddRow(Table tab,string Postiler,string PostilTime,string PostilContent,int PostilType,string FileName,string FileVisualPath,string UsedTime)
		{
			TableRow tr						=	new TableRow();
			TableCell tdPotiler				=	new TableCell();
			TableCell tdPostilTime			=	new TableCell();
			TableCell tdPotilType			=	new TableCell();
			TableCell tdPotilContent		=	new TableCell();
			TableCell tdAttachFiles			=	new TableCell();
			TableCell tdTime				=	new TableCell();
			
			
			tdPotiler.Text					= Postiler;
			tdPotiler.HorizontalAlign		= HorizontalAlign.Center;
			tdPotiler.Width					= Unit.Percentage(20);
			

			tdPostilTime.Text				= PostilTime;
			tdPostilTime.HorizontalAlign	= HorizontalAlign.Center;
			tdPostilTime.Width				= Unit.Percentage(20);
			switch(PostilType)
			{
				case 1:
					tdPotilType.Text				= "同意";
					break;
				case 2:
					tdPotilType.Text				= "拒绝";
					break;
				case 3:
					tdPotilType.Text				= "完成";
					break;
				case 4:

⌨️ 快捷键说明

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