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

📄 displaydocument.aspx.cs

📁 协同办公系统.含权限短信项目,适合咨询服务性企业
💻 CS
📖 第 1 页 / 共 2 页
字号:
					tdPotilType.Text				= "回退";
					break;
				default:
					break;
			}			
			tdPotilType.HorizontalAlign		= HorizontalAlign.Center;
			tdPotilType.Width				= Unit.Percentage(10);


			tdPotilContent.Text				= PostilContent;
			tdPotilContent.HorizontalAlign	= HorizontalAlign.Left;
			tdPotilContent.Width			= Unit.Percentage(30);
	
			tr.Height  =22;
			//tr.BackColor = Color.FromArgb(0xe8,0xf4,0xff);
			

			string FilePath		= FileVisualPath + FileName;
			tdAttachFiles.Text				= "<a href='" +"." + FilePath.Replace("\\","/") +"' target='_blank'>" + FileName + "</a>";
			
			tdAttachFiles.HorizontalAlign	= HorizontalAlign.Center  ;
			tdAttachFiles.Width				= Unit.Percentage(10);

			tdTime.Text						= UsedTime;
			tdTime.HorizontalAlign			= HorizontalAlign.Center  ;
			tdTime.Width					= Unit.Percentage(10);

			tr.Cells.Add(tdPotiler);
			tr.Cells.Add(tdPostilTime);
			tr.Cells.Add(tdPotilType);
			tr.Cells.Add(tdPotilContent);
			tr.Cells.Add(tdAttachFiles);
			tr.Cells.Add(tdTime);


			tab.Rows.Add(tr);


			tdPotiler		= null;
			tdPostilTime	= null;
			tdPotilType		= null;
			tdPotilContent	= null;
			tdAttachFiles	= null;
			tdTime			= null;

			tr				= null;					
		}

		private void AddPostitleHead(Table tab)
		{

			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					="批阅人";
			tdPotiler.HorizontalAlign		= HorizontalAlign.Center;
			tdPotiler.Width					= Unit.Percentage(20);
			

			tdPostilTime.Text				="批阅时间";
			tdPostilTime.HorizontalAlign	= HorizontalAlign.Center;
			tdPostilTime.Width				= Unit.Percentage(20);

			tdPotilType.Text				="批阅类型";
			tdPotilType.HorizontalAlign		= HorizontalAlign.Center;
			tdPotilType.Width				= Unit.Percentage(10);


			tdPotilContent.Text				="批阅内容";
			tdPotilContent.HorizontalAlign	= HorizontalAlign.Left ;
			tdPotilContent.Width			= Unit.Percentage(30);

			tdAttachFiles.Text				="附件";

			tdAttachFiles.HorizontalAlign	= HorizontalAlign.Center  ;
			tdAttachFiles.Width				= Unit.Percentage(10);

			tdTime.Text						="用时(分)";
			tdTime.HorizontalAlign			= HorizontalAlign.Center  ;
			tdTime.Width					= Unit.Percentage(10);

	
			tr.Height  =22;
			tr.BackColor = Color.FromArgb(0xe8,0xf4,0xff);

			tr.Cells.Add(tdPotiler);
			tr.Cells.Add(tdPostilTime);
			tr.Cells.Add(tdPotilType);
			tr.Cells.Add(tdPotilContent);
			tr.Cells.Add(tdAttachFiles);
			tr.Cells.Add(tdTime);


			tab.Rows.Add(tr);


			tdPotiler		= null;
			tdPostilTime	= null;
			tdPotilType		= null;
			tdPotilContent	= null;

			tr				= null;			

		}

		private void UploadFile(long PostilID)
		{
			string FileName = "";
			HtmlForm FrmCompose   = (HtmlForm)this.Page.FindControl("PostilDocument");

			//生成附件目录
			if(!System.IO.Directory.Exists(Server.MapPath(".")+"\\AttachFiles"))
			{
				System.IO.Directory.CreateDirectory(Server.MapPath(".")+"\\AttachFiles");
			}
			
			try
			{
				HtmlInputFile hif = ((HtmlInputFile)(FrmCompose.FindControl("fileTemplate")));
				if(hif.PostedFile!=null)
				{
					if(hif.PostedFile.FileName.Trim()!="")
					{	
						FileName = System.IO.Path.GetFileName(hif.PostedFile.FileName);											
						
						//生成用户目录
						if(!System.IO.Directory.Exists(Server.MapPath(".")+"\\AttachFiles\\" + UserName))
						{
							System.IO.Directory.CreateDirectory(Server.MapPath(".")+"\\AttachFiles\\"+ UserName);						
						}
						
						Random TempNameInt    = new Random(); 
						string NewDocDirName  = TempNameInt.Next(100000000).ToString();		
						//生成随机目录
						if(!System.IO.Directory.Exists(Server.MapPath(".")+"\\AttachFiles\\" + UserName + "\\" + NewDocDirName))
						{
							System.IO.Directory.CreateDirectory(Server.MapPath(".")+"\\AttachFiles\\" + UserName  + "\\" + NewDocDirName);						
						}			

						TempNameInt = null;
						
						//保存文件
						hif.PostedFile.SaveAs(Server.MapPath(".")+"\\AttachFiles\\" + UserName  + "\\" + NewDocDirName + "\\" + FileName);

						UDS.Components.DocAttachFile att = new UDS.Components.DocAttachFile();
						UDS.Components.DocumentFlow  df  = new UDS.Components.DocumentFlow();

						// 初始化
						att.FileAttribute	= 0;
						att.FileSize		= hif.PostedFile.ContentLength;
						att.FileName		= FileName;
						att.FileAuthor		= UserName;
						att.FileCatlog		= "公文";
						att.FileVisualPath	= "\\AttachFiles\\" + UserName  + "\\" + NewDocDirName + "\\";
						att.FileAddedDate	= DateTime.Now.ToString();;
						
						
						df.AddPostilAttach(att,PostilID);

						df = null;
						att = null;

					}
					hif=null;
				}
			}
			catch(Exception ex)
			{
				UDS.Components.Error.Log(ex.ToString());
			}
			finally
			{
				
			}			
			
		}

		private void AddControl(Table tab)
		{
			TableRow tr = new TableRow();
			TableCell td = new TableCell();
			
			
			td.Controls.Add(cmdSignIn);
			td.Controls.Add(cmdPostilNext);
			td.Controls.Add(cmdBack);
			td.Controls.Add(cmdPostilFaile);
			td.Controls.Add(cmdPostilFinish);
			td.Controls.Add(cmdCancelSignIn);			
			td.Controls.Add(cmdReturn);			

			//cmdReturn.Text ="<INPUT class='redButtonCss' style='WIDTH: 74px; HEIGHT: 20px' type='button' value='返回' onclick=\"location.href='listDocument.aspx?DisplayType=" + ReturnPage.ToString() + "'\">";
			
			if(cmdPostilNext.Visible||cmdPostilFaile.Visible||cmdPostilFinish.Visible)
			{

				AddRow(tab,"审批意见");

				TableRow trc		= new TableRow();
				TableCell tdc		= new TableCell();
				TableCell tc		= new TableCell();

				TextBox txtPostil	= new TextBox();
				
				txtPostil.ID = "txtPostil";				
				txtPostil.TextMode	= TextBoxMode.MultiLine;
				txtPostil.Width		= Unit.Percentage(70);
				txtPostil.Height	= 100;
				
				tc.Text = "审批内容:";
				tc.HorizontalAlign	= HorizontalAlign.Right;
				tc.VerticalAlign	= VerticalAlign.Top;
				tc.Width = Unit.Percentage(20);

				tdc.ColumnSpan		= 5;
				tdc.HorizontalAlign = HorizontalAlign.Left ;
				tdc.Controls.Add(txtPostil);

				trc.Cells.Add(tc);
				trc.Cells.Add(tdc);
				
				tab.Rows.Add(trc);

				trc			= null;
				tdc			= null;
				txtPostil	= null;

				AddAttachControl();

			}

			td.ColumnSpan	=6;

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

			td	= null;
			tr	= null;
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    			
			this.cmdSignIn.Click += new System.EventHandler(this.cmdSignIn_Click);
			this.cmdBack.Click += new System.EventHandler(this.cmdBack_Click);
			this.cmdPostilNext.Click += new System.EventHandler(this.cmdPostilNext_Click);
			this.cmdPostilFaile.Click += new System.EventHandler(this.cmdPostilFaile_Click);
			this.cmdPostilFinish.Click += new System.EventHandler(this.cmdPostilFinish_Click);
			this.cmdCancelSignIn.Click += new System.EventHandler(this.cmdCancelSignIn_Click);
			this.cmdReturn.Click += new System.EventHandler(this.cmdReturn_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void cmdSignIn_Click(object sender, System.EventArgs e)
		{			
			string UserName					= Request.Cookies["UserName"].Value.ToString();
			UDS.Components.DocumentFlow df	= new UDS.Components.DocumentFlow();

			df.SignInDocument(UserName,DocID);
			df = null;

			cmdSignIn.Visible				= false;
			
			Response.AddHeader("Refresh","1");

		}

		private void cmdCancelSignIn_Click(object sender, System.EventArgs e)
		{
			string UserName					= Request.Cookies["UserName"].Value.ToString();
			UDS.Components.DocumentFlow df	= new UDS.Components.DocumentFlow();						
			df.CancelSignInDocument(UserName,DocID); 				
			df = null;
						
			Response.AddHeader("Refresh","1");

		}

		private void cmdPostilNext_Click(object sender, System.EventArgs e)
		{
			UDS.Components.DocumentFlow df	= new UDS.Components.DocumentFlow();
			HtmlForm FrmNewDocument			= (HtmlForm)this.Page.FindControl("PostilDocument");
			TextBox tmpText;
			tmpText							= (TextBox)FrmNewDocument.FindControl("txtPostil");
			long PostilID;
			try
			{			
				if(ProjectID>=0)
				{
					PostilID = df.AddPostil(UserName,DocID,tmpText.Text,1,ProjectID,2);	

					int iResult;
					iResult = df.PostDocument(UserName,DocID,ProjectID);
				

					if(iResult==0)
					{
						UploadFile(PostilID);							
					}
					else
					{
						Response.Write("<script lanuage='javascript'>alert('" + df.DoMessage(iResult,DocID,false) + "');</script>");
					}
				}
				else
				{
					Response.Write("<script lanuage='javascript'>alert('没有上级项目!');</script>");
				}
				
			}
			catch(Exception ex)
			{
				UDS.Components.Error.Log(ex.ToString());			
			}
			finally
			{
				df = null;
			}
			Response.AddHeader("Refresh","1");			
		
		}

		private void cmdPostilFaile_Click(object sender, System.EventArgs e)
		{
			UDS.Components.DocumentFlow df	= new UDS.Components.DocumentFlow();
			HtmlForm FrmNewDocument			= (HtmlForm)this.Page.FindControl("PostilDocument");
			TextBox tmpText;
			tmpText							= (TextBox)(FrmNewDocument.FindControl("txtPostil"));
			long PostilID;
			try
			{
				PostilID= df.AddPostil(UserName,DocID,tmpText.Text,2,ProjectID,2);				
				df.FaileDocument(DocID);
				UploadFile(PostilID);
			}
			catch(Exception ex)
			{
				UDS.Components.Error.Log(ex.ToString());			
			}
			finally
			{
				df = null;
			}
			Response.AddHeader("Refresh","1");			
		}

		private void cmdPostilFinish_Click(object sender, System.EventArgs e)
		{
			UDS.Components.DocumentFlow df	= new UDS.Components.DocumentFlow();
			HtmlForm FrmNewDocument			= (HtmlForm)this.Page.FindControl("PostilDocument");
			TextBox tmpText;
			tmpText							= (TextBox)(FrmNewDocument.FindControl("txtPostil"));
			long PostilID;
			try
			{
				PostilID = df.AddPostil(UserName,DocID,tmpText.Text,3,ProjectID,0);				
				df.FinishDocument(DocID);
				UploadFile(PostilID);
			}
			catch(Exception ex)
			{
				UDS.Components.Error.Log(ex.ToString());			
			}
			finally
			{
				df = null;
			}
			Response.AddHeader("Refresh","1");			

		}


		private void cmdReturn_Click(object sender, System.EventArgs e)
		{
			Server.Transfer("listDocument.aspx?DisplayType=" + ReturnPage.ToString());		
		}

		private void cmdBack_Click(object sender, System.EventArgs e)
		{
			UDS.Components.DocumentFlow df	= new UDS.Components.DocumentFlow();
			HtmlForm FrmNewDocument			= (HtmlForm)this.Page.FindControl("PostilDocument");
			TextBox tmpText;
			tmpText							= (TextBox)FrmNewDocument.FindControl("txtPostil");
			long PostilID;
			try
			{
				PostilID = df.AddPostil(UserName,DocID,tmpText.Text,4,ProjectID,2);	
				df.BackDocument(DocID);
				UploadFile(PostilID);
			}
			catch(Exception ex)
			{
				UDS.Components.Error.Log(ex.ToString());			
			}
			finally
			{
				df = null;
			}
			Response.AddHeader("Refresh","1");					
		}


	}
}

⌨️ 快捷键说明

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