20241227 新增support document
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GuideManual.aspx.cs" Inherits="FineUIPro.Web.SupportDocument.GuideManual" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>Guide Manual</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
|
||||
<Items>
|
||||
<f:Panel ID="Panel2" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
|
||||
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="Guide Manual" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="GuideManualId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
ClicksToEdit="2" DataIDField="GuideManualId" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"
|
||||
EnableCheckBoxSelect="true">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Top" runat="server">
|
||||
<Items>
|
||||
<f:ToolbarFill ID="ToolbarFill2" runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnNew" ToolTip="Add" Text="Add" Icon="Add" OnClick="btnAdd_Click" runat="server" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnEdit" ToolTip="Modify" Text="Modify" Icon="Pencil" runat="server" OnClick="btnEdit_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnDelete" ToolTip="Delete" Text="Delete" Icon="Delete" ConfirmText="Make sure to delete the current data?" OnClick="btnDelete_Click"
|
||||
runat="server" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnBatchDownload" ToolTip="Batch Download" Text="Batch Download" Icon="ArrowDown" EnableAjax="false" OnClick="btnBatchDownload_Click" runat="server" Hidden="true">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:TemplateField Width="50px" TextAlign="Center" HeaderText="No.">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex + 1 %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField Width="260px" ColumnID="GuideManual" DataField="GuideManual" FieldType="String" HeaderText="Guide Manual" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="130px" ColumnID="UploadByName" DataField="UploadByName" FieldType="String" HeaderText="Uploaded by" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="130px" ColumnID="UploadDate" DataField="UploadDate" FieldType="Date" Renderer="Date" HeaderText="Uploaded Date" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:TemplateField HeaderText="Attach View" Width="350px" HeaderTextAlign="Center" TextAlign="Left" ExpandUnusedSpace="true">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lbtnUrl1" runat="server" CommandArgument='<%# Bind("AttachUrl") %>'
|
||||
ToolTip="Attach View" EnableAjax="false" Height="20px"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
</Columns>
|
||||
<PageItems>
|
||||
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
|
||||
</f:ToolbarSeparator>
|
||||
<f:ToolbarText ID="ToolbarText1" runat="server" Text="Number of records per page:">
|
||||
</f:ToolbarText>
|
||||
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
|
||||
<f:ListItem Text="15" Value="15" />
|
||||
<f:ListItem Text="20" Value="20" />
|
||||
<f:ListItem Text="25" Value="25" />
|
||||
</f:DropDownList>
|
||||
</PageItems>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px" OnClose="Window1_Close"
|
||||
Height="500px">
|
||||
</f:Window>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,329 @@
|
||||
using BLL;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.SupportDocument
|
||||
{
|
||||
public partial class GuideManual : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
GetButtonPower();//按钮权限
|
||||
BindGrid();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"SELECT t.GuideManualId,
|
||||
t.GuideManual,
|
||||
t.UploadBy,
|
||||
t.UploadDate,
|
||||
t.AttachUrl,
|
||||
U.UserName AS UploadByName
|
||||
FROM dbo.SupportDocument_GuideManual AS t
|
||||
LEFT JOIN Sys_User AS U ON U.UserId = t.UploadBy
|
||||
WHERE 1=1 ";
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
//if (tvStandardTemp.SelectedNodeID != "0" && tvStandardTemp.SelectedNodeID != null)
|
||||
//{
|
||||
// strSql += " AND t.TemplateTypeId = @TemplateTypeId";
|
||||
// listStr.Add(new SqlParameter("@TemplateTypeId", tvStandardTemp.SelectedNodeID));
|
||||
//}
|
||||
strSql += " ORDER BY t.UploadDate DESC";
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
|
||||
for (int i = 0; i < Grid1.Rows.Count; i++)
|
||||
{
|
||||
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid1.Rows[i].FindControl("lbtnUrl1")));
|
||||
string url = lbtnUrl.CommandArgument.ToString();
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
url = url.Replace('\\', '/');
|
||||
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//protected void btnSearch_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// if (!string.IsNullOrEmpty(this.tvStandardTemp.SelectedNodeID))
|
||||
// {
|
||||
// BindGrid(this.tvStandardTemp.SelectedNodeID);
|
||||
// }
|
||||
//}
|
||||
protected void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
string id = SQLHelper.GetNewID(typeof(Model.SupportDocument_GuideManual));
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader3.aspx?type=add&toKeyId={0}&path=FileUpload/SupportDocument/GuideManual&menuId={1}", id, BLL.Const.GuideManualMenuId)));
|
||||
}
|
||||
|
||||
protected void btnEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rowId = Grid1.SelectedRowID;
|
||||
if (!string.IsNullOrEmpty(rowId))
|
||||
{
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader3.aspx?type=edit&toKeyId={0}&path=FileUpload/SupportDocument/GuideManual&menuId={1}", rowId, BLL.Const.GuideManualMenuId)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("Please select the record to modify!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("StandardTemplateEdit.aspx?templateId={0}", rowId, "编辑 - ")));
|
||||
}
|
||||
protected void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
var t = BLL.GuideManualService.GetGuideManualById(rowID);
|
||||
if (t != null)
|
||||
{
|
||||
BLL.GuideManualService.DeleteGuideManualById(rowID);
|
||||
}
|
||||
}
|
||||
BindGrid();
|
||||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Delete Guide Manual");
|
||||
ShowNotify("Deleted successfully!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("Please select the record to Delete!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void Grid1_RowDoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
string rowId = Grid1.SelectedRowID;
|
||||
if (!string.IsNullOrEmpty(rowId))
|
||||
{
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader3.aspx?type=edit&toKeyId={0}&path=FileUpload/SupportDocument/GuideManual&menuId={1}", rowId, BLL.Const.GuideManualMenuId)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("Please select the record to modify!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("StandardTemplateEdit.aspx?templateId={0}", rowId, "编辑 - ")));
|
||||
}
|
||||
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
Grid1.PageIndex = e.NewPageIndex;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页显示条数下拉框
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
#region 权限设置
|
||||
/// <summary>
|
||||
/// 菜单按钮权限
|
||||
/// </summary>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.GuideManualMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
{
|
||||
this.btnEdit.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnDownload))
|
||||
{
|
||||
this.btnBatchDownload.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||||
{
|
||||
this.btnDelete.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnBatchDownload_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/").Replace('\\', '/');
|
||||
if (Grid1.SelectedRowIDArray.Count() == 0)
|
||||
{
|
||||
Alert.ShowInParent("Please select Download Row!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] rowList = Grid1.SelectedRowIDArray;
|
||||
List<string> durl = new List<string>();
|
||||
List<string> urlList = (from x in Funs.DB.SupportDocument_GuideManual where rowList.Contains(x.GuideManualId) && x.AttachUrl != null && x.AttachUrl != "" select x.AttachUrl).ToList();
|
||||
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
string destFile = rootPath + "FileUpload\\Temp\\GuideManual" + date;
|
||||
string zipFileName = "GuideManual_" + date;
|
||||
if (!Directory.Exists(destFile))
|
||||
{
|
||||
Directory.CreateDirectory(destFile);
|
||||
}
|
||||
|
||||
foreach (string url in urlList)
|
||||
{
|
||||
string sourceFileName = rootPath + url.Replace('\\', '/');
|
||||
string[] subUrl = sourceFileName.Split('/');
|
||||
string fileName = subUrl[subUrl.Count() - 1];
|
||||
|
||||
|
||||
string newFileName = fileName.Substring(fileName.IndexOf("~") + 1);
|
||||
if (newFileName.Contains("_"))
|
||||
{
|
||||
if (newFileName.Substring(0, 1) == "_")
|
||||
{
|
||||
newFileName = newFileName.Substring(1, newFileName.Length - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
newFileName = newFileName.Replace(newFileName.Split('_')[0], "");
|
||||
newFileName = newFileName.Substring(1);
|
||||
}
|
||||
}
|
||||
string destFileName = destFile + "/" + newFileName;
|
||||
if (File.Exists(sourceFileName))
|
||||
{
|
||||
File.Copy(sourceFileName, destFileName, true);
|
||||
}
|
||||
}
|
||||
FileZipDownload(destFile.Replace('\\', '/'), zipFileName);
|
||||
}
|
||||
}
|
||||
|
||||
public string DownloadFileByHttpUrl(List<string> HttpUrlList)
|
||||
{
|
||||
if (HttpUrlList == null || HttpUrlList.Count == 0)
|
||||
{
|
||||
return "没有附件";
|
||||
}
|
||||
try
|
||||
{
|
||||
var random = new Random();
|
||||
var zipMs = new MemoryStream();
|
||||
ZipOutputStream zipStream = new ZipOutputStream(zipMs);
|
||||
zipStream.SetLevel(6);//压缩率0~9
|
||||
foreach (var url in HttpUrlList)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(url))
|
||||
{
|
||||
string rootPath = System.Configuration.ConfigurationManager.AppSettings["RootUrl"];
|
||||
string surl = rootPath + url.Replace('\\', '/');
|
||||
var urlStr = HttpUtility.UrlDecode(surl);
|
||||
Console.WriteLine(urlStr);
|
||||
string fileExt = Path.GetExtension(urlStr).ToLower();
|
||||
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(urlStr);
|
||||
var strName = fileNameWithoutExtension.Substring(fileNameWithoutExtension.LastIndexOf("/") + 1) + random.Next(1000, 9999) + fileExt;
|
||||
zipStream.PutNextEntry(new ZipEntry(strName));
|
||||
ServicePointManager.ServerCertificateValidationCallback += (s, cert, chain, sslPolicyErrors) => true;
|
||||
ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlStr);
|
||||
request.AllowAutoRedirect = true;
|
||||
WebProxy proxy = new WebProxy();
|
||||
proxy.BypassProxyOnLocal = true;
|
||||
proxy.UseDefaultCredentials = true;
|
||||
request.Proxy = proxy;
|
||||
WebResponse response = request.GetResponse();
|
||||
using (Stream streams = response.GetResponseStream())
|
||||
{
|
||||
Byte[] buffer = new Byte[1024];
|
||||
int current = 0;
|
||||
while ((current = streams.Read(buffer, 0, buffer.Length)) != 0)
|
||||
{
|
||||
zipStream.Write(buffer, 0, current);
|
||||
}
|
||||
zipStream.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
zipStream.Finish();
|
||||
zipMs.Position = 0;
|
||||
//下边为打包压缩
|
||||
MemoryStream stream = zipMs;
|
||||
byte[] srcBuf = new Byte[stream.Length];
|
||||
stream.Read(srcBuf, 0, srcBuf.Length);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
string filePath = "C:/DownLoad";//Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
string con = "GuideManual";
|
||||
|
||||
|
||||
var file_name = con + "_" + date + ".zip";
|
||||
using (FileStream fs = new FileStream(filePath + "\\" + file_name, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
fs.Write(srcBuf, 0, srcBuf.Length);
|
||||
fs.Close();
|
||||
return "已下载到C盘Download文件下!";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "下载失败:" + ex.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void FileZipDownload(string destFilePath, string zipFileName)
|
||||
{
|
||||
string zipFilePath = destFilePath + ".zip";
|
||||
System.IO.Compression.ZipFile.CreateFromDirectory(destFilePath, zipFilePath);
|
||||
FileInfo info = new FileInfo(zipFilePath);
|
||||
long fileSize = info.Length;
|
||||
System.Web.HttpContext.Current.Response.Clear();
|
||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(zipFileName + ".zip", System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(zipFilePath, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
Funs.DeleteDir(destFilePath);
|
||||
File.Delete(zipFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.SupportDocument
|
||||
{
|
||||
|
||||
|
||||
public partial class GuideManual
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel2;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill2;
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// btnEdit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnEdit;
|
||||
|
||||
/// <summary>
|
||||
/// btnDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDelete;
|
||||
|
||||
/// <summary>
|
||||
/// btnBatchDownload 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnBatchDownload;
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label1;
|
||||
|
||||
/// <summary>
|
||||
/// lbtnUrl1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtnUrl1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarSeparator1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window WindowAtt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Template.aspx.cs" Inherits="FineUIPro.Web.SupportDocument.Template" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>Template</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
|
||||
<Items>
|
||||
<f:Panel ID="Panel2" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
|
||||
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="Template" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="TemplateId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
ClicksToEdit="2" DataIDField="TemplateId" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"
|
||||
EnableCheckBoxSelect="true">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Top" runat="server">
|
||||
<Items>
|
||||
<f:ToolbarFill ID="ToolbarFill2" runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnNew" ToolTip="Add" Text="Add" Icon="Add" OnClick="btnAdd_Click" runat="server" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnEdit" ToolTip="Modify" Text="Modify" Icon="Pencil" runat="server" OnClick="btnEdit_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnDelete" ToolTip="Delete" Text="Delete" Icon="Delete" ConfirmText="Make sure to delete the current data?" OnClick="btnDelete_Click"
|
||||
runat="server" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnBatchDownload" ToolTip="Batch Download" Text="Batch Download" Icon="ArrowDown" EnableAjax="false" OnClick="btnBatchDownload_Click" runat="server" Hidden="true">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:TemplateField Width="50px" TextAlign="Center" HeaderText="No.">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex + 1 %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField Width="260px" ColumnID="Template" DataField="Template" FieldType="String" HeaderText="Template" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="130px" ColumnID="UploadByName" DataField="UploadByName" FieldType="String" HeaderText="Uploaded by" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="130px" ColumnID="UploadDate" DataField="UploadDate" FieldType="Date" Renderer="Date" HeaderText="Uploaded Date" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:TemplateField HeaderText="Attach View" Width="350px" HeaderTextAlign="Center" TextAlign="Left" ExpandUnusedSpace="true">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lbtnUrl1" runat="server" CommandArgument='<%# Bind("AttachUrl") %>'
|
||||
ToolTip="Attach View" EnableAjax="false" Height="20px"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
</Columns>
|
||||
<PageItems>
|
||||
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
|
||||
</f:ToolbarSeparator>
|
||||
<f:ToolbarText ID="ToolbarText1" runat="server" Text="Number of records per page:">
|
||||
</f:ToolbarText>
|
||||
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
|
||||
<f:ListItem Text="15" Value="15" />
|
||||
<f:ListItem Text="20" Value="20" />
|
||||
<f:ListItem Text="25" Value="25" />
|
||||
</f:DropDownList>
|
||||
</PageItems>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px" OnClose="Window1_Close"
|
||||
Height="500px">
|
||||
</f:Window>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,329 @@
|
||||
using BLL;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.SupportDocument
|
||||
{
|
||||
public partial class Template : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
GetButtonPower();//按钮权限
|
||||
BindGrid();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"SELECT t.TemplateId,
|
||||
t.Template,
|
||||
t.UploadBy,
|
||||
t.UploadDate,
|
||||
t.AttachUrl,
|
||||
U.UserName AS UploadByName
|
||||
FROM dbo.SupportDocument_Template AS t
|
||||
LEFT JOIN Sys_User AS U ON U.UserId = t.UploadBy
|
||||
WHERE 1=1 ";
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
//if (tvStandardTemp.SelectedNodeID != "0" && tvStandardTemp.SelectedNodeID != null)
|
||||
//{
|
||||
// strSql += " AND t.TemplateTypeId = @TemplateTypeId";
|
||||
// listStr.Add(new SqlParameter("@TemplateTypeId", tvStandardTemp.SelectedNodeID));
|
||||
//}
|
||||
strSql += " ORDER BY t.UploadDate DESC";
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
|
||||
for (int i = 0; i < Grid1.Rows.Count; i++)
|
||||
{
|
||||
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid1.Rows[i].FindControl("lbtnUrl1")));
|
||||
string url = lbtnUrl.CommandArgument.ToString();
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
url = url.Replace('\\', '/');
|
||||
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//protected void btnSearch_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// if (!string.IsNullOrEmpty(this.tvStandardTemp.SelectedNodeID))
|
||||
// {
|
||||
// BindGrid(this.tvStandardTemp.SelectedNodeID);
|
||||
// }
|
||||
//}
|
||||
protected void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
string id = SQLHelper.GetNewID(typeof(Model.SupportDocument_Template));
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader3.aspx?type=add&toKeyId={0}&path=FileUpload/SupportDocument/Template&menuId={1}", id, BLL.Const.TemplateMenuId)));
|
||||
}
|
||||
|
||||
protected void btnEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rowId = Grid1.SelectedRowID;
|
||||
if (!string.IsNullOrEmpty(rowId))
|
||||
{
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader3.aspx?type=edit&toKeyId={0}&path=FileUpload/SupportDocument/Template&menuId={1}", rowId, BLL.Const.TemplateMenuId)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("Please select the record to modify!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("StandardTemplateEdit.aspx?templateId={0}", rowId, "编辑 - ")));
|
||||
}
|
||||
protected void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
var t = BLL.TemplateService.GetTemplateById(rowID);
|
||||
if (t != null)
|
||||
{
|
||||
BLL.TemplateService.DeleteTemplateById(rowID);
|
||||
}
|
||||
}
|
||||
BindGrid();
|
||||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Delete Template");
|
||||
ShowNotify("Deleted successfully!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("Please select the record to Delete!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void Grid1_RowDoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
string rowId = Grid1.SelectedRowID;
|
||||
if (!string.IsNullOrEmpty(rowId))
|
||||
{
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader3.aspx?type=edit&toKeyId={0}&path=FileUpload/SupportDocument/Template&menuId={1}", rowId, BLL.Const.TemplateMenuId)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("Please select the record to modify!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("StandardTemplateEdit.aspx?templateId={0}", rowId, "编辑 - ")));
|
||||
}
|
||||
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
Grid1.PageIndex = e.NewPageIndex;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页显示条数下拉框
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
#region 权限设置
|
||||
/// <summary>
|
||||
/// 菜单按钮权限
|
||||
/// </summary>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.TemplateMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
{
|
||||
this.btnEdit.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnDownload))
|
||||
{
|
||||
this.btnBatchDownload.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||||
{
|
||||
this.btnDelete.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnBatchDownload_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/").Replace('\\', '/');
|
||||
if (Grid1.SelectedRowIDArray.Count() == 0)
|
||||
{
|
||||
Alert.ShowInParent("Please select Download Row!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] rowList = Grid1.SelectedRowIDArray;
|
||||
List<string> durl = new List<string>();
|
||||
List<string> urlList = (from x in Funs.DB.SupportDocument_Template where rowList.Contains(x.TemplateId) && x.AttachUrl != null && x.AttachUrl != "" select x.AttachUrl).ToList();
|
||||
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
string destFile = rootPath + "FileUpload\\Temp\\Template" + date;
|
||||
string zipFileName = "Template_" + date;
|
||||
if (!Directory.Exists(destFile))
|
||||
{
|
||||
Directory.CreateDirectory(destFile);
|
||||
}
|
||||
|
||||
foreach (string url in urlList)
|
||||
{
|
||||
string sourceFileName = rootPath + url.Replace('\\', '/');
|
||||
string[] subUrl = sourceFileName.Split('/');
|
||||
string fileName = subUrl[subUrl.Count() - 1];
|
||||
|
||||
|
||||
string newFileName = fileName.Substring(fileName.IndexOf("~") + 1);
|
||||
if (newFileName.Contains("_"))
|
||||
{
|
||||
if (newFileName.Substring(0, 1) == "_")
|
||||
{
|
||||
newFileName = newFileName.Substring(1, newFileName.Length - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
newFileName = newFileName.Replace(newFileName.Split('_')[0], "");
|
||||
newFileName = newFileName.Substring(1);
|
||||
}
|
||||
}
|
||||
string destFileName = destFile + "/" + newFileName;
|
||||
if (File.Exists(sourceFileName))
|
||||
{
|
||||
File.Copy(sourceFileName, destFileName, true);
|
||||
}
|
||||
}
|
||||
FileZipDownload(destFile.Replace('\\', '/'), zipFileName);
|
||||
}
|
||||
}
|
||||
|
||||
public string DownloadFileByHttpUrl(List<string> HttpUrlList)
|
||||
{
|
||||
if (HttpUrlList == null || HttpUrlList.Count == 0)
|
||||
{
|
||||
return "没有附件";
|
||||
}
|
||||
try
|
||||
{
|
||||
var random = new Random();
|
||||
var zipMs = new MemoryStream();
|
||||
ZipOutputStream zipStream = new ZipOutputStream(zipMs);
|
||||
zipStream.SetLevel(6);//压缩率0~9
|
||||
foreach (var url in HttpUrlList)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(url))
|
||||
{
|
||||
string rootPath = System.Configuration.ConfigurationManager.AppSettings["RootUrl"];
|
||||
string surl = rootPath + url.Replace('\\', '/');
|
||||
var urlStr = HttpUtility.UrlDecode(surl);
|
||||
Console.WriteLine(urlStr);
|
||||
string fileExt = Path.GetExtension(urlStr).ToLower();
|
||||
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(urlStr);
|
||||
var strName = fileNameWithoutExtension.Substring(fileNameWithoutExtension.LastIndexOf("/") + 1) + random.Next(1000, 9999) + fileExt;
|
||||
zipStream.PutNextEntry(new ZipEntry(strName));
|
||||
ServicePointManager.ServerCertificateValidationCallback += (s, cert, chain, sslPolicyErrors) => true;
|
||||
ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlStr);
|
||||
request.AllowAutoRedirect = true;
|
||||
WebProxy proxy = new WebProxy();
|
||||
proxy.BypassProxyOnLocal = true;
|
||||
proxy.UseDefaultCredentials = true;
|
||||
request.Proxy = proxy;
|
||||
WebResponse response = request.GetResponse();
|
||||
using (Stream streams = response.GetResponseStream())
|
||||
{
|
||||
Byte[] buffer = new Byte[1024];
|
||||
int current = 0;
|
||||
while ((current = streams.Read(buffer, 0, buffer.Length)) != 0)
|
||||
{
|
||||
zipStream.Write(buffer, 0, current);
|
||||
}
|
||||
zipStream.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
zipStream.Finish();
|
||||
zipMs.Position = 0;
|
||||
//下边为打包压缩
|
||||
MemoryStream stream = zipMs;
|
||||
byte[] srcBuf = new Byte[stream.Length];
|
||||
stream.Read(srcBuf, 0, srcBuf.Length);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
string filePath = "C:/DownLoad";//Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
string con = "Template";
|
||||
|
||||
|
||||
var file_name = con + "_" + date + ".zip";
|
||||
using (FileStream fs = new FileStream(filePath + "\\" + file_name, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
fs.Write(srcBuf, 0, srcBuf.Length);
|
||||
fs.Close();
|
||||
return "已下载到C盘Download文件下!";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "下载失败:" + ex.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void FileZipDownload(string destFilePath, string zipFileName)
|
||||
{
|
||||
string zipFilePath = destFilePath + ".zip";
|
||||
System.IO.Compression.ZipFile.CreateFromDirectory(destFilePath, zipFilePath);
|
||||
FileInfo info = new FileInfo(zipFilePath);
|
||||
long fileSize = info.Length;
|
||||
System.Web.HttpContext.Current.Response.Clear();
|
||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(zipFileName + ".zip", System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(zipFilePath, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
Funs.DeleteDir(destFilePath);
|
||||
File.Delete(zipFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.SupportDocument
|
||||
{
|
||||
|
||||
|
||||
public partial class Template
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel2;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill2;
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// btnEdit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnEdit;
|
||||
|
||||
/// <summary>
|
||||
/// btnDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDelete;
|
||||
|
||||
/// <summary>
|
||||
/// btnBatchDownload 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnBatchDownload;
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label1;
|
||||
|
||||
/// <summary>
|
||||
/// lbtnUrl1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtnUrl1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarSeparator1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window WindowAtt;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user