人员信息档案图片
This commit is contained in:
parent
b0f0e166d9
commit
ae176da165
|
@ -1208,6 +1208,7 @@
|
|||
<Content Include="HSSE\SitePerson\PersonListEdit.aspx" />
|
||||
<Content Include="HSSE\SitePerson\PersonOut.aspx" />
|
||||
<Content Include="HSSE\SitePerson\PersonUnitList.aspx" />
|
||||
<Content Include="HSSE\SitePerson\PersonListImg.aspx" />
|
||||
<Content Include="HSSE\SitePerson\WorkPostStatistic.aspx" />
|
||||
<Content Include="HSSE\SitePerson\PersonStatistic.aspx" />
|
||||
<Content Include="HSSE\SitePerson\PersonUnitRefresh.aspx" />
|
||||
|
@ -12886,6 +12887,13 @@
|
|||
<Compile Include="HSSE\SitePerson\PersonUnitList.aspx.designer.cs">
|
||||
<DependentUpon>PersonUnitList.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HSSE\SitePerson\PersonListImg.aspx.cs">
|
||||
<DependentUpon>PersonListImg.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="HSSE\SitePerson\PersonListImg.aspx.designer.cs">
|
||||
<DependentUpon>PersonListImg.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HSSE\SitePerson\WorkPostStatistic.aspx.cs">
|
||||
<DependentUpon>WorkPostStatistic.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
|
|
@ -140,6 +140,9 @@
|
|||
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="出场时间"
|
||||
HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:WindowField TextAlign="Left" Width="60px" WindowID="WindowAtt" HeaderText="附件" Text="附件" ToolTip="附件上传查看"
|
||||
DataIFrameUrlFields="PersonId" DataIFrameUrlFormatString="./PersonListImg.aspx?toKeyId={0}"
|
||||
HeaderTextAlign="Center" />
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
|
||||
|
@ -173,6 +176,10 @@
|
|||
<f:Window ID="WindowPunishRecord" Title="处罚记录" Hidden="true" EnableIFrame="true"
|
||||
EnableMaximize="true" Target="Parent" EnableResize="false" runat="server" IsModal="true"
|
||||
Width="1300px" Height="520px">
|
||||
</f:Window>
|
||||
<f:Window ID="WindowAtt" Title="附件" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
|
||||
Height="500px">
|
||||
</f:Window>
|
||||
<f:Menu ID="Menu1" runat="server">
|
||||
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
|
||||
|
|
|
@ -320,6 +320,15 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
|||
/// </remarks>
|
||||
protected global::FineUIPro.Window WindowPunishRecord;
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window WindowAtt;
|
||||
|
||||
/// <summary>
|
||||
/// Menu1 控件。
|
||||
/// </summary>
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PersonListImg.aspx.cs" Inherits="FineUIPro.Web.AttachFile.PersonListImg" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title></title>
|
||||
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
<meta name="sourcefiles" content="~/AttachFile/fileupload.ashx" />
|
||||
<style type="text/css">
|
||||
.webuploader-element-invisible {
|
||||
position: absolute !important;
|
||||
clip: rect(1px,1px,1px,1px);
|
||||
}
|
||||
|
||||
.webuploader-pick-disable {
|
||||
opacity: 0.6;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="SimpleForm1"/>
|
||||
<f:Grid ID="Grid1" runat="server" ShowHeader="false" ShowBorder="true" Title="文件上传"
|
||||
Width="650px" Height="360px" EnableColumnLines="true"
|
||||
EnableCollapse="false" EnableCheckBoxSelect="false" EmptyText="尚未上传文件"
|
||||
DataIDField="id" OnRowCommand="Grid1_RowCommand">
|
||||
<Toolbars>
|
||||
<f:Toolbar runat="server" ID="toolBar" Hidden="true" ToolbarAlign="Right">
|
||||
<Items>
|
||||
<f:Button ID="btnImageMagnify" runat="server" IconFont="Inbox" ToolTip="扫描文件" OnClick="btnImageMagnify_Click"></f:Button>
|
||||
<f:ToolbarFill runat="server">
|
||||
</f:ToolbarFill>
|
||||
<f:Button ID="btnSelectFiles" ToolTip="选择文件上传" IconFont="Upload" runat="server" EnablePostBack="false">
|
||||
</f:Button>
|
||||
<f:ToolbarSeparator runat="server"></f:ToolbarSeparator>
|
||||
<f:Button ID="btnDelete" ToolTip="删除选中文件" IconFont="Trash" runat="server" OnClick="btnDelete_Click">
|
||||
</f:Button>
|
||||
<f:ToolbarSeparator ID="ToolbarSeparator2" runat="server"></f:ToolbarSeparator>
|
||||
<f:Button ID="btnSave" ToolTip="保存" IconFont="Save" runat="server" OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:LinkButtonField ColumnID="FileName" DataTextField="name" DataToolTipField="name" HeaderText="文件名"
|
||||
ExpandUnusedSpace="True" CommandName="Attach" EnableAjax="false" />
|
||||
<f:BoundField ColumnID="Type" DataField="type" HeaderText="文件类型" Width="100px" />
|
||||
<f:BoundField ColumnID="FileType" DataField="FileType" HeaderText="类型" Width="100px" />
|
||||
<f:RenderField ColumnID="FileSize" DataField="size" HeaderText="大小" Renderer="FileSize" Width="90px" />
|
||||
<f:BoundField ColumnID='FileStatus' DataField="status" NullDisplayText="已完成" HeaderText="状态" Width="90px" />
|
||||
<f:LinkButtonField Width="60px" ConfirmText="你确定要删除这个文件吗?" ConfirmTarget="Parent" Text="删除"
|
||||
HeaderText="删除" CommandName="Delete" IconUrl="~/res/icon/delete.png" Hidden="true"/>
|
||||
</Columns>
|
||||
</f:Grid>
|
||||
<br />
|
||||
注:本多附件上传支持的浏览器版本为:Chrome、Firefox、Safari、IE10+ 。
|
||||
<f:Window ID="Window1" Title="播放" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Parent" EnableResize="false" runat="server" IsModal="true"
|
||||
Width="700px" Height="600px">
|
||||
</f:Window>
|
||||
</form>
|
||||
<script src="../../AttachFile/res/webuploader/webuploader.nolog.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var btnDeleteClientID = '<%= btnDelete.ClientID %>';
|
||||
var btnSelectFilesClientID = '<%= btnSelectFiles.ClientID %>';
|
||||
var gridClientID = '<%= Grid1.ClientID %>';
|
||||
var BASE_URL = '<%= ResolveUrl("~/") %>';
|
||||
var SERVER_URL = BASE_URL + 'AttachFile/fileupload.ashx';
|
||||
F.ready(function () {
|
||||
var grid = F(gridClientID);
|
||||
var uploader = WebUploader.create({
|
||||
// swf文件路径
|
||||
swf: BASE_URL + 'AttachFile/res/webuploader/Uploader.swf',
|
||||
// 文件接收服务端。
|
||||
server: SERVER_URL,
|
||||
// 选择文件的按钮。可选。
|
||||
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
|
||||
pick: '#' + btnSelectFilesClientID,
|
||||
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
|
||||
resize: false,
|
||||
// 自动上传
|
||||
auto: true,
|
||||
// 文件上传参数表,用来标记文件的所有者(如果是一篇文章的附件,就是文章的ID)
|
||||
formData: {
|
||||
owner: '<%= ParamStr%>'
|
||||
},
|
||||
// 单个文件大小限制(单位:byte),这里限制为 500M
|
||||
fileSingleSizeLimit: 500 * 1024 * 1024
|
||||
|
||||
});
|
||||
|
||||
// 添加到上传队列
|
||||
uploader.on('fileQueued', function (file) {
|
||||
grid.addNewRecord(file.id, {
|
||||
'FileName': file.name,
|
||||
'FileType': file.ext,
|
||||
'FileSize': file.size,
|
||||
'FileStatus': '等待上传'
|
||||
}, true);
|
||||
});
|
||||
|
||||
uploader.on('uploadProgress', function (file, percentage) {
|
||||
var cellEl = grid.getCellEl(file.id, 'FileStatus').find('.f-grid-cell-inner');
|
||||
var barEl = cellEl.find('.ui-progressbar-value');
|
||||
// 避免重复创建
|
||||
if (!barEl.length) {
|
||||
cellEl.html('<div class="ui-progressbar ui-widget ui-widget-content ui-corner-all" style="height:12px;">' +
|
||||
'<div class="ui-progressbar-value ui-widget-header ui-corner-left" style="width:0%">' +
|
||||
'</div></div>');
|
||||
barEl = cellEl.find('.ui-progressbar-value');
|
||||
}
|
||||
|
||||
barEl.css('width', percentage * 100 + '%');
|
||||
});
|
||||
|
||||
uploader.on('uploadSuccess', function (file) {
|
||||
var cellEl = grid.getCellEl(file.id, 'FileStatus').find('.f-grid-cell-inner');
|
||||
cellEl.text('上传成功');
|
||||
});
|
||||
|
||||
uploader.on('uploadError', function (file) {
|
||||
var cellEl = grid.getCellEl(file.id, 'FileStatus').find('.f-grid-cell-inner');
|
||||
cellEl.text('上传出错');
|
||||
});
|
||||
|
||||
// 不管上传成功还是失败,都会触发 uploadComplete 事件
|
||||
uploader.on('uploadComplete', function (file) {
|
||||
uploader.removeFile(file, true);
|
||||
});
|
||||
|
||||
|
||||
// 当开始上传流程时触发
|
||||
uploader.on('startUpload', function () {
|
||||
// 禁用删除按钮
|
||||
F(btnDeleteClientID).disable();
|
||||
});
|
||||
|
||||
// 当所有文件上传结束时触发
|
||||
uploader.on('uploadFinished', function () {
|
||||
// 启用删除按钮
|
||||
F(btnDeleteClientID).enable();
|
||||
|
||||
// 回发页面,重新绑定表格数据
|
||||
__doPostBack('', 'RebindGrid');
|
||||
});
|
||||
|
||||
uploader.on('error', function (type, arg, file) {
|
||||
if (type === 'F_EXCEED_SIZE') {
|
||||
F.alert('文件[' + file.name + ']大小超出限制值(' + F.format.fileSize(arg) + ')');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,540 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using WIA;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace FineUIPro.Web.AttachFile
|
||||
{
|
||||
public partial class PersonListImg : PageBase
|
||||
{
|
||||
private static readonly string sessionName = "AttachFile.webuploader";
|
||||
protected string ParamStr;
|
||||
|
||||
#region 定义项
|
||||
public string ToKeyId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ToKeyId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ToKeyId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string AttachPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["AttachPath"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["AttachPath"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string MenuId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["MenuId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["MenuId"] = value;
|
||||
}
|
||||
}
|
||||
public string Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["Type"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["Type"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Source
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["Source"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["Source"] = value;
|
||||
}
|
||||
}
|
||||
public string JointCheck
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["JointCheck"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["JointCheck"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载页面
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
// 删除选中行
|
||||
this.btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!");
|
||||
this.btnDelete.ConfirmText = String.Format("你确定要删除选中的 <b><script>{0}</script></b> 个文件吗?", Grid1.GetSelectedCountReference());
|
||||
Session[sessionName] = null;
|
||||
this.ToKeyId = Request.QueryString["toKeyId"];
|
||||
this.AttachPath = Request.QueryString["path"];
|
||||
this.ParamStr = sessionName + "|" + AttachPath;
|
||||
this.MenuId = Request.QueryString["menuId"];
|
||||
this.Type = Request.Params["type"];
|
||||
this.GetButtonPower();
|
||||
this.BindGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetRequestEventArgument() == "RebindGrid")
|
||||
{
|
||||
this.BindGrid();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region BindGrid
|
||||
/// <summary>
|
||||
/// 绑定GV
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
|
||||
Grid1.DataSource = SourceData();
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 文件柜专用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private JArray SourceData()
|
||||
{
|
||||
if (Session[sessionName] == null && !string.IsNullOrEmpty(ToKeyId))
|
||||
{
|
||||
JArray temp = new JArray();
|
||||
Session[sessionName] = temp;
|
||||
StringBuilder stxt = new StringBuilder();
|
||||
List<string> listToKeyId = new List<string>();
|
||||
listToKeyId.Add(ToKeyId + "#1");
|
||||
listToKeyId.Add(ToKeyId + "#2");
|
||||
listToKeyId.Add(ToKeyId + "#3");
|
||||
listToKeyId.Add(ToKeyId + "#4");
|
||||
listToKeyId.Add(ToKeyId + "#5");
|
||||
IList<Model.AttachFile> sourlist = Funs.DB.AttachFile.Where(p => listToKeyId.Contains(p.ToKeyId)).ToList();
|
||||
|
||||
if (sourlist.Count > 0)
|
||||
{
|
||||
|
||||
|
||||
foreach (var sour in sourlist)
|
||||
{
|
||||
JArray jarrayTwo = JArray.Parse(sour.AttachSource);
|
||||
for (int i = 0; i < jarrayTwo.Count; i++)
|
||||
{
|
||||
var tempo = jarrayTwo[i];
|
||||
if (sour.ToKeyId == (ToKeyId + "#1"))
|
||||
{
|
||||
tempo["FileType"] = "身份证正面";
|
||||
}
|
||||
else if (sour.ToKeyId == (ToKeyId + "#2"))
|
||||
{
|
||||
tempo["FileType"] = "保险";
|
||||
}
|
||||
else if(sour.ToKeyId == (ToKeyId + "#3"))
|
||||
{
|
||||
tempo["FileType"] = "体检证明";
|
||||
}
|
||||
else if (sour.ToKeyId == (ToKeyId + "#4"))
|
||||
{
|
||||
tempo["FileType"] = "安全生产考核合格证书/特种作业操作证";
|
||||
}
|
||||
else if (sour.ToKeyId == (ToKeyId + "#5"))
|
||||
{
|
||||
tempo["FileType"] = "身份证背面";
|
||||
}
|
||||
temp.Add(tempo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return (JArray)Session[sessionName];
|
||||
}
|
||||
|
||||
#region Events
|
||||
/// <summary>
|
||||
/// 删除按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (string rowId in Grid1.SelectedRowIDArray)
|
||||
{
|
||||
DeleteRow(rowId);
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 行事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
||||
{
|
||||
if (e.CommandName == "Delete")
|
||||
{
|
||||
DeleteRow(e.RowID);
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
if (e.CommandName == "Attach")
|
||||
{
|
||||
JArray source = GetSourceData();
|
||||
for (int i = 0, count = source.Count; i < count; i++)
|
||||
{
|
||||
JObject item = source[i] as JObject;
|
||||
if (item.Value<string>("id") == e.RowID)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string savedName = item.Value<string>("savedName");
|
||||
string folder = item.Value<string>("folder");
|
||||
string xnUrl = AttachPath + "\\" + savedName;
|
||||
if (!string.IsNullOrEmpty(folder))
|
||||
{
|
||||
xnUrl = folder + savedName;
|
||||
}
|
||||
|
||||
string url = Funs.RootPath + xnUrl;
|
||||
if (savedName.Contains("FileUpLoad"))
|
||||
{
|
||||
url = Funs.RootPath + savedName.Replace('/', '\\');
|
||||
}
|
||||
FileInfo info = new FileInfo(url);
|
||||
if (!info.Exists || string.IsNullOrEmpty(savedName))
|
||||
{
|
||||
url = Funs.RootPath + "Images//Null.jpg";
|
||||
info = new FileInfo(url);
|
||||
}
|
||||
|
||||
if (Path.GetExtension(savedName) == ".mp4" || Path.GetExtension(savedName).ToLower() == ".mp4" || Path.GetExtension(savedName) == ".m4v")
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/player.aspx?url={0}", xnUrl.Replace('\\', '/'), "播放 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Path.GetExtension(savedName) == ".gif" || Path.GetExtension(savedName) == ".jpg" || Path.GetExtension(savedName) == ".jpeg" || Path.GetExtension(savedName) == ".bmp" || Path.GetExtension(savedName) == ".png")
|
||||
{
|
||||
string httpUrl = Funs.SGGLUrl + xnUrl;
|
||||
ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script type='text/javascript'>window.open('" + httpUrl + "');</script>");
|
||||
}
|
||||
else
|
||||
{
|
||||
string fileName = Path.GetFileName(url);
|
||||
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.ContentType = "application/octet-stream";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(url, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.End();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetSourceData
|
||||
/// <summary>
|
||||
/// 得到Session
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private JArray GetSourceData()
|
||||
{
|
||||
if (Session[sessionName] == null && !string.IsNullOrEmpty(ToKeyId))
|
||||
{
|
||||
Session[sessionName] = new JArray();
|
||||
Model.AttachFile sour = new Model.AttachFile();
|
||||
|
||||
|
||||
sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == ToKeyId);
|
||||
|
||||
|
||||
if (sour != null)
|
||||
{
|
||||
string url = sour.AttachUrl.Replace('\\', '/');
|
||||
List<string> list = Funs.GetStrListByStr(url, ',');
|
||||
if (list.Count() > 0)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var item in list)
|
||||
{
|
||||
string atturl = Funs.RootPath + item.Replace(';', ' ').Trim();
|
||||
if (File.Exists(atturl))
|
||||
{
|
||||
i += 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i > 0)
|
||||
{
|
||||
Session[sessionName] = JArray.Parse(sour.AttachSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (JArray)Session[sessionName];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="rowId"></param>
|
||||
private void DeleteRow(string rowId)
|
||||
{
|
||||
JArray source = GetSourceData();
|
||||
for (int i = 0, count = source.Count; i < count; i++)
|
||||
{
|
||||
JObject item = source[i] as JObject;
|
||||
if (item.Value<string>("id") == rowId)
|
||||
{
|
||||
try
|
||||
{
|
||||
string savedName = item.Value<string>("savedName");
|
||||
string attachUrl = AttachPath + "\\" + savedName;
|
||||
if (!string.IsNullOrEmpty(item.Value<string>("folder")))
|
||||
{
|
||||
attachUrl = item.Value<string>("folder") + savedName;
|
||||
}
|
||||
File.Delete(Server.MapPath("~/" + attachUrl));
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, "删除附件!", null, this.MenuId, BLL.Const.BtnDelete);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// 尝试删除物理文件失败,不做处理
|
||||
}
|
||||
source.RemoveAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Session[sessionName] = source;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存按钮事件
|
||||
/// <summary>
|
||||
/// 保存按钮事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
JArray source = GetSourceData();
|
||||
if (!string.IsNullOrEmpty(source.ToString()))
|
||||
{
|
||||
string attachUrl = string.Empty;
|
||||
for (int i = 0, count = source.Count; i < count; i++)
|
||||
{
|
||||
JObject item = source[i] as JObject;
|
||||
if (!string.IsNullOrEmpty(item.Value<string>("folder")))
|
||||
{
|
||||
attachUrl += item.Value<string>("folder") + item.Value<string>("savedName") + ",";
|
||||
}
|
||||
else
|
||||
{
|
||||
attachUrl += AttachPath + "/" + DateTime.Now.ToString("yyyy-MM") + "/" + item.Value<string>("savedName") + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(attachUrl))
|
||||
{
|
||||
attachUrl = attachUrl.Substring(0, attachUrl.LastIndexOf(",")).Replace('\\', '/');
|
||||
}
|
||||
///保存方法
|
||||
this.SaveData(source.ToString(), attachUrl);
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 保存附件
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="attachUrl"></param>
|
||||
private void SaveData(string source, string attachUrl)
|
||||
{
|
||||
UploadFileService.SaveAttachUrl(source, attachUrl, MenuId, ToKeyId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描文件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnImageMagnify_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceManager manager = new DeviceManagerClass();
|
||||
Device device = null;
|
||||
foreach (DeviceInfo info in manager.DeviceInfos)
|
||||
{
|
||||
if (info.Type != WiaDeviceType.ScannerDeviceType)
|
||||
continue;
|
||||
device = info.Connect();
|
||||
break;
|
||||
}
|
||||
Item item = device.Items[1];
|
||||
CommonDialogClass cdc = new WIA.CommonDialogClass();
|
||||
ImageFile imageFile = null;
|
||||
imageFile = cdc.ShowAcquireImage(WIA.WiaDeviceType.ScannerDeviceType,
|
||||
WIA.WiaImageIntent.TextIntent,
|
||||
WIA.WiaImageBias.MaximizeQuality,
|
||||
"{00000000-0000-0000-0000-000000000000}",
|
||||
true,
|
||||
true,
|
||||
false);
|
||||
if (imageFile != null)
|
||||
{
|
||||
var buffer = imageFile.FileData.get_BinaryData() as byte[];
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
ms.Write(buffer, 0, buffer.Length);
|
||||
string filePath = Server.MapPath("~/") + AttachPath; ///文件夹
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
string name = "\\";
|
||||
var menu = BLL.SysMenuService.GetSysMenuByMenuId(this.MenuId);
|
||||
if (menu != null)
|
||||
{
|
||||
name += menu.MenuName;
|
||||
|
||||
}
|
||||
name += Funs.GetNewFileName() + ".jpg";
|
||||
string url = filePath + name;
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
using (FileStream fs = new FileStream(url, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
ms.WriteTo(fs);
|
||||
string attachUrl = AttachPath + name;
|
||||
if (!string.IsNullOrEmpty(attachUrl))
|
||||
{
|
||||
attachUrl = attachUrl.Replace('/', '\\');
|
||||
}
|
||||
string oldSrouce = string.Empty;
|
||||
string FullPath = string.Empty;
|
||||
Model.AttachFile att = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.ToKeyId);
|
||||
if (att != null && !string.IsNullOrEmpty(att.AttachUrl))
|
||||
{
|
||||
FullPath = att.AttachUrl + "," + attachUrl;
|
||||
oldSrouce = att.AttachSource;
|
||||
}
|
||||
else
|
||||
{
|
||||
FullPath = attachUrl;
|
||||
}
|
||||
string source = BLL.UploadFileService.GetSourceByAttachUrl(attachUrl, buffer.Length, oldSrouce);
|
||||
//this.SaveData(source, FullPath); ///保存方法
|
||||
Session[sessionName] = JArray.Parse(source);
|
||||
}
|
||||
|
||||
this.BindGrid();
|
||||
ShowNotify("扫描完成!", MessageBoxIcon.Success);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
ShowNotify("请检查扫描仪是否连接正确!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
#region 获取权限按钮
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
if (this.Type == "0")
|
||||
{
|
||||
this.toolBar.Hidden = false;
|
||||
}
|
||||
else if (this.Type == "-1")
|
||||
{
|
||||
this.toolBar.Hidden = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.CurrUser != null && this.MenuId != Const.ProjectPunishNoticeStatisticsMenuId)
|
||||
{
|
||||
var buttonList = CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, MenuId);
|
||||
if (buttonList.Count > 0)
|
||||
{
|
||||
if (buttonList.Contains(Const.BtnSave) || buttonList.Contains(Const.BtnAuditing))
|
||||
{
|
||||
this.toolBar.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnPlay_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.AttachFile
|
||||
{
|
||||
|
||||
|
||||
public partial class PersonListImg
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// toolBar 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar toolBar;
|
||||
|
||||
/// <summary>
|
||||
/// btnImageMagnify 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImageMagnify;
|
||||
|
||||
/// <summary>
|
||||
/// btnSelectFiles 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSelectFiles;
|
||||
|
||||
/// <summary>
|
||||
/// btnDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDelete;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarSeparator2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator2;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue