20240206 生产人员培训

This commit is contained in:
2024-02-06 17:11:15 +08:00
parent 68f0498287
commit 49458be8e5
20 changed files with 1885 additions and 911 deletions
@@ -5,7 +5,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>人员培训记录</title>
<title>人员培训计划</title>
</head>
<body>
<form id="form1" runat="server">
@@ -13,7 +13,7 @@
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="人员培训记录" EnableCollapse="true"
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="人员培训计划" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="PersonTrainPlanId" AllowCellEditing="true" EnableColumnLines="true"
ClicksToEdit="2" DataIDField="PersonTrainPlanId" AllowSorting="true" SortField="TrainingDate"
SortDirection="DESC" OnSort="Grid1_Sort"
@@ -40,22 +40,22 @@
<asp:Label ID="lblPageIndex" runat="server" Text='<%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField ColumnID="TrainType" DataField="TrainType" FieldType="String" HeaderText="培训类型" TextAlign="Center"
<%-- <f:RenderField ColumnID="TrainType" DataField="TrainType" FieldType="String" HeaderText="培训类型" TextAlign="Center"
HeaderTextAlign="Center" Width="150px">
</f:RenderField>
<f:RenderField ColumnID="Purpose" DataField="Purpose" FieldType="String" HeaderText="培训目的"
HeaderTextAlign="Center" Width="150px">
</f:RenderField>
</f:RenderField>--%>
<f:RenderField ColumnID="TrainingContent" DataField="TrainingContent" FieldType="String" HeaderText="培训内容"
HeaderTextAlign="Center" Width="120px" ExpandUnusedSpace="true">
</f:RenderField>
<f:RenderField ColumnID="TrainingAddress" DataField="TrainingAddress" FieldType="String" HeaderText="培训地点"
HeaderTextAlign="Center" Width="120px">
HeaderTextAlign="Center" Width="120px" ExpandUnusedSpace="true">
</f:RenderField>
<f:RenderField ColumnID="TrainingDate" DataField="TrainingDate" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="培训时间"
HeaderTextAlign="Center" Width="100px">
HeaderTextAlign="Center" Width="120px">
</f:RenderField>
<f:RenderField ColumnID="TrainingPersonNum" DataField="TrainingPersonNum" FieldType="String" HeaderText="参训人员及人数"
<%-- <f:RenderField ColumnID="TrainingPersonNum" DataField="TrainingPersonNum" FieldType="String" HeaderText="参训人员及人数"
HeaderTextAlign="Center" Width="120px">
</f:RenderField>
<f:RenderField ColumnID="TrainingHours" DataField="TrainingHours" FieldType="String" HeaderText="培训学时数"
@@ -69,8 +69,8 @@
</f:RenderField>
<f:RenderField ColumnID="AssessmentMethod" DataField="AssessmentMethod" FieldType="String" HeaderText="考核方式"
HeaderTextAlign="Center" Width="100px">
</f:RenderField>
<f:LinkButtonField HeaderText="附件" ConfirmTarget="Top" Width="90" CommandName="AttachUrl" ColumnID="AttachUrl"
</f:RenderField>--%>
<f:LinkButtonField HeaderText="培训计划" ConfirmTarget="Top" Width="90" CommandName="AttachUrl" ColumnID="AttachUrl"
TextAlign="Center" ToolTip="附件查看" Icon="Find" />
</Columns>
<Listeners>
@@ -92,9 +92,9 @@
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="人员培训记录" Hidden="true" EnableIFrame="true" EnableMaximize="true"
<f:Window ID="Window1" Title="人员培训计划" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" OnClose="Window1_Close"
Width="900px" Height="620px">
Width="800px" Height="420px">
</f:Window>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
@@ -5,7 +5,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>编辑人员培训记录</title>
<title>编辑人员培训计划</title>
</head>
<body>
<form id="form1" runat="server">
@@ -34,27 +34,31 @@
<f:Form ID="Form2" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<%-- <f:FormRow>
<Items>
<f:DropDownList ID="drpTrainType" runat="server" Label="培训类型" LabelAlign="Right" LabelWidth="120px" ShowRedStar="true" Required="true"></f:DropDownList>
<f:TextBox ID="txtPurpose" runat="server" Label="培训目的" LabelAlign="Right" LabelWidth="100px" MaxLength="50">
</f:TextBox>
</Items>
</f:FormRow>
</f:FormRow>--%>
<f:FormRow>
<Items>
<f:TextArea ID="txtTrainingContent" runat="server" Label="培训内容" LabelAlign="Right" LabelWidth="120px" MaxLength="200" Required="true" ShowRedStar="true">
</f:TextArea>
<f:TextBox ID="txtTrainingContent" runat="server" Label="培训内容" LabelAlign="Right" LabelWidth="120px" MaxLength="200" Required="true" ShowRedStar="true">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtTrainingAddress" runat="server" Label="培训地址" LabelAlign="Right" LabelWidth="120px" MaxLength="50" Required="true" ShowRedStar="true">
</f:TextBox>
<f:DatePicker ID="txtTrainingDate" runat="server" Label="培训时间" LabelAlign="Right" LabelWidth="100px" Required="true" ShowRedStar="true"></f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DatePicker ID="txtTrainingDate" runat="server" Label="培训时间" LabelAlign="Right" LabelWidth="120px" Required="true" ShowRedStar="true"></f:DatePicker>
</Items>
</f:FormRow>
<%-- <f:FormRow>
<Items>
<f:TextBox ID="txtTrainingPersonNum" runat="server" Label="参训人员及人数" LabelAlign="Right" LabelWidth="120px" MaxLength="100">
</f:TextBox>
@@ -75,13 +79,13 @@
</f:TextBox>
<f:Label ID="Label1" runat="server"></f:Label>
</Items>
</f:FormRow>
</f:FormRow>--%>
<f:FormRow runat="server">
<Items>
<f:Panel ID="Panel3" Width="300px" ShowHeader="false" ShowBorder="false" Layout="Column" CssClass="" runat="server">
<Items>
<f:Label ID="lblAttach" runat="server" Label="附件"
LabelWidth="100px">
<f:Label ID="lblAttach" runat="server" Label="培训计划"
LabelWidth="120px">
</f:Label>
<f:Button ID="btnAttach" Icon="TableCell" EnablePostBack="true" Text="附件" runat="server" OnClick="btnAttach_Click">
</f:Button>
@@ -16,10 +16,10 @@ namespace FineUIPro.Web.TestRun.PersonTrain
if (!IsPostBack)
{
///培训类型
this.drpTrainType.DataTextField = "Text";
this.drpTrainType.DataValueField = "Value";
this.drpTrainType.DataSource=BLL.DropListService.drpTrainTypeList();
this.drpTrainType.DataBind();
//this.drpTrainType.DataTextField = "Text";
//this.drpTrainType.DataValueField = "Value";
//this.drpTrainType.DataSource=BLL.DropListService.drpTrainTypeList();
//this.drpTrainType.DataBind();
string id = Request.Params["id"];
if (!string.IsNullOrEmpty(id))
@@ -28,19 +28,19 @@ namespace FineUIPro.Web.TestRun.PersonTrain
if (data != null)
{
this.hdId.Text = id;
if (!string.IsNullOrEmpty(data.TrainType))
{
this.drpTrainType.SelectedValue = data.TrainType;
}
this.txtPurpose.Text = data.Purpose;
//if (!string.IsNullOrEmpty(data.TrainType))
//{
// this.drpTrainType.SelectedValue = data.TrainType;
//}
//this.txtPurpose.Text = data.Purpose;
this.txtTrainingContent.Text = data.TrainingContent;
this.txtTrainingAddress.Text = data.TrainingAddress;
this.txtTrainingDate.Text = data.TrainingDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.TrainingDate) : "";
this.txtTrainingPersonNum.Text = data.TrainingPersonNum;
this.txtTrainingHours.Text = data.TrainingHours.HasValue ? data.TrainingHours.ToString() : "";
this.txtTrainingManager.Text = data.TrainingManager;
this.txtTrainingTeacher.Text = data.TrainingTeacher;
this.txtAssessmentMethod.Text = data.AssessmentMethod;
//this.txtTrainingPersonNum.Text = data.TrainingPersonNum;
//this.txtTrainingHours.Text = data.TrainingHours.HasValue ? data.TrainingHours.ToString() : "";
//this.txtTrainingManager.Text = data.TrainingManager;
//this.txtTrainingTeacher.Text = data.TrainingTeacher;
//this.txtAssessmentMethod.Text = data.AssessmentMethod;
}
}
else
@@ -75,23 +75,23 @@ namespace FineUIPro.Web.TestRun.PersonTrain
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.drpTrainType.SelectedValue)||this.drpTrainType.SelectedValue==BLL.Const._Null)
{
Alert.ShowInTop("请选择培训类型!", MessageBoxIcon.Warning);
return;
}
//if (string.IsNullOrEmpty(this.drpTrainType.SelectedValue)||this.drpTrainType.SelectedValue==BLL.Const._Null)
//{
// Alert.ShowInTop("请选择培训类型!", MessageBoxIcon.Warning);
// return;
//}
string id = Request.Params["id"];
Model.TestRun_PersonTrainPlan newData = new Model.TestRun_PersonTrainPlan();
newData.TrainType = this.drpTrainType.SelectedValue;
newData.Purpose = this.txtPurpose.Text.Trim();
//newData.TrainType = this.drpTrainType.SelectedValue;
//newData.Purpose = this.txtPurpose.Text.Trim();
newData.TrainingContent = this.txtTrainingContent.Text.Trim();
newData.TrainingAddress = this.txtTrainingAddress.Text.Trim();
newData.TrainingDate = Funs.GetNewDateTime(this.txtTrainingDate.Text.Trim());
newData.TrainingPersonNum = this.txtTrainingPersonNum.Text.Trim();
newData.TrainingHours = Funs.GetNewDecimal(this.txtTrainingHours.Text.Trim());
newData.TrainingManager = this.txtTrainingManager.Text.Trim();
newData.TrainingTeacher = this.txtTrainingTeacher.Text.Trim();
newData.AssessmentMethod = this.txtAssessmentMethod.Text.Trim();
//newData.TrainingPersonNum = this.txtTrainingPersonNum.Text.Trim();
//newData.TrainingHours = Funs.GetNewDecimal(this.txtTrainingHours.Text.Trim());
//newData.TrainingManager = this.txtTrainingManager.Text.Trim();
//newData.TrainingTeacher = this.txtTrainingTeacher.Text.Trim();
//newData.AssessmentMethod = this.txtAssessmentMethod.Text.Trim();
newData.ProjectId = this.CurrUser.LoginProjectId;
if (!string.IsNullOrEmpty(id))
{
@@ -102,24 +102,6 @@ namespace FineUIPro.Web.TestRun.PersonTrain {
/// </remarks>
protected global::FineUIPro.Form Form2;
/// <summary>
/// drpTrainType 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpTrainType;
/// <summary>
/// txtPurpose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPurpose;
/// <summary>
/// txtTrainingContent 控件。
/// </summary>
@@ -127,7 +109,7 @@ namespace FineUIPro.Web.TestRun.PersonTrain {
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextArea txtTrainingContent;
protected global::FineUIPro.TextBox txtTrainingContent;
/// <summary>
/// txtTrainingAddress 控件。
@@ -147,60 +129,6 @@ namespace FineUIPro.Web.TestRun.PersonTrain {
/// </remarks>
protected global::FineUIPro.DatePicker txtTrainingDate;
/// <summary>
/// txtTrainingPersonNum 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtTrainingPersonNum;
/// <summary>
/// txtTrainingHours 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtTrainingHours;
/// <summary>
/// txtTrainingManager 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtTrainingManager;
/// <summary>
/// txtTrainingTeacher 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtTrainingTeacher;
/// <summary>
/// txtAssessmentMethod 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtAssessmentMethod;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label Label1;
/// <summary>
/// Panel3 控件。
/// </summary>
@@ -22,11 +22,11 @@
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<%-- <f:TextBox ID="txtTrainContent" runat="server" Label="培训内容" LabelAlign="Right">
<f:TextBox ID="txtTrainRecordsName" runat="server" Label="培训内容" LabelAlign="Right">
</f:TextBox>
<f:Button ID="btnSearch" Icon="SystemSearch"
EnablePostBack="true" runat="server" OnClick="btnSearch_Click" ToolTip="搜索">
</f:Button>--%>
</f:Button>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnDonwLoadTrainRecords" runat="server" Icon="DiskDownload" Text="下载培训报告" ToolTip="下载培训报告模板" EnableAjaxLoading="false" OnClick="btnDonwLoadTrainRecords_Click"></f:Button>
<f:Button ID="btnDownLoadSign" runat="server" Icon="DiskDownload" Text="下载签到表" ToolTip="下载签到表模板" EnableAjaxLoading="false" OnClick="btnDownLoadSign_Click"></f:Button>
@@ -45,18 +45,30 @@
<f:RenderField ColumnID="TrainRecordsCode" DataField="TrainRecordsCode" FieldType="String" HeaderText="编号" TextAlign="Center"
HeaderTextAlign="Center" Width="200px">
</f:RenderField>
<f:RenderField ColumnID="TrainRecordsName" DataField="TrainRecordsName" FieldType="String" HeaderText="名称"
<f:RenderField ColumnID="TrainRecordsName" DataField="TrainRecordsName" FieldType="String" HeaderText="培训内容"
HeaderTextAlign="Center" Width="300px">
</f:RenderField>
<f:RenderField ColumnID="UploadDate" DataField="UploadDate" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="上传时间"
<f:RenderField ColumnID="ClassHours" DataField="ClassHours" FieldType="String" HeaderText="学时数"
HeaderTextAlign="Center" Width="100px">
</f:RenderField>
<f:RenderField ColumnID="TrainingTime" DataField="TrainingTime" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="培训时间"
HeaderTextAlign="Center" Width="100px">
</f:RenderField>
<f:RenderField ColumnID="TrainingAddress" DataField="TrainingAddress" FieldType="String" HeaderText="培训地点"
HeaderTextAlign="Center" Width="120px">
</f:RenderField>
<f:RenderField ColumnID="Remark" DataField="Remark" FieldType="String" HeaderText="备注"
HeaderTextAlign="Center" Width="150px" ExpandUnusedSpace="true">
<f:RenderField ColumnID="TrainingLevel" DataField="TrainingLevel" FieldType="String" HeaderText="培训级别"
HeaderTextAlign="Center" Width="150px">
</f:RenderField>
<f:LinkButtonField HeaderText="培训报告" ConfirmTarget="Top" Width="120" CommandName="AttachUrl" ColumnID="AttachUrl"
<f:RenderField ColumnID="Speaker" DataField="Speaker" FieldType="String" HeaderText="主讲人"
HeaderTextAlign="Center" Width="100px">
</f:RenderField>
<f:RenderField ColumnID="States" DataField="States" FieldType="String" HeaderText="状态"
HeaderTextAlign="Center" Width="100px">
</f:RenderField>
<f:LinkButtonField HeaderText="培训报告" ConfirmTarget="Top" Width="90" CommandName="AttachUrl" ColumnID="AttachUrl"
TextAlign="Center" ToolTip="附件查看" Icon="Find" />
<f:LinkButtonField HeaderText="签到表" ConfirmTarget="Top" Width="120" CommandName="AttachUrl2" ColumnID="AttachUrl2"
<f:LinkButtonField HeaderText="签到表" ConfirmTarget="Top" Width="90" CommandName="AttachUrl2" ColumnID="AttachUrl2"
TextAlign="Center" ToolTip="附件查看" Icon="Find" />
</Columns>
<Listeners>
@@ -1,4 +1,5 @@
using BLL;
using Aspose.Words;
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
@@ -33,14 +34,25 @@ namespace FineUIPro.Web.TestRun.PersonTrain
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT * FROM TestRun_TrainRecords WHERE ProjectId=@projectId";
string strSql = @"select TrainRecordsId,
ProjectId,
TrainRecordsCode,
TrainRecordsName,
UploadDate,
ClassHours,
TrainingTime,
TrainingAddress,
TrainingLevel,
Speaker,
(case when States='1' then '已完成' else '未完成' end) as States "
+ @"FROM TestRun_TrainRecords WHERE ProjectId=@projectId";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
//if (!string.IsNullOrEmpty(this.txtTrainContent.Text.Trim()))
//{
// strSql += " AND TrainContent LIKE @trainContent";
// listStr.Add(new SqlParameter("@trainContent", "%" + this.txtTrainContent.Text.Trim() + "%"));
//}
if (!string.IsNullOrEmpty(this.txtTrainRecordsName.Text.Trim()))
{
strSql += " AND TrainRecordsName LIKE @trainRecordsName";
listStr.Add(new SqlParameter("@trainRecordsName", "%" + this.txtTrainRecordsName.Text.Trim() + "%"));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
@@ -218,6 +230,20 @@ namespace FineUIPro.Web.TestRun.PersonTrain
/// <param name="e"></param>
protected void btnDonwLoadTrainRecords_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
var trainRecords = BLL.TrainRecordsService.GetTrainRecordsById(Grid1.SelectedRowID);
if (trainRecords != null)
{
if (trainRecords.States == "1")
{
Alert.ShowInTop("该培训已完成无需下载!", MessageBoxIcon.Warning);
return;
}
}
PageContext.RegisterStartupScript(Confirm.GetShowReference("是否确认下载培训报告?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
}
@@ -228,6 +254,20 @@ namespace FineUIPro.Web.TestRun.PersonTrain
/// <param name="e"></param>
protected void btnDownLoadSign_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
var trainRecords = BLL.TrainRecordsService.GetTrainRecordsById(Grid1.SelectedRowID);
if (trainRecords != null)
{
if (trainRecords.States == "1")
{
Alert.ShowInTop("该培训已完成无需下载!", MessageBoxIcon.Warning);
return;
}
}
PageContext.RegisterStartupScript(Confirm.GetShowReference("是否确认下载签到表?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK2"), PageManager1.GetCustomEventReference("Confirm_Cancel2")));
}
@@ -239,34 +279,138 @@ namespace FineUIPro.Web.TestRun.PersonTrain
if (e.EventArgument == "Confirm_OK")
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + Const.TestRun_TrainRecordsUrl;
string filePath = Const.TestRun_TrainRecordsUrl;
string fileName = Path.GetFileName(filePath);
string initTemplatePath = string.Empty;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
string filePath = string.Empty;
Model.TestRun_TrainRecords trainRecords = BLL.TrainRecordsService.GetTrainRecordsById(Grid1.SelectedRowID);
initTemplatePath = Const.TestRun_TrainRecordsUrl;
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace(".doc", trainRecords.TrainRecordsId.Replace("/", "-") + ".doc");
//filePath = initTemplatePath.Replace(".doc", trainRecords.TrainRecordsId.Replace("/", "-") + ".pdf");
File.Copy(uploadfilepath, newUrl);
Document doc = new Aspose.Words.Document(uploadfilepath);
Bookmark trainRecordsCode = doc.Range.Bookmarks["TrainRecordsCode"];
if (trainRecordsCode != null)
{
trainRecordsCode.Text = trainRecords.TrainRecordsCode;
}
Bookmark trainingTime = doc.Range.Bookmarks["TrainingTime"];
if (trainingTime != null)
{
trainingTime.Text = trainRecords.TrainingTime.HasValue ? string.Format("{0:yyyy-MM-dd}", trainRecords.TrainingTime) : "";
}
Bookmark classHours = doc.Range.Bookmarks["ClassHours"];
if (classHours != null)
{
classHours.Text = trainRecords.ClassHours.HasValue ? trainRecords.ClassHours.ToString() : "";
}
Bookmark trainingAddress = doc.Range.Bookmarks["TrainingAddress"];
if (trainingAddress != null)
{
trainingAddress.Text = trainRecords.TrainingAddress;
}
doc.Save(uploadfilepath);
//生成PDF文件
//string pdfUrl = uploadfilepath.Replace(".doc", ".pdf");
Document doc1 = new Aspose.Words.Document(uploadfilepath);
//验证参数
if (doc1 == null) { throw new Exception("Word文件无效"); }
doc1.Save(uploadfilepath, Aspose.Words.SaveFormat.Doc);//还可以改成其它格式
string fileName = Path.GetFileName(initTemplatePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.AddHeader("Content-Length", fileSize.ToString());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
Response.Flush();
Response.Close();
File.Delete(newUrl);
}
else if (e.EventArgument == "Confirm_OK2")
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + Const.TestRun_SignUrl;
string filePath = Const.TestRun_SignUrl;
string fileName = Path.GetFileName(filePath);
string initTemplatePath = string.Empty;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
string filePath = string.Empty;
Model.TestRun_TrainRecords trainRecords = BLL.TrainRecordsService.GetTrainRecordsById(Grid1.SelectedRowID);
initTemplatePath = Const.TestRun_SignUrl;
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace(".doc", trainRecords.TrainRecordsId.Replace("/", "-") + ".doc");
//filePath = initTemplatePath.Replace(".doc", trainRecords.TrainRecordsId.Replace("/", "-") + ".pdf");
File.Copy(uploadfilepath, newUrl);
Document doc = new Aspose.Words.Document(uploadfilepath);
Bookmark trainRecordsCode = doc.Range.Bookmarks["TrainRecordsCode"];
if (trainRecordsCode != null)
{
trainRecordsCode.Text = trainRecords.TrainRecordsCode;
}
Bookmark trainRecordsName = doc.Range.Bookmarks["TrainRecordsName"];
if (trainRecordsName != null)
{
trainRecordsName.Text = trainRecords.TrainRecordsName;
}
Bookmark trainingTime = doc.Range.Bookmarks["TrainingTime"];
if (trainingTime != null)
{
trainingTime.Text = trainRecords.TrainingTime.HasValue ? string.Format("{0:yyyy-MM-dd}", trainRecords.TrainingTime) : "";
}
Bookmark classHours = doc.Range.Bookmarks["ClassHours"];
if (classHours != null)
{
classHours.Text = trainRecords.ClassHours.HasValue ? trainRecords.ClassHours.ToString() : "";
}
Bookmark trainingAddress = doc.Range.Bookmarks["TrainingAddress"];
if (trainingAddress != null)
{
trainingAddress.Text = trainRecords.TrainingAddress;
}
Bookmark trainingLevel = doc.Range.Bookmarks["TrainingLevel"];
if (trainingLevel != null)
{
if (trainRecords.TrainingLevel == "五环工程项目经理部")
{
trainingLevel.Text = "☑五环工程项目经理部 □厂家培训";
}
else if (trainRecords.TrainingLevel == "厂家培训")
{
trainingLevel.Text = "□五环工程项目经理部 ☑厂家培训";
}
else
{
trainingLevel.Text = "□五环工程项目经理部 □厂家培训";
}
}
Bookmark speaker = doc.Range.Bookmarks["Speaker"];
if (speaker != null)
{
speaker.Text = trainRecords.Speaker;
}
doc.Save(uploadfilepath);
//生成PDF文件
//string pdfUrl = uploadfilepath.Replace(".doc", ".pdf");
Document doc1 = new Aspose.Words.Document(uploadfilepath);
//验证参数
if (doc1 == null) { throw new Exception("Word文件无效"); }
doc1.Save(uploadfilepath, Aspose.Words.SaveFormat.Doc);//还可以改成其它格式
string fileName = Path.GetFileName(initTemplatePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.AddHeader("Content-Length", fileSize.ToString());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
Response.Flush();
Response.Close();
File.Delete(newUrl);
}
}
#endregion
@@ -57,6 +57,24 @@ namespace FineUIPro.Web.TestRun.PersonTrain {
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// txtTrainRecordsName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtTrainRecordsName;
/// <summary>
/// btnSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSearch;
/// <summary>
/// btnDonwLoadTrainRecords 控件。
/// </summary>
@@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>编辑培训记录及执行报告</title>
</head>
<body>
@@ -12,7 +12,7 @@
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Toolbars>
<toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
@@ -24,8 +24,8 @@
<f:HiddenField ID="hdId" runat="server"></f:HiddenField>
</Items>
</f:Toolbar>
</Toolbars>
<Rows>
</toolbars>
<rows>
<f:FormRow>
<Items>
<f:ContentPanel ID="ContentPanel2" ShowBorder="true"
@@ -37,19 +37,37 @@
<f:FormRow>
<Items>
<f:TextBox ID="txtCode" runat="server" Label="编号" LabelAlign="Right" LabelWidth="100px" MaxLength="50" Required="true" ShowRedStar="true">
</f:TextBox>
<f:TextBox ID="txtName" runat="server" Label="培训内容" LabelAlign="Right" LabelWidth="100px" Required="true" ShowRedStar="true" MaxLength="500">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtName" runat="server" Label="名称" LabelAlign="Right" LabelWidth="100px" Required="true" ShowRedStar="true" MaxLength="500">
</f:TextBox>
<f:NumberBox ID="txtClassHours" runat="server" Label="学时数" LabelAlign="Right" LabelWidth="100px">
</f:NumberBox>
<f:DatePicker ID="txtTrainingTime" runat="server" Label="培训时间" LabelAlign="Right" LabelWidth="100px" ></f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DatePicker ID="txtUploadDate" runat="server" Label="上传时间" LabelAlign="Right" LabelWidth="100px" ></f:DatePicker>
<f:TextBox ID="txtTrainingAddress" runat="server" Label="培训地点" LabelAlign="Right" LabelWidth="100px" MaxLength="50" Required="true" ShowRedStar="true">
</f:TextBox>
<%--<f:TextBox ID="txtTrainingLevel" runat="server" Label="培训级别" LabelAlign="Right" LabelWidth="100px" Required="true" ShowRedStar="true" MaxLength="500">
</f:TextBox>--%>
<f:DropDownList ID="drpTrainingLevel" runat="server" Label="培训级别" LabelAlign="Right" LabelWidth="100px">
<f:ListItem Value="" Text="-请选择-" Selected="true" />
<f:ListItem Value="五环工程项目经理部" Text="五环工程项目经理部" />
<f:ListItem Value="厂家培训" Text="厂家培训" />
<f:ListItem />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtSpeaker" runat="server" Label="主讲人" LabelAlign="Right" LabelWidth="100px" MaxLength="50" >
</f:TextBox>
<f:Label ID="Label2" runat="server"></f:Label>
</Items>
</f:FormRow>
<f:FormRow>
@@ -75,7 +93,7 @@
<Items>
<f:Panel ID="Panel1" Width="300px" ShowHeader="false" ShowBorder="false" Layout="Column" CssClass="" runat="server">
<Items>
<f:Label ID="Label1" runat="server" Label="签到表"
<f:Label ID="lblSign" runat="server" Label="签到表"
LabelWidth="100px">
</f:Label>
<f:Button ID="btnSign" Icon="TableCell" EnablePostBack="true" Text="附件" runat="server" OnClick="btnSign_Click">
@@ -89,7 +107,7 @@
</f:ContentPanel>
</Items>
</f:FormRow>
</Rows>
</rows>
</f:Form>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
@@ -24,13 +24,32 @@ namespace FineUIPro.Web.TestRun.PersonTrain
this.hdId.Text = id;
this.txtCode.Text = data.TrainRecordsCode;
this.txtName.Text = data.TrainRecordsName;
this.txtUploadDate.Text = data.UploadDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.UploadDate) : "";
//this.txtUploadDate.Text = data.UploadDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.UploadDate) : "";
this.txtRemark.Text = data.Remark;
this.txtClassHours.Text = data.ClassHours.HasValue ? data.ClassHours.ToString() : "";
this.txtTrainingTime.Text = data.TrainingTime.HasValue ? string.Format("{0:yyyy-MM-dd}", data.TrainingTime) : "";
this.txtTrainingAddress.Text = data.TrainingAddress;
//this.txtTrainingLevel.Text = data.TrainingLevel;
if (!string.IsNullOrEmpty(data.TrainingLevel))
{
this.drpTrainingLevel.SelectedValue = data.TrainingLevel;
}
this.txtSpeaker.Text = data.Speaker;
this.btnAttach.Hidden = false;
this.btnSign.Hidden = false;
if (data.States == "1")
{
this.btnSave.Hidden = true;
}
}
}
else
{
this.txtUploadDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.txtTrainingTime.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.btnAttach.Hidden = true;
this.btnSign.Hidden = true;
this.lblAttach.Hidden = true;
this.lblSign.Hidden = true;
}
}
}
@@ -78,7 +97,14 @@ namespace FineUIPro.Web.TestRun.PersonTrain
Model.TestRun_TrainRecords newData = new Model.TestRun_TrainRecords();
newData.TrainRecordsCode = this.txtCode.Text.Trim();
newData.TrainRecordsName = this.txtName.Text.Trim();
newData.UploadDate = Funs.GetNewDateTime(this.txtUploadDate.Text.Trim());
newData.TrainingTime = Funs.GetNewDateTime(this.txtTrainingTime.Text.Trim());
newData.ClassHours = Funs.GetNewDecimal(this.txtClassHours.Text.Trim());
newData.TrainingAddress = this.txtTrainingAddress.Text.Trim();
if (!string.IsNullOrEmpty(this.drpTrainingLevel.SelectedValue))
{
newData.TrainingLevel = this.drpTrainingLevel.SelectedValue;
}
newData.Speaker = this.txtSpeaker.Text.Trim();
newData.CompileMan = this.CurrUser.UserId;
newData.CompileDate = DateTime.Now;
newData.Remark = this.txtRemark.Text.Trim();
@@ -96,11 +122,25 @@ namespace FineUIPro.Web.TestRun.PersonTrain
}
else
{
newData.States = "0";
newData.TrainRecordsId = SQLHelper.GetNewID(typeof(Model.TestRun_TrainRecords));
this.hdId.Text = newData.TrainRecordsId;
}
BLL.TrainRecordsService.AddTrainRecords(newData);
}
//签到表和记录表都上传更新状态
var att = BLL.AttachFileService.Getfiles(this.hdId.Text + "#1", BLL.Const.TrainRecordsMenuId);
var att2 = BLL.AttachFileService.Getfiles(this.hdId.Text + "#2", BLL.Const.TrainRecordsMenuId);
if (att != null && att2 != null)
{
var data = BLL.TrainRecordsService.GetTrainRecordsById(this.hdId.Text);
if (data != null)
{
data.States = "1";
Funs.DB.SubmitChanges();
}
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
@@ -121,13 +121,58 @@ namespace FineUIPro.Web.TestRun.PersonTrain {
protected global::FineUIPro.TextBox txtName;
/// <summary>
/// txtUploadDate 控件。
/// txtClassHours 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtUploadDate;
protected global::FineUIPro.NumberBox txtClassHours;
/// <summary>
/// txtTrainingTime 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtTrainingTime;
/// <summary>
/// txtTrainingAddress 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtTrainingAddress;
/// <summary>
/// drpTrainingLevel 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpTrainingLevel;
/// <summary>
/// txtSpeaker 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtSpeaker;
/// <summary>
/// Label2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label Label2;
/// <summary>
/// txtRemark 控件。
@@ -175,13 +220,13 @@ namespace FineUIPro.Web.TestRun.PersonTrain {
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Label1 控件。
/// lblSign 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label Label1;
protected global::FineUIPro.Label lblSign;
/// <summary>
/// btnSign 控件。