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

📄 docfileinfo.cs

📁 这是一学习的好东西
💻 CS
字号:
using System;
using System.Data ;
using DocAdmin.DAL ;
using DocAdmin.COMMON ;

namespace DocAdmin.BLL
{
	/// <summary>
	/// FileInfo 的摘要说明。
	/// </summary>
	public class DocFileInfo
	{
		public DocFileInfo()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}

		private int _fileID ;
		private int _folderID ;
		private string _fileName ;
		private int _type ;
		private string _keyword ;
		private string _note ;
		private int _status ;
		private DateTime _crdt ;
		private DateTime _mddt ;
		private DateTime _dldt ;
		private int _crusr ;
		private int _mdusr ;
		private int _dlusr ;
		private string _userName ;

		#region 公共属性
		public int FileID
		{
			get{ return _fileID ; }
			set{ _fileID = value ;}
		}

		public int FolderID
		{
			get{ return _folderID ; }
			set{ _folderID = value ;}
		}		

		public string FileName
		{
			get{ return _fileName ; }
			set{ _fileName = value ;}
		}

		public int Type
		{
			get{ return _type ; }
			set{ _type = value ;}
		}	
	
		public string Keyword
		{
			get{ return _keyword ; }
			set{ _keyword = value ;}
		}

		public string Note
		{
			get{ return _note ; }
			set{ _note = value ;}
		}

		
		public DateTime CRDT
		{
			get{ return _crdt ; }
			set{ _crdt = value ;}
		}

		public DateTime MDDT
		{
			get{ return _mddt ; }
			set{ _mddt = value ;}
		}

		public DateTime DLDT
		{
			get{ return _dldt ; }
			set{ _dldt = value ;}
		}

		public int CrUsr
		{
			get{ return _crusr ; }
			set{ _crusr = value ;}
		}

		public int MdUsr
		{
			get{ return _mdusr ; }
			set{ _mdusr = value ;}
		}

		public int DlUsr
		{
			get{ return _dlusr ; }
			set{ _dlusr = value ;}
		}

		public int Status
		{
			get{ return _status ; }
			set{ _status = value ;}
		}

		public string UserName
		{
			get{ return _userName ;}
			set{ _userName = value ;}
		}
		#endregion

		#region 公共方法

		public static int MoveFile(int folderID,int fileID)
		{
			int ret = -1 ;
			//存储过程名
			string spName = "Doc_File_Move" ;
			//存储过程参数
			object[] para = new object[] {fileID,folderID} ;

			//调用数据访问方法执行存储过程			
			ret = DataAccess.ExecuteNonQuery(spName,false,para) ;

			return ret ;
		}

		public static DataTable GetRecycle()
		{			
			//存储过程名
			string spName = "Doc_File_GetRecycle" ;

			//调用数据访问方法执行存储过程			
			return DataAccess.ExecuteDataTable(spName) ;			
		}

		public static DataTable GetFileFromFolder(int folderID)
		{			
			//存储过程名
			string spName = "Doc_File_GetByFolder" ;
			//存储过程参数
			object[] para = new object[] {folderID} ;

			//调用数据访问方法执行存储过程			
			return DataAccess.ExecuteDataTable(spName,para) ;			
		}

		public static int DeleteFile(int fileID)
		{
			//存储过程名
			string spName = "Doc_File_Delete" ;

			//存储过程参数
			object[] para = new object[] {fileID} ;

			return DataAccess.ExecuteNonQuery(spName,false,para) ;
		}

		public int GetFile(int fileID)
		{
			int ret = -1 ;

			//存储过程名
			string spName = "Doc_File_Get" ;
			//存储过程参数
			object[] para = new object[] {fileID} ;

			//调用数据访问方法执行存储过程			
			DataTable dt = DataAccess.ExecuteDataTable(spName,para) ;	
			if(dt.Rows.Count > 0)
			{
				DataRow dr = dt.Rows[0] ;
				//根据查询结果指定文件信息对象的属性
				AssignAttribute(dr) ;

				ret = 0 ;
			}

			return ret ;
		}

		private void AssignAttribute(DataRow dr)
		{
			this._crdt = CommHandler.StringToDateTime(dr["crdt"].ToString()) ;
			this._crusr = CommHandler.StringToInt(dr["userid"].ToString()) ;
			this._fileID = CommHandler.StringToInt(dr["fileid"].ToString()) ;
			this._fileName = dr["filename"].ToString() ;
			this._folderID = CommHandler.StringToInt(dr["folderid"].ToString()) ;
			this._keyword = dr["keyword"].ToString() ;
			this._mddt = CommHandler.StringToDateTime(dr["mddt"].ToString()) ;
			this._mdusr = CommHandler.StringToInt(dr["mdusr"].ToString()) ;
			this._note = dr["note"].ToString() ;
			this._type = CommHandler.StringToInt(dr["type"].ToString()) ;
			this._userName = dr["UserName"].ToString() ;
		}

		public int AddFileInfo()
		{
			int ret = -1 ;

			//存储过程名
			string spName = "Doc_File_Add" ;
			//存储过程参数
			object[] para = new object[] {"",_folderID,_fileName,_type,_keyword,_note,_crusr} ;

			//调用数据访问方法执行存储过程			
			ret = DataAccess.ExecuteNonQuery(spName,true,para) ;

			return ret ;
		}

		public int ModifyFileInfo()
		{
			int ret = -1 ;
			//存储过程名
			string spName = "Doc_File_Modify" ;
			//存储过程参数
			object[] para = new object[] {_fileID,_folderID,_fileName,_type,_keyword,_note,_mdusr} ;

			//调用数据访问方法执行存储过程			
			ret = DataAccess.ExecuteNonQuery(spName,false,para) ;

			return ret ;
		}

		public static int RecycleFile(int fileID,int usrid)
		{
			//存储过程名
			string spName = "Doc_File_Recycle" ;

			//存储过程参数
			object[] para = new object[] {fileID,usrid} ;

			return DataAccess.ExecuteNonQuery(spName,false,para) ;

		}

		public static int RevertFile(int fileID)
		{
			//存储过程名
			string spName = "Doc_File_Revert" ;

			//存储过程参数
			object[] para = new object[] {fileID} ;

			return DataAccess.ExecuteNonQuery(spName,false,para) ;

		}

		public static int MoveFile(int fileID)
		{
			//存储过程名
			string spName = "Doc_File_Move" ;

			//存储过程参数
			object[] para = new object[] {fileID} ;

			return DataAccess.ExecuteNonQuery(spName,false,para) ;

		}

		
		#endregion
	}
}

⌨️ 快捷键说明

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