Init YZ_BASF

This commit is contained in:
2024-05-13 08:48:51 +08:00
parent 2ff382ee61
commit c586dd7e9e
3815 changed files with 616322 additions and 0 deletions
@@ -0,0 +1,126 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditOffice.aspx.cs" Inherits="FineUIPro.Web.FileManage.EditOffice" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta content="IE=7" http-equiv="X-UA-Compatible" />
<title>文档编辑</title>
<link href="../Styles/Style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="ntko.js"></script>
<script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
</head>
<body onload='javascript:TANGER_OCX_OpenDoc1("<% = readURL %>","<%=newofficetype %>");' >
<form id="form1" action="Save.aspx" enctype="multipart/form-data">
<div id="editmain">
<div id="editmain_middle" class="editmain_middle">
<div id="editmain_right" class="editmain_right">
<div id="formtop">
<table width="100%" cellpadding="1" cellspacing="1" class="table">
<tr>
<td align="center" colspan="8" style="height:32px">
<%if (strOper != "read")
{%>
<input type="button" class="button" value="保存关闭" onclick="saveFileToUrl()"/>
<input type="button" class="button" value="打开本地文件" onclick="WebOpenLocal()"/>
<input type="button" class="button" value="存为本地文件" onclick="WebSaveLocal()"/>
<%}%>
<input type="button" class="button" value="返回关闭" onclick="javascript:window.close();" style="width:80"/>
<input type="button" class="button" value="页面设置" onclick="WebPageSetup()"/>
<input type="button" class="button" value="打印文档" onclick="TANGER_OCX_PrintDoc(false)"/>
</td>
</tr>
<tr align="left">
<td colspan="8"> &nbsp;文件编号:
<input id="txtFileCode" name="txtFileCode" style="width:120px" type="text" value="<%=txtFileCode %>" />
文件名称:
<input id="txtFileName" name="txtFileName" style="width:240px" type="text" value="<%=txtFileName %>"/>
<input id="txtFileId" style="width:50px" name="txtFileId" type="hidden" value="<%=txtFileId %>" />
<input id="typeFlag" style="width:50px" name="typeFlag" type="hidden" value="<%=typeFlag %>" />
</td>
</tr>
</table>
</div>
<div id="officecontrol">
<!--引用NTKO OFFICE文档控件-->
<script language="javascript" type="text/javascript" src="../OfficeControl/ntkoofficecontrol.js"></script>
<!--控件事件代码开始-->
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(cmd,canceled);">
alert(cmd);
CancelLastCommand=true;
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentClosed();">
setFileOpenedOrClosed(false);
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentOpened(TANGER_OCX_str,TANGER_OCX_obj);">
//saved属性用来判断文档是否被修改过,文档打开的时候设置成ture,当文档被修改,自动被设置为false,该属性由office提供.
TANGER_OCX_OBJ.ActiveDocument.Saved = true;
if(2==TANGER_OCX_OBJ.DocType)
{
try{
TANGER_OCX_OBJ.ActiveDocument.Application.ActiveWorkbook.Saved=true;
}catch(e)
{
alert("错误:" + err.number + ":" + err.description);
}
}
setFileOpenedOrClosed(true);//设置文档状态值
controlStyle();//插入控件样式自定义菜单
SetReviewMode(false);//设置文档在痕迹模式下编辑
setShowRevisions(false); //设置是否显示痕迹
objside2();
TANGER_OCX_OBJ.SetBookmarkValue ('projectName','<%=projectName %>');
TANGER_OCX_OBJ.SetBookmarkValue ('projectName1','<%=projectName1 %>');
TANGER_OCX_OBJ.SetBookmarkValue ('projectName2','<%=projectName2 %>');
TANGER_OCX_OBJ.SetBookmarkValue ('projectName3','<%=projectName3 %>');
TANGER_OCX_OBJ.SetBookmarkValue ('projectCode','<%=projectCode %>');
TANGER_OCX_OBJ.SetBookmarkValue ('projectCode1','<%=projectCode1 %>');
TANGER_OCX_OBJ.SetBookmarkValue ('projectCode2','<%=projectCode2 %>');
TANGER_OCX_OBJ.SetBookmarkValue ('projectCode3','<%=projectCode3 %>');
TANGER_OCX_OBJ.SetBookmarkValue ('fileCode','<%=fileCode %>');
TANGER_OCX_OBJ.SetBookmarkValue ('fileCode1','<%=fileCode1 %>');
TANGER_OCX_OBJ.SetBookmarkValue ('fileCode2','<%=fileCode2 %>');
TANGER_OCX_OBJ.SetBookmarkValue ('fileCode3','<%=fileCode3 %>');
TANGER_OCX_OBJ.SetBookmarkValue ('bzr','<%=bzr %>');
TANGER_OCX_OBJ.SetBookmarkValue ('shr','<%=shr %>');
TANGER_OCX_OBJ.SetBookmarkValue ('spr','<%=spr %>');
TANGER_OCX_OBJ.SetBookmarkValue ('fbdate','<%=fbdate %>');
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="BeforeOriginalMenuCommand(TANGER_OCX_str,TANGER_OCX_obj);">
alert("BeforeOriginalMenuCommand事件被触发");
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(TANGER_OCX_str,TANGER_OCX_obj);">
if (TANGER_OCX_str == 3)
{
alert("不能保存!");
CancelLastCommand = true;
}
</script>
<script language="JScript" for="TANGER_OCX" event="OnCustomMenuCmd2(menuPos,submenuPos,subsubmenuPos,menuCaption,menuID)">
//alert("第" + menuPos +","+ submenuPos +","+ subsubmenuPos +"个菜单项,menuID="+menuID+",菜单标题为\""+menuCaption+"\"的命令被执行.");
if("全网页查看"==menuCaption)objside();
if("恢复原大小"==menuCaption)objside2();
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="AfterPublishAsPDFToURL(result,code);">
result=trim(result);
alert(result);
if(result=="succeed")
{window.close();}
</script>
<!--控件事件代码结束-->
</div>
</div>
</div>
</div>
</form>
</body>
</html>
@@ -0,0 +1,539 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace FineUIPro.Web.FileManage
{
public partial class EditOffice : PageBase
{
public string docId, newofficetype, readURL, strOper, typeFlag;
public string txtFileId, txtFileCode, txtFileName, drpBigType, drpSmallType;//定义表单数据
public string projectName, projectCode, projectCode1, projectCode2, projectCode3,
fileCode, fileCode1, fileCode2, fileCode3, projectName1, projectName2, projectName3,
bzr, shr, spr, fbdate;
protected void Page_Load(object sender, EventArgs e)
{
docId = Request.QueryString["docId"];
newofficetype = Request.QueryString["newofficetype"];
drpBigType = Request.QueryString["drpBigType"];
drpSmallType = Request.QueryString["drpSmallType"];
strOper = Request.QueryString["oper"];
typeFlag = Request.QueryString["typeFlag"];
var p = BLL.Base_ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
if (p != null)
{
projectName = p.ProjectName;
projectName1 = projectName;
projectName2 = projectName;
projectName3 = projectName;
projectCode = p.ProjectCode;
projectCode1 = projectCode;
projectCode2 = projectCode;
projectCode3 = projectCode;
}
if (docId != null && docId != "")
{
txtFileId = docId;
//SqlDataReader dr = null;
string strSql = string.Empty;
readURL = "Read.aspx?typeFlag=" + typeFlag + "&docid=" + docId;
try
{
if (typeFlag == "00")
{
//strSql = "select * from Office_File where FileId=" + docId;
//dr = BLL.SQLHelper.RunSql(strSql);
//var q = from x in Funs.DB.Common_FileManage where x.FileId.ToString() == docId select x;
//if (q.Count()>0)
//{
// txtFileCode =q.First().FileCode;
// txtFileName = q.First().FileName.ToString();
// drpBigType = q.First().BigType.ToString();
// drpSmallType = q.First().SmallType.ToString();
//}
}
//if (typeFlag == Const.HSSE_ManagerRuleTemplate)
//{
// //strSql = "select FileCode, FileName, CompileMan, IssueDate from HSSE_ActionPlan_ManagerRule where ManagerRuleId='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.HSSE_ActionPlan_ManagerRule where x.ManagerRuleId == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().FileCode;
// txtFileName = q.First().FileName.ToString();
// fileCode = q.First().FileCode;
// fileCode1 = fileCode;
// if (q.First().IssueDate != null)
// {
// fbdate = q.First().IssueDate.ToString();
// }
// bzr = BLL.Sys_UserService.GetUserNameByUserId(q.First().CompileMan.ToString());
// //shr = BLL.HSSE_ActionPlan_ManagerRuleApproveService.GetUserName(txtFileCode, "3");
// //spr = BLL.HSSE_ActionPlan_ManagerRuleApproveService.GetUserName(txtFileCode, "4");
// }
//}
//if (typeFlag == Const.HSSE_ActionPlanTemplate)
//{
// //strSql = "select ActionPlanCode,ActionPlanName,CompileMan from dbo.HSSE_ActionPlan_ActionPlan where ActionPlanCode='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.HSSE_ActionPlan_ActionPlan where x.ActionPlanCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().ActionPlanCode.ToString();
// txtFileName = q.First().ActionPlanName.ToString();
// fileCode = q.First().ActionPlanCode.ToString();
// bzr = BLL.Sys_UserService.GetUserNameByUserId(q.First().CompileMan.ToString());
// shr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 2);
// spr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 3);
// //fbdate = BLL.AuditFlowApproveService.GetIssueDate(txtFileCode, "3");
// }
//}
//if (typeFlag == Const.HSSE_MeetingTemplate)
//{
// //strSql = "select MeetingListCode, MeetingName, RecordMan from dbo.HSSE_Meeting_MeetingList where MeetingListCode='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.HSSE_Meeting_MeetingList where x.MeetingListCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().MeetingListCode.ToString();
// txtFileName = q.First().MeetingName.ToString();
// fileCode = q.First().MeetingListCode.ToString();
// bzr = BLL.Sys_UserService.GetUserNameByUserId(q.First().RecordMan.ToString());
// shr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 2);
// spr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 3);
// fbdate = BLL.AuditFlowApproveService.GetIssueDate(txtFileCode, 3);
// }
//}
//if (typeFlag == Const.HSSE_EmergencyTemplate)
//{
// //strSql = "select EmergencyCode, FileName from HSSE_Emergency_EmergencyList where EmergencyCode='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.HSSE_Emergency_EmergencyList where x.EmergencyCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().EmergencyCode.ToString();
// txtFileName = q.First().FileName.ToString();
// fileCode = q.First().EmergencyCode.ToString();
// }
//}
//if (typeFlag == Const.HSSE_EmergencyDrillTemplate)
//{
// //strSql = "select DrillRecordCode, DrillName from HSSE_Emergency_DrillRecord where DrillRecordCode='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.HSSE_Emergency_DrillRecord where x.DrillRecordCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().DrillRecordCode.ToString();
// if (q.First().DrillName != null)
// {
// txtFileName = q.First().DrillName.ToString();
// }
// fileCode = q.First().DrillRecordCode.ToString();
// }
//}
//if (typeFlag == Const.HSSE_ManagerWeekTemplate)
//{
// //strSql = "select ManagerWeekCode, FileName from HSSE_Manager_ManagerWeek where ManagerWeekCode='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.HSSE_Manager_ManagerWeek where x.ManagerWeekCode == docId select x;
// if (q.Count()>0)
// {
// txtFileCode = q.First().ManagerWeekCode.ToString();
// if (q.First().FileName != null)
// {
// txtFileName = q.First().FileName.ToString();
// }
// fileCode = q.First().ManagerWeekCode.ToString();
// }
//}
//if (typeFlag == Const.HSSE_ManagerTotalTemplate)
//{
// //strSql = "select ManagerTotalCode, FileName from HSSE_Manager_ManagerTotal where ManagerTotalCode='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.HSSE_Manager_ManagerTotal where x.ManagerTotalCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().ManagerTotalCode.ToString();
// if (q.First().FileName != null)
// {
// txtFileName = q.First().FileName.ToString();
// }
// fileCode = q.First().ManagerTotalCode.ToString();
// }
//}
//if (typeFlag == Const.HSSE_ManagerPerformanceTemplate)
//{
// //strSql = "select ManagerPerformanceCode, FileName from HSSE_Manager_ManagerPerformance where ManagerPerformanceCode ='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.HSSE_Manager_ManagerPerformance where x.ManagerPerformanceCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().ManagerPerformanceCode.ToString();
// if (q.First().FileName != null)
// {
// txtFileName = q.First().FileName.ToString();
// }
// fileCode = q.First().ManagerPerformanceCode.ToString();
// }
//}
//if (typeFlag == Const.HSSE_SecurityLicenseTemplate) // 新开项目
//{
// //strSql = "select LicenseManagerCode, LicenseName from HSSE_License_LicenseManager where LicenseManagerCode='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.HSSE_License_SecurityLicense where x.SecurityLicenseId == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().LicenseCode.ToString();
// if (q.First().LicenseName != null)
// {
// txtFileName = q.First().LicenseName.ToString();
// }
// fileCode = q.First().LicenseCode.ToString();
// }
//}
//if (typeFlag == Const.HSSE_AccidentTemplate)
//{
// //strSql = "select AccidentRecordId from HSSE_Accident_AccidentRecord where AccidentRecordId='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.HSSE_Accident_AccidentRecord where x.AccidentRecordId == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = "001";
// if (q.First().AccidentRecordId != null)
// {
// txtFileName = "安全事故报告";
// }
// }
//}
//if (typeFlag == Const.HSSE_Log)
//{
// strSql = "select Code from dbo.HSSE_Log where LogId ='" + docId + "'";
// dr = BLL.SQLHelper.RunSql(strSql);
// if (dr.Read())
// {
// txtFileCode = dr["Code"].ToString();
// txtFileName = "HSSE管理日志";
// fileCode = dr["Code"].ToString();
// }
//}
if (typeFlag == "110")
{
//strSql = "select FinalFileCode, FinalFileName from View_FinalFile where FinalFileCode='" + docId + "'";
//dr = BLL.SQLHelper.RunSql(strSql);
//var q = from x in Funs.DB.View_FinalFile where x.AccidentRecordId == docId select x;
//if (q.Count() > 0)
//{
// txtFileCode = dr["FinalFileCode"].ToString();
// if (dr["FinalFileName"] != null)
// {
// txtFileName = dr["FinalFileName"].ToString();
// }
//}
}
//////////////////////////////////////////////////////////////////////////////////////////
//if (typeFlag == Const.TempFileTemplate)
//{
// //strSql = "select * from CQMS_TempFile where o_pkid = '" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_TempFile where x.O_pkid.ToString() == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().O_pkid.ToString(); ;
// if (q.First().O_name != null)
// {
// txtFileName = q.First().O_name.ToString();
// }
// }
//}
//if (typeFlag == Const.HSSE_PauseNoticeTemplate)
//{
// //strSql = "select PauseNoticeCode, FileName from dbo.HSSE_Check_PauseNotice where PauseNoticeCode ='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.HSSE_Check_PauseNotice where x.PauseNoticeCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().PauseNoticeCode.ToString();
// if (q.First().FileName != null)
// {
// txtFileName = q.First().FileName.ToString();
// }
// fileCode = q.First().PauseNoticeCode.ToString();
// }
//}
//////////////////////////////////////以下为质量////////////////////////////////////////////////
//if (typeFlag == Const.CQMS_ConstructSolutionTemplate)
//{
// //strSql = "select ConstructSolutionCode,c.CnProfessionName as FileName from CQMS_Solution_ConstructSolutionModel m left join WBS_CnProfessionInit c on m.CNProfessionalCode=c.CnProfessionCode where ConstructSolutionId='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_Solution_ConstructSolutionModel
// join y in Funs.DB.WBS_CnProfessionInit on x.CNProfessionalCode equals y.CnProfessionCode
// where x.ConstructSolutionId == docId
// select new { x.ConstructSolutionCode, y.CnProfessionName };
// if (q.Count() > 0)
// {
// txtFileCode = q.First().ConstructSolutionCode.ToString();
// if (q.First().CnProfessionName != null)
// {
// txtFileName = q.First().CnProfessionName.ToString();
// }
// }
//}
//if (typeFlag == Const.CQMS_ManagerRuleTemplate)
//{
// //strSql = "select FileCode, FileName,CompileMan, IssueDate from CQMS_ActionPlan_ManagerRule where ManagerRuleId='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_ActionPlan_ManagerRule where x.ManagerRuleId == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().FileCode.ToString();
// if (q.First().FileName != null)
// {
// txtFileName = q.First().FileName.ToString();
// }
// fileCode = projectCode + "-" + q.First().FileCode.ToString();
// if (q.First().IssueDate != null)
// {
// fbdate = q.First().IssueDate.ToString();
// }
// bzr = BLL.Sys_UserService.GetUserNameByUserId(q.First().CompileMan.ToString());
// //shr = BLL.CQMS_ActionPlan_ManagerRuleApproveService.GetUserName(txtFileCode, "3");
// //spr = BLL.CQMS_ActionPlan_ManagerRuleApproveService.GetUserName(txtFileCode, "4");
// }
//}
//if (typeFlag == Const.CQMS_DrawingAuditTemplate)
//{
// //strSql = "select DrawingAuditCode, FileName from dbo.CQMS_Drawing_DrawingAudit where DrawingAuditCode ='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_Drawing_DrawingAudit where x.DrawingAuditCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().DrawingAuditCode.ToString();
// if (q.First().FileName != null)
// {
// txtFileName = q.First().FileName.ToString();
// }
// }
//}
//if (typeFlag == Const.CQMS_NoFourLetoffTemplate)
//{
// //strSql = "select NoFourLetoffCode, AccidentName from dbo.CQMS_Nonconformity_NoFourLetoff where NoFourLetoffCode ='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_Nonconformity_NoFourLetoff where x.NoFourLetoffCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().NoFourLetoffCode.ToString();
// if (q.First().AccidentName != null)
// {
// txtFileName = q.First().AccidentName.ToString();
// }
// fileCode = q.First().NoFourLetoffCode.ToString();
// }
//}
//if (typeFlag == Const.CQMS_NonconformityNoticeTemplate)
//{
// //strSql = "select NonconformityNoticeCode, FileName from dbo.CQMS_Nonconformity_NonconformityNotice where NonconformityNoticeCode ='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_Nonconformity_NonconformityNotice where x.NonconformityNoticeCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().NonconformityNoticeCode.ToString();
// if (q.First().FileName != null)
// {
// txtFileName = q.First().FileName.ToString();
// }
// fileCode = q.First().NonconformityNoticeCode.ToString();
// }
//}
//if (typeFlag == Const.CQMS_NonconformityReviewTemplate)
//{
// //strSql = "select NonconformityReviewCode, FileName from dbo.CQMS_Nonconformity_NonconformityReview where NonconformityReviewCode ='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_Nonconformity_NonconformityReview where x.NonconformityReviewCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().NonconformityReviewCode.ToString();
// if (q.First().FileName != null)
// {
// txtFileName = q.First().FileName.ToString();
// }
// fileCode = q.First().NonconformityReviewCode.ToString();
// }
//}
//if (typeFlag == Const.CQMS_MeetingTemplate)
//{
// //strSql = "select MeetingListCode, MeetingName, RecordMan from dbo.CQMS_Meeting_MeetingList where MeetingListCode ='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_Meeting_MeetingList where x.MeetingListCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().MeetingListCode.ToString();
// if (q.First().MeetingName != null)
// {
// txtFileName = q.First().MeetingName.ToString();
// }
// fileCode = q.First().MeetingListCode.ToString();
// bzr = BLL.Sys_UserService.GetUserNameByUserId(q.First().RecordMan.ToString());
// shr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 2);
// spr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 3);
// fbdate = BLL.AuditFlowApproveService.GetIssueDate(txtFileCode, 3);
// }
//}
//if (typeFlag == Const.CQMS_RectifyNoticeTemplate)
//{
// //strSql = "select RectifyNoticeCode, FileName from dbo.CQMS_Unqualified_RectifyNotice where RectifyNoticeCode ='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_Unqualified_RectifyNotice where x.RectifyNoticeCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().RectifyNoticeCode.ToString();
// if (q.First().FileName != null)
// {
// txtFileName = q.First().FileName.ToString();
// }
// fileCode = q.First().RectifyNoticeCode.ToString();
// }
//}
//if (typeFlag == Const.CQMS_PauseNoticeTemplate)
//{
// //strSql = "select PauseNoticeCode, FileName from dbo.CQMS_Unqualified_PauseNotice where PauseNoticeCode ='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_Unqualified_PauseNotice where x.PauseNoticeCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().PauseNoticeCode.ToString();
// if (q.First().FileName != null)
// {
// txtFileName = q.First().FileName.ToString();
// }
// fileCode = q.First().PauseNoticeCode.ToString();
// }
//}
//if (typeFlag == Const.CQMS_RepriseApplyTemplate)
//{
// //strSql = "select RepriseApplyCode, RepriseApplyName from dbo.CQMS_Unqualified_RepriseApply where RepriseApplyCode ='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_Unqualified_RepriseApply where x.RepriseApplyCode == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().RepriseApplyCode;
// if (q.First().RepriseApplyName != null)
// {
// txtFileName = q.First().RepriseApplyName.ToString();
// }
// fileCode = q.First().RepriseApplyCode;
// }
//}
//if (typeFlag == Const.CQMS_Log)
//{
// //strSql = "select Code from dbo.CQMS_Log where LogId ='" + docId + "'";
// //dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.CQMS_Log where x.LogId == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().Code.ToString();
// txtFileName = "施工日志";
// fileCode = q.First().Code.ToString();
// }
//}
//if (typeFlag == Const.GJSX_RoleReplace)
//{
// strSql = "select Code from dbo.GJSX_RoleEntrust where RoleEntrustId ='" + docId + "'";
// dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.GJSX_RoleEntrust where x.RoleEntrustId == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().Code.ToString();
// txtFileName = "角色替代委托书";
// fileCode = q.First().Code.ToString();
// }
//}
//if (typeFlag == Const.GJSX_Concert)
//{
// strSql = "select Code from dbo.GJSX_CoordinationReport where CoordinationReportId ='" + docId + "'";
// dr = BLL.SQLHelper.RunSql(strSql);
// var q = from x in Funs.DB.GJSX_CoordinationReport where x.CoordinationReportId == docId select x;
// if (q.Count() > 0)
// {
// txtFileCode = q.First().Code.ToString();
// txtFileName = "沟通协调报告";
// fileCode = q.First().Code.ToString();
// }
//}
fileCode2 = fileCode;
fileCode3 = fileCode;
}
catch (Exception err) { }
}
}
}
}
@@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.FileManage {
public partial class EditOffice {
}
}
@@ -0,0 +1,171 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FileManageList.aspx.cs" Inherits="FineUIPro.Web.FileManage.FileManageList" %>
<%@ Register Src="~/Controls/GridNavgator.ascx" TagName="GridNavgator" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<link href="../Styles/Style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="ntko.js"></script>
<script type="text/javascript">
function CreateNew(newofficetype, docId) {
var iWidth = 1280;
var iHeight = 720;
var iTop = (window.screen.availHeight - 30 - iHeight) / 2;
var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
window.open("EditOffice.aspx?ispop=1&newofficetype=" + newofficetype + "&docId=" + docId, "EditOffice", "width=" + iWidth + ",height=" + iHeight + ",top=" + iTop + ",left=" + iLeft + ",scrollbars=yes,resizable=yes");
}
// 这里url传的是主键
function ShowOffice(docId, oper) {
var iWidth = 1180;
var iHeight = 720;
var iTop = (window.screen.availHeight - 30 - iHeight) / 2;
var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
window.open("EditOffice.aspx?ispop=1&officetype=1&oper=" + oper + "&docId=" + docId, "EditOffice", "width=" + iWidth + ",height=" + iHeight + ",top=" + iTop + ",left=" + iLeft + ",scrollbars=yes,resizable=yes");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<table id="Table1" runat="server" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 100%; background: url('../../Images/bg-1.gif')">
<table id="tabbtn" runat="server" width="100%" style="background: url('../Images/bg-1.gif')"
cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle" style="width: 35%; font-size: 11pt; font-weight: bold">
<asp:Image ImageUrl="~/Images/lv-1.gif" ImageAlign="AbsMiddle" ID="image15" runat="server" />
&nbsp;模板信息
</td>
<td align="right" valign="middle" style="width: 65%; height: 30px;">
<asp:DropDownList runat="server" ID="DrpTemplateType" Height="24px" Width="120px">
<asp:ListItem Selected="True" Value="0">--请选择--</asp:ListItem>
<asp:ListItem Value="1">Word模板</asp:ListItem>
<asp:ListItem Value="2">Excel模板</asp:ListItem>
<asp:ListItem Value="3">PowerPoint模板</asp:ListItem>
</asp:DropDownList>&nbsp;
<asp:ImageButton ID="btnAdd" runat="server" ImageUrl="~/Images/addbutton.gif" onclick="btnAdd_Click"
/>
<asp:ImageButton ID="imgbtnSearch" runat="server" ImageUrl="~/Images/Search.gif"
OnClick="imgbtnSearch_Click" Style="height: 20px" />
&nbsp;
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div runat="server" id="divSearch" visible="false">
<table style="width: 100%;">
<tr>
<td align="right" style="height: 32px; width:15%">
&nbsp;
<asp:Label ID="Label1" runat="server" Text="文件名称"></asp:Label>&nbsp;
</td>
<td align="left" style="height: 32px; width:20%" >
<asp:TextBox ID="txtFileName" runat="server" Width="90%"></asp:TextBox>
</td>
<td align="right" style="height: 32px; width:15%">
&nbsp;
<asp:Label ID="Label2" runat="server" Text="模板类型"></asp:Label>&nbsp;
</td>
<td align="left" style="height: 32px; width:20%">
<asp:DropDownList ID="drpFileSort" runat="server" Height="22px" Width="80%">
</asp:DropDownList>
</td>
<td align="left" style="height: 32px">
<asp:ImageButton ID="btnSearch" runat="server" ImageUrl="~/Images/confirm.gif" OnClick="btnSearch_Click" />
<asp:ImageButton ID="btnCancel" runat="server" ImageUrl="~/Images/cancel.gif" OnClick="imgbtnCancel_Click" />
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
<asp:GridView ID="gvFileT" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" HorizontalAlign="Justify" PageSize="12" Width="100%"
OnDataBound="gvFileT_DataBound" OnRowCommand="gvFileT_RowCommand" DataSourceID="ObjectDataSource1">
<AlternatingRowStyle CssClass="GridBgColr" />
<Columns>
<asp:TemplateField HeaderText="序号" HeaderStyle-Width="5%" ItemStyle-HorizontalAlign="Center"
ItemStyle-Height="20px">
<ItemTemplate>
<%# gvFileT.PageIndex * gvFileT.PageSize + Container.DataItemIndex + 1%>
</ItemTemplate>
<HeaderStyle Width="5%"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" Height="20px"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="FileCode" HeaderText="文件编号">
<HeaderStyle Width="10%" />
</asp:BoundField>
<asp:TemplateField HeaderText="文件名称" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="click" CssClass="ItemLink"
Text='<%# Bind("FileName") %>' CommandArgument='<%# Bind("FileId") %>' ToolTip="编辑"></asp:LinkButton>
</ItemTemplate>
<HeaderStyle Width="28%" />
<ItemStyle HorizontalAlign="Left"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="BigType" HeaderText="模板类型">
<HeaderStyle Width="15%" />
</asp:BoundField>
<asp:BoundField DataField="SmallType" HeaderText="适用范围">
<HeaderStyle Width="10%" />
</asp:BoundField>
<asp:TemplateField HeaderText="文件大小">
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# ConvertSize(Eval("FileSize")) %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="10%" />
</asp:TemplateField>
<asp:BoundField DataField="FileCreate" HeaderText="创建人">
<HeaderStyle Width="10%" />
</asp:BoundField>
<asp:TemplateField HeaderText="查看" HeaderStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="lbtnFind" runat="server" Text="查看" CssClass="ItemLink" CommandArgument='<%# Bind("FileId") %>'
CommandName="find" ToolTip="查看模板内容"></asp:LinkButton>
</ItemTemplate>
<HeaderStyle Width="5%"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="删除">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/DeleteBtn.gif"
CommandArgument='<%# Bind("FileId") %>' CommandName="Del" OnClientClick="return confirm(&quot;确定要删除此模板吗?&quot;)"
ToolTip="删除" />
</ItemTemplate>
<HeaderStyle Width="5%" />
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="GridBgColr" />
<PagerStyle HorizontalAlign="Left" />
<RowStyle CssClass="GridRow" />
<PagerTemplate>
<uc1:GridNavgator runat="server" ID="GridNavgator1" />
</PagerTemplate>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetListData"
TypeName="BLL.FileManageService" EnablePaging="True" OnSelecting="ObjectDataSource1_Selecting"
SelectCountMethod="GetListCount">
<SelectParameters>
<asp:Parameter Name="fileType" />
<asp:Parameter Name="fileName" />
</SelectParameters>
</asp:ObjectDataSource>
</td>
</tr>
</table>
<asp:ValidationSummary ID="ValidationSummary1" Style="z-index: 101; left: 8px; position: absolute;
top: 8px" runat="server" HeaderText="请注意!" ShowMessageBox="True" ShowSummary="False"
ValidationGroup="Save" />
</form>
</body>
</html>
@@ -0,0 +1,118 @@
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;
}
}
}
@@ -0,0 +1,177 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.FileManage {
public partial class FileManageList {
/// <summary>
/// Head1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// Table1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTable Table1;
/// <summary>
/// tabbtn 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTable tabbtn;
/// <summary>
/// image15 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Image image15;
/// <summary>
/// DrpTemplateType 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList DrpTemplateType;
/// <summary>
/// btnAdd 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.ImageButton btnAdd;
/// <summary>
/// imgbtnSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.ImageButton imgbtnSearch;
/// <summary>
/// divSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divSearch;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label1;
/// <summary>
/// txtFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtFileName;
/// <summary>
/// Label2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label2;
/// <summary>
/// drpFileSort 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList drpFileSort;
/// <summary>
/// btnSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.ImageButton btnSearch;
/// <summary>
/// btnCancel 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.ImageButton btnCancel;
/// <summary>
/// gvFileT 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.GridView gvFileT;
/// <summary>
/// ObjectDataSource1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource ObjectDataSource1;
/// <summary>
/// ValidationSummary1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
}
}
+2
View File
@@ -0,0 +1,2 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Read.aspx.cs" Inherits="FineUIPro.Web.FileManager.Read" %>
@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace FineUIPro.Web.FileManager
{
public partial class Read : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
doGetDocData();
}
/// <summary>
/// 从数据库或者磁盘中读取文件并发送给客户端
/// </summary>
public void doGetDocData()
{
SqlDataReader objReader = null;
SqlConnection conn = new SqlConnection(BLL.Funs.ConnString);
if (conn.State == ConnectionState.Closed) conn.Open();
try
{
string strcmd = string.Empty;
string docid = Request.QueryString["docid"];
string typeFlag = Request.QueryString["typeFlag"];
if (!string.IsNullOrEmpty(docid))
{
if (!string.IsNullOrEmpty(strcmd))
{
SqlCommand command = new SqlCommand(strcmd, conn);
command.CommandType = CommandType.Text;
objReader = command.ExecuteReader();
if (objReader.Read())
{
Response.AddHeader("Content-Disposition", "attachment; filename=" + objReader[0].ToString());
Response.AppendHeader("Contenttype", "application/msword");
//读取数据
byte[] buffer = new Byte[10240];
long datalen = objReader.GetBytes(1, 0, null, 0, 0);//["filedata"]
//Response.Write("datalen=" + datalen.ToString());
//*
long curPos = 0;
long readsize = 0;
readsize = objReader.GetBytes(1, curPos, buffer, 0, 10240);
while (readsize == 10240)
{
curPos += readsize;
Response.BinaryWrite(buffer);
Response.Flush();
readsize = objReader.GetBytes(1, curPos, buffer, 0, 10240);
}
byte[] rBuf = new Byte[readsize];
objReader.GetBytes(1, curPos, rBuf, 0, (int)readsize);
Response.BinaryWrite(rBuf);
Response.Flush();
//*/
}
}
}
}
finally
{
if (objReader != null)
{
objReader.Close();
}
conn.Close();
}
}
}
}
+15
View File
@@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.FileManager {
public partial class Read {
}
}
+233
View File
@@ -0,0 +1,233 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReadCad.aspx.cs" Inherits="FineUIPro.Web.FileManage.ReadCad" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta content="IE=7" http-equiv="X-UA-Compatible" />
<title>文档编辑</title>
<link href="../../Styles/Style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="../ntko.js"></script>
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
</head>
<body onload='editoffice("<%=url %>","<%=newofficetype %>");' onunload="onPageClose();">
<script language="javascript" type="text/javascript">
$("#drpJoint").ready(
function () {
var drpJoint = document.getElementById("drpJoint")
var joint = "<%=jointList() %>";
//alert(joint);
var arr = joint.split('|')
for (i = 0; i < arr.length; i++) {
option = new Option(arr[i].split(',')[1], arr[i].split(',')[0]);
drpJoint.options.add(option);
}
});
var jot = "<%=ReturnValue() %>";
function bao(s) {
var WLO_CODE = document.getElementById("WLO_CODE");
var STE = document.getElementById("STE");
var Component = document.getElementById("Component");
var JointDesc = document.getElementById("JointDesc");
var JOTY_ID = document.getElementById("JOTY_ID");
var Size = document.getElementById("Size");
var Dia = document.getElementById("Dia");
var JST_ID = document.getElementById("JST_ID");
var Sch = document.getElementById("Sch");
var LastTemp = document.getElementById("LastTemp");
var CellTemp = document.getElementById("CellTemp");
var PrepareTemp = document.getElementById("PrepareTemp");
var JointAttribute = document.getElementById("JointAttribute");
var WME_ID = document.getElementById("WME_ID");
var WeldSilk = document.getElementById("WeldSilk");
var WeldMat = document.getElementById("WeldMat");
var Electricity = document.getElementById("Electricity");
var Voltage = document.getElementById("Voltage");
var ReportDate = document.getElementById("ReportDate");
var ReportCode = document.getElementById("ReportCode");
var FloorWelder = document.getElementById("FloorWelder");
var CellWelder = document.getElementById("CellWelder");
// alert(jot)
var jotInfo = jot.split('|')
for (i = 0; i < jotInfo.length; i++) {
if (s == jotInfo[i].split(',')[0]) {
WLO_CODE.value = jotInfo[i].split(',')[1]
STE.value = jotInfo[i].split(',')[2]
Component.value = jotInfo[i].split(',')[3]
JointDesc.value = jotInfo[i].split(',')[4]
JOTY_ID.value = jotInfo[i].split(',')[5]
Size.value = jotInfo[i].split(',')[6]
Dia.value = jotInfo[i].split(',')[7]
JST_ID.value = jotInfo[i].split(',')[8]
Sch.value = jotInfo[i].split(',')[9]
LastTemp.value = jotInfo[i].split(',')[10]
CellTemp.value = jotInfo[i].split(',')[11]
PrepareTemp.value = jotInfo[i].split(',')[12]
JointAttribute.value = jotInfo[i].split(',')[13]
WME_ID.value = jotInfo[i].split(',')[14]
WeldSilk.value = jotInfo[i].split(',')[15]
WeldMat.value = jotInfo[i].split(',')[16]
Electricity.value = jotInfo[i].split(',')[17]
Voltage.value = jotInfo[i].split(',')[18]
ReportDate.value = jotInfo[i].split(',')[19]
ReportCode.value = jotInfo[i].split(',')[20]
FloorWelder.value = jotInfo[i].split(',')[21]
CellWelder.value = jotInfo[i].split(',')[22]
}
}
}
</script>
<form id="form1" action="Save.aspx" enctype="multipart/form-data">
<div id="editmain">
<div id="editmain_middle" class="editmain_middle">
<div id="editmain_right" class="editmain_right">
<div id="formtop">
<table width="100%" cellpadding="1" cellspacing="1" class="table">
<tr align="left">
<td colspan="10" style="height:30px; font-weight:bold"> &nbsp;工区号:
<input id="txtArea" name="txtArea" style="width:100px" type="text" value="<%=txtArea %>" />
&nbsp;管线号:
<input id="txtIsoCode" name="txtIsoCode" style="width:240px" type="text" value="<%=txtIsoCode %>" />
<input id="txtIsoId" name="txtIsoId" type="text" value="<%=txtIsoId %>" style="display:none" />
<input id="filename" name="filename" type="text" value="<%=filename %>" style="display:none"/>
选择查看焊口:
<select id="drpJoint" name="drpJoint" style="width: 150px; height: 22px;"
onchange="bao(this.options[this.options.selectedIndex].value)" />
</td>
</tr>
<tr align="left">
<td> &nbsp;焊接区域:</td>
<td><input id="WLO_CODE" name="WLO_CODE" style="width:85px" type="text" /></td>
<td> &nbsp;材质:</td>
<td><input id="STE" name="STE" style="width:85px" type="text" /></td>
<td> &nbsp;组件: </td>
<td><input id="Component" name="Component" style="width:85px" type="text" /></td>
<td> &nbsp;焊口规格:</td>
<td><input id="JointDesc" name="JointDesc" style="width:85px" type="text" /></td>
<td>&nbsp;焊缝类型: </td>
<td><input id="JOTY_ID" name="JOTY_ID" style="width:85px" type="text" /></td>
</tr>
<tr align="left">
<td> &nbsp;寸径:</td>
<td><input id="Size" name="Size" style="width:85px" type="text" /></td>
<td>&nbsp;外径:</td>
<td><input id="Dia" name="Dia" style="width:85px" type="text" /></td>
<td>&nbsp;坡口类型:</td>
<td><input id="JST_ID" name="JST_ID" style="width:85px" type="text" /></td>
<td>&nbsp;壁厚:</td>
<td><input id="Sch" name="Sch" style="width:85px" type="text" /></td>
<td> &nbsp;后热温度: </td>
<td><input id="LastTemp" name="LastTemp" style="width:85px" type="text" /></td>
</tr>
<tr align="left">
<td> &nbsp;层间温度:</td>
<td><input id="CellTemp" name="CellTemp" style="width:85px" type="text" /></td>
<td> &nbsp;预热温度: </td>
<td><input id="PrepareTemp" name="PrepareTemp" style="width:85px" type="text" /></td>
<td>&nbsp;焊口属性:</td>
<td><input id="JointAttribute" name="JointAttribute" style="width:85px" type="text" /></td>
<td>&nbsp;焊接方法:</td>
<td><input id="WME_ID" name="WME_ID" style="width:85px" type="text" /></td>
<td> &nbsp;焊丝:</td>
<td><input id="WeldSilk" name="WeldSilk" style="width:85px" type="text" /></td>
</tr>
<tr align="left">
<td> &nbsp;焊条:</td>
<td><input id="WeldMat" name="WeldMat" style="width:85px" type="text" /></td>
<td>&nbsp;焊接电流:</td>
<td><input id="Electricity" name="Electricity" style="width:85px" type="text" /></td>
<td>&nbsp;焊接电压:</td>
<td><input id="Voltage" name="Voltage" style="width:85px" type="text" /></td>
<td>&nbsp;日报日期: </td>
<td><input id="ReportDate" name="ReportDate" style="width:85px" type="text" /></td>
<td>&nbsp;日报编号: </td>
<td><input id="ReportCode" name="ReportCode" style="width:85px" type="text" />
</td>
</tr>
<tr align="left">
<td> &nbsp;打底焊工: </td>
<td> <input id="FloorWelder" name="FloorWelder" style="width:85px" type="text" /></td>
<td> &nbsp;盖面焊工:</td>
<td> <input id="CellWelder" name="CellWelder" style="width:85px" type="text" /></td>
</tr>
</table>
</div>
<div id="officecontrol">
<!--引用NTKO OFFICE文档控件-->
<script language="javascript" type="text/javascript" src="../../OfficeControl/ntkoofficecontrol.js"></script>
<!--控件事件代码开始-->
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(cmd,canceled);">
alert(cmd);
CancelLastCommand=true;
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentClosed();">
setFileOpenedOrClosed(false);
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentOpened(TANGER_OCX_str,TANGER_OCX_obj);">
//saved属性用来判断文档是否被修改过,文档打开的时候设置成ture,当文档被修改,自动被设置为false,该属性由office提供.
//TANGER_OCX_OBJ.ActiveDocument.Saved = true;
if(2==TANGER_OCX_OBJ.DocType)
{
try{
TANGER_OCX_OBJ.ActiveDocument.Application.ActiveWorkbook.Saved=true;
}catch(e)
{
alert("错误:" + err.number + ":" + err.description);
}
}
setFileOpenedOrClosed(true);//设置文档状态值
controlStyle();//插入控件样式自定义菜单
SetReviewMode(false);//设置文档在痕迹模式下编辑
setShowRevisions(false); //设置是否显示痕迹
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="BeforeOriginalMenuCommand(TANGER_OCX_str,TANGER_OCX_obj);">
alert("BeforeOriginalMenuCommand事件被触发");
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(TANGER_OCX_str,TANGER_OCX_obj);">
if (TANGER_OCX_str == 3)
{
alert("不能保存!");
CancelLastCommand = true;
}
</script>
<script language="JScript" for="TANGER_OCX" event="OnCustomMenuCmd2(menuPos,submenuPos,subsubmenuPos,menuCaption,menuID)">
//alert("第" + menuPos +","+ submenuPos +","+ subsubmenuPos +"个菜单项,menuID="+menuID+",菜单标题为\""+menuCaption+"\"的命令被执行.");
if("全网页查看"==menuCaption)objside();
if("恢复原大小"==menuCaption)objside2();
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="AfterPublishAsPDFToURL(result,code);">
result=trim(result);
alert(result);
if(result=="succeed")
{window.close();}
</script>
<!--控件事件代码结束-->
</div>
</div>
</div>
</div>
</form>
</body>
</html>
<script language="javascript" type="text/javascript">
var height = parent.document.getElementById("RegionPanel1").offsetHeight;
var width = parent.document.getElementById("RegionPanel1").offsetWidth;
$("#officecontrol").height(height - 55);
$("#officecontrol").width(width - 290);
</script>
@@ -0,0 +1,297 @@
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BLL;
namespace FineUIPro.Web.FileManage
{
public partial class ReadCad : PageBase
{
public string url, newofficetype, strOper;
public string txtArea,txtIsoCode, txtIsoId, filename;//定义表单数据
protected void Page_Load(object sender, EventArgs e)
{
txtIsoId = Request.QueryString["url"];
newofficetype = Request.QueryString["newofficetype"];
//strOper = Request.QueryString["oper"];
url = txtIsoId;
if (txtIsoId != null && txtIsoId != "")
{
SqlDataReader dr = null;
string strSql = string.Empty;
try
{
//strSql = "select iso.ISO_IsoNo,iso.FileName,area.WorkAreaCode from HJGL_PW_IsoInfo iso left join dbo.Project_WorkArea area on area.WorkAreaId=iso.BAW_ID where iso.ISO_ID='" + txtIsoId + "'";
//dr = BLL.SQLHelper.RunSql(strSql);
//var q = from x in BLL.Funs.DB.HJGL_PW_IsoInfo
// join y in BLL.Funs.DB.Project_WorkArea on x.BAW_ID equals y.WorkAreaId
// where x.ISO_ID == txtIsoId
// select new { x.ISO_IsoNo, x.FileName, y.WorkAreaCode };
//if (q.Count() > 0)
//{
// txtIsoCode = q.First().ISO_IsoNo.ToString();
// txtArea = q.First().WorkAreaCode.ToString();
// if (q.First().FileName != null)
// {
// q.First().FileName.ToString();
// }
// else
// {
// filename = "";
// }
//}
}
catch (Exception err) { }
}
}
public string jointList()
{
//var q = from x in BLL.Funs.DB.HJGL_PW_JointInfo where x.ISO_ID == txtIsoId orderby x.JOT_JointNo select x;
string jointArr = string.Empty;
//if (q.Count() > 0)
//{
// foreach (var j in q)
// {
// if (!string.IsNullOrEmpty(j.DReportID))
// {
// jointArr = jointArr + j.JOT_ID + "," + j.JOT_JointNo + "已焊" + "|";
// }
// else
// {
// jointArr = jointArr + j.JOT_ID + "," + j.JOT_JointNo + "未焊" + "|";
// }
// }
//}
//return jointArr.Substring(0,jointArr.Length-1);
return jointArr;
}
public string ReturnValue()
{
string reValue = string.Empty;
//var q = from x in BLL.Funs.DB.HJGL_PW_JointInfo where x.ISO_ID == txtIsoId orderby x.JOT_JointNo select x;
//if (q.Count() > 0)
//{
// foreach (var j in q)
// {
// if (j.WLO_Code != null)
// {
// reValue = reValue + j.JOT_ID + "," + (j.WLO_Code == "F" ? "安装" : "预制") + ",";
// }
// else
// {
// reValue = reValue + j.JOT_ID + "," + "" + ",";
// }
// if (j.STE_ID != null)
// {
// reValue = reValue + (BLL.HJGL_MaterialService.GetSteelBySteID(j.STE_ID) != null ? BLL.HJGL_MaterialService.GetSteelBySteID(j.STE_ID).STE_Name : "") + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_Component1 != null)
// {
// reValue = reValue + (BLL.HJGL_ComponentsService.GetComponentByComID(j.JOT_Component1) != null ? BLL.HJGL_ComponentsService.GetComponentByComID(j.JOT_Component1).COM_Name : "") + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOTY_ID != null)
// {
// reValue = reValue + (BLL.HJGL_WeldService.GetJointTypeByJotID(j.JOTY_ID) != null ? BLL.HJGL_WeldService.GetJointTypeByJotID(j.JOTY_ID).JOTY_Name : "") + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_JointDesc != null)
// {
// reValue = reValue + j.JOT_JointDesc + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_Size != 0)
// {
// reValue = reValue + Convert.ToString(j.JOT_Size) + ",";
// }
// else
// {
// reValue = reValue + "0" + ",";
// }
// if (j.JOT_Dia != 0)
// {
// reValue = reValue + Convert.ToString(j.JOT_Dia) + ",";
// }
// else
// {
// reValue = reValue + "0" + ",";
// }
// if (j.JST_ID != null)
// {
// reValue = reValue + (BLL.HJGL_GrooveService.GetSlopeTypeByJSTID(j.JST_ID) != null ? BLL.HJGL_GrooveService.GetSlopeTypeByJSTID(j.JST_ID).JST_Name : "") + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_Sch != null)
// {
// reValue = reValue + j.JOT_Sch + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_LastTemp != null)
// {
// reValue = reValue + j.JOT_LastTemp.ToString() + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_CellTemp != null)
// {
// reValue = reValue + j.JOT_CellTemp.ToString() + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_PrepareTemp != null)
// {
// reValue = reValue + j.JOT_PrepareTemp.ToString() + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_JointAttribute != null)
// {
// reValue = reValue + j.JOT_JointAttribute.ToString() + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.WME_ID != null)
// {
// reValue = reValue + (BLL.HJGL_WeldingMethodService.GetWeldMethodByWMEID(j.WME_ID) != null ? BLL.HJGL_WeldingMethodService.GetWeldMethodByWMEID(j.WME_ID).WME_Name : "") + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_WeldSilk != null)
// {
// reValue = reValue + (BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(j.JOT_WeldSilk) != null ? BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(j.JOT_WeldSilk).WMT_MatName : "") + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_WeldMat != null)
// {
// reValue = reValue + (BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(j.JOT_WeldMat) != null ? BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(j.JOT_WeldMat).WMT_MatName : "") + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_Electricity != null)
// {
// reValue = reValue + j.JOT_Electricity.ToString() + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_Voltage != null)
// {
// reValue = reValue + j.JOT_Voltage.ToString() + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.DReportID != null)
// {
// reValue = reValue + (BLL.HJGL_PW_JointInfoService.GetReportDateByDReportID(j.DReportID).ToShortDateString()) + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.DReportID != null)
// {
// reValue = reValue + (BLL.HJGL_WeldReportService.GetWeldReportByDReportID(j.DReportID) != null ? BLL.HJGL_WeldReportService.GetWeldReportByDReportID(j.DReportID).JOT_DailyReportNo : "") + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_FloorWelder != null)
// {
// var floorWelder = from x in BLL.Funs.DB.HJGL_BS_Welder where x.WED_ID == j.JOT_FloorWelder select x;
// reValue = reValue + floorWelder.FirstOrDefault().WED_Name + ",";
// }
// else
// {
// reValue = reValue + "" + ",";
// }
// if (j.JOT_CellWelder != null)
// {
// var cellWelder = from x in BLL.Funs.DB.HJGL_BS_Welder where x.WED_ID == j.JOT_CellWelder select x;
// reValue = reValue + cellWelder.FirstOrDefault().WED_Name + "|";
// }
// else
// {
// reValue = reValue + "" + "|";
// }
// }
//}
//return reValue.Substring(0, reValue.Length - 1);
return reValue;
}
}
}
+15
View File
@@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.FileManage {
public partial class ReadCad {
}
}
+2
View File
@@ -0,0 +1,2 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Save.aspx.cs" Inherits="FineUIPro.Web.FileManager.Save" %>
+112
View File
@@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace FineUIPro.Web.FileManager
{
public partial class Save : System.Web.UI.Page
{
public string url, newofficetype,filetype, readURL,typeFlag;
public string txtFileId, txtFileCode, txtFileName, drpBigType, drpSmallType;//定义表单数据
protected void Page_Load(object sender, EventArgs e)
{
txtFileId = Request.Form["txtFileId"];//获取文件ID
txtFileCode = Request.Form["txtFileCode"];//获取已有文件的名称
txtFileName = Request.Form["txtFileName"];//获取文件的标题
drpBigType = Request.Form["drpBigType"];//获取文件另存为格式类型
filetype = Request.Form["filetype"];//获取当前文件的文件格式
drpSmallType = Request.Form["drpSmallType"];
typeFlag = Request.Form["typeFlag"];
saveoffice();
}
//保存文档为office
public void saveoffice()
{
System.Web.HttpFileCollection uploadFiles = Request.Files;
System.Web.HttpPostedFile theFile;
bool isNewRecord = false;
if ((txtFileId.Length == 0) || (txtFileId.Trim().Length == 0))
{
isNewRecord = true;
}
else
{
isNewRecord = false;
}
if (uploadFiles.Count == 0)
{
Response.Write("没有文件上传!");
return;
}
else
{
SqlConnection conn = new SqlConnection(BLL.Funs.ConnString);
if (conn.State == ConnectionState.Closed) conn.Open();
try
{
for (int i = 0; i < uploadFiles.Count; i++)
{
theFile = uploadFiles[i];
int flieLength = theFile.ContentLength;
Stream fs = theFile.InputStream;
byte[] bytes = new byte[fs.Length];
fs.Read(bytes, 0, flieLength);
if (uploadFiles.GetKey(i).ToUpper() == "EDITFILE")//上传文档控件中的文档
{
string strcmd = "";
SqlCommand objCommand = new SqlCommand(strcmd, conn);
if (typeFlag == "00")
{
objCommand.Parameters.Add("@FileCode", System.Data.SqlDbType.NVarChar).Value = txtFileCode;
objCommand.Parameters.Add("@FileName", System.Data.SqlDbType.NVarChar).Value = txtFileName;//
objCommand.Parameters.Add("@FileSize", System.Data.SqlDbType.NVarChar).Value = theFile.ContentLength;
objCommand.Parameters.Add("@FileType", System.Data.SqlDbType.NVarChar).Value = filetype;
objCommand.Parameters.Add("@BigType", System.Data.SqlDbType.NVarChar).Value = drpBigType;
objCommand.Parameters.Add("@SmallType", System.Data.SqlDbType.VarChar).Value = drpSmallType;
objCommand.Parameters.Add("@FileDate", System.Data.SqlDbType.DateTime).Value = DateTime.Now;
objCommand.Parameters.Add("@FileCreate", System.Data.SqlDbType.NVarChar).Value = ((Model.Sys_User)Session["CurrUser"]).UserId;
objCommand.Parameters.Add("@FileContent", System.Data.SqlDbType.Image).Value = bytes;
}
else
{
objCommand.Parameters.Add("@FileContent", System.Data.SqlDbType.Image).Value = bytes;
}
if (isNewRecord)
{
txtFileId = objCommand.ExecuteScalar().ToString();
}
else
{
objCommand.ExecuteNonQuery();
}
//Response.Write("ID:" + txtFileId + "</br>");
//Response.Write("Files: " + txtFileName + "<br>");
//Response.Write("Size: " + theFile.ContentLength.ToString() + " bytes<br>");
}
}
}
finally
{
conn.Close();
}
}
}
}
}
+15
View File
@@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.FileManager {
public partial class Save {
}
}
@@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SaveCAD.aspx.cs" Inherits="FineUIPro.Web.FileManage.SaveCAD" %>
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace FineUIPro.Web.FileManage
{
public partial class SaveCAD : System.Web.UI.Page
{
public string txtIsoCode, txtIsoId, txtArea, filename;//定义表单数据
HttpResponse response = System.Web.HttpContext.Current.Response;
HttpRequest request = System.Web.HttpContext.Current.Request;
protected void Page_Load(object sender, EventArgs e)
{
txtIsoId = Request.Form["txtIsoId"];//获取文件ID
txtArea = Request.Form["txtArea"];
txtIsoCode = Request.Form["txtIsoCode"];
filename = Request.Form["filename"];
saveoffice();
}
//保存文档为office
public void saveoffice()
{
System.Web.HttpFileCollection uploadFiles = Request.Files;
System.Web.HttpPostedFile theFile;
if (uploadFiles.Count == 0)
{
Response.Write("没有文件上传!");
return;
}
else
{
SqlConnection conn = new SqlConnection(BLL.Funs.ConnString);
if (conn.State == ConnectionState.Closed) conn.Open();
try
{
for (int i = 0; i < uploadFiles.Count; i++)
{
theFile = uploadFiles[i];
if (uploadFiles.GetKey(i) == "ntkofile")//上传文档控件中的文档
{
string strcmd = "";
strcmd = "Update HJGL_PW_IsoInfo Set FileName=@FileName WHERE ISO_ID='" + txtIsoId + "'";
if (filename == "" || filename == null)
{
filename = "(" + txtArea + ")" + txtIsoCode + ".dwg";
}
filename = filename.Replace(":", "."); //上传文件到磁盘,文件名中不允许带:符号
filename = filename.Replace(@"/", @"-");
theFile.SaveAs(Server.MapPath("~/FileManage/uploadCADFile/" + filename));
SqlCommand objCommand = new SqlCommand(strcmd, conn);
objCommand.Parameters.Add("@FileName", System.Data.SqlDbType.NVarChar).Value = filename;
objCommand.ExecuteNonQuery();
response.Write("文档控件提交的的文档保存到应用服务器磁盘成功!\n");//后台做一写的输出有利用前台监控文档的保存情况
}
}
}
finally
{
conn.Close();
}
}
}
}
}
+15
View File
@@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.FileManage {
public partial class SaveCAD {
}
}
+134
View File
@@ -0,0 +1,134 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="editCAD.aspx.cs" Inherits="FineUIPro.Web.FileManage.editCAD" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta content="IE=7" http-equiv="X-UA-Compatible" />
<title>文档编辑</title>
<link href="../Styles/Style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="../ntko.js"></script>
<script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
</head>
<body onload='editoffice("<%=url %>","<%=newofficetype %>");' onunload="onPageClose();">
<script language="javascript" type="text/javascript">
$("#drpJoint").ready(
function () {
var drpJoint = document.getElementById("drpJoint")
var joint = "<%=jointList() %>";
//alert(joint);
var arr = joint.split('|')
for (i = 0; i < arr.length; i++) {
option = new Option(arr[i].split(',')[1], arr[i].split(',')[0]);
drpJoint.options.add(option);
}
});
var jot = "<%=ReturnValue() %>";
function bao(s) {
var test = document.getElementById("test");
var size = document.getElementById("size");
// alert(jot)
var aaa = jot.split('|')
for (i = 0; i < aaa.length; i++) {
if (s == aaa[i].split(',')[0]) {
test.value = aaa[i].split(',')[1]
size.value = aaa[i].split(',')[2]
}
}
}
</script>
<form id="form1" action="Save.aspx" enctype="multipart/form-data">
<div id="editmain">
<div id="editmain_middle" class="editmain_middle">
<div id="editmain_right" class="editmain_right">
<div id="formtop">
<table width="100%" cellpadding="1" cellspacing="1" class="table">
<tr>
<td align="center" colspan="8" style="height:32px">
<input type="button" class="button" value="保存CAD" onclick="SaveCAD()"/>
<input type="button" class="button" value="返回关闭" onclick="javascript:window.close();" style="width:80"/>
<input type="button" class="button" value="页面设置" onclick="WebPageSetup()"/>
<input type="button" class="button" value="打印文档" onclick="TANGER_OCX_PrintDoc(false)"/>
</td>
</tr>
<tr align="left">
<td colspan="8"> &nbsp;工区号:
<input id="txtArea" name="txtArea" style="width:100px" type="text" value="<%=txtArea %>" />
&nbsp;管线号:
<input id="txtIsoCode" name="txtIsoCode" style="width:240px" type="text" value="<%=txtIsoCode %>" />
<input id="txtIsoId" name="txtIsoId" type="text" value="<%=txtIsoId %>" style="display:none" />
<input id="filename" name="filename" type="text" value="<%=filename %>" style="display:none"/>
<select id="drpJoint" name="drpJoint" style="width: 150px; height: 22px;"
onchange="bao(this.options[this.options.selectedIndex].value)" style="display:none"/>
<input id="test" name="test" style="width:120px" type="text" style="display:none" />
<input id="size" name="size" style="width:120px" type="text" style="display:none"/>
</td>
</tr>
</table>
</div>
<div id="officecontrol">
<!--引用NTKO OFFICE文档控件-->
<script language="javascript" type="text/javascript" src="../OfficeControl/ntkoofficecontrol.js"></script>
<!--控件事件代码开始-->
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(cmd,canceled);">
alert(cmd);
CancelLastCommand=true;
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentClosed();">
setFileOpenedOrClosed(false);
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentOpened(TANGER_OCX_str,TANGER_OCX_obj);">
//saved属性用来判断文档是否被修改过,文档打开的时候设置成ture,当文档被修改,自动被设置为false,该属性由office提供.
//TANGER_OCX_OBJ.ActiveDocument.Saved = true;
if(2==TANGER_OCX_OBJ.DocType)
{
try{
TANGER_OCX_OBJ.ActiveDocument.Application.ActiveWorkbook.Saved=true;
}catch(e)
{
alert("错误:" + err.number + ":" + err.description);
}
}
setFileOpenedOrClosed(true);//设置文档状态值
controlStyle();//插入控件样式自定义菜单
SetReviewMode(false);//设置文档在痕迹模式下编辑
setShowRevisions(false); //设置是否显示痕迹
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="BeforeOriginalMenuCommand(TANGER_OCX_str,TANGER_OCX_obj);">
alert("BeforeOriginalMenuCommand事件被触发");
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(TANGER_OCX_str,TANGER_OCX_obj);">
if (TANGER_OCX_str == 3)
{
alert("不能保存!");
CancelLastCommand = true;
}
</script>
<script language="JScript" for="TANGER_OCX" event="OnCustomMenuCmd2(menuPos,submenuPos,subsubmenuPos,menuCaption,menuID)">
//alert("第" + menuPos +","+ submenuPos +","+ subsubmenuPos +"个菜单项,menuID="+menuID+",菜单标题为\""+menuCaption+"\"的命令被执行.");
if("全网页查看"==menuCaption)objside();
if("恢复原大小"==menuCaption)objside2();
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="AfterPublishAsPDFToURL(result,code);">
result=trim(result);
alert(result);
if(result=="succeed")
{window.close();}
</script>
<!--控件事件代码结束-->
</div>
</div>
</div>
</div>
</form>
</body>
</html>
@@ -0,0 +1,118 @@
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BLL;
namespace FineUIPro.Web.FileManage
{
public partial class editCAD : PageBase
{
public string url, newofficetype, strOper;
public string txtArea, txtIsoCode, txtIsoId, filename;//定义表单数据
protected void Page_Load(object sender, EventArgs e)
{
txtIsoId = Request.QueryString["url"];
newofficetype = Request.QueryString["newofficetype"];
//strOper = Request.QueryString["oper"];
url = txtIsoId;
if (txtIsoId != null && txtIsoId != "")
{
SqlDataReader dr = null;
string strSql = string.Empty;
try
{
//strSql = "select iso.ISO_IsoNo,iso.FileName,area.WorkAreaCode from dbo.HJGL_PW_IsoInfo iso left join dbo.Project_WorkArea area on area.WorkAreaId=iso.BAW_ID where iso.ISO_ID='" + txtIsoId + "'";
//dr = BLL.SQLHelper.RunSql(strSql);
//var q = from x in BLL.Funs.DB.HJGL_PW_IsoInfo
// join y in BLL.Funs.DB.Project_WorkArea on x.BAW_ID equals y.WorkAreaId
// where x.ISO_ID == txtIsoId
// select new { x.ISO_IsoNo, x.FileName, y.WorkAreaCode };
//if (q.Count()>0)
//{
// txtIsoCode = q.First().ISO_IsoNo.ToString();
// txtArea = q.First().WorkAreaCode.ToString();
// if (q.First().FileName != null)
// {
// q.First().FileName.ToString();
// }
// else
// {
// filename = "";
// }
//}
}
catch (Exception err) { }
}
}
public string jointList()
{
//var q = from x in BLL.Funs.DB.HJGL_PW_JointInfo where x.ISO_ID == txtIsoId orderby x.JOT_JointNo select x;
string jointArr = string.Empty;
//if (q.Count() > 0)
//{
// foreach (var j in q)
// {
// if (!string.IsNullOrEmpty(j.DReportID))
// {
// jointArr = jointArr + j.JOT_ID + "," + j.JOT_JointNo + "已焊" + "|";
// }
// else
// {
// jointArr = jointArr + j.JOT_ID + "," + j.JOT_JointNo + "未焊" + "|";
// }
// }
//}
//return jointArr.Substring(0, jointArr.Length - 1);
return jointArr;
}
public string ReturnValue()
{
string reValue = string.Empty;
//var q = from x in BLL.Funs.DB.HJGL_PW_JointInfo where x.ISO_ID == txtIsoId orderby x.JOT_JointNo select x;
//if (q.Count() > 0)
//{
// foreach (var j in q)
// {
// if (j.WLO_Code != null)
// {
// reValue = reValue + j.JOT_ID + "," + (j.WLO_Code == "F" ? "安装" : "预制") + ",";
// }
// else
// {
// reValue = reValue + j.JOT_ID + "," + "" + ",";
// }
// if (j.JOT_Size != 0)
// {
// reValue = reValue + Convert.ToString(j.JOT_Size) + "|";
// }
// else
// {
// reValue = reValue + "0" + "|";
// }
// }
//}
//return reValue.Substring(0, reValue.Length - 1);
return reValue;
}
}
}
+15
View File
@@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.FileManage {
public partial class editCAD {
}
}
+768
View File
@@ -0,0 +1,768 @@
//以下是程序引用页面的定义
var editMScode = "EditOffice.aspx"; //编辑MS OFFICE文档页面程序
var editWPScode = "editwps.aspx"; //编辑WPS文档页面程序
var savecode = "Save.aspx"; //保存文档程序程序
var readcode = "Read.aspx"; //读取后台二进制数据程序
var delcode = "delete.aspx"; //执行数据删除后台程序
//以下变量为JS公共变量
var TANGER_OCX_bDocOpen = false;
var TANGER_OCX_filename; //文件名称
var filetype; //文件类型
var savetype; //文件保存类型
var TANGER_OCX_actionURL; //For auto generate form fiields
var TANGER_OCX_OBJ; //控件对象
var TANGER_OCX_Username = "匿名用户"; //User Name
var TANGER_OCX_key = ""; //设置加载印章的key
var IsFileOpened; //控件是否打开文档
var svisble = true; //印章显示状态
var url = ""; //初始化URL值
var newwin, newdoc;
//创建新的文档
function CreatNew(newofficetype) {
//根据传递文档类型参数新建文档
switch (newofficetype) {
case "1":
openoffice(url, newofficetype)
break
case "2":
openoffice(url, newofficetype)
break
case "3":
openoffice(url, newofficetype)
break
case "4":
openoffice(url, newofficetype)
break
case "5":
openoffice(url, newofficetype)
break
default:
openoffice(url, "1")
break;
}
}
function openoffice(url, newofficetype) {
window.open(editMScode + "?newofficetype=" + newofficetype + "&url=" + url, "editoffice", "top=0,left=0,scrollbars=yes,resizable=yes");
}
//当前表单不可编辑,当整个表单只读时调用
function FormDisabled(bool) {
var formid = document.forms.item(0)
var elelength = formid.length;
for (var i = 0; i < elelength; i++)
{ formid.elements[i].disabled = bool; }
//下面是控件标题栏,状态栏,工具栏,菜单栏不显示
TANGER_OCX_OBJ.TitleBar = !bool;
TANGER_OCX_OBJ.Statusbar = !bool;
TANGER_OCX_OBJ.ToolBars = !bool;
TANGER_OCX_OBJ.Menubar = !bool;
document.getElementById("editmain_left").style.display = "none";
document.getElementById("editmain_right").style.width = "95%";
}
//示例程序帮助文档
function NtkoHelp() {
window.open("help.htm", "help");
}
//编辑文档
function editoffice(url, newofficetype) {
TANGER_OCX_OBJ = document.getElementById("TANGER_OCX"); //;初始化控件对象
//根据文档URL和newofficetype编辑文档,如果有url是编辑已有文档,如果为空根据newofficetype新建文档
if ((typeof (url) != "undefined") && (url != "")) {
var filename = document.all("filename").value;
// alert(filename);
try { TANGER_OCX_OBJ.BeginOpenFromURL("uploadOfficeFile/" + filename); } catch (err) { };
}
else {
switch (newofficetype) {
//新建文档
case "1":
TANGER_OCX_OBJ.CreateNew("word.document"); //word文档
break
case "2":
TANGER_OCX_OBJ.CreateNew("excel.sheet"); //excel电子表格
break
case "3":
TANGER_OCX_OBJ.CreateNew("PowerPoint.Show"); //微软幻灯片
break
case "4":
TANGER_OCX_OBJ.CreateNew("WPS.Document"); //金山文档
break
case "5":
TANGER_OCX_OBJ.CreateNew("ET.WorkBook"); //金山电子表格
break
default:
alert("文档编辑出错!")
break
}
}
}
function intializePage() {
TANGER_OCX_OBJ = document.all("TANGER_OCX");
}
//文档编辑页面关闭事件
function onPageClose() {
if (IsFileOpened) {
if (!TANGER_OCX_OBJ.ActiveDocument.Saved) {
if (confirm("文档修改过,还没有保存,是否需要保存?")) {
saveFileToUrl();
}
}
}
}
function TANGER_OCX_OpenDoc(fileUrl) {
if (fileUrl != null || fileUrl != "") {
TANGER_OCX_OBJ.BeginOpenFromURL(fileUrl);
}
else {
alert("dd");
TANGER_OCX_OBJ.BegingOpenFromURL("templateFile/newWordTemplate.doc")
}
}
function TANGER_OCX_OpenDoc1(URL, newofficetype) {
TANGER_OCX_OBJ = document.getElementById("TANGER_OCX");
if ((typeof (URL) != "undefined") && (URL != "")) {
try { TANGER_OCX_OBJ.BeginOpenFromURL(URL); } catch (err) { };
}
else {
try {
switch (newofficetype) {
//新建文档
case "1":
TANGER_OCX_OBJ.CreateNew("word.document"); //word文档
break
case "2":
TANGER_OCX_OBJ.CreateNew("excel.sheet"); //excel电子表格
break
case "3":
TANGER_OCX_OBJ.CreateNew("PowerPoint.Show"); //微软幻灯片
break
case "4":
TANGER_OCX_OBJ.CreateNew("WPS.Document"); //金山文档
break
case "5":
TANGER_OCX_OBJ.CreateNew("ET.WorkBook"); //金山电子表格
break
default:
alert("文档编辑出错!")
break
}
} catch (err) { };
}
}
//设置文件是打开还是关闭
function setFileOpenedOrClosed(bool) {
IsFileOpened = bool;
fileType = TANGER_OCX_OBJ.DocType;
}
function trim(str) { //删除左右两端的空格
return str.replace(/(^\s*)|(\s*$)/g, "");
}
function erropen(retHTML) {
newwin = window.open("", "_blank", "left=200,top=200,width=400,height=300,status=0,toolbar=0,menubar=0,location=0,scrollbars=1,resizable=1", false);
newdoc = newwin.document;
newdoc.open();
newdoc.write("<html><head><title>返回的数据</title></head><body><center><hr>")
newdoc.write(retHTML + "kdkd<hr>");
newdoc.write("<input type=button VALUE='关闭窗口' onclick='window.close();'>");
newdoc.write('</center></body></html>');
newdoc.close();
}
//保存office文档
function saveFileToUrl() {
var fileName = trim(document.all("txtFileName").value);
if (fileName.length == 0) { alert("请输入文件名称!"); document.all("txtFileName").focus(); return false; } //判断文件标题输入域
var result, filedot;
if (IsFileOpened) {
switch (TANGER_OCX_OBJ.doctype) {
case 1:
fileType = "Word.Document";
filedot = ".doc";
break;
case 2:
fileType = "Excel.Sheet";
filedot = ".xls";
break;
case 3:
fileType = "PowerPoint.Show";
filedot = ".ppt";
break;
case 4:
fileType = "Visio.Drawing";
filedot = ".vso"
break;
case 5:
fileType = "MSProject.Project";
filedot = ".pro";
break;
case 6:
fileType = "WPS Doc";
filedot = ".wps";
break;
case 7:
fileType = "Kingsoft Sheet";
filedot = ".et";
break;
default:
fileType = "unkownfiletype";
filedot = ".doc";
}
retHTML = TANGER_OCX_OBJ.saveToURL(savecode, //提交到的url地址
"EDITFILE", //文件域的id,类似<input type=file id=upLoadFile 中的id
"savetype=1&fileType=" + fileType, //与控件一起提交的参数,savetype参数为要保存的文件格式office,html,pdf。filetype参数保存文件类型
fileName + filedot, //上传文件的名称,类似<input type=file 的value
0 //与控件一起提交的表单id,也可以是form的序列号,这里应该是0.
);
switch (TANGER_OCX_OBJ.StatusCode) {
case 0:
alert("文件保存成功");
TANGER_OCX_OBJ.ActiveDocument.Saved = true;
window.opener = null;
//window.opener.location.reload()
window.close();
//window.location.reload();
//parent.location.reload();
//window.opener.location.href = window.opener.location.href;
break;
case 1:
erropen(retHTML);
break;
case 2:
erropen(retHTML);
break;
case 3:
erropen(retHTML);
break;
case 4:
erropen(retHTML);
break;
case 5:
erropen(retHTML);
break;
case 6:
erropen(retHTML);
break;
case 100:
erropen(retHTML);
break;
}
}
else {
alert("不能执行保存,没有编辑文档!");
}
}
//保存office文档1
function saveFileToUrl1() {
var fileName = "test.doc";
if (fileName.length == 0) { alert("请输入文件标题!"); document.all("filetitle").focus(); return false; } //判断文件标题输入域
var result,
retHTML = TANGER_OCX_OBJ.saveToURL(savecode, //提交到的url地址
"EDITFILE", //文件域的id,类似<input type=file id=upLoadFile 中的id
"savetype=1&fileType=doc", //与控件一起提交的参数,savetype参数为要保存的文件格式office,html,pdf。filetype参数保存文件类型
fileName, //上传文件的名称,类似<input type=file 的value
0 //与控件一起提交的表单id,也可以是form的序列号,这里应该是0.
);
newwin = window.open("", "_blank", "left=200,top=200,width=400,height=300,status=0,toolbar=0,menubar=0,location=0,scrollbars=1,resizable=1", false);
newdoc = newwin.document;
newdoc.open();
newdoc.write("<center><hr>" + retHTML + "<hr><input type=button VALUE='关闭窗口' onclick='window.close();if(window.opener){window.opener.location.reload()};'></center>");
newdoc.close();
window.opener.focus();
}
//保存文档为html文件到服务器
function saveFileAsHtmlToUrl() {
var fileName = trim(document.all("filetitle").value);
if (fileName.length == 0) { alert("请输入文件标题!"); document.all("filetitle").focus(); return false; } //判断文件标题输入域
var result, filedot;
if (IsFileOpened) {
switch (TANGER_OCX_OBJ.doctype) {
case 1:
fileType = "Word.Document";
filedot = ".doc";
break;
case 2:
fileType = "Excel.Sheet";
filedot = ".xls";
break;
case 3:
fileType = "PowerPoint.Show";
filedot = ".ppt";
break;
case 4:
fileType = "Visio.Drawing";
filedot = ".vso"
break;
case 5:
fileType = "MSProject.Project";
filedot = ".pro";
break;
case 6:
fileType = "WPS Doc";
filedot = ".wps";
break;
case 7:
fileType = "Kingsoft Sheet";
filedot = ".et";
break;
default:
fileType = "unkownfiletype";
filedot = ".doc";
}
retHTML = TANGER_OCX_OBJ.PublishAsHTMLToURL(savecode, //提交到的url地址
"EDITFILE", //文件域的id,类似<input type=file id=upLoadFile 中的id
"savetype=2&fileType=" + fileType, //与控件一起提交的参数,savetype参数为要保存的文件格式office,html,pdf。filetype参数保存文件类型
fileName, //上传文件的名称,类似<input type=file 的value
0 //与控件一起提交的表单id,也可以是form的序列号,这里应该是0.
);
newwin = window.open("", "_blank", "left=200,top=200,width=400,height=300,status=0,toolbar=0,menubar=0,location=0,scrollbars=1,resizable=1", false);
newdoc = newwin.document;
newdoc.open();
newdoc.write("<center><hr>" + retHTML + "<hr><input type=button VALUE='关闭窗口' onclick='window.close();if(window.opener){window.opener.location.reload()};'></center>");
newdoc.close();
window.opener.focus();
}
else {
alert("不能执行保存,没有编辑文档!");
}
}
//保护文档为pdf格式
function saveFileAsPdfToUrl() {
var fileName = trim(document.all("filetitle").value);
if (fileName.length == 0) { alert("请输入文件标题!"); document.all("filetitle").focus(); return false; } //判断文件标题输入域
var result, filedot;
if (IsFileOpened && TANGER_OCX_OBJ.IsPDFCreatorInstalled()) {
switch (TANGER_OCX_OBJ.doctype) {
case 1:
fileType = "Word.Document";
filedot = ".doc";
break;
case 2:
fileType = "Excel.Sheet";
filedot = ".xls";
break;
case 3:
fileType = "PowerPoint.Show";
filedot = ".ppt";
break;
case 4:
fileType = "Visio.Drawing";
filedot = ".vso"
break;
case 5:
fileType = "MSProject.Project";
filedot = ".pro";
break;
case 6:
fileType = "WPS Doc";
filedot = ".wps";
break;
case 7:
fileType = "Kingsoft Sheet";
filedot = ".et";
break;
default:
fileType = "unkownfiletype";
filedot = ".doc";
}
TANGER_OCX_OBJ.PublishAsPDFToURL(savecode, //提交到的url地址
"EDITFILE", //文件域的id,类似<input type=file id=upLoadFile 中的id
"savetype=3&fileType=" + fileType, //与控件一起提交的参数,savetype参数为要保存的文件格式office,html,pdf。filetype参数保存文件类型
fileName + filedot, //上传文件的名称,类似<input type=file 的value
0, //与控件一起提交的表单id,也可以是form的序列号,这里应该是0.
null, //sheetname,保存excel的哪个表格
true, //IsShowUI,是否显示保存界面
false, // IsShowMsg,是否显示保存成功信息
false, // IsUseSecurity,是否使用安全特性
null, // OwnerPass,安全密码.可直接传值
false, //IsPermitPrint,是否允许打印
true //IsPermitCopy,是否允许拷贝
);
}
else {
alert("不能执行保存,没有编辑文档或者没有安装PDF虚拟打印机!");
}
}
function testFunction() {
alert(IsFileOpened);
}
function addServerSecSign() {
var signUrl = document.all("secSignFileUrl").options[document.all("secSignFileUrl").selectedIndex].value;
if (IsFileOpened) {
if (TANGER_OCX_OBJ.doctype == 1 || TANGER_OCX_OBJ.doctype == 2) {
try {
alert("正式版本用户请插入EKEY!\r\n\r\n此为电子印章系统演示功能,请购买正式版本!");
TANGER_OCX_OBJ.AddSecSignFromURL("ntko", signUrl);
}
catch (error) { }
}
else
{ alert("不能在该类型文档中使用安全签名印章."); }
}
}
function addLocalSecSign() {
if (IsFileOpened) {
if (TANGER_OCX_OBJ.doctype == 1 || TANGER_OCX_OBJ.doctype == 2) {
try
{ TANGER_OCX_OBJ.AddSecSignFromLocal("ntko", ""); }
catch (error) { }
}
else
{ alert("不能在该类型文档中使用安全签名印章."); }
}
}
function addEkeySecSign() {
if (IsFileOpened) {
if (TANGER_OCX_OBJ.doctype == 1 || TANGER_OCX_OBJ.doctype == 2) {
try
{ TANGER_OCX_OBJ.AddSecSignFromEkey("ntko"); }
catch (error) { }
}
else
{ alert("不能在该类型文档中使用安全签名印章."); }
}
}
function addHandSecSign() {
if (IsFileOpened) {
if (TANGER_OCX_OBJ.doctype == 1 || TANGER_OCX_OBJ.doctype == 2) {
try
{ TANGER_OCX_OBJ.AddSecHandSign("ntko"); }
catch (error) { }
}
else
{ alert("不能在该类型文档中使用安全签名印章."); }
}
}
function addServerSign(signUrl) {
if (IsFileOpened) {
try {
TANGER_OCX_OBJ.AddSignFromURL("ntko", //印章的用户名
signUrl, //印章所在服务器相对url
100, //左边距
100, //上边距 根据Relative的设定选择不同参照对象
"ntko", //调用DoCheckSign函数签名印章信息,用来验证印章的字符串
3, //Relative,取值1-4。设置左边距和上边距相对以下对象所在的位置 1:光标位置;2:页边距;3:页面距离 4:默认设置栏,段落
100, //缩放印章,默认100%
1); //0印章位于文字下方,1位于上方
}
catch (error) { }
}
}
function addLocalSign() {
if (IsFileOpened) {
try {
TANGER_OCX_OBJ.AddSignFromLocal("ntko", //印章的用户名
"", //缺省文件名
true, //是否提示选择
100, //左边距
100, //上边距 根据Relative的设定选择不同参照对象
"ntko", //调用DoCheckSign函数签名印章信息,用来验证印章的字符串
3, //Relative,取值1-4。设置左边距和上边距相对以下对象所在的位置 1:光标位置;2:页边距;3:页面距离 4:默认设置栏,段落
100, //缩放印章,默认100%
1); //0印章位于文字下方,1位于上方
}
catch (error) { }
}
}
function addPicFromUrl(picURL) {
if (IsFileOpened) {
if (TANGER_OCX_OBJ.doctype == 1 || TANGER_OCX_OBJ.doctype == 2) {
try {
TANGER_OCX_OBJ.AddPicFromURL(picURL, //图片的url地址可以时相对或者绝对地址
false, //是否浮动,此参数设置为false时,top和left无效
100, //left 左边距
100, //top 上边距 根据Relative的设定选择不同参照对象
1, //Relative,取值1-4。设置左边距和上边距相对以下对象所在的位置 1:光标位置;2:页边距;3:页面距离 4:默认设置栏,段落
100, //缩放印章,默认100%
1); //0印章位于文字下方,1位于上方
}
catch (error) { }
}
else
{ alert("不能在该类型文档中使用安全签名印章."); }
}
}
function addPicFromLocal() {
if (IsFileOpened) {
try {
TANGER_OCX_OBJ.AddPicFromLocal("", //印章的用户名
true, //缺省文件名
false, //是否提示选择
100, //左边距
100, //上边距 根据Relative的设定选择不同参照对象
1, //Relative,取值1-4。设置左边距和上边距相对以下对象所在的位置 1:光标位置;2:页边距;3:页面距离 4:默认设置栏,段落
100, //缩放印章,默认100%
1); //0印章位于文字下方,1位于上方
}
catch (error) { }
}
}
function TANGER_OCX_AddDocHeader(strHeader) {
if (!IsFileOpened)
{ return; }
var i, cNum = 30;
var lineStr = "";
try {
for (i = 0; i < cNum; i++) lineStr += "_"; //生成下划线
with (TANGER_OCX_OBJ.ActiveDocument.Application) {
Selection.HomeKey(6, 0); // go home
Selection.TypeText(strHeader);
Selection.TypeParagraph(); //换行
Selection.TypeText(lineStr); //插入下划线
// Selection.InsertSymbol(95,"",true); //插入下划线
Selection.TypeText("★");
Selection.TypeText(lineStr); //插入下划线
Selection.TypeParagraph();
//Selection.MoveUp(5, 2, 1); //上移两行,且按住Shift键,相当于选择两行
Selection.HomeKey(6, 1); //选择到文件头部所有文本
Selection.ParagraphFormat.Alignment = 1; //居中对齐
with (Selection.Font) {
NameFarEast = "宋体";
Name = "宋体";
Size = 12;
Bold = false;
Italic = false;
Underline = 0;
UnderlineColor = 0;
StrikeThrough = false;
DoubleStrikeThrough = false;
Outline = false;
Emboss = false;
Shadow = false;
Hidden = false;
SmallCaps = false;
AllCaps = false;
Color = 255;
Engrave = false;
Superscript = false;
Subscript = false;
Spacing = 0;
Scaling = 100;
Position = 0;
Kerning = 0;
Animation = 0;
DisableCharacterSpaceGrid = false;
EmphasisMark = 0;
}
Selection.MoveDown(5, 3, 0); //下移3行
}
}
catch (err) {
alert("错误:" + err.number + ":" + err.description);
}
finally {
}
}
function insertRedHeadFromUrl(headFileURL) {
if (TANGER_OCX_OBJ.doctype != 1)//TANGER_OCX_OBJ.doctype=1为word文档
{ return; }
TANGER_OCX_OBJ.ActiveDocument.Application.Selection.HomeKey(6, 0); //光标移动到文档开头
TANGER_OCX_OBJ.addtemplatefromurl(headFileURL); //在光标位置插入红头文档
}
function insertRedButtomFromUrl(headFileURL) {
if (TANGER_OCX_OBJ.doctype != 1)//TANGER_OCX_OBJ.doctype=1为word文档
{ return; }
TANGER_OCX_OBJ.ActiveDocument.Application.Selection.EndKey(6, 0);
TANGER_OCX_OBJ.ActiveDocument.Application.Selection.TypeParagraph();
TANGER_OCX_OBJ.addtemplatefromurl(headFileURL); //在光标位置插入红头文档
}
function openTemplateFileFromUrl(templateUrl) {
TANGER_OCX_OBJ.openFromUrl(templateUrl);
}
function doHandSign() {
/*if(TANGER_OCX_OBJ.doctype==1||TANGER_OCX_OBJ.doctype==2)//此处设置只允许在word和excel中盖章.doctype=1是"word"文档,doctype=2是"excel"文档
{*/
TANGER_OCX_OBJ.DoHandSign2(
"ntko", //手写签名用户名称
"ntko", //signkey,DoCheckSign(检查印章函数)需要的验证密钥。
0, //left
0, //top
1, //relative,设定签名位置的参照对象.0:表示按照屏幕位置插入,此时,Left,Top属性不起作用。1:光标位置;2:页边距;3:页面距离 4:默认设置栏,段落(为兼容以前版本默认方式)
100);
//}
}
// 存为本地文件
function WebSaveLocal() {
TANGER_OCX_OBJ.ShowDialog(3);
}
// 打开本地文件
function WebOpenLocal() {
TANGER_OCX_OBJ.ShowDialog(1);
}
// 打印预览
function PrintPreview() {
TANGER_OCX_OBJ.PrintPreview();
}
// 页面设置
function WebPageSetup() {
TANGER_OCX_OBJ.showDialog(5);
}
//isBackground参数可以控制是前台打印还是后台打印。对于比较大的文档,如果确认必须等待用户打印完毕,可以调用TANGER_OCX_PrintDoc(false);函数来进行前台打印。
function TANGER_OCX_PrintDoc(isBackground) {
var oldOption;
try {
var objOptions = TANGER_OCX_OBJ.ActiveDocument.Application.Options;
oldOption = objOptions.PrintBackground;
objOptions.PrintBackground = isBackground;
}
catch (err) { };
TANGER_OCX_OBJ.printout(true);
try {
var objOptions = TANGER_OCX_OBJ.ActiveDocument.Application.Options;
objOptions.PrintBackground = oldOption;
}
catch (err) { };
}
function SetReviewMode(boolvalue) {
if (TANGER_OCX_OBJ.doctype == 1) {
TANGER_OCX_OBJ.ActiveDocument.TrackRevisions = boolvalue; //设置是否保留痕迹
}
}
function setShowRevisions(boolevalue) {
if (TANGER_OCX_OBJ.doctype == 1) {
TANGER_OCX_OBJ.ActiveDocument.ShowRevisions = boolevalue; //设置是否显示痕迹
}
}
//接受或者取消所有修订
function TANGER_OCX_AllRevisions(bool) {
if (bool) {
TANGER_OCX_OBJ.ActiveDocument.AcceptAllRevisions(); //接受所有的痕迹修订
}
else {
TANGER_OCX_OBJ.ActiveDocument.Application.WordBasic.RejectAllChangesInDoc(); //拒绝所有的痕迹修订
}
}
function setFilePrint(boolvalue) {
TANGER_OCX_OBJ.fileprint = boolvalue; //是否允许打印
}
function setFileNew(boolvalue) {
TANGER_OCX_OBJ.FileNew = boolvalue; //是否允许新建
}
function setFileSaveAs(boolvalue) {
TANGER_OCX_OBJ.FileSaveAs = boolvalue; //是否允许另存为
}
function setIsNoCopy(boolvalue) {
TANGER_OCX_OBJ.IsNoCopy = boolvalue; //是否禁止粘贴
}
function DoCheckSign() {
if (IsFileOpened) {
var ret = TANGER_OCX_OBJ.DoCheckSign
(
false, /*可选参数 IsSilent 缺省为FAlSE,表示弹出验证对话框,否则,只是返回验证结果到返回值*/
"ntko"//使用盖章时的signkey,这里为"ntko"
); //返回值,验证结果字符串
//alert(ret);
}
}
function setToolBar() {
TANGER_OCX_OBJ.ToolBars = !TANGER_OCX_OBJ.ToolBars;
}
function setMenubar() {
TANGER_OCX_OBJ.Menubar = !TANGER_OCX_OBJ.Menubar;
}
function setInsertMemu() {
TANGER_OCX_OBJ.IsShowInsertMenu = !TANGER_OCX_OBJ.IsShowInsertMenu;
}
function setEditMenu() {
TANGER_OCX_OBJ.IsShowEditMenu = !TANGER_OCX_OBJ.IsShowEditMenu;
}
function setToolMenu() {
TANGER_OCX_OBJ.IsShowToolMenu = !TANGER_OCX_OBJ.IsShowToolMenu;
}
//增加自定义菜单
function initCustomMenus1() {
var myobj = TANGER_OCX_OBJ;
for (var menuPos = 0; menuPos < 1; menuPos++) {
myobj.AddCustomMenu2(menuPos, "常用功能" + "(&" + menuPos + ")");
for (var submenuPos = 0; submenuPos < 1; submenuPos++) {
myobj.AddCustomMenuItem2(menuPos, submenuPos, -1, true, "打印设置", false);
//增加子菜单项目
for (var subsubmenuPos = 0; subsubmenuPos < 3; subsubmenuPos++) {
if (0 == subsubmenuPos)//增加子菜单项目
{
myobj.AddCustomMenuItem2(menuPos, submenuPos, subsubmenuPos, false,
"设置打印区域", false, menuPos * 100 + submenuPos * 20 + subsubmenuPos);
}
if (1 == subsubmenuPos)//增加子菜单项目
{
myobj.AddCustomMenuItem2(menuPos, submenuPos, subsubmenuPos, false,
"取消打印区域", false, menuPos * 100 + submenuPos * 20 + subsubmenuPos);
}
if (2 == subsubmenuPos) {
myobj.AddCustomMenuItem2(menuPos, submenuPos, subsubmenuPos, false,
"手写批注", false, menuPos * 100 + submenuPos * 20 + subsubmenuPos);
}
}
}
}
}
//控件控制
function controlStyle() {
var myobj = TANGER_OCX_OBJ;
for (var menuPos = 0; menuPos < 1; menuPos++) {
myobj.AddCustomMenu2(menuPos, "控件样式" + "(&" + menuPos + ")");
for (var submenuPos = 0; submenuPos < 1; submenuPos++) {
myobj.AddCustomMenuItem2(menuPos, submenuPos, -1, true, "改变大小", false);
//增加子菜单项目
for (var subsubmenuPos = 0; subsubmenuPos < 2; subsubmenuPos++) {
if (0 == subsubmenuPos)//增加子菜单项目
{
myobj.AddCustomMenuItem2(menuPos, submenuPos, subsubmenuPos, false,
"全网页查看", false, menuPos * 100 + submenuPos * 20 + subsubmenuPos);
}
if (1 == subsubmenuPos)//增加子菜单项目
{
myobj.AddCustomMenuItem2(menuPos, submenuPos, subsubmenuPos, false,
"恢复原大小", false, menuPos * 100 + submenuPos * 20 + subsubmenuPos);
}
}
}
}
}
//改变控件大小为当前网页可见区域
function objside() {
document.all.officecontrol.style.position = "absolute";
document.all.officecontrol.style.left = "0px";
document.all.officecontrol.style.top = "0px";
document.all.officecontrol.style.width = document.body.clientWidth; //网页可见区域宽
document.all.officecontrol.style.height = document.body.clientHeight; //网页可见区域高
}
//恢复控件显示大小
function objside2() {
document.all.officecontrol.style.position = "relative";
document.all.officecontrol.style.left = "0px";
document.all.officecontrol.style.top = "0px";
document.all.officecontrol.style.width = "100%";
document.all.officecontrol.style.height = "980px";
}
//显示或隐藏文档控件对象
function ObjectDisplay(boolvalue) {
var obj = document.getElementById("objside");
if (!boolvalue) {
obj.style.display = "none";
}
else {
obj.style.display = "block";
}
}