您目前尚未登陆,请选择【登陆】或【注册
首页->上传下载->文件管理系统源码(Asp.net1.1)>>FileList_v.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:文件管理系统源码(Asp.net1.1)
当前文件:文件类型 FileManageSys/FileList_v.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Collections; 3using System.ComponentModel; 4using System.Data; 5using System.Drawing; 6using System.Web; 7using System.Web.SessionState; 8using System.Web.UI; 9using System.Web.UI.WebControls; 10using System.Web.UI.HtmlControls; 11using System.Text; 12using System.Data.OleDb; 13 14namespace FileManage_Sys 15{ 16 /// <summary> 17 /// FileList_v 的摘要说明。 18 /// </summary> 19 public class FileList_v : System.Web.UI.Page 20 { 21 protected System.Web.UI.WebControls.Label zu_file; 22 protected System.Web.UI.WebControls.Label fileliststr; 23 24 private void Page_Load(object sender, System.EventArgs e) 25 { 26 if(Request.QueryString["zu"]!=null) 27 { 28 string SqlStr=""; 29 string ConnectionStr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source="+Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ConnectionStr"].ToString());//从Web.config文件中获取数据库连接字符串 30 OleDbConnection AccessConnection = new OleDbConnection(ConnectionStr); 31 AccessConnection.Open();//打开数据库 32 33 zu_file.Text = Request.QueryString["zu"].ToString(); 34 string File_Zu; 35 File_Zu = Request.QueryString["zu"].ToString();//文件组 36 37 StringBuilder FileList_Builder= new StringBuilder();//记录查询结果 38 string FileListString = "",RoleStrList=""; 39 40 string[] RoleArray; 41 string RoleCookieStr = Request.Cookies["UserCookie"]["role"].ToString(); 42 43 RoleArray = RoleCookieStr.Split(','); 44 45 for(int i=0;i<RoleArray.Length;i++) 46 { 47 if(i!=(RoleArray.Length-1)) 48 RoleStrList = RoleStrList + "'"+RoleArray[i].ToString()+"',"; 49 else 50 RoleStrList = RoleStrList + "'"+RoleArray[i].ToString()+"'"; 51 } 52 53 54 SqlStr="Select * From files Where filearea='"+ File_Zu +"' And filetype In ("+ RoleStrList.ToLower() +") Order By Id DESC"; 55 56 OleDbCommand AccessCommand = new OleDbCommand(SqlStr,AccessConnection); 57 58 OleDbDataReader AccessReader = AccessCommand.ExecuteReader(); 59 60 int Rownum=0,Rowid=1; 61 62 string FileType="";//文件类型 63 while(AccessReader.Read()) 64 {//提取信息 65 66 switch(AccessReader["fileexe"].ToString()) 67 { 68 case ".pdf": 69 FileType = "PDF文件"; 70 break; 71 case ".doc": 72 FileType = "WORD文件"; 73 break; 74 case ".xls": 75 FileType = "EXCEL文件"; 76 break; 77 case ".jpg": 78 FileType = "JPG文件"; 79 break; 80 case ".dwg": 81 FileType = "DWG文件"; 82 break; 83 case ".PDF": 84 FileType = "PDF文件"; 85 break; 86 case ".DOC": 87 FileType = "WORD文件"; 88 break; 89 case ".XLS": 90 FileType = "EXCEL文件"; 91 break; 92 case ".JPG": 93 FileType = "JPG文件"; 94 break; 95 case ".DWG": 96 FileType = "DWG文件"; 97 break; 98 default:break; 99 } 100 101 102 if(Rownum==0) 103 FileListString = FileListString +"<TR bgcolor='#E4E4E4' height=30><TD style='FONT-SIZE: 12px' align='left' width='100%' height='7'><table width='100%'><tr><td width='20%' align='center'><font class='font_12px'>"+ Rowid.ToString() +"</font></td><td width='20%' align='center'><font class='font_12px'><a href='"+ AccessReader["filepath"].ToString()+AccessReader["filename"].ToString() +"' target='_blank'>"+AccessReader["filename"].ToString()+"</a></font></td><td width='20%' align='center'><font class='font_12px'>"+File_Zu+"类文件组</font></td><td width='20%' align='center'><font class='font_12px'>"+ FileType +"</font></td><td width='20%' align='center'><font class='font_12px'>"+ AccessReader["addtime"].ToString() +"</font></td></tr></table></TD></TR>"; 104 else 105 FileListString = FileListString +"<TR bgcolor='#FFFFFF' height=30><TD style='FONT-SIZE: 12px' align='left' width='100%' height='7'><table width='100%'><tr><td width='20%' align='center'><font class='font_12px'>"+ Rowid.ToString() +"</font></td><td width='20%' align='center'><font class='font_12px'><a href='"+ AccessReader["filepath"].ToString()+AccessReader["filename"].ToString() +"' target='_blank'>"+AccessReader["filename"].ToString()+"</a></font></td><td width='20%' align='center'><font class='font_12px'>"+File_Zu+"类文件组</font></td><td width='20%' align='center'><font class='font_12px'>"+ FileType +"</font></td><td width='20%' align='center'><font class='font_12px'>"+ AccessReader["addtime"].ToString() +"</font></td></tr></table></TD></TR>"; 106 107 Rownum++; 108 Rowid++; 109 if(Rownum==2) Rownum=0; 110 111 } 112 if(FileListString =="") 113 { 114 FileListString ="<TR bgcolor='#FFFFFF' height=30><TD style='FONT-SIZE: 12px' align='center' width='100%' height='7'>此文件组暂无文件</TD></TR>"; 115 } 116 FileList_Builder.Append(FileListString); 117 fileliststr.Text =FileList_Builder.ToString(); 118 119 AccessReader.Close(); 120 AccessCommand.Dispose(); 121 AccessConnection.Close(); 122 123 124 } 125 // 在此处放置用户代码以初始化页面 126 } 127 128 Web 窗体设计器生成的代码 148 } 149} 150
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:文件管理系统源码(Asp.net1.1)
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号