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

📄 securityfmpage.aspx.cs

📁 专业的办公oa代码下载 c#语言编写 三层结构
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Collections;
using System.Data;
using System.Web.UI.WebControls; 

using qminoa.Common; 
using qminoa.DA; 
using qminoa.BLL; 

namespace qminoa.Webs.FM
{
	public class SecurityFMPage : qminoa.Webs.PageBase
	{
		protected System.Web.UI.WebControls.DataGrid dgdFolder;
		protected System.Web.UI.WebControls.Image Image1;
		protected System.Web.UI.WebControls.ImageButton cmdClose;
		protected System.Web.UI.WebControls.ImageButton cmdBack;
		protected System.Web.UI.WebControls.ImageButton cmdForword;
		protected System.Web.UI.WebControls.ImageButton cmdUp;
		protected System.Web.UI.WebControls.ImageButton cmdSeach;
		protected System.Web.UI.WebControls.ImageButton cmdFolderShow;
		protected System.Web.UI.WebControls.ImageButton cmdNewFolder;
		protected System.Web.UI.WebControls.ImageButton cmdNewFile;
		protected System.Web.UI.WebControls.Label lblAddress;
		protected System.Web.UI.WebControls.TextBox txtFolderPath;
		protected System.Web.UI.WebControls.Image imgDrive;
		protected System.Web.UI.WebControls.ImageButton cmdGoto;
		protected System.Web.UI.WebControls.Label lblObjNum;
		protected System.Web.UI.WebControls.Label lblLastID;
		protected System.Web.UI.WebControls.Label lblID;
		protected System.Web.UI.WebControls.Label lblFID;
		protected System.Web.UI.WebControls.Label lblBID;

		static int DocId;
		static int  id;
		static int  Type;
		static int fm_empid;
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!IsPostBack)
			{
				this.PageBegin("项目管理",true);
				fm_empid=Convert.ToInt16(this.Empid);
				DocId=Convert.ToInt32(Request.QueryString["fid"],10); 
				id= Convert.ToInt32( Request.QueryString["Id"],10);
				Type=Convert.ToInt32(Request.QueryString["type"],10);
				txtFolderPath.Text="C:\\";

				if(Type==-1)	
				{
					if( id!=0 && DocId==0)
					{
						RightForReBind_Folder(id,0,fm_empid);
					}
					else if(id==0 && DocId!=0)
					{
						RightForReBind_Doc(0,DocId,fm_empid);
					}
					else if(id!=0 && DocId!=0)
					{
						int fid = Convert.ToInt32(Session["_fm_id"].ToString());
						if(id!=fid )
						{
							RightForReBind_Folder(id,DocId,fm_empid);
						}
						else
						{
							RightForReBind_Doc(id,DocId,fm_empid);
						}
					}
				}
				else if((id!=0 && Type==-2) || (id!=0 && Type==-3) )
				{
					RightForReBind_Folder(id,0,fm_empid);
					UpdateLeftTree();
				}
				else if(Type==-4)
				{
					RightForReBind_Folder(id,DocId,fm_empid);
				}
				else
				{
					FirstLoad();
					UpdateLeftTree();
				}
			}
		}

		public void FirstLoad()
		{
			FileData filedata = (new  FileA()).LoadFile();
			DataView dv=filedata.Tables[FileData.FMDOCFOLDER_TABLE].DefaultView;
			DataTable dt=CreateTable(dv);
			dgdFolder.DataSource =dt.DefaultView; 
			dgdFolder.DataBind();
			txtFolderPath.Text="C:\\";
			Session["_fm_id"]=0;
		}

		public void RightForReBind_Doc(int folderid,int docid,int empid)
		{
			int depid=(new FileRight()).GetDepId(empid);
			string rightctr_emp=(new FileBLL()).GetDocRight(docid,empid);
			if(rightctr_emp=="Admin"||rightctr_emp=="Write"||rightctr_emp=="Read")
			{
				Response.Redirect("fmNewFile.aspx?fid="+id+"&did="+docid+"&type=-1",true);
			}
			else
			{
				string rightctr_dep=(new FileBLL()).GetDocRightForDep(docid,depid); 
				if(rightctr_dep=="Admin"||rightctr_dep=="Write"||rightctr_dep=="Read")
				{
					Response.Redirect("fmNewFile.aspx?fid="+id+"&did="+DocId+"&type=-1",true);
				}
				else
				{
					Response.Write("<script language='javascript'>alert('您没有权限访问这个文件!');</script>"); 
					if(folderid==0)
					{
						FirstLoad();
					}
					else
					{
						ReBind(folderid);
					}
				}
			}
		}
		
		public void  RightForReBind_Folder(int folderid,int docid,int empid)
		{
			string rightctr_emp=(new FileBLL()).GetFolderRight(folderid,empid);
			if(rightctr_emp=="Admin"||rightctr_emp=="Write"||rightctr_emp=="Read")
			{
				ReBind(folderid);
			}
			else
			{
				int depid=(new FileRight()).GetDepId(empid); 
				string rightctr_dep=(new FileBLL()).GetFolderRightForDep(folderid,depid); 
				if(rightctr_dep=="Admin"||rightctr_dep=="Write"||rightctr_dep=="Read")
				{
					ReBind(folderid);
				}
				else 
				{   
					Response.Write("<script language='javascript'>alert('您没有权限访问改文件夹!');</script>"); 
					FirstLoad();
				}
			}
		}

		public void ReBind(int id)
		{
			DataView dvdata; 
			FileData filedata =(new FileA()).LoadDocFolder(id);
			dvdata=filedata.Tables[FileData.FMDOCFOLDER_TABLE].DefaultView;
			DataTable dt=CreateTable(dvdata);
			dgdFolder.DataSource=dt.DefaultView;
			dgdFolder.DataBind(); 
			cmdBack.ImageUrl="img/button/fmback.gif"; 
			txtFolderPath.Text=GetPath(id);
			Session["_fm_id"]=id;
		}

		private string GetPath(int fid)
		{    
			FileA fa= new FileA();
			string fpath=fa.GetDocPath(fid); 
			return fpath;
		}

		private void cmdNewFolder_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			int fid =id;
			Response.Redirect("fmNewFolder.aspx?id="+fid+"&type=-2");
		}
		
	#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.cmdUp.Click += new System.Web.UI.ImageClickEventHandler(this.cmdUp_Click);
			this.cmdSeach.Click += new System.Web.UI.ImageClickEventHandler(this.cmdSeach_Click);
			this.cmdNewFolder.Click += new System.Web.UI.ImageClickEventHandler(this.cmdNewFolder_Click);
			this.cmdNewFile.Click += new System.Web.UI.ImageClickEventHandler(this.cmdNewFile_Click);
			this.dgdFolder.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgdFolder_ItemCommand);
			this.dgdFolder.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgdFolder_EditCommand);
			
			this.Load += new System.EventHandler(this.Page_Load);
			this.dgdFolder.ItemCreated += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgdFolder_ItemCreated);
		}
		#endregion
		private void cmdNewFile_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
            int fid=id;
			FileA fa=new FileA();
			fa.UpdateFileCont();
			if(txtFolderPath.Text=="C:\\")
			{
				Response.Redirect("fmNewFile.aspx?did=0&fid=0&type=-2",true);
			}
			else
			{ 
				Response.Redirect("fmNewFile.aspx?did=0&fid="+id+"&type=-2",true);
			}
		}

		private void cmdSeach_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			Response.Redirect("FileSearch.aspx",false);
		}

		private void cmdUp_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			try
			{
				int _id = Convert.ToInt32(Session["_fm_id"].ToString(),10);
				int _fid=FileA.gethifolderid(_id);
				id=_fid;
				if(_fid!=0)
				{
					RightForReBind_Folder(_fid,0,fm_empid);
				}
				else
				{
					FirstLoad();
				}
			}
			catch
			{}
		}

		private void dgdFolder_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
		{
			int FolderId =Convert.ToInt32(e.Item.Cells[1].Text);
			int DocId=Convert.ToInt32(e.Item.Cells[0].Text); 
			
			if(e.CommandName=="edit") 
			{  
				if( DocId==0 && FolderId!=0 )
				{
					RightForEdit_Folder(FolderId,0,fm_empid);
				}
				else if(DocId!=0 && FolderId!=0)
				{
					int id=Convert.ToInt32(Session["_fm_id"].ToString());
					if( FolderId!=id )
					{
						RightForEdit_Folder(FolderId,DocId,fm_empid);
					}
					else
					{
						RightForReBind_Doc(FolderId,DocId,fm_empid);
					}
				}
				else if( DocId!=0 && FolderId==0 )
				{
					RightForReBind_Doc(FolderId,DocId,fm_empid);	
				}
			}
		}

⌨️ 快捷键说明

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