培训
This commit is contained in:
@@ -33,24 +33,19 @@
|
||||
AutoPostBack="true" OnTextChanged="TextBox_TextChanged" Width="180px" LabelWidth="60px"
|
||||
LabelAlign="right">
|
||||
</f:TextBox>
|
||||
<f:TextBox runat="server" Label="人员" ID="txtPersonName" EmptyText="输入查询条件"
|
||||
<f:TextBox runat="server" Label="标题" ID="txtName" EmptyText="输入查询条件"
|
||||
AutoPostBack="true" OnTextChanged="TextBox_TextChanged" Width="180px" LabelWidth="60px"
|
||||
LabelAlign="right">
|
||||
</f:TextBox>
|
||||
<%--<f:DropDownList ID="drpRole" runat="server" Label="适用岗位" AutoSelectFirstItem="true" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged" Width="220px" LabelWidth="80px">
|
||||
<f:DropDownList ID="drpUnitId" runat="server" Label="单位" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged"
|
||||
LabelAlign="Right" LabelWidth="50px" Width="260px">
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpCategory" runat="server" Label="培训类别" AutoSelectFirstItem="true" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged" Width="220px" LabelWidth="80px">
|
||||
<f:DropDownList ID="drpCategory" runat="server" Label="培训类别" AutoSelectFirstItem="true" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="drpCategory_SelectedIndexChanged" Width="220px" LabelWidth="80px">
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpCourse" runat="server" Label="培训课程" AutoSelectFirstItem="true" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged" Width="220px" LabelWidth="80px">
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpMethod" runat="server" Label="培训方式" AutoSelectFirstItem="true" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged" Width="180px" LabelWidth="80px">
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpTeachers" runat="server" Label="培训师资" AutoSelectFirstItem="true" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged" Width="180px" LabelWidth="80px">
|
||||
</f:DropDownList>--%>
|
||||
<%--<f:DropDownList ID="drpOutcome" runat="server" Label="培训效果" AutoSelectFirstItem="true" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged" Width="160px" LabelWidth="80px">
|
||||
</f:DropDownList>--%>
|
||||
<%--<f:TextBox runat="server" Label="备注" ID="txtRemark" EmptyText="输入查询条件"
|
||||
AutoPostBack="true" OnTextChanged="TextBox_TextChanged" Width="180px" LabelWidth="60px"
|
||||
LabelAlign="right">
|
||||
</f:TextBox>--%>
|
||||
<f:ToolbarFill ID="ToolbarFill1" runat="server">
|
||||
</f:ToolbarFill>
|
||||
<%--<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click">
|
||||
@@ -75,14 +70,26 @@
|
||||
SortField="Code" FieldType="String" HeaderText="编号" HeaderTextAlign="Center" EnableLock="true" Locked="true"
|
||||
TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="PersonName" DataField="PersonName"
|
||||
SortField="PersonName" FieldType="String" HeaderText="人员" HeaderTextAlign="Center" EnableLock="true" Locked="true"
|
||||
<f:RenderField Width="220px" ColumnID="Name" DataField="Name"
|
||||
SortField="Name" FieldType="String" HeaderText="标题" HeaderTextAlign="Center" EnableLock="true" Locked="true"
|
||||
TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField MinWidth="120px" ColumnID="RoleName" DataField="RoleName"
|
||||
<%--<f:RenderField MinWidth="120px" ColumnID="RoleName" DataField="RoleName"
|
||||
SortField="RoleName" FieldType="String" HeaderText="适用岗位" HeaderTextAlign="Center" EnableLock="true" Locked="true"
|
||||
TextAlign="Center">
|
||||
</f:RenderField>
|
||||
</f:RenderField>--%>
|
||||
<f:TemplateField ColumnID="tfUnitIds" Width="220px" HeaderText="单位名称" HeaderTextAlign="Center"
|
||||
TextAlign="left">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblUnitId" runat="server" Text='<%# ConvertUnitName(Eval("UnitIds")) %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:TemplateField ColumnID="tfRoleIds" Width="220px" HeaderText="适用岗位" HeaderTextAlign="Center"
|
||||
TextAlign="left">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblRoleId" runat="server" Text='<%# ConvertRoleName(Eval("RoleIds")) %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField MinWidth="180px" ColumnID="CategoryName" DataField="CategoryName"
|
||||
SortField="CategoryName" FieldType="String" HeaderText="类别" HeaderTextAlign="Center" EnableLock="true" Locked="true"
|
||||
TextAlign="Center">
|
||||
@@ -91,6 +98,18 @@
|
||||
SortField="CourseName" FieldType="String" HeaderText="培训课程" HeaderTextAlign="Center" EnableLock="true" Locked="true"
|
||||
TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="120px" ColumnID="TrainingTime" DataField="TrainingTime"
|
||||
SortField="TrainingTime" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"
|
||||
HeaderText="培训时间" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField MinWidth="120px" ColumnID="Location" DataField="Location"
|
||||
SortField="Location" FieldType="String" HeaderText="培训地点" HeaderTextAlign="Center" EnableLock="true" Locked="true"
|
||||
TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField MinWidth="140px" ColumnID="Method" DataField="Method"
|
||||
SortField="Method" FieldType="String" HeaderText="培训方式" HeaderTextAlign="Center"
|
||||
TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<%-- <f:RenderField MinWidth="140px" ColumnID="ClassHour" DataField="ClassHour"
|
||||
SortField="ClassHour" FieldType="Double" HeaderText="培训课时(学时)" HeaderTextAlign="Center"
|
||||
TextAlign="Center">
|
||||
@@ -99,10 +118,6 @@
|
||||
SortField="Cycle" FieldType="Double" HeaderText="培训周期(年/次)" HeaderTextAlign="Center"
|
||||
TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField MinWidth="140px" ColumnID="Method" DataField="Method"
|
||||
SortField="Method" FieldType="String" HeaderText="培训方式" HeaderTextAlign="Center"
|
||||
TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField MinWidth="140px" ColumnID="Teachers" DataField="Teachers"
|
||||
SortField="Teachers" FieldType="String" HeaderText="培训教资" HeaderTextAlign="Center"
|
||||
TextAlign="Center">
|
||||
|
||||
@@ -63,28 +63,39 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
/// </summary>
|
||||
private void InitDropDownList()
|
||||
{
|
||||
//单位
|
||||
BLL.UnitService.InitUnitDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true);
|
||||
////获取适用岗位下拉框
|
||||
//PostTrainingRoleService.InitPostTrainingRoleDropDownList(this.drpRole, true);
|
||||
////获取培训类别下拉框
|
||||
//PostTrainingCategoryService.InitPostTrainingCategoryDropDownList(this.drpCategory, true);
|
||||
////获取培训方式下拉框
|
||||
//PostTrainingMethodService.InitPostTrainingMethodDropDownList(this.drpMethod, null, true);
|
||||
//获取培训类别下拉框
|
||||
PostTrainingCategoryService.InitPostTrainingCategoryDropDownList(this.drpCategory, true);
|
||||
//获取培训方式下拉框
|
||||
PostTrainingMethodService.InitPostTrainingMethodDropDownList(this.drpMethod, null, true);
|
||||
////获取培训师资下拉框
|
||||
//PostTrainingTeachersService.InitPostTrainingTeachersDropDownList(this.drpTeachers, null, true);
|
||||
////获取培训效果下拉框
|
||||
//PostTrainingRecordService.InitPostTrainingOutcomeDropDownList(this.drpOutcome, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 培训类别下拉加载
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void drpCategory_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
//培训课程
|
||||
PostTrainingCourseService.InitPostTrainingCourseDropDownList(this.drpCourse, this.drpCategory.SelectedValue, true);
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"SELECT Record.*,Person.PersonName,Role.Name AS RoleName
|
||||
FROM PostTraining_Record_Detail AS Detail
|
||||
LEFT JOIN PostTraining_Record AS Record ON Record.Id=Detail.RecordId
|
||||
LEFT JOIN SitePerson_Person AS Person ON Person.PersonId=Detail.PersonId
|
||||
LEFT JOIN PostTraining_Role AS Role ON Role.Id=Person.PostTrainingRoleId
|
||||
string strSql = @"SELECT Record.* ,SUser.UserName AS CompileManName
|
||||
FROM PostTraining_Record AS Record
|
||||
LEFT JOIN Sys_User AS SUser ON SUser.UserId=Record.CompileMan
|
||||
WHERE 1=1 ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
@@ -93,26 +104,31 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
strSql += " AND Record.Code LIKE @Code";
|
||||
listStr.Add(new SqlParameter("@Code", "%" + this.txtCode.Text.Trim() + "%"));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtPersonName.Text.Trim()))
|
||||
if (!string.IsNullOrEmpty(this.txtName.Text.Trim()))
|
||||
{
|
||||
strSql += " AND Person.PersonName LIKE @PersonName";
|
||||
listStr.Add(new SqlParameter("@PersonName", "%" + this.txtPersonName.Text.Trim() + "%"));
|
||||
strSql += " AND Record.Name LIKE @Name";
|
||||
listStr.Add(new SqlParameter("@Name", "%" + this.txtName.Text.Trim() + "%"));
|
||||
}
|
||||
//if (this.drpRole.SelectedValue != BLL.Const._Null)
|
||||
//{
|
||||
// strSql += " AND Record.RoleId = @RoleId";
|
||||
// listStr.Add(new SqlParameter("@RoleId", this.drpRole.SelectedValue));
|
||||
//}
|
||||
//if (this.drpCategory.SelectedValue != BLL.Const._Null)
|
||||
//{
|
||||
// strSql += " AND Course.CategoryId = @CategoryId";
|
||||
// listStr.Add(new SqlParameter("@CategoryId", this.drpCategory.SelectedValue));
|
||||
//}
|
||||
//if (this.drpMethod.SelectedValue != BLL.Const._Null)
|
||||
//{
|
||||
// strSql += " AND Record.Method = @Method";
|
||||
// listStr.Add(new SqlParameter("@Method", this.drpMethod.SelectedValue));
|
||||
//}
|
||||
if (this.drpCategory.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND Record.CategoryId = @CategoryId";
|
||||
listStr.Add(new SqlParameter("@CategoryId", this.drpCategory.SelectedValue));
|
||||
}
|
||||
if (this.drpCourse.SelectedValue != null && this.drpCourse.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND Record.CourseId = @CourseId";
|
||||
listStr.Add(new SqlParameter("@CourseId", this.drpCourse.SelectedValue));
|
||||
}
|
||||
if (this.drpMethod.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND Record.Method = @Method";
|
||||
listStr.Add(new SqlParameter("@Method", this.drpMethod.SelectedValue));
|
||||
}
|
||||
//if (this.drpTeachers.SelectedValue != BLL.Const._Null)
|
||||
//{
|
||||
// strSql += " AND Record.Teachers = @Teachers";
|
||||
@@ -168,6 +184,71 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
this.BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 格式化字符串
|
||||
|
||||
/// <summary>
|
||||
/// 获取单位名称
|
||||
/// </summary>
|
||||
/// <param name="unitIds"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertUnitName(object unitIds)
|
||||
{
|
||||
string unitName = string.Empty;
|
||||
if (unitIds != null)
|
||||
{
|
||||
List<string> infos = unitIds.ToString().Split(',').ToList();
|
||||
if (infos.Count() > 0)
|
||||
{
|
||||
foreach (var item in infos)
|
||||
{
|
||||
Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(item);
|
||||
if (unit != null)
|
||||
{
|
||||
unitName += unit.UnitName + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(unitName))
|
||||
{
|
||||
unitName = unitName.Substring(0, unitName.LastIndexOf(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
return unitName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取适用岗位名称
|
||||
/// </summary>
|
||||
/// <param name="roleIds"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertRoleName(object roleIds)
|
||||
{
|
||||
string roleName = string.Empty;
|
||||
if (roleIds != null)
|
||||
{
|
||||
List<string> infos = roleIds.ToString().Split(',').ToList();
|
||||
if (infos.Count() > 0)
|
||||
{
|
||||
foreach (var item in infos)
|
||||
{
|
||||
Model.PostTraining_Role role = BLL.PostTrainingRoleService.GetRoleById(item);
|
||||
if (role != null)
|
||||
{
|
||||
roleName += role.Name + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(roleName))
|
||||
{
|
||||
roleName = roleName.Substring(0, roleName.LastIndexOf(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
return roleName;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region 查询
|
||||
|
||||
+56
-2
@@ -69,13 +69,49 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
protected global::FineUIPro.TextBox txtCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtPersonName 控件。
|
||||
/// txtName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtPersonName;
|
||||
protected global::FineUIPro.TextBox txtName;
|
||||
|
||||
/// <summary>
|
||||
/// drpUnitId 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnitId;
|
||||
|
||||
/// <summary>
|
||||
/// drpCategory 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpCategory;
|
||||
|
||||
/// <summary>
|
||||
/// drpCourse 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpCourse;
|
||||
|
||||
/// <summary>
|
||||
/// drpMethod 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpMethod;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill1 控件。
|
||||
@@ -104,6 +140,24 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblNumber;
|
||||
|
||||
/// <summary>
|
||||
/// lblUnitId 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblUnitId;
|
||||
|
||||
/// <summary>
|
||||
/// lblRoleId 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblRoleId;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarSeparator1 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -67,14 +67,16 @@
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:DropDownList ID="drpUnits" runat="server" Label="培训单位" EnableCheckBoxSelect="true" EnableMultiSelect="true">
|
||||
<f:DropDownList ID="drpUnits" runat="server" Label="培训单位" AutoSelectFirstItem="false" EnableCheckBoxSelect="true" EnableMultiSelect="true">
|
||||
</f:DropDownList>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow runat="server" ID="trRole">
|
||||
<Items>
|
||||
<f:DropDownList ID="drpRole" runat="server" Label="培训岗位" EnableCheckBoxSelect="true" EnableMultiSelect="true" ShowRedStar="true" Required="true">
|
||||
<f:DropDownList ID="drpWorkPost" runat="server" Label="培训岗位" AutoSelectFirstItem="false" EnableCheckBoxSelect="true" EnableMultiSelect="true" ShowRedStar="true" Required="true">
|
||||
</f:DropDownList>
|
||||
<%-- <f:DropDownList ID="drpRole" runat="server" Label="培训岗位" AutoSelectFirstItem="false" EnableCheckBoxSelect="true" EnableMultiSelect="true" ShowRedStar="true" Required="true">
|
||||
</f:DropDownList>--%>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
@@ -98,9 +100,9 @@
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Right">
|
||||
<Items>
|
||||
<%-- <f:Button ID="btnImport" ToolTip="导入" Icon="PageExcel" runat="server" ValidateForms="SimpleForm1"
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PageExcel" runat="server" ValidateForms="SimpleForm1"
|
||||
OnClick="btnImport_Click">
|
||||
</f:Button>--%>
|
||||
</f:Button>
|
||||
<f:Button ID="btnSelect" Icon="ShapeSquareSelect" runat="server" ToolTip="选择培训人员" ValidateForms="SimpleForm1"
|
||||
OnClick="btnSelect_Click">
|
||||
</f:Button>
|
||||
|
||||
@@ -69,7 +69,25 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
if (model != null)
|
||||
{
|
||||
this.txtCode.Text = model.Code;
|
||||
this.txtName.Text = model.Name;
|
||||
this.txtContent.Text = model.Content;
|
||||
this.txtRemark.Text = model.Remark;
|
||||
this.txtPersonNum.Text = model.PersonNum.ToString();
|
||||
this.txtLocation.Text = model.Location;
|
||||
this.txtDuration.Text = model.Duration.ToString();
|
||||
this.txtLecturer.Text = model.Lecturer;
|
||||
if (!string.IsNullOrEmpty(model.UnitIds))
|
||||
{
|
||||
this.drpUnits.SelectedValueArray = model.UnitIds.Split(',');
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.WorkPostIds))
|
||||
{
|
||||
this.drpWorkPost.SelectedValueArray = model.WorkPostIds.Split(',');
|
||||
}
|
||||
if (model.TrainingTime != null)
|
||||
{
|
||||
this.txtTrainingTime.Text = string.Format("{0:yyyy-MM-dd}", model.TrainingTime);
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(model.CourseId))
|
||||
{
|
||||
var course = BLL.PostTrainingCourseService.GetCourseById(model.CourseId);
|
||||
@@ -88,7 +106,10 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
{
|
||||
////自动生成编码
|
||||
this.txtCode.Text = SQLHelper.RunProcNewId("SpGetNewCode5", "dbo.PostTraining_Record", "Code", "");
|
||||
this.txtLecturer.Text = this.CurrUser.UserName;
|
||||
this.txtTrainingTime.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
}
|
||||
this.Grid1DataBind();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,8 +120,10 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
{
|
||||
//培训单位
|
||||
UnitService.InitUnitDropDownList(this.drpUnits, this.ProjectId, false);
|
||||
//获取适用岗位下拉框
|
||||
PostTrainingRoleService.InitPostTrainingRoleDropDownList(this.drpRole, false);
|
||||
//所属岗位
|
||||
WorkPostService.InitWorkPostDropDownList(this.drpWorkPost, true);
|
||||
////获取适用岗位下拉框
|
||||
//PostTrainingRoleService.InitPostTrainingRoleDropDownList(this.drpRole, false);
|
||||
//获取培训类别下拉框
|
||||
PostTrainingCategoryService.InitPostTrainingCategoryDropDownList(this.drpCategory, false);
|
||||
//获取培训方式下拉框
|
||||
@@ -127,36 +150,10 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
{
|
||||
recordDetails = (from x in Funs.DB.View_PostTraining_RecordDetail
|
||||
where x.RecordId == this.Id
|
||||
orderby x.UnitName, x.RoleName, x.PersonName
|
||||
orderby x.UnitName, x.WorkPostName, x.PersonName
|
||||
select x).ToList();
|
||||
Grid1.DataSource = recordDetails;
|
||||
Grid1.DataBind();
|
||||
//for (int i = 0; i < Grid1.Rows.Count; i++)
|
||||
//{
|
||||
// bool isRed = true;
|
||||
// string trainDetailId = Grid1.Rows[i].DataKeys[0].ToString();
|
||||
// var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == trainDetailId);
|
||||
// if (getAtt != null)
|
||||
// {
|
||||
// isRed = false;
|
||||
// }
|
||||
// if (isRed)
|
||||
// {
|
||||
// var getRecordDetail = recordDetails.FirstOrDefault(x => x.DetailId == trainDetailId);
|
||||
// if (getRecordDetail != null && !string.IsNullOrEmpty(this.TestPlanId)) ////未参加过培训的人员
|
||||
// {
|
||||
// var getTestRecord = Funs.DB.Training_TestRecord.FirstOrDefault(x => x.TestManId == getRecordDetail.PersonId && x.TestPlanId == this.TestPlanId);
|
||||
// if (getTestRecord != null)
|
||||
// {
|
||||
// isRed = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (isRed)
|
||||
// {
|
||||
// Grid1.Rows[i].RowCssClass = "Red";
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -174,16 +171,16 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
this.SaveData(BLL.Const.BtnSave);
|
||||
}
|
||||
//培训岗位
|
||||
string roleIds = string.Empty;
|
||||
foreach (var item in this.drpRole.SelectedValueArray)
|
||||
string workPostIds = string.Empty;
|
||||
foreach (var item in this.drpWorkPost.SelectedValueArray)
|
||||
{
|
||||
roleIds += item + ",";
|
||||
workPostIds += item + ",";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(roleIds))
|
||||
if (!string.IsNullOrEmpty(workPostIds))
|
||||
{
|
||||
roleIds = roleIds.Substring(0, roleIds.LastIndexOf(","));
|
||||
workPostIds = workPostIds.Substring(0, workPostIds.LastIndexOf(","));
|
||||
}
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SelectPerson.aspx?RecordId={0}&RoleIds={1}", this.Id, roleIds, "编辑 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SelectPerson.aspx?RecordId={0}&WorkPostIds={1}", this.Id, workPostIds, "编辑 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -277,18 +274,18 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
}
|
||||
|
||||
//培训岗位
|
||||
string roleIds = string.Empty;
|
||||
foreach (var item in this.drpRole.SelectedValueArray)
|
||||
string workPostIds = string.Empty;
|
||||
foreach (var item in this.drpWorkPost.SelectedValueArray)
|
||||
{
|
||||
roleIds += item + ",";
|
||||
workPostIds += item + ",";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(roleIds))
|
||||
if (!string.IsNullOrEmpty(workPostIds))
|
||||
{
|
||||
roleIds = roleIds.Substring(0, roleIds.LastIndexOf(","));
|
||||
workPostIds = workPostIds.Substring(0, workPostIds.LastIndexOf(","));
|
||||
}
|
||||
|
||||
newModel.UnitIds = unitIds;
|
||||
newModel.RoleIds = roleIds;
|
||||
newModel.WorkPostIds = workPostIds;
|
||||
if (!string.IsNullOrEmpty(this.Id))
|
||||
{
|
||||
newModel.Id = this.Id;
|
||||
@@ -326,6 +323,33 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导入
|
||||
/// <summary>
|
||||
/// 导入按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpCategory.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
ShowNotify("请选择培训类别!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (this.drpCourse.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
ShowNotify("请选择培训课程!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.Id))
|
||||
{
|
||||
this.SaveData(BLL.Const.BtnSave);
|
||||
}
|
||||
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RecordIn.aspx?RecordId={0}", this.Id, "导入 - "), "导入", 900, 560));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 附件上传
|
||||
/// <summary>
|
||||
/// 上传附件
|
||||
|
||||
@@ -150,13 +150,13 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
protected global::FineUIPro.FormRow trRole;
|
||||
|
||||
/// <summary>
|
||||
/// drpRole 控件。
|
||||
/// drpWorkPost 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpRole;
|
||||
protected global::FineUIPro.DropDownList drpWorkPost;
|
||||
|
||||
/// <summary>
|
||||
/// txtContent 控件。
|
||||
@@ -194,6 +194,15 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnSelect 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RecordIn.aspx.cs" Inherits="FineUIPro.Web.HSSE.PostTraining.RecordIn" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>导入</title>
|
||||
<link href="~/res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
|
||||
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
|
||||
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
|
||||
<Items>
|
||||
<f:ToolbarFill runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="数据导入" ValidateForms="SimpleForm1"
|
||||
OnClick="btnAudit_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnClose" EnablePostBack="false" runat="server" Icon="SystemClose" MarginRight="10px">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
|
||||
LabelWidth="150px">
|
||||
</f:FileUpload>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true" runat="server"
|
||||
EnableColumnLines="true" BoxFlex="1" DataKeyNames="DetailId" AllowCellEditing="true"
|
||||
ClicksToEdit="2" DataIDField="DetailId" AllowSorting="true" SortField="UnitName,PersonName"
|
||||
PageSize="50" Height="350px">
|
||||
<Columns>
|
||||
<f:TemplateField Width="55px" HeaderText="序号">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label2" runat="server" Text='<%# Container.DataItemIndex + 1 %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField Width="180px" ColumnID="UnitName" DataField="UnitName" SortField="UnitName" ExpandUnusedSpace="true"
|
||||
FieldType="String" HeaderText="单位" TextAlign="Left" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="120px" ColumnID="PersonName" DataField="PersonName" FieldType="String"
|
||||
HeaderText="培训人员" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<%-- <f:RenderField Width="150px" ColumnID="CheckResult" DataField="CheckResult" FieldType="Boolean"
|
||||
RendererFunction="renderCheckResult" HeaderText="考核结果" HeaderTextAlign="Center"
|
||||
TextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="120px" ColumnID="CheckScore" DataField="CheckScore" FieldType="Double"
|
||||
HeaderText="成绩" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>--%>
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="dataload" Handler="onGridDataLoad" />
|
||||
</Listeners>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:HiddenField ID="hdFileName" runat="server">
|
||||
</f:HiddenField>
|
||||
<f:HiddenField ID="hdCheckResult" runat="server">
|
||||
</f:HiddenField>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:Label ID="lblBottom" runat="server" Text="说明:1 导入模板为.xls后缀的EXCEL文件,黑体字为必填项。2 对于导入信息中重复记录自动过滤插入一条记录。3 数据导入完成,成功后自动返回,如果有不成功数据页面弹出提示框,列表显示导入成功数据。">
|
||||
</f:Label>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
</Rows>
|
||||
</f:Form>
|
||||
<f:Window ID="Window1" Title="导入信息" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="false"
|
||||
CloseAction="HidePostBack" Width="900px" Height="600px">
|
||||
</f:Window>
|
||||
</form>
|
||||
<script>
|
||||
function renderCheckResult(value) {
|
||||
return value == true ? '合格' : '不合格';
|
||||
}
|
||||
|
||||
function onGridDataLoad(event) {
|
||||
this.mergeColumns(['UnitName']);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,360 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.OleDb;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
namespace FineUIPro.Web.HSSE.PostTraining
|
||||
{
|
||||
|
||||
public partial class RecordIn : PageBase
|
||||
{
|
||||
#region 定义变量
|
||||
/// <summary>
|
||||
/// 上传预设的虚拟路径
|
||||
/// </summary>
|
||||
private string initPath = Const.ExcelUrl;
|
||||
|
||||
/// <summary>
|
||||
/// 导入集合
|
||||
/// </summary>
|
||||
public static List<Model.View_PostTraining_RecordDetail> viewRecordDetails = new List<Model.View_PostTraining_RecordDetail>();
|
||||
|
||||
/// <summary>
|
||||
/// 错误集合
|
||||
/// </summary>
|
||||
public static string errorInfos = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string RecordId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["RecordId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["RecordId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载页面
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHidePostBackReference();
|
||||
this.hdFileName.Text = string.Empty;
|
||||
this.hdCheckResult.Text = string.Empty;
|
||||
this.RecordId = Request.Params["RecordId"];
|
||||
if (viewRecordDetails != null)
|
||||
{
|
||||
viewRecordDetails.Clear();
|
||||
}
|
||||
errorInfos = string.Empty;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据导入
|
||||
/// <summary>
|
||||
/// 数据导入
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnAudit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.RecordId))
|
||||
{
|
||||
Alert.ShowInTop("先保存培训,再导入!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (this.fuAttachUrl.HasFile == false)
|
||||
{
|
||||
Alert.ShowInTop("请您选择Excel文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
|
||||
if (IsXls != ".xls")
|
||||
{
|
||||
Alert.ShowInTop("只可以选择Excel文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (viewRecordDetails != null)
|
||||
{
|
||||
viewRecordDetails.Clear();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(errorInfos))
|
||||
{
|
||||
errorInfos = string.Empty;
|
||||
}
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initFullPath = rootPath + initPath;
|
||||
if (!Directory.Exists(initFullPath))
|
||||
{
|
||||
Directory.CreateDirectory(initFullPath);
|
||||
}
|
||||
|
||||
this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
|
||||
string filePath = initFullPath + this.hdFileName.Text;
|
||||
this.fuAttachUrl.PostedFile.SaveAs(filePath);
|
||||
ImportXlsToData(rootPath + initPath + this.hdFileName.Text);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
#region 读Excel提取数据
|
||||
/// <summary>
|
||||
/// 从Excel提取数据--》Dataset
|
||||
/// </summary>
|
||||
/// <param name="filename">Excel文件路径名</param>
|
||||
private void ImportXlsToData(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
viewRecordDetails.Clear();
|
||||
string oleDBConnString = String.Empty;
|
||||
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
|
||||
oleDBConnString += "Data Source=";
|
||||
oleDBConnString += fileName;
|
||||
oleDBConnString += ";Extended Properties=Excel 8.0;";
|
||||
OleDbConnection oleDBConn = null;
|
||||
OleDbDataAdapter oleAdMaster = null;
|
||||
DataTable m_tableName = new DataTable();
|
||||
DataSet ds = new DataSet();
|
||||
|
||||
oleDBConn = new OleDbConnection(oleDBConnString);
|
||||
oleDBConn.Open();
|
||||
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
|
||||
|
||||
if (m_tableName != null && m_tableName.Rows.Count > 0)
|
||||
{
|
||||
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
|
||||
}
|
||||
string sqlMaster;
|
||||
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
|
||||
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
|
||||
oleAdMaster.Fill(ds, "m_tableName");
|
||||
oleAdMaster.Dispose();
|
||||
oleDBConn.Close();
|
||||
oleDBConn.Dispose();
|
||||
|
||||
AddDatasetToSQL(ds.Tables[0]);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 将Dataset的数据导入数据库
|
||||
/// <summary>
|
||||
/// 将Dataset的数据导入数据库
|
||||
/// </summary>
|
||||
/// <param name="pds">数据集</param>
|
||||
/// <param name="Cols">数据集行数</param>
|
||||
/// <returns></returns>
|
||||
private bool AddDatasetToSQL(DataTable pds)
|
||||
{
|
||||
string results = string.Empty;
|
||||
int ir = pds.Rows.Count;
|
||||
if (pds != null && ir > 0)
|
||||
{
|
||||
var record = BLL.PostTrainingRecordService.GetRecordById(this.RecordId);
|
||||
if (record != null)
|
||||
{
|
||||
var units = from x in Funs.DB.Base_Unit select x;
|
||||
var persons = from x in Funs.DB.SitePerson_Person where x.ProjectId == record.ProjectId select x;
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
string result = string.Empty;
|
||||
string col0 = pds.Rows[i][0].ToString().Trim();
|
||||
string col1 = pds.Rows[i][1].ToString().Trim();
|
||||
//string col2 = pds.Rows[i][2].ToString().Trim();
|
||||
//string col3 = pds.Rows[i][3].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col0) || !string.IsNullOrEmpty(col1) )
|
||||
{
|
||||
if (string.IsNullOrEmpty(col0) || string.IsNullOrEmpty(col1))
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "导入项" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.View_PostTraining_RecordDetail newViewRecordDetail = new Model.View_PostTraining_RecordDetail
|
||||
{
|
||||
DetailId = SQLHelper.GetNewID(typeof(Model.View_PostTraining_RecordDetail)),
|
||||
RecordId = record.Id,
|
||||
UnitName = col0,
|
||||
PersonName = col1,
|
||||
//CheckResult = false,
|
||||
//CheckScore=Funs.GetNewDecimal(col3),
|
||||
};
|
||||
|
||||
//if (col2 == "合格")
|
||||
//{
|
||||
// newViewRecordDetail.CheckResult = true;
|
||||
//}
|
||||
var unit = units.FirstOrDefault(x => x.UnitName == col0);
|
||||
if (unit != null)
|
||||
{
|
||||
newViewRecordDetail.UnitId = unit.UnitId;
|
||||
var person = persons.FirstOrDefault(x => x.PersonName == col1 && x.UnitId == unit.UnitId);
|
||||
if (person != null)
|
||||
{
|
||||
newViewRecordDetail.PersonId = person.PersonId;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "在现场人员信息中不存在!" + "|";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "在单位信息中不存在!" + "|";
|
||||
}
|
||||
|
||||
|
||||
///判断是否已存在
|
||||
var addItem = Funs.DB.PostTraining_Record_Detail.FirstOrDefault(x => x.Id == newViewRecordDetail.DetailId && x.PersonId == newViewRecordDetail.PersonId);
|
||||
if (addItem == null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(result))
|
||||
{
|
||||
Model.PostTraining_Record_Detail newRecordDetail = new Model.PostTraining_Record_Detail
|
||||
{
|
||||
Id = newViewRecordDetail.DetailId,
|
||||
RecordId = newViewRecordDetail.RecordId,
|
||||
PersonId = newViewRecordDetail.PersonId,
|
||||
};
|
||||
|
||||
BLL.PostTrainingRecordDetailService.AddRecordDetail(newRecordDetail);
|
||||
///加入
|
||||
viewRecordDetails.Add(newViewRecordDetail);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "导入数据重复" + "|";
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
results += result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (viewRecordDetails.Count > 0)
|
||||
{
|
||||
viewRecordDetails = viewRecordDetails.Distinct().ToList();
|
||||
this.Grid1.Hidden = false;
|
||||
this.Grid1.DataSource = viewRecordDetails;
|
||||
this.Grid1.DataBind();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(results))
|
||||
{
|
||||
viewRecordDetails.Clear();
|
||||
results = "数据导入完成,未成功数据:" + results.Substring(0, results.LastIndexOf("|"));
|
||||
errorInfos = results;
|
||||
Alert.ShowInParent(results, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
errorInfos = string.Empty;
|
||||
ShowNotify("导入成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("培训数据为空!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("导入数据为空!", MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, initPath + this.hdFileName.Text);
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 关闭弹出窗口
|
||||
/// <summary>
|
||||
/// 关闭导入弹出窗口
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
if (Session["trainRecordDetails"] != null)
|
||||
{
|
||||
viewRecordDetails = Session["trainRecordDetails"] as List<Model.View_PostTraining_RecordDetail>;
|
||||
}
|
||||
if (viewRecordDetails.Count > 0)
|
||||
{
|
||||
this.Grid1.Hidden = false;
|
||||
this.Grid1.DataSource = viewRecordDetails;
|
||||
this.Grid1.DataBind();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 下载模板
|
||||
/// <summary>
|
||||
/// 下载模板按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnDownLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载导入模板
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
|
||||
{
|
||||
if (e.EventArgument == "Confirm_OK")
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string filePath = Const.PostTrainingRecordTemplateUrl;
|
||||
string uploadfilepath = rootPath + filePath;
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
FileInfo info = new FileInfo(uploadfilepath);
|
||||
long fileSize = info.Length;
|
||||
Response.ClearContent();
|
||||
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.TransmitFile(uploadfilepath, 0, fileSize);
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.HSSE.PostTraining
|
||||
{
|
||||
|
||||
|
||||
public partial class RecordIn
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// btnAudit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAudit;
|
||||
|
||||
/// <summary>
|
||||
/// btnDownLoad 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDownLoad;
|
||||
|
||||
/// <summary>
|
||||
/// btnClose 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnClose;
|
||||
|
||||
/// <summary>
|
||||
/// fuAttachUrl 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FileUpload fuAttachUrl;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Label2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label2;
|
||||
|
||||
/// <summary>
|
||||
/// hdFileName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdFileName;
|
||||
|
||||
/// <summary>
|
||||
/// hdCheckResult 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdCheckResult;
|
||||
|
||||
/// <summary>
|
||||
/// lblBottom 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label lblBottom;
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,9 @@
|
||||
<f:TextBox ID="txtCode" runat="server" Label="编号" Required="true" ShowRedStar="true"
|
||||
MaxLength="50">
|
||||
</f:TextBox>
|
||||
<f:DropDownList ID="drpRole" runat="server" Label="适用岗位" EnableEdit="true" ForceSelection="false" AutoSelectFirstItem="false" LabelAlign="Right" Required="true" ShowRedStar="true">
|
||||
<%--<f:DropDownList ID="drpRole" runat="server" Label="适用岗位" EnableEdit="true" ForceSelection="false" AutoSelectFirstItem="false" LabelAlign="Right" Required="true" ShowRedStar="true">
|
||||
</f:DropDownList>--%>
|
||||
<f:DropDownList ID="drpWorkPost" runat="server" Label="适用岗位" EnableEdit="true" ForceSelection="false" AutoSelectFirstItem="false" LabelAlign="Right" Required="true" ShowRedStar="true">
|
||||
</f:DropDownList>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
@@ -60,9 +60,13 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
this.txtClassHour.Text = model.ClassHour.ToString();
|
||||
this.txtCycle.Text = model.Cycle.ToString();
|
||||
this.txtRemark.Text = model.Remark;
|
||||
if (!string.IsNullOrWhiteSpace(model.RoleId))
|
||||
//if (!string.IsNullOrWhiteSpace(model.RoleId))
|
||||
//{
|
||||
// this.drpRole.SelectedValue = model.RoleId;
|
||||
//}
|
||||
if (!string.IsNullOrWhiteSpace(model.WorkPostId))
|
||||
{
|
||||
this.drpRole.SelectedValue = model.RoleId;
|
||||
this.drpWorkPost.SelectedValue = model.WorkPostId;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(model.CourseId))
|
||||
{
|
||||
@@ -100,8 +104,10 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
/// </summary>
|
||||
private void InitDropDownList()
|
||||
{
|
||||
//获取适用岗位下拉框
|
||||
PostTrainingRoleService.InitPostTrainingRoleDropDownList(this.drpRole, false);
|
||||
//所属岗位
|
||||
WorkPostService.InitWorkPostDropDownList(this.drpWorkPost, true);
|
||||
////获取适用岗位下拉框
|
||||
//PostTrainingRoleService.InitPostTrainingRoleDropDownList(this.drpRole, false);
|
||||
//获取培训类别下拉框
|
||||
PostTrainingCategoryService.InitPostTrainingCategoryDropDownList(this.drpCategory, false);
|
||||
//获取培训方式下拉框
|
||||
@@ -151,7 +157,8 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
CompileDate = DateTime.Now,
|
||||
CompileMan = this.CurrUser.UserId
|
||||
};
|
||||
newModel.RoleId = this.drpRole.SelectedValue;
|
||||
newModel.WorkPostId = this.drpWorkPost.SelectedValue;
|
||||
//newModel.RoleId = this.drpRole.SelectedValue;
|
||||
newModel.CourseId = this.drpCourse.SelectedValue;
|
||||
newModel.ClassHour = decimal.Parse(this.txtClassHour.Text.Trim());
|
||||
newModel.Cycle = decimal.Parse(this.txtCycle.Text.Trim());
|
||||
|
||||
@@ -51,13 +51,13 @@ namespace FineUIPro.Web.HSSE.PostTraining
|
||||
protected global::FineUIPro.TextBox txtCode;
|
||||
|
||||
/// <summary>
|
||||
/// drpRole 控件。
|
||||
/// drpWorkPost 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpRole;
|
||||
protected global::FineUIPro.DropDownList drpWorkPost;
|
||||
|
||||
/// <summary>
|
||||
/// drpCategory 控件。
|
||||
|
||||
Reference in New Issue
Block a user