118 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			118 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Web;
 | |
| using System.Web.UI;
 | |
| using System.Web.UI.WebControls;
 | |
| 
 | |
| namespace FineUIPro.Web.FileManage
 | |
| {
 | |
|     public partial class FileManageList : PageBase
 | |
|     {
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 BLL.Funs.PleaseSelect(this.drpFileSort, Resources.Lan.PleaseSelect);
 | |
|                 //this.drpFileSort.Items.AddRange(BLL.FileManageService.FileSortList());
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         protected void btnSearch_Click(object sender, ImageClickEventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         protected void imgbtnCancel_Click(object sender, ImageClickEventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         protected void btnAdd_Click(object sender, ImageClickEventArgs e)
 | |
|         {
 | |
|             if (this.DrpTemplateType.SelectedValue != "0")
 | |
|             {
 | |
|                 string type = this.DrpTemplateType.SelectedValue.Trim();
 | |
|                 ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script type='text/javascript'>CreateNew('" + type + "','');</script>");
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 绑定参数
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
 | |
|         {
 | |
|             e.InputParameters["fileType"] = this.drpFileSort.SelectedValue.Trim();
 | |
|             e.InputParameters["fileName"] = this.txtFileName.Text.Trim();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 绑定GridView
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void gvFileT_DataBound(object sender, EventArgs e)
 | |
|         {
 | |
|             //if (this.gvFileT.BottomPagerRow == null)
 | |
|             //{
 | |
|             //    return;
 | |
|             //}
 | |
|             //((Web.Controls.GridNavgator)this.gvFileT.BottomPagerRow.FindControl("GridNavgator1")).GridView = this.gvFileT;
 | |
|         }
 | |
| 
 | |
|         protected void gvFileT_RowCommand(object sender, GridViewCommandEventArgs e)
 | |
|         {
 | |
|             string pid = e.CommandArgument.ToString();
 | |
|             if (e.CommandName == "click")
 | |
|             {
 | |
|                 ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script type='text/javascript'>ShowOffice('" + pid + "','edit');</script>");
 | |
|             }
 | |
|             if (e.CommandName == "find")
 | |
|             {
 | |
|                 ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script type='text/javascript'>ShowOffice('" + pid + "','read');</script>");
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         protected void imgbtnSearch_Click(object sender, ImageClickEventArgs e)
 | |
|         {
 | |
|             this.divSearch.Visible = true;
 | |
|             this.gvFileT.PageIndex = 0;
 | |
|             this.gvFileT.DataBind();
 | |
|         }
 | |
|         protected string ConvertSize(object size)
 | |
|         {
 | |
|             string strSize = string.Empty;
 | |
|             if (size != null)
 | |
|             {
 | |
|                 try
 | |
|                 {
 | |
|                     double temsize = (Convert.ToDouble(size)) / 1000;
 | |
|                     if (temsize > 0)
 | |
|                     {
 | |
|                         if (temsize > 1000)
 | |
|                         {
 | |
|                             temsize = temsize / 1000;
 | |
|                             strSize = temsize.ToString() + "M";
 | |
|                         }
 | |
|                         else
 | |
|                         {
 | |
|                             strSize = temsize.ToString() + "K";
 | |
|                         }
 | |
|                     }
 | |
|                     else
 | |
|                     {
 | |
|                         strSize = temsize.ToString() + "bytes";
 | |
|                     }
 | |
| 
 | |
|                 }
 | |
|                 catch
 | |
|                 {
 | |
| 
 | |
|                 }
 | |
|             }
 | |
|             return strSize;
 | |
|         }
 | |
|     }
 | |
| } |