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

📄 filedetail.aspx.cs

📁 C#2005 实例源代码
💻 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;

using MyOA.BusinessLogicLayer;
using MyOA.DataAccessHelper;

namespace MyOA.Web
{
	/// <summary>
	/// FileUpdate 的摘要说明。
	/// </summary>
	public partial class FileUpdate : System.Web.UI.Page
	{
	
		/// <summary>
		/// 页面加载事件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		protected void Page_Load(object sender, System.EventArgs e)
		{
			InitData();
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Imagebutton2.Click += new System.Web.UI.ImageClickEventHandler(this.Imagebutton2_Click);
			this.ImageButtonBack.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButtonBack_Click);

		}
		#endregion

		/// <summary>
		/// 初始化页面数据
		/// </summary>
		private void InitData()
		{
			int fileId=Convert.ToInt32(Request.QueryString["file_id"]);
			File file=new File();
			file.LoadData(fileId);

			LabelFileTitle.Text=file.FileTitle;
			LabelFromUserName.Text=file.FromUserName;
			LabelToUserName.Text=file.ToUserName;
			LabelContent.Text=file.FileContent;

			if(file.AffixFile!=System.String.Empty)
			{
				int idx=file.AffixFile.IndexOf("@_@")+3;
				HyperLinkAffixFile.NavigateUrl=file.AffixFile;
				HyperLinkAffixFile.Text=file.AffixFile.Substring(idx);	
			}
			else
				HyperLinkAffixFile.Text="[无]";	

			LabelFileStatus.Text=file.FileStatusName;
		}

		/// <summary>
		/// “返回”按钮单击事件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void ImageButtonBack_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			Response.Write("<Script Language=JavaScript>history.go(-2);</Script>");	
		}

		/// <summary>
		/// “审阅”按钮单击事件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void Imagebutton2_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			int fileId=Convert.ToInt32(Request.QueryString["file_id"]);
			File file=new File();
			file.LoadData(fileId);

			User user=new User();
			user.LoadData(Session["login_name"].ToString());
			if(file.FileStatusId==2 || file.ToUserName!=user.UserName)
			{
				Response.Write("<Script Language=JavaScript>alert('您不能审阅这个公文,因为你没有权限,或者公文已经被审阅!');</Script>");
				return;
			}

			Hashtable ht=new Hashtable();
			ht.Add("FileStatus",2);

			string where=" Where FileId="+Convert.ToInt32(Request.QueryString["file_id"]);
			File.Update(ht,where);	
		
			InitData();
		}
	}
}

⌨️ 快捷键说明

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