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

📄 fmrecycle.aspx.cs

📁 专业的办公oa代码下载 c#语言编写 三层结构
💻 CS
字号:
	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 fmRecycle : qminoa.Webs.PageBase
	{
		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;
		protected System.Web.UI.WebControls.Image Image1;
		protected System.Web.UI.WebControls.ImageButton cmdClose;
		protected System.Web.UI.WebControls.DataGrid dgdFolder;
	    static int fm_empid;
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!this.IsPostBack)
			{
				this.PageBegin("文档管理-回收站",true);
				fm_empid=Convert.ToInt16(this.Empid);
				BindTable();
			}
		}

		#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.dgdFolder.ItemCreated += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgdFolder_ItemCreated);
			this.dgdFolder.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgdFolder_EditCommand);
			this.dgdFolder.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgdFolder_DeleteCommand);
			this.dgdFolder.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgdFolder_ItemDataBound);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void dgdFolder_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
		{
			int index= Convert.ToInt32(e.Item.Cells[0].Text,10);
			string typename=dgdFolder.DataKeys[e.Item.ItemIndex].ToString().Trim();
			if(typename=="文件夹")
			{
				DeleteFolder(index);
			}
			else
			{ 
				FileA fa = new FileA();
				fa.DoRecycle(1,index); 
			}
			BindTable();
		}

		public void BindTable()
		{
			DataTable _dtRecycle= new DataTable(); 
			DataColumnCollection d= _dtRecycle.Columns; 
			d.Add("folderid",typeof(System.Int32)); 
			d.Add("hifolderid", typeof(System.Int32));
			d.Add("name",typeof(System.String)); 
			d.Add("path",typeof(System.String));
			d.Add("type",typeof(System.String)); 
			d.Add("dempid",typeof(System.String));
			d.Add("Ddate",typeof(System.DateTime));

			DataTable dtRecycle = (new FileBLL()).DoRecycle();
			DataView dv= dtRecycle.DefaultView;  
			int _count=dtRecycle.Rows.Count;
			int num=0;
			for(int i=0;i<_count;i++)
			{
				int fid=Convert.ToInt32(dv[i].Row[0].ToString());     
				int hifid=Convert.ToInt32(dv[i].Row[1].ToString());  
				string type=dv[i].Row[4].ToString();  
				if(type=="文件夹")
				{
					DataTable dt = (new FileBLL()).DoRecycle();
					DataView dv2= dt.DefaultView;
					dv2.RowFilter="folderid="+fid+"and hifolderid="+hifid+"and type='文件夹'";
					int count2=dv2.Count;

					if(count2==1)
					{
						DataRow row = _dtRecycle.NewRow();
						row["folderid"]=Convert.ToInt32(dv2[0].Row[0].ToString(),10);
						row["hifolderid"] =Convert.ToInt32(dv2[0].Row[1].ToString(),10);
						row["name"]=dv2[0].Row[2].ToString();
						row["path"]=dv2[0].Row[3].ToString();
						row["Ddate"]=dv2[0].Row[6].ToString();
						row["dempid"]=(new FileA()).GetEmpName(Convert.ToInt32(dv2[0].Row[5].ToString()));
						row["type"]=dv2[0].Row[4].ToString();
						_dtRecycle.Rows.Add(row);
					}
					else
					{
						if(num==0)
						{
							DataRow row = _dtRecycle.NewRow();
							row["folderid"]=Convert.ToInt32(dv2[0].Row[0].ToString(),10);
							row["hifolderid"] =Convert.ToInt32(dv2[0].Row[1].ToString(),10);
							row["name"]=dv2[0].Row[2].ToString();
							row["path"]=dv2[0].Row[3].ToString();
							row["Ddate"]=dv2[0].Row[6].ToString();
							row["dempid"]=(new FileA()).GetEmpName(Convert.ToInt32(dv2[0].Row[5].ToString()));
							row["type"]=dv2[0].Row[4].ToString();
							_dtRecycle.Rows.Add(row);
							num=1;
						}
					}
				}
				else
				{
					DataRow row = _dtRecycle.NewRow();
					row["folderid"]=Convert.ToInt32(dv[i].Row[0].ToString(),10);
					row["hifolderid"] =Convert.ToInt32(dv[i].Row[1].ToString(),10);
					row["name"]=dv[i].Row[2].ToString();
					row["path"]=dv[i].Row[3].ToString();
					row["Ddate"]=dv[i].Row[6].ToString();
					row["dempid"]=(new FileA()).GetEmpName(Convert.ToInt32(dv[i].Row[5].ToString()));
					row["type"]=dv[i].Row[4].ToString();
					_dtRecycle.Rows.Add(row);
				}
			}
			dgdFolder.DataSource=_dtRecycle.DefaultView;
			dgdFolder.DataBind(); 
		} 

		private void dgdFolder_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
		{
			int index= Convert.ToInt32(e.Item.Cells[0].Text,10);
			int seleteitem=e.Item.ItemIndex;
			string typename=dgdFolder.DataKeys[seleteitem].ToString().Trim();
			if(typename!="文件夹")
			{
				FileA fa = new FileA();
				fa.DoRecycle(2,index); 
			}
			else
			{
				ReuseFolder(index);
			}
			BindTable();  
			Response.Write("<script>parent.frmDocTree.location.reload();</script>");
		}

		public void DeleteFolder(int folderid)
		{
			FileA FileA =new FileA(); 
			ArrayList arrlist=(new FileA()).GetDelFolderId(folderid);
			for(int i=0;i<arrlist.Count;i++)
			{
				int foldid=Convert.ToInt32(arrlist[i].ToString(),10); 
				FileA.DeleteFolder(foldid,fm_empid,0); 
			}
			ArrayList arrlistDoc= FileA.GetDelDocId(arrlist);
			for(int j=0;j<arrlistDoc.Count;j++)
			{
				int docid=Convert.ToInt32(arrlistDoc[j].ToString(),10);  
				FileA.DoRecycle(1,docid); 
			}
		}

		public void ReuseFolder(int folderid)
		{
			FileA FileA =new FileA(); 
            ArrayList arrlist=(new FileA()).GetDelFolderId(folderid);
			for(int i=0;i<arrlist.Count;i++)
			{
				int foldid=Convert.ToInt32(arrlist[i].ToString(),10); 
				FileA.DoRecycle(3,foldid); 
			}
			ArrayList arrlistDoc= FileA.GetDelDocIdForReuse(arrlist);
            for(int j=0;j<arrlistDoc.Count;j++)
			{
				int docid=Convert.ToInt32(arrlistDoc[j].ToString(),10);  
				FileA.DoRecycle(2,docid); 
			}
		}

		public  void dgdFolder_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
		{
			if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem||e.Item.ItemType==ListItemType.EditItem)
			{  
			    TableCell myTableCell_Edit = new TableCell(); 	
				myTableCell_Edit = e.Item.Cells[7];
				LinkButton myDeleteButton_Edit =new LinkButton(); 
				myDeleteButton_Edit = (LinkButton)myTableCell_Edit.Controls[0];
				myDeleteButton_Edit.Attributes.Add("onclick", "return confirm('您真的要还原吗?');");
				
				TableCell myTableCell_Del = new TableCell(); 
				myTableCell_Del = e.Item.Cells[8];
				LinkButton myDeleteButton_Del =new LinkButton(); 
				myDeleteButton_Del = (LinkButton)myTableCell_Del.Controls[0];
				myDeleteButton_Del.Attributes.Add("onclick", "return confirm('您真的要删除吗?');");
			}
		}

		private void dgdFolder_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
		{
			ListItemType itemType = e.Item.ItemType;
			e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';" ;
			if (itemType == ListItemType.Item )
			{
				e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#dedfde';";
			}
			else if( itemType == ListItemType.AlternatingItem)
			{
				e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#ffffff';";
			}
		}
	}
}

⌨️ 快捷键说明

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