学习园地

This commit is contained in:
2026-10-13 15:32:31 +08:00
parent ec60636947
commit 29b15d4b54
28 changed files with 3926 additions and 1 deletions
@@ -0,0 +1,84 @@
--公司级:学习园地资料库
IF NOT EXISTS (SELECT * FROM Sys_Menu WHERE MenuId = 'B0491FC1-804A-4A41-A959-F165EA32D9DD')
BEGIN
INSERT INTO dbo.Sys_Menu (MenuId, MenuName,Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed)
VALUES (N'B0491FC1-804A-4A41-A959-F165EA32D9DD', N'学习园地资料库', N'HSSE/EduTrain/StudyZone.aspx', 90, N'E26D223B-4CA2-4A6D-82D0-224CC9C8676D', N'Menu_DigData', 1,1, 1);
END
GO
--公司级:学习园地资料库菜单权限
IF NOT EXISTS (SELECT * FROM Sys_ButtonToMenu WHERE MenuId = 'B0491FC1-804A-4A41-A959-F165EA32D9DD')
BEGIN
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
VALUES (N'00D8E3F5-4005-4E0F-A69B-107B0B0A3B48', N'B0491FC1-804A-4A41-A959-F165EA32D9DD', N'增加', 1);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
VALUES (N'B48DA37F-9FDE-4604-BA0D-23AE09D04E1E', N'B0491FC1-804A-4A41-A959-F165EA32D9DD', N'修改', 2);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
VALUES (N'9538545C-B41D-4036-A31B-3F7428BFD567', N'B0491FC1-804A-4A41-A959-F165EA32D9DD', N'删除', 3);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
VALUES (N'6FB4A421-C353-4A41-98CF-C3C428753869', N'B0491FC1-804A-4A41-A959-F165EA32D9DD', N'保存', 4);
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
VALUES (N'599DC1D4-997E-4930-9BAE-53D04D201478', N'B0491FC1-804A-4A41-A959-F165EA32D9DD', N'导出', 5);
END
GO
--学习园地资源
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'Training_StudyZone') AND type = N'U')
BEGIN
CREATE TABLE [dbo].[Training_StudyZone](
[StudyZoneId] [nvarchar](50) NOT NULL,
[StudyZoneCode] [nvarchar](50) NULL,
[StudyZoneName] [nvarchar](100) NULL,
[SupStudyZoneId] [nvarchar](50) NULL,
[IsEndLever] [bit] NULL,
CONSTRAINT [PK_Training_StudyZone] PRIMARY KEY CLUSTERED
(
[StudyZoneId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'学习园地资源' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Training_StudyZone'
END
GO
--学习园地资源明细
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'Training_StudyZoneItem') AND type = N'U')
BEGIN
CREATE TABLE [dbo].[Training_StudyZoneItem](
[StudyZoneItemId] [nvarchar](50) NOT NULL,
[StudyZoneId] [nvarchar](50) NULL,
[StudyZoneItemCode] [nvarchar](50) NULL,
[StudyZoneItemName] [nvarchar](100) NULL,
[AttachUrl] [nvarchar](2000) NULL,
[CompileMan] [nvarchar](50) NULL,
[CompileDate] [datetime] NULL,
[WorkPostIds] [nvarchar](max) NULL,
[LearningTime] [int] NULL,
[TestTrainingIds] [nvarchar](max) NULL,
[WorkPostNames] [nvarchar](max) NULL,
[Outcome] [int] NULL,
[Durations] [float] NULL,
CONSTRAINT [PK_Training_StudyZoneItem] PRIMARY KEY CLUSTERED
(
[StudyZoneItemId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
ALTER TABLE [dbo].[Training_StudyZoneItem] ADD DEFAULT ((0)) FOR [Outcome]
ALTER TABLE [dbo].[Training_StudyZoneItem] WITH CHECK ADD CONSTRAINT [FK_Training_StudyZoneItem_Training_StudyZone] FOREIGN KEY([StudyZoneId])
REFERENCES [dbo].[Training_StudyZone] ([StudyZoneId])
ALTER TABLE [dbo].[Training_StudyZoneItem] CHECK CONSTRAINT [FK_Training_StudyZoneItem_Training_StudyZone]
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'学习园地资源明细id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Training_StudyZoneItem', @level2type=N'COLUMN',@level2name=N'StudyZoneItemId'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'学习园地资源主键id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Training_StudyZoneItem', @level2type=N'COLUMN',@level2name=N'StudyZoneId'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'明细编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Training_StudyZoneItem', @level2type=N'COLUMN',@level2name=N'StudyZoneItemCode'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'明细名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Training_StudyZoneItem', @level2type=N'COLUMN',@level2name=N'StudyZoneItemName'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'附件' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Training_StudyZoneItem', @level2type=N'COLUMN',@level2name=N'AttachUrl'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'适合岗位ids' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Training_StudyZoneItem', @level2type=N'COLUMN',@level2name=N'WorkPostIds'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'学习园地资源明细' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Training_StudyZoneItem'
END
GO
+81
View File
@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
/// <summary>
/// 学习园地
/// </summary>
public static class APIStudyZoneService
{
/// <summary>
/// 获取学习园地列表
/// </summary>
/// <param name="supId"></param>
/// <returns></returns>
public static List<Model.StudyZoneType> getStudyZoneTypeList(string supId)
{
using (Model.CNPCDB db = new Model.CNPCDB(Funs.ConnString))
{
var getDataLists = (from x in db.Training_StudyZone
orderby x.StudyZoneCode
select new Model.StudyZoneType
{
StudyZoneId = x.StudyZoneId,
StudyZoneCode = x.StudyZoneCode,
StudyZoneName = x.StudyZoneName,
SupStudyZoneId = x.SupStudyZoneId,
IsEndLever = x.IsEndLever ?? true,
}).ToList();
if (!string.IsNullOrWhiteSpace(supId))
{
getDataLists = getDataLists.Where(x => x.SupStudyZoneId == supId).ToList();
}
return getDataLists;
}
}
#region 获取学习园地教材列表
/// <summary>
/// 获取学习园地列表
/// </summary>
/// <param name="typeId"></param>
/// <param name="itemName"></param>
/// <returns></returns>
public static List<Model.StudyZoneItemItem> getStudyZoneItemList(string typeId, string itemName)
{
using (Model.CNPCDB db = new Model.CNPCDB(Funs.ConnString))
{
var getDataLists = (from x in db.Training_StudyZoneItem
join y in db.Training_StudyZone on x.StudyZoneId equals y.StudyZoneId into temp
from y in temp.DefaultIfEmpty()
orderby x.StudyZoneItemCode
select new Model.StudyZoneItemItem
{
StudyZoneItemId = x.StudyZoneItemId,
StudyZoneId = x.StudyZoneId,
StudyZoneCode = y.StudyZoneCode,
StudyZoneName = y.StudyZoneName,
StudyZoneItemCode = x.StudyZoneItemCode,
StudyZoneItemName = x.StudyZoneItemName,
AttachUrl = db.AttachFile.FirstOrDefault(y => y.ToKeyId == x.StudyZoneItemId).AttachUrl.Replace("\\", "/"),
//AttachUrl = x.AttachUrl.Replace('\\', '/'),
}).ToList();
if (!string.IsNullOrWhiteSpace(typeId))
{
getDataLists = getDataLists.Where(x => x.StudyZoneId == typeId).ToList();
}
if (!string.IsNullOrWhiteSpace(itemName))
{
getDataLists = getDataLists.Where(x => x.StudyZoneItemName.Contains(itemName)).ToList();
}
return getDataLists;
}
}
#endregion
}
}
+3
View File
@@ -247,6 +247,7 @@
<Compile Include="API\HSSE\APITestRecordService.cs" />
<Compile Include="API\HSSE\APIBonusScoreSelfManagementService.cs" />
<Compile Include="API\HSSE\APITrainingPlanService.cs" />
<Compile Include="API\HSSE\APIStudyZoneService.cs" />
<Compile Include="API\HSSE\APITrainingTaskService.cs" />
<Compile Include="API\HSSE\APITrainTestRecordService.cs" />
<Compile Include="API\HSSE\APITrainRecordService.cs" />
@@ -575,7 +576,9 @@
<Compile Include="HSSE\CostGoods\GoodsManageService.cs" />
<Compile Include="HSSE\EduTrain\AccidentCaseItemService.cs" />
<Compile Include="HSSE\EduTrain\AccidentCaseService.cs" />
<Compile Include="HSSE\EduTrain\StudyZoneItemService.cs" />
<Compile Include="HSSE\EduTrain\CompanyTrainingItemService.cs" />
<Compile Include="HSSE\EduTrain\StudyZoneService.cs" />
<Compile Include="HSSE\EduTrain\CompanyTrainingService.cs" />
<Compile Include="HSSE\EduTrain\EduTrain_TrainRecordDetailService.cs" />
<Compile Include="HSSE\EduTrain\EduTrain_TrainRecordService.cs" />
+8
View File
@@ -2065,6 +2065,10 @@ namespace BLL
#region 安全教育
/// <summary>
/// 学习园地资料库
/// </summary>
public const string StudyZoneMenuId = "B0491FC1-804A-4A41-A959-F165EA32D9DD";
/// <summary>
/// 培训教材库
/// </summary>
public const string TrainDBMenuId = "9D99A981-7380-4085-84FA-8C3B1AFA6202";
@@ -3947,6 +3951,10 @@ namespace BLL
/// </summary>
public const string TrainRecordTemplateUrl = "File\\Excel\\DataIn\\人员培训导入模板.xls";
/// <summary>
/// 学习园地资源库模板文件原始的虚拟路径
/// </summary>
public const string StudyZoneTemplateUrl = "File\\Excel\\DataIn\\学习园地资源库导入模板.xls";
/// <summary>
/// 公司教材库模板文件原始的虚拟路径
/// </summary>
public const string CompanyTrainingTemplateUrl = "File\\Excel\\DataIn\\公司教材库导入模板.xls";
@@ -0,0 +1,121 @@
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
/// <summary>
/// 学习园地明细表——教材库
/// </summary>
public class StudyZoneItemService
{
/// <summary>
/// 根据主键获取学习园地明细信息
/// </summary>
/// <param name="companyTrainingItemId"></param>
/// <returns></returns>
public static Model.Training_StudyZoneItem GetStudyZoneItemById(string companyTrainingItemId)
{
Model.CNPCDB db = Funs.DB;
return db.Training_StudyZoneItem.FirstOrDefault(e => e.StudyZoneItemId == companyTrainingItemId);
}
/// <summary>
/// 添加学习园地明细
/// </summary>
/// <param name="model"></param>
public static void AddStudyZoneItem(Model.Training_StudyZoneItem model)
{
Model.CNPCDB db = Funs.DB;
Model.Training_StudyZoneItem newModel = new Model.Training_StudyZoneItem();
newModel.StudyZoneItemId = model.StudyZoneItemId;
newModel.StudyZoneId = model.StudyZoneId;
newModel.StudyZoneItemCode = model.StudyZoneItemCode;
newModel.StudyZoneItemName = model.StudyZoneItemName;
newModel.AttachUrl = model.AttachUrl;
newModel.CompileMan = model.CompileMan;
newModel.CompileDate = model.CompileDate;
newModel.WorkPostIds = model.WorkPostIds;
newModel.WorkPostNames = model.WorkPostNames;
newModel.Outcome = model.Outcome;
newModel.LearningTime = model.LearningTime;
newModel.TestTrainingIds = model.TestTrainingIds;
db.Training_StudyZoneItem.InsertOnSubmit(newModel);
db.SubmitChanges();
}
/// <summary>
/// 修改学习园地明细
/// </summary>
/// <param name="model"></param>
public static void UpdateStudyZoneItem(Model.Training_StudyZoneItem model)
{
Model.CNPCDB db = Funs.DB;
Model.Training_StudyZoneItem newModel = db.Training_StudyZoneItem.FirstOrDefault(e => e.StudyZoneItemId == model.StudyZoneItemId);
if (newModel != null)
{
newModel.StudyZoneItemCode = model.StudyZoneItemCode;
newModel.StudyZoneItemName = model.StudyZoneItemName;
newModel.AttachUrl = model.AttachUrl;
newModel.CompileMan = model.CompileMan;
newModel.CompileDate = model.CompileDate;
newModel.WorkPostIds = model.WorkPostIds;
newModel.WorkPostNames = model.WorkPostNames;
newModel.Outcome = model.Outcome;
newModel.LearningTime = model.LearningTime;
newModel.TestTrainingIds = model.TestTrainingIds;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除明细信息
/// </summary>
/// <param name="companyTrainItemId"></param>
public static void DeleteStudyZoneItemById(string companyTrainItemId)
{
Model.CNPCDB db = Funs.DB;
Model.Training_StudyZoneItem model = db.Training_StudyZoneItem.FirstOrDefault(e => e.StudyZoneItemId == companyTrainItemId);
if (model != null)
{
db.Training_StudyZoneItem.DeleteOnSubmit(model);
db.SubmitChanges();
}
}
/// <summary>
/// 教材库下拉框
/// </summary>
/// <param name="dropName">下拉框名字</param>
/// <param name="workPostId">职务Id</param>
/// <param name="isShowPlease">是否显示请选择</param>
public static void InitStudyZoneItemDownList(FineUIPro.DropDownList dropName, string workPostId, bool isShowPlease)
{
dropName.DataValueField = "StudyZoneItemId";
dropName.DataTextField = "StudyZoneItemName";
dropName.DataSource = GetStudyZoneItemList(workPostId);
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
/// <summary>
/// 获取教材库下拉项
/// </summary>
/// <param name="workPostId"></param>
/// <returns></returns>
public static List<Model.Training_StudyZoneItem> GetStudyZoneItemList(string workPostId)
{
var lst = (from x in Funs.DB.Training_StudyZoneItem orderby x.StudyZoneItemCode select x).ToList();
if (!string.IsNullOrWhiteSpace(workPostId))
{
lst = lst.Where(x => x.WorkPostIds == null || x.WorkPostIds.Contains(workPostId)).ToList();
}
return lst;
}
}
}
+174
View File
@@ -0,0 +1,174 @@
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
/// <summary>
/// 学习园地主表
/// </summary>
public class StudyZoneService
{
/// <summary>
/// 根据主键获取学习园地
/// </summary>
/// <param name="companyTrainingId"></param>
/// <returns></returns>
public static Model.Training_StudyZone GetStudyZoneById(string companyTrainingId)
{
var db = Funs.DB;
return db.Training_StudyZone.FirstOrDefault(e => e.StudyZoneId == companyTrainingId);
}
/// <summary>
/// 添加学习园地
/// </summary>
/// <param name="companyTraining"></param>
public static void AddStudyZone(Model.Training_StudyZone companyTraining)
{
var db = Funs.DB;
Model.Training_StudyZone newStudyZone = new Model.Training_StudyZone();
newStudyZone.StudyZoneId = companyTraining.StudyZoneId;
newStudyZone.StudyZoneCode = companyTraining.StudyZoneCode;
newStudyZone.StudyZoneName = companyTraining.StudyZoneName;
newStudyZone.SupStudyZoneId = companyTraining.SupStudyZoneId;
newStudyZone.IsEndLever = companyTraining.IsEndLever;
db.Training_StudyZone.InsertOnSubmit(newStudyZone);
db.SubmitChanges();
}
/// <summary>
/// 修改学习园地
/// </summary>
/// <param name="companyTraining"></param>
public static void UpdateStudyZone(Model.Training_StudyZone companyTraining)
{
var db = Funs.DB;
Model.Training_StudyZone newStudyZone = db.Training_StudyZone.FirstOrDefault(e => e.StudyZoneId == companyTraining.StudyZoneId);
if (newStudyZone != null)
{
newStudyZone.StudyZoneCode = companyTraining.StudyZoneCode;
newStudyZone.StudyZoneName = companyTraining.StudyZoneName;
newStudyZone.SupStudyZoneId = companyTraining.SupStudyZoneId;
newStudyZone.IsEndLever = companyTraining.IsEndLever;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除学习园地
/// </summary>
/// <param name="companyTrainingId"></param>
public static void DeleteStudyZone(string companyTrainingId)
{
var db = Funs.DB;
Model.Training_StudyZone companyTraining = db.Training_StudyZone.FirstOrDefault(e => e.StudyZoneId == companyTrainingId);
if (companyTraining != null)
{
var getItems = from x in Funs.DB.Training_StudyZoneItem
where x.StudyZoneId == companyTraining.StudyZoneId
select x;
if (getItems.Count() > 0)
{
foreach (var item in getItems)
{
BLL.CommonService.DeleteAttachFileById(item.TestTrainingIds);
}
db.Training_StudyZoneItem.DeleteAllOnSubmit(getItems);
}
db.Training_StudyZone.DeleteOnSubmit(companyTraining);
db.SubmitChanges();
}
}
/// <summary>
/// 是否可删除资源节点
/// </summary>
/// <param name="postName"></param>
/// <returns>true-可以,false-不可以</returns>
public static bool IsDeleteStudyZone(string companyTrainingId)
{
bool isDelete = true;
var Training = BLL.StudyZoneService.GetStudyZoneById(companyTrainingId);
if (Training != null)
{
if (Training.IsEndLever == true)
{
var detailCout = Funs.DB.Training_StudyZoneItem.FirstOrDefault(x => x.StudyZoneId == companyTrainingId);
if (detailCout != null)
{
isDelete = false;
}
}
else
{
var supItemSetCount = BLL.StudyZoneService.GetStudyZoneBySupItem(companyTrainingId);
if (supItemSetCount.Count() > 0)
{
isDelete = false;
}
}
}
return isDelete;
}
/// <summary>
/// 根据上级Id查询所有学习园地
/// </summary>
/// <param name="supItem">上级Id</param>
/// <returns>学习园地的集合</returns>
public static List<Model.Training_StudyZone> GetStudyZoneBySupItem(string supItem)
{
return (from x in Funs.DB.Training_StudyZone where x.SupStudyZoneId == supItem select x).ToList();
}
/// <summary>
/// 根据上级Id查询所有学习园地
/// </summary>
/// <param name="supItem">上级Id</param>
/// <returns>学习园地的集合</returns>
public static List<Model.Training_StudyZone> GetStudyZoneIsEnd()
{
return (from x in Funs.DB.Training_StudyZone
where x.IsEndLever == true
orderby x.StudyZoneCode
select x).ToList();
}
/// <summary>
/// 教材类型下拉框
/// </summary>
/// <param name="dropName"></param>
/// <param name="projectId"></param>
/// <param name="isShowPlease"></param>
public static void InitStudyZoneDropDownList(FineUIPro.DropDownList dropName, string supItem, bool isShowPlease)
{
dropName.DataValueField = "StudyZoneId";
dropName.DataTextField = "StudyZoneName";
dropName.DataSource = GetStudyZoneBySupItem(supItem);
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
/// <summary>
/// 教材类型下拉框(末级)
/// </summary>
/// <param name="dropName"></param>
/// <param name="projectId"></param>
/// <param name="isShowPlease"></param>
public static void InitStudyZoneIsEndDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
{
dropName.DataValueField = "StudyZoneId";
dropName.DataTextField = "StudyZoneName";
dropName.DataSource = GetStudyZoneIsEnd();
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
}
}
+32
View File
@@ -1881,6 +1881,10 @@
<Content Include="HSSE\EduTrain\AccidentCaseItemSave.aspx" />
<Content Include="HSSE\EduTrain\AccidentCaseItemSelectCloumn.aspx" />
<Content Include="HSSE\EduTrain\AccidentCaseSave.aspx" />
<Content Include="HSSE\EduTrain\StudyZoneItemIn.aspx" />
<Content Include="HSSE\EduTrain\StudyZoneItemSave.aspx" />
<Content Include="HSSE\EduTrain\StudyZoneSave.aspx" />
<Content Include="HSSE\EduTrain\StudyZone.aspx" />
<Content Include="HSSE\EduTrain\PlanEdit.aspx" />
<Content Include="HSSE\EduTrain\SelectCompanyTrainingItemProducePlan.aspx" />
<Content Include="HSSE\EduTrain\TaskNotice.aspx" />
@@ -12883,6 +12887,34 @@
<Compile Include="HSSE\EduTrain\AccidentCaseSave.aspx.designer.cs">
<DependentUpon>AccidentCaseSave.aspx</DependentUpon>
</Compile>
<Compile Include="HSSE\EduTrain\StudyZoneItemIn.aspx.cs">
<DependentUpon>StudyZoneItemIn.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="HSSE\EduTrain\StudyZoneItemIn.aspx.designer.cs">
<DependentUpon>StudyZoneItemIn.aspx</DependentUpon>
</Compile>
<Compile Include="HSSE\EduTrain\StudyZoneItemSave.aspx.cs">
<DependentUpon>StudyZoneItemSave.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="HSSE\EduTrain\StudyZoneItemSave.aspx.designer.cs">
<DependentUpon>StudyZoneItemSave.aspx</DependentUpon>
</Compile>
<Compile Include="HSSE\EduTrain\StudyZoneSave.aspx.cs">
<DependentUpon>StudyZoneSave.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="HSSE\EduTrain\StudyZoneSave.aspx.designer.cs">
<DependentUpon>StudyZoneSave.aspx</DependentUpon>
</Compile>
<Compile Include="HSSE\EduTrain\StudyZone.aspx.cs">
<DependentUpon>StudyZone.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="HSSE\EduTrain\StudyZone.aspx.designer.cs">
<DependentUpon>StudyZone.aspx</DependentUpon>
</Compile>
<Compile Include="HSSE\EduTrain\PlanEdit.aspx.cs">
<DependentUpon>PlanEdit.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -0,0 +1,174 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudyZone.aspx.cs"
Inherits="FineUIPro.Web.HSSE.EduTrain.StudyZone" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>学习园地</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
<Items>
<f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true"
EnableCollapse="true" Width="300" Title="学习园地" TitleToolTip="学习园地" ShowBorder="true"
ShowHeader="false" AutoScroll="true" BodyPadding="5px" IconFont="ArrowCircleLeft">
<Items>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Right">
<Items>
<f:Button ID="btnNew" Icon="Add" runat="server" OnClick="btnNew_Click" Hidden="true">
</f:Button>
<f:Button ID="btnEdit" Icon="Pencil" runat="server" OnClick="btnEdit_Click" Hidden="true">
</f:Button>
<f:Button ID="btnDelete" Icon="Delete" ConfirmText="确定删除当前数据?" OnClick="btnDelete_Click"
runat="server" Hidden="true">
</f:Button>
</Items>
</f:Toolbar>
<f:Tree ID="trStudyZone" EnableCollapse="true" ShowHeader="true" Title="学习园地" MinHeight="400px"
OnNodeCommand="trStudyZone_NodeCommand" AutoLeafIdentification="true" runat="server"
EnableTextSelection="True">
</f:Tree>
</Items>
</f:Panel>
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" ShowBorder="true"
Layout="VBox" ShowHeader="false" BodyPadding="5px" IconFont="PlusCircle" Title="学习材料明细"
TitleToolTip="学习材料明细" AutoScroll="true">
<Items>
<f:Grid ID="Grid1" Width="850px" ShowBorder="true" ShowHeader="false" EnableCollapse="true" ForceFit="true"
runat="server" BoxFlex="1" DataKeyNames="StudyZoneItemIdNum" DataIDField="StudyZoneItemIdNum"
AllowSorting="true" SortField="StudyZoneItemCode" OnRowCommand="Grid1_RowCommand"
SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true"
PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" EnableRowDoubleClickEvent="true"
OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True" EnableColumnLines="true">
<Toolbars>
<f:Toolbar ID="Toolbar3" Position="Top" runat="server">
<Items>
<%--<f:DropDownList ID="drpWorkPost" runat="server" Label="适用岗位" AutoSelectFirstItem="true" AutoPostBack="true" EnableEdit="true" OnSelectedIndexChanged="drp_SelectedIndexChanged"
LabelAlign="Right" LabelWidth="80px" Width="300px">
</f:DropDownList>--%>
<f:TextBox ID="txtStudyZoneItemCode" runat="server" Label="编号" EmptyText="输入查询教材编号"
AutoPostBack="true" OnTextChanged="TextBox_TextChanged" Width="250px" LabelWidth="80px"
LabelAlign="Right">
</f:TextBox>
<f:TextBox ID="txtStudyZoneItemName" runat="server" Label="名称" EmptyText="输入查询教材名称"
AutoPostBack="true" OnTextChanged="TextBox_TextChanged" Width="250px" LabelWidth="80px"
LabelAlign="Right">
</f:TextBox>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnNewDetail" ToolTip="新增" Icon="Add" runat="server" OnClick="btnNewDetail_Click"
Hidden="true">
</f:Button>
<%--<f:Button ID="btnImport" ToolTip="导入" Icon="ApplicationGet" Hidden="true" runat="server"
OnClick="btnImport_Click">
</f:Button>--%>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<%-- <f:TemplateField ColumnID="tfNumber" Width="55px" HeaderText="序号" HeaderTextAlign="Center"
TextAlign="Center">
<ItemTemplate>
<asp:Label ID="lbNumber" runat="server" Text='<%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>--%>
<f:TemplateField Width="120px" HeaderText="编号" HeaderTextAlign="Center" TextAlign="Center"
SortField="StudyZoneItemCode" ColumnID="tfStudyZoneItemCode">
<ItemTemplate>
<asp:Label ID="lbStudyZoneItemCode" runat="server" Text='<%# Bind("StudyZoneItemCode") %>'
ToolTip='<%#Bind("StudyZoneItemCode") %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:TemplateField Width="200px" HeaderText="名称" HeaderTextAlign="Center" TextAlign="Left"
SortField="StudyZoneItemName" ColumnID="tfStudyZoneItemName">
<ItemTemplate>
<asp:Label ID="lbStudyZoneItemName" runat="server" Text='<%# Bind("StudyZoneItemName") %>'
ToolTip='<%#Bind("StudyZoneItemName") %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<%--<f:RenderField ColumnID="WorkPostNames" DataField="WorkPostNames" SortField="WorkPostNames"
Width="300px" FieldType="String" HeaderText="适合岗位" HeaderTextAlign="Center" TextAlign="left">
</f:RenderField>--%>
<%-- <f:TemplateField Width="120px" HeaderText="整理人" HeaderTextAlign="Center" TextAlign="Left" ColumnID="tfCompileMan"
SortField="CompileMan">
<ItemTemplate>
<asp:Label ID="lbCompileMan" runat="server" Text='<%# Bind("CompileMan") %>' ToolTip='<%#Bind("CompileMan") %>'>
</asp:Label>
</ItemTemplate>
</f:TemplateField>--%>
<f:TemplateField Width="100px" HeaderText="整理时间" HeaderTextAlign="Center" TextAlign="Center" ColumnID="tfCompileDate"
SortField="CompileDate">
<ItemTemplate>
<asp:Label ID="lbCompileDate" runat="server" Text='<%# Bind("CompileDate","{0:yyyy-MM-dd}") %>'
ToolTip='<%#Bind("CompileDate") %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<%--<f:LinkButtonField ColumnID="AttachUrlName" DataTextField="AttachUrlName" DataToolTipField="AttachUrlName" HeaderText="附件"
CommandName="Attach" EnableAjax="false" HeaderTextAlign="Center" Width="120px">
</f:LinkButtonField>--%>
<f:BoundField runat="server" Hidden="true" ColumnID="hdUrl" DataField="AttachUrl"></f:BoundField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="类别" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="700px" Height="600px">
</f:Window>
<f:Window ID="Window2" Title="详情" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window2_Close" IsModal="true"
Width="700px" Height="600px">
</f:Window>
<f:Window ID="Window3" Title="导入信息" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window3_Close" IsModal="false"
CloseAction="HidePostBack" Width="1200px" Height="700px">
</f:Window>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
runat="server" Text="编辑" Hidden="true" Icon="Pencil">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true"
Icon="Delete" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除"
Hidden="true">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>
@@ -0,0 +1,573 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using AspNet = System.Web.UI.WebControls;
namespace FineUIPro.Web.HSSE.EduTrain
{
public partial class StudyZone : PageBase
{
#region 加载
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
this.GetButtonPower();
//WorkPostService.InitWorkPostDropDownList(drpWorkPost, true);
InitTreeMenu();
}
}
#endregion
#region 加载树
/// <summary>
/// 初始化树
/// </summary>
private void InitTreeMenu()
{
trStudyZone.Nodes.Clear();
trStudyZone.ShowBorder = false;
trStudyZone.ShowHeader = false;
trStudyZone.EnableIcons = true;
trStudyZone.AutoScroll = true;
trStudyZone.EnableSingleClickExpand = true;
TreeNode rootNode = new TreeNode
{
Text = "学习园地",
NodeID = "0",
Expanded = true
};
this.trStudyZone.Nodes.Add(rootNode);
BoundTree(rootNode.Nodes, "0");
}
private void BoundTree(TreeNodeCollection nodes, string menuId)
{
var dt = GetNewTraining(menuId);
if (dt.Count() > 0)
{
TreeNode tn = null;
foreach (var dr in dt)
{
tn = new TreeNode
{
Text = dr.StudyZoneName,
NodeID = dr.StudyZoneId,
EnableClickEvent = true,
ToolTip = dr.StudyZoneName
};
nodes.Add(tn);
BoundTree(tn.Nodes, dr.StudyZoneId);
}
}
}
/// <summary>
/// 得到菜单方法
/// </summary>
/// <param name="parentId"></param>
/// <returns></returns>
private List<Model.Training_StudyZone> GetNewTraining(string parentId)
{
return (from x in Funs.DB.Training_StudyZone where x.SupStudyZoneId == parentId orderby x.StudyZoneCode select x).ToList(); ;
}
#endregion
#region 增加、修改、删除学习园地类别
/// <summary>
/// 增加学习园地类别
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNew_Click(object sender, EventArgs e)
{
if (this.trStudyZone.SelectedNode != null)
{
Model.Training_StudyZone training = BLL.StudyZoneService.GetStudyZoneById(this.trStudyZone.SelectedNode.NodeID);
if ((training != null && training.IsEndLever == false) || this.trStudyZone.SelectedNode.NodeID == "0") //根节点或者非末级节点,可以增加
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("StudyZoneSave.aspx?SupStudyZoneId={0}", this.trStudyZone.SelectedNode.NodeID, "编辑 - ")));
}
else
{
ShowNotify("选择的项已是末级!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 修改学习园地类别
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnEdit_Click(object sender, EventArgs e)
{
if (this.trStudyZone.SelectedNode != null)
{
if (this.trStudyZone.SelectedNode.NodeID != "0") //非根节点可以编辑
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("StudyZoneSave.aspx?StudyZoneId={0}", this.trStudyZone.SelectedNode.NodeID, "编辑 - ")));
}
else
{
ShowNotify("根节点无法编辑!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 删除学习园地类别
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDelete_Click(object sender, EventArgs e)
{
if (this.trStudyZone.SelectedNode != null)
{
var q = BLL.StudyZoneService.GetStudyZoneById(this.trStudyZone.SelectedNode.NodeID);
if (q != null && BLL.StudyZoneService.IsDeleteStudyZone(this.trStudyZone.SelectedNode.NodeID))
{
BLL.StudyZoneService.DeleteStudyZone(this.trStudyZone.SelectedNode.NodeID);
InitTreeMenu();
}
else
{
ShowNotify("存在下级菜单或已增加资源数据或者为内置项,不允许删除!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请选择删除项!", MessageBoxIcon.Warning);
}
}
#endregion
#region 树点击事件
/// <summary>
/// 树点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void trStudyZone_NodeCommand(object sender, FineUIPro.TreeCommandEventArgs e)
{
BindGrid();
}
#endregion
#region 下拉触发事件
/// <summary>
/// 适用岗位下拉触发事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drp_SelectedIndexChanged(object sender, EventArgs e)
{
this.BindGrid();
}
#endregion
#region 绑定数据
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
if (this.trStudyZone.SelectedNode != null && !string.IsNullOrEmpty(this.trStudyZone.SelectedNode.NodeID))
{
//string strSql = @"SELECT item.StudyZoneItemId,(item.StudyZoneItemId+'_'+CAST(row_number() over(order by item.StudyZoneItemCode) AS nvarchar(10))) AS StudyZoneItemIdNum,"
// + @" item.StudyZoneItemId,item.StudyZoneId,item.StudyZoneItemCode,item.StudyZoneItemName,--A.AttachUrl,"
// + @" item.CompileMan, item.CompileDate,--dbo.GetFileName(A.AttachUrl) AS AttachUrlName, "
// + @" (CASE WHEN WorkPostNames IS NULL THEN '通用' ELSE WorkPostNames END) AS WorkPostNames "
// + @" FROM dbo.Training_StudyZoneItem AS item"
// //+ @" LEFT JOIN (SELECT ToKeyId ,F1 as AttachUrl"
// //+ @" FROM AttachFile CROSS APPLY (SELECT * FROM dbo.f_splitstr(AttachUrl,',')) t"
// //+ @" WHERE LEN(F1) > 0) AS A ON A.ToKeyId=item.StudyZoneItemId "
// + @" WHERE item.StudyZoneId=@StudyZoneId";
string strSql = @"SELECT item.StudyZoneItemId,(item.StudyZoneItemId+'_'+CAST(row_number() over(order by item.StudyZoneItemCode) AS nvarchar(10))) AS StudyZoneItemIdNum,"
+ @" item.StudyZoneItemId,item.StudyZoneId,item.StudyZoneItemCode,item.StudyZoneItemName,"
+ @" item.CompileMan, item.CompileDate,"
+ @" (CASE WHEN WorkPostNames IS NULL THEN '通用' ELSE WorkPostNames END) AS WorkPostNames "
+ @" FROM dbo.Training_StudyZoneItem AS item"
+ @" WHERE item.StudyZoneId=@StudyZoneId";
List<SqlParameter> listStr = new List<SqlParameter>
{
new SqlParameter("@StudyZoneId", this.trStudyZone.SelectedNode.NodeID)
};
if (!string.IsNullOrEmpty(this.txtStudyZoneItemCode.Text.Trim()))
{
strSql += " AND StudyZoneItemCode LIKE @StudyZoneItemCode";
listStr.Add(new SqlParameter("@StudyZoneItemCode", "%" + this.txtStudyZoneItemCode.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.txtStudyZoneItemName.Text.Trim()))
{
strSql += " AND StudyZoneItemName LIKE @StudyZoneItemName";
listStr.Add(new SqlParameter("@StudyZoneItemName", "%" + this.txtStudyZoneItemName.Text.Trim() + "%"));
}
//if (!string.IsNullOrEmpty(this.drpWorkPost.SelectedValue) && this.drpWorkPost.SelectedValue != Const._Null)
//{
// strSql += " AND (WorkPostIds IS NULL OR WorkPostIds LIKE @WorkPostId)";
// listStr.Add(new SqlParameter("@WorkPostId", "%" + this.drpWorkPost.SelectedValue + "%"));
//}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
}
#endregion
#region 弹出窗关闭事件
protected void Window1_Close(object sender, EventArgs e)
{
InitTreeMenu();
}
protected void Window2_Close(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region 排序、分页
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
#endregion
#region 查询
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
}
#endregion
#region 增加、修改、删除明细信息
#region 新增明细
/// <summary>
/// 新增明细
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNewDetail_Click(object sender, EventArgs e)
{
if (this.trStudyZone.SelectedNode != null)
{
if (this.trStudyZone.SelectedNode.Nodes.Count == 0)
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("StudyZoneItemSave.aspx?StudyZoneId={0}", this.trStudyZone.SelectedNode.NodeID, "编辑 - ")));
}
else
{
ShowNotify("请选择末级节点!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
}
}
#endregion
#region 编辑明细
protected void btnEditDetail_Click(object sender, EventArgs e)
{
this.EditData();
}
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
this.EditData();
}
/// <summary>
/// 右键编辑事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
this.EditData();
}
/// <summary>
/// 编辑数据方法
/// </summary>
private void EditData()
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string companyTrainingItemId = Grid1.SelectedRowID;
companyTrainingItemId = companyTrainingItemId.Substring(0, companyTrainingItemId.IndexOf("_"));
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("StudyZoneItemSave.aspx?StudyZoneItemId={0}", companyTrainingItemId, "编辑 - ")));
}
#endregion
#region 删除明细
// 删除数据
protected void btnDeleteDetail_Click(object sender, EventArgs e)
{
this.DeleteData();
}
/// <summary>
/// 右键删除事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
this.DeleteData();
}
/// <summary>
/// 删除方法
/// </summary>
private void DeleteData()
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
rowID = rowID.Substring(0, rowID.IndexOf("_"));
var getD = BLL.StudyZoneItemService.GetStudyZoneItemById(rowID);
if (getD != null)
{
BLL.LogService.AddSys_Log(this.CurrUser, getD.StudyZoneItemCode, getD.StudyZoneItemId, BLL.Const.StudyZoneMenuId, BLL.Const.BtnDelete);
BLL.StudyZoneItemService.DeleteStudyZoneItemById(rowID);
}
}
BindGrid();
ShowNotify("删除数据成功!");
}
}
#endregion
#endregion
#region 按钮权限
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.StudyZoneMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNew.Hidden = false;
//this.btnImport.Hidden = false;
this.btnNewDetail.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
this.btnEdit.Hidden = false;
this.btnMenuEdit.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnDelete.Hidden = false;
this.btnMenuDelete.Hidden = false;
}
}
}
#endregion
#region 导入
/// <summary>
/// 导入按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("StudyZoneItemIn.aspx", "导入 - ")));
}
protected void Window3_Close(object sender, EventArgs e)
{
this.InitTreeMenu();
this.BindGrid();
}
#endregion
/// <summary>
/// 导出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut_Click(object sender, EventArgs e)
{
Response.ClearContent();
string filename = Funs.GetNewFileName();
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("学习园地" + filename, System.Text.Encoding.UTF8) + ".xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
this.Grid1.PageSize = Grid1.RecordCount;
BindGrid();
Response.Write(GetGridTableHtml(Grid1, 5));
Response.End();
}
#region 导出方法
/// <summary>
/// 导出方法
/// </summary>
/// <param name="grid"></param>
/// <returns></returns>
public static string GetGridTableHtml(Grid grid, int count)
{
StringBuilder sb = new StringBuilder();
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
sb.Append("<tr>");
foreach (GridColumn column in grid.Columns)
{
if (column.ColumnIndex < count)
{
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
}
}
sb.Append("</tr>");
foreach (GridRow row in grid.Rows)
{
sb.Append("<tr>");
foreach (GridColumn column in grid.Columns)
{
if (column.ColumnIndex < count)
{
string html = row.Values[column.ColumnIndex].ToString();
if (column.ColumnID == "tfNumber" && (row.FindControl("lbNumber") as AspNet.Label) != null)
{
html = (row.FindControl("lbNumber") as AspNet.Label).Text;
}
if (column.ColumnID == "tfStudyZoneItemCode" && (row.FindControl("lbStudyZoneItemCode") as AspNet.Label) != null)
{
html = (row.FindControl("lbStudyZoneItemCode") as AspNet.Label).Text;
}
if (column.ColumnID == "tfStudyZoneItemName" && (row.FindControl("lbStudyZoneItemName") as AspNet.Label) != null)
{
html = (row.FindControl("lbStudyZoneItemName") as AspNet.Label).Text;
}
if (column.ColumnID == "tfCompileMan" && (row.FindControl("lbCompileMan") as AspNet.Label) != null)
{
html = (row.FindControl("lbCompileMan") as AspNet.Label).Text;
}
if (column.ColumnID == "tfCompileDate" && (row.FindControl("lbCompileDate") as AspNet.Label) != null)
{
html = (row.FindControl("lbCompileDate") as AspNet.Label).Text;
}
sb.AppendFormat("<td>{0}</td>", html);
}
}
sb.Append("</tr>");
}
sb.Append("</table>");
return sb.ToString();
}
#endregion
/// <summary>
/// 行事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "Attach")
{
string attUrl = this.Grid1.Rows[e.RowIndex].Values[this.Grid1.Columns.Count - 1].ToString();
try
{
string url = Funs.RootPath + attUrl;
FileInfo info = new FileInfo(url);
string savedName = Path.GetFileName(url);
if (!info.Exists || string.IsNullOrEmpty(savedName))
{
url = Funs.RootPath + "Images//Null.jpg";
info = new FileInfo(url);
}
if (Path.GetExtension(savedName) == ".mp4" || Path.GetExtension(savedName).ToLower() == ".mp4" || Path.GetExtension(savedName) == ".m4v")
{
string mpUrl = HttpUtility.UrlEncode(attUrl.Replace('\\', '/'));
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/AttachFile/player.aspx?url={0}", attUrl.Replace('\\', '/'), "播放 - "), "播放视频", 700, 560));
}
else
{
string fileName = Path.GetFileName(url);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.Clear();
//System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
System.Web.HttpContext.Current.Response.ContentType = "application/octet-stream";
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
System.Web.HttpContext.Current.Response.TransmitFile(url, 0, fileSize);
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.End();
}
}
catch (Exception)
{
}
}
}
}
}
@@ -0,0 +1,287 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.EduTrain
{
public partial class StudyZone
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// panelLeftRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelLeftRegion;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// btnNew 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// btnEdit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnEdit;
/// <summary>
/// btnDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDelete;
/// <summary>
/// trStudyZone 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tree trStudyZone;
/// <summary>
/// panelCenterRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelCenterRegion;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar3 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar3;
/// <summary>
/// txtStudyZoneItemCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtStudyZoneItemCode;
/// <summary>
/// txtStudyZoneItemName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtStudyZoneItemName;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnNewDetail 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnNewDetail;
/// <summary>
/// btnOut 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// lbStudyZoneItemCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbStudyZoneItemCode;
/// <summary>
/// lbStudyZoneItemName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbStudyZoneItemName;
/// <summary>
/// lbCompileDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbCompileDate;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Window3 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window3;
/// <summary>
/// WindowAtt 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnMenuDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}
@@ -0,0 +1,86 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudyZoneItemIn.aspx.cs" Inherits="FineUIPro.Web.HSSE.EduTrain.StudyZoneItemIn" %>
<!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:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1"
OnClick="btnAudit_Click">
</f:Button>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click">
</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="gvErrorInfo" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="导入教材信息" EnableCollapse="true"
runat="server" BoxFlex="1" AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true"
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" AllowPaging="false" IsDatabasePaging="false" PageSize="10"
EnableRowDoubleClickEvent="true" AllowFilters="true" EnableTextSelection="True" Height="400">
<Columns>
<f:TemplateField ColumnID="tfPageIndex" Width="40px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="False">
<ItemTemplate>
<asp:Label ID="lblPageIndex" runat="server" Text='<%# gvErrorInfo.PageIndex * gvErrorInfo.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:BoundField DataField="Row" HeaderText="错误行号" Width="50px">
</f:BoundField>
<f:BoundField DataField="Column" HeaderText="错误列" Width="100px">
</f:BoundField>
<f:BoundField DataField="Reason" HeaderText="错误类型" MinWidth="220px">
</f:BoundField>
</Columns>
</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、掌握程度为掌握、熟悉、了解;
4、适合岗位空时为通用,多岗位时用,隔开,多选答案时用,隔开;
5、数据导入完成,成功后自动返回,如果有不成功数据页面弹出提示框,列表显示导入成功数据。">
</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>
</body>
</html>
@@ -0,0 +1,419 @@
using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Web.Util;
namespace FineUIPro.Web.HSSE.EduTrain
{
public partial class StudyZoneItemIn : PageBase
{
#region 定义变量
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private string initPath = Const.ExcelUrl;
/// <summary>
/// 导入集合
/// </summary>
public static List<Model.Training_StudyZoneItem> viewTrainingItems = new List<Model.Training_StudyZoneItem>();
/// <summary>
/// 错误集合
/// </summary>
public static List<Model.ErrorInfo> errorInfos = new List<Model.ErrorInfo>();
#endregion
#region 加载页面
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.hdFileName.Text = string.Empty;
this.hdCheckResult.Text = string.Empty;
if (viewTrainingItems != null)
{
viewTrainingItems.Clear();
}
if (errorInfos != null)
{
errorInfos.Clear();
}
}
}
#endregion
#region 数据导入
/// <summary>
/// 数据导入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAudit_Click(object sender, EventArgs e)
{
try
{
if (this.fuAttachUrl.HasFile == false)
{
ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
return;
}
string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls")
{
ShowNotify("只可以选择Excel文件!", MessageBoxIcon.Warning);
return;
}
if (viewTrainingItems != null)
{
viewTrainingItems.Clear();
}
if (errorInfos != null)
{
errorInfos.Clear();
}
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
{
viewTrainingItems.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 result = string.Empty;
int ic, ir;
ic = pds.Columns.Count;
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
///教材库
var companyTrainingItems = from x in Funs.DB.Training_StudyZoneItem select x;
///类型
var trainings = from x in Funs.DB.Training_StudyZone select x;
///岗位
var workPosts = from x in Funs.DB.Base_WorkPost select x;
for (int i = 0; i < ir; i++)
{
Model.Training_StudyZoneItem newViewTrainingItem = new Model.Training_StudyZoneItem();
newViewTrainingItem.StudyZoneItemId = SQLHelper.GetNewID(typeof(Model.Training_StudyZoneItem));
//类型
string col1 = pds.Rows[i][0].ToString().Trim();
if (string.IsNullOrEmpty(col1))
{
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "教材类型", Reason = "此项为必填项!" });
}
else
{
var standard = trainings.FirstOrDefault(x => x.StudyZoneName == col1);
if (standard != null)
{
newViewTrainingItem.StudyZoneId = standard.StudyZoneId;
}
else
{
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "教材类别", Reason = $"不存在教材类别[{col1}]!" });
}
}
if (!string.IsNullOrWhiteSpace(newViewTrainingItem.StudyZoneId))
{
//教材编号
string col2 = pds.Rows[i][1].ToString().Trim();
//教材名称
string col3 = pds.Rows[i][2].ToString().Trim();
if (!string.IsNullOrWhiteSpace(col2))
{
var items = companyTrainingItems.FirstOrDefault(x => x.StudyZoneItemCode == col2);
if (items != null)
{
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "教材编号", Reason = $"[{col1}]已存在编号[{col2}]!" });
}
else
{
newViewTrainingItem.StudyZoneItemCode = col2;
}
}
else
{
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "教材编号", Reason = "不能为空!" });
}
if (!string.IsNullOrWhiteSpace(col3))
{
var item = companyTrainingItems.FirstOrDefault(x => x.StudyZoneItemName == col3);
if (item != null)
{
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "教材名称", Reason = $"[{col1}]已存在教材名称[{col3}]!" });
}
else
{
newViewTrainingItem.StudyZoneItemName = col3;
}
}
else
{
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "教材名称", Reason = "不能为空!" });
}
}
//适合岗位
string col4 = pds.Rows[i][3].ToString().Trim();
if (!string.IsNullOrEmpty(col4))
{
List<string> WorkPostSels = Funs.GetStrListByStr(col4, ',');
if (WorkPostSels.Count() > 0)
{
string ids = string.Empty;
foreach (var item in WorkPostSels)
{
string workItem = item.Trim();
var wp = workPosts.FirstOrDefault(x => x.WorkPostName == workItem);
if (wp != null)
{
ids += wp.WorkPostId + ",";
}
else
{
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "适合岗位", Reason = $"[{workItem}]不在岗位表中!" });
}
}
if (!string.IsNullOrEmpty(ids))
{
newViewTrainingItem.WorkPostNames = col4;
newViewTrainingItem.WorkPostIds = ids.Substring(0, ids.LastIndexOf(","));
}
}
}
//时长(分钟)
string col5 = pds.Rows[i][4].ToString().Trim();
if (!string.IsNullOrWhiteSpace(col5))
{
newViewTrainingItem.LearningTime = int.Parse(col5) * 60;
}
//掌握程度
string col6 = pds.Rows[i][5].ToString().Trim();
if (!string.IsNullOrWhiteSpace(col6))
{
newViewTrainingItem.Outcome = col6 == "了解" ? 2 : col6 == "熟悉" ? 1 : 0;
}
else
{
newViewTrainingItem.Outcome = 0;
}
newViewTrainingItem.CompileDate = DateTime.Now;
newViewTrainingItem.CompileMan = this.CurrUser.UserName;
///加入学习园地资料
viewTrainingItems.Add(newViewTrainingItem);
}
if (errorInfos.Any())
{
viewTrainingItems.Clear();
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
}
else
{
errorInfos.Clear();
if (!viewTrainingItems.Any())
{
Alert.ShowInTop("导入数据为空!", MessageBoxIcon.Warning);
}
else
{
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
}
}
}
else
{
Alert.ShowInTop("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region 保存
/// <summary>
/// 保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (!errorInfos.Any())
{
int a = viewTrainingItems.Count();
int insertCount = 0;
int updateCount = 0;
for (int i = 0; i < a; i++)
{
Model.Training_StudyZoneItem newModel = new Model.Training_StudyZoneItem
{
StudyZoneId = viewTrainingItems[i].StudyZoneId,
StudyZoneItemId = viewTrainingItems[i].StudyZoneItemId,
StudyZoneItemCode = viewTrainingItems[i].StudyZoneItemCode,
StudyZoneItemName = viewTrainingItems[i].StudyZoneItemName,
WorkPostIds = viewTrainingItems[i].WorkPostIds,
WorkPostNames = viewTrainingItems[i].WorkPostNames,
LearningTime = viewTrainingItems[i].LearningTime,
CompileDate = viewTrainingItems[i].CompileDate,
CompileMan = viewTrainingItems[i].CompileMan,
Outcome = viewTrainingItems[i].Outcome
};
BLL.StudyZoneItemService.AddStudyZoneItem(newModel);
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
string filePath = initFullPath + this.hdFileName.Text;
if (filePath != string.Empty && File.Exists(filePath))
{
File.Delete(filePath);//删除上传的XLS文件
}
ShowNotify("导入完成!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("请先将错误数据修正,再重新导入保存!", MessageBoxIcon.Warning);
}
}
#endregion
#region 关闭弹出窗口
/// <summary>
/// 关闭导入弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
if (Session["trainingItem"] != null)
{
viewTrainingItems = Session["trainingItem"] as List<Model.Training_StudyZoneItem>;
}
if (viewTrainingItems.Count > 0)
{
this.gvErrorInfo.Hidden = false;
this.gvErrorInfo.DataSource = viewTrainingItems;
this.gvErrorInfo.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.StudyZoneTemplateUrl;
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.EduTrain
{
public partial class StudyZoneItemIn
{
/// <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>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnDownLoad 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDownLoad;
/// <summary>
/// fuAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fuAttachUrl;
/// <summary>
/// gvErrorInfo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid gvErrorInfo;
/// <summary>
/// lblPageIndex 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
/// <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;
}
}
@@ -0,0 +1,153 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudyZoneItemSave.aspx.cs"
Inherits="FineUIPro.Web.HSSE.EduTrain.StudyZoneItemSave" %>
<!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">
<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" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtStudyZoneItemCode" runat="server" Label="编号" Required="true"
ShowRedStar="true" FocusOnPageLoad="true" MaxLength="50" LabelWidth="120px">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtStudyZoneItemName" runat="server" Label="名称" Required="true" LabelWidth="120px"
ShowRedStar="true" MaxLength="50" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
</f:TextBox>
</Items>
</f:FormRow>
<%--<f:FormRow>
<Items>
<f:DropDownBox runat="server" Label="适合岗位" ID="DropDownBox1" LabelWidth="120px"
DataControlID="RadioButtonList1" EnableMultiSelect="true">
<PopPanel>
<f:SimpleForm ID="SimpleForm2" BodyPadding="10px" runat="server" AutoScroll="true"
ShowBorder="True" ShowHeader="false" Hidden="true">
<Items>
<f:Label ID="Label1" runat="server" Text="请选择适合的岗位"></f:Label>
<f:CheckBoxList ID="RadioButtonList1" ColumnNumber="3" runat="server">
</f:CheckBoxList>
</Items>
</f:SimpleForm>
</PopPanel>
</f:DropDownBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownBox runat="server" ID="ddTestTraining" Label="考试题库" EnableMultiSelect="true" CustomData="true" LabelWidth="120px">
<PopPanel>
<f:Tree ID="treeTestTraining" ShowHeader="false" Hidden="true" runat="server" EnableCheckBox="true" CascadeCheck="true">
</f:Tree>
</PopPanel>
<Listeners>
<f:Listener Event="poppanelshow" Handler="onPopPanelShow" />
</Listeners>
</f:DropDownBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:NumberBox ID="txtLearningTime" Label="时长(分钟)" runat="server" DecimalPrecision="0" NoDecimal="true" NoNegative="true" LabelWidth="120px"></f:NumberBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpOutcome" Label="掌握程度" AutoSelectFirstItem="false" AutoPostBack="false" EnableSimulateTree="true" Required="true" ShowRedStar="true" runat="server" LabelWidth="120px">
</f:DropDownList>
</Items>
</f:FormRow>--%>
<f:FormRow>
<Items>
<f:TextBox ID="txtCompileMan" runat="server" Label="整理人" Readonly="true" MaxLength="50" LabelWidth="120px">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DatePicker runat="server" Label="整理时间" ID="txtCompileDate" LabelWidth="120px">
</f:DatePicker>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:Label runat="server" ID="lbTemp">
</f:Label>
<f:Button ID="btnAttachUrl" Text="学习资料" ToolTip="学习资料上传及查看" Icon="TableCell" runat="server"
OnClick="btnUploadResources_Click" ValidateForms="SimpleForm1">
</f:Button>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1"
OnClick="btnSave_Click" Hidden="true">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
<f:HiddenField ID="hdCompileMan" runat="server">
</f:HiddenField>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
</form>
</body>
<script>
<%-- var ddTestTraining = '<%= ddTestTraining.ClientID %>';
var treeTestTraining = '<%= treeTestTraining.ClientID %>';
function onPopPanelShow(event) {
var nodes = this.getValue();
F.noEvent(function () {
// 第二个参数true:是否递归调用子节点
F(treeTestTraining).checkNodes(nodes, true);
// 启用树控件的级联选择时,确保把树控件的选中值全部同步到下拉框
syncToDropDownBox();
});
}
// 将树控件的选中值同步到下拉框
function syncToDropDownBox() {
var values = [], texts = [];
var checkedNodes = F(treeTestTraining).getCheckedNodes(true);
$.each(checkedNodes, function (index, node) {
debugger;
values.push(node.id);
texts.push(node.text);
});
F(ddTestTraining).setValue(values, texts);
}
F.ready(function () {
F(treeTestTraining).on('nodecheck', function (event, nodeId, checked) {
// 加个延迟,等待复选框的级联选择完成
window.setTimeout(function () {
syncToDropDownBox();
});
});
});--%>
</script>
</html>
@@ -0,0 +1,286 @@
using System;
using System.Linq;
using Model;
using BLL;
using System.Collections.Generic;
using Microsoft.Office.Interop.Excel;
namespace FineUIPro.Web.HSSE.EduTrain
{
public partial class StudyZoneItemSave : PageBase
{
#region 定义变量
/// <summary>
/// 主键
/// </summary>
public string StudyZoneItemId
{
get
{
return (string)ViewState["StudyZoneItemId"];
}
set
{
ViewState["StudyZoneItemId"] = value;
}
}
/// <summary>
/// 主表主键
/// </summary>
public string StudyZoneId
{
get
{
return (string)ViewState["StudyZoneId"];
}
set
{
ViewState["StudyZoneId"] = value;
}
}
#endregion
#region 加载页面
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.GetButtonPower();
btnClose.OnClientClick = ActiveWindow.GetHideReference();
//BoundTree(treeTestTraining.Nodes, "0");
//BindEnumrableToDropDownList();
this.StudyZoneItemId = Request.QueryString["StudyZoneItemId"];
this.StudyZoneId = Request.QueryString["StudyZoneId"];
if (!string.IsNullOrEmpty(this.StudyZoneItemId))
{
var model = StudyZoneItemService.GetStudyZoneItemById(this.StudyZoneItemId);
if (model != null)
{
this.StudyZoneId = model.StudyZoneId;
txtStudyZoneItemCode.Text = model.StudyZoneItemCode;
txtStudyZoneItemName.Text = model.StudyZoneItemName;
txtCompileMan.Text = model.CompileMan;
hdCompileMan.Text = model.CompileMan;
// if (model.Outcome!=null)
// drpOutcome.SelectedValue = model.Outcome.ToString();
// if (!string.IsNullOrEmpty(model.TestTrainingIds))
// {
// ddTestTraining.Values = model.TestTrainingIds.Split(',');
// string text = "";
// var trains = Funs.DB.Training_TestTraining.ToList();
// foreach (var ids in ddTestTraining.Values)
// {
// var t = trains.FirstOrDefault(x => x.TrainingId == ids);
// if (t != null)
// {
// text += "[" + t.TrainingCode + "]" + t.TrainingName + ",";
// }
// }
// ddTestTraining.Text = text.TrimEnd(new char[] { ',' });
// }
// if (!string.IsNullOrEmpty(model.WorkPostIds))
// {
// string[] ids1 = model.WorkPostIds.Split(',');
// DropDownBox1.Values = ids1;
// }
// if (model.LearningTime.HasValue)
//{
// txtLearningTime.Text = (model.LearningTime.Value/60).ToString();
//}
if (model.CompileDate != null)
{
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", model.CompileDate);
}
}
}
else
{
var cTraining = BLL.StudyZoneService.GetStudyZoneById(this.StudyZoneId);
if (cTraining != null)
{
txtCompileMan.Text = this.CurrUser.UserName;
hdCompileMan.Text = this.CurrUser.UserName;
//this.txtStudyZoneItemName.Text = cTraining.StudyZoneName;
this.txtStudyZoneItemCode.Text = SQLHelper.RunProcNewId("SpGetNewCode3", "Training_StudyZoneItem", "StudyZoneItemCode", cTraining.StudyZoneCode + "-");
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
}
}
}
}
//private void BindEnumrableToDropDownList()
//{
// List<Model.Base_WorkPost> workPostList = BLL.WorkPostService.GetWorkPostList();
// RadioButtonList1.DataTextField = "WorkPostName";
// RadioButtonList1.DataValueField = "WorkPostId";
// RadioButtonList1.DataSource = workPostList;
// RadioButtonList1.DataBind();
// Enums.InitOutcomeDropDownList(drpOutcome, false);
//}
#endregion
//private List<Model.Training_TestTraining> GetNewTraining(string parentId)
//{
// return (from x in Funs.DB.Training_TestTraining
// where x.SupTrainingId == parentId
// orderby x.TrainingCode
// select x).ToList();
//}
//private void BoundTree(TreeNodeCollection nodes, string parentId)
//{
// var dt = GetNewTraining(parentId);
// if (dt.Count() > 0)
// {
// TreeNode tn = null;
// foreach (var dr in dt)
// {
// string name = dr.TrainingName;
// if (!string.IsNullOrEmpty(dr.TrainingCode))
// {
// name = "[" + dr.TrainingCode + "]" + dr.TrainingName;
// }
// tn = new TreeNode
// {
// Text = name,
// NodeID = dr.TrainingId,
// EnableClickEvent = true,
// ToolTip = dr.TrainingName
// };
// nodes.Add(tn);
// ///是否存在下级节点
// var sup = Funs.DB.Training_TestTraining.FirstOrDefault(x => x.SupTrainingId == tn.NodeID);
// if (sup != null)
// {
// BoundTree(tn.Nodes, tn.NodeID);
// }
// }
// }
//}
#region 保存
/// <summary>
/// 保存数据
/// </summary>
private void SaveData(bool isClose)
{
Model.Training_StudyZoneItem newModel = new Training_StudyZoneItem
{
StudyZoneItemCode = this.txtStudyZoneItemCode.Text.Trim(),
StudyZoneItemName = this.txtStudyZoneItemName.Text.Trim(),
CompileMan = hdCompileMan.Text.Trim()
};
// newModel.Outcome = int.Parse(drpOutcome.SelectedValue);
// if (!string.IsNullOrEmpty(DropDownBox1.Text))
// {
// newModel.WorkPostIds = String.Join(",", DropDownBox1.Values);
// newModel.WorkPostNames = String.Join(",", DropDownBox1.Texts);
// }
// if (ddTestTraining.Values != null && ddTestTraining.Values.Length > 0)
// {
// newModel.TestTrainingIds = string.Join(",", ddTestTraining.Values);
// }
// if (!string.IsNullOrEmpty(txtLearningTime.Text))
//{
// newModel.LearningTime = int.Parse(txtLearningTime.Text)*60;
//}
if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim()))
{
newModel.CompileDate = Convert.ToDateTime(txtCompileDate.Text.Trim());
}
if (!string.IsNullOrEmpty(this.StudyZoneItemId))
{
newModel.StudyZoneItemId = this.StudyZoneItemId;
BLL.StudyZoneItemService.UpdateStudyZoneItem(newModel);
BLL.LogService.AddSys_Log(this.CurrUser, newModel.StudyZoneItemCode, newModel.StudyZoneItemId,BLL.Const.StudyZoneMenuId,BLL.Const.BtnModify);
}
else
{
newModel.StudyZoneId = this.StudyZoneId;
this.StudyZoneItemId = SQLHelper.GetNewID(typeof(Model.Training_StudyZoneItem));
newModel.StudyZoneItemId = this.StudyZoneItemId;
BLL.StudyZoneItemService.AddStudyZoneItem(newModel);
BLL.LogService.AddSys_Log(this.CurrUser, newModel.StudyZoneItemCode, newModel.StudyZoneItemId, BLL.Const.StudyZoneMenuId, BLL.Const.BtnAdd);
}
if (isClose)
{
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
}
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
SaveData(true);
}
#endregion
#region 验证教材名称是否存在
/// <summary>
/// 验证教材名称是否存在
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
var q = Funs.DB.Training_StudyZoneItem.FirstOrDefault(x => x.StudyZoneId == this.StudyZoneId && x.StudyZoneItemName == this.txtStudyZoneItemName.Text.Trim() && (x.StudyZoneItemId != this.StudyZoneItemId || (this.StudyZoneItemId == null && x.StudyZoneItemId != null)));
if (q != null)
{
ShowNotify("输入的教材名称已存在!", MessageBoxIcon.Warning);
}
}
#endregion
#region 上传附件资源
/// <summary>
/// 上传附件资源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnUploadResources_Click(object sender, EventArgs e)
{
if (this.btnSave.Hidden)
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/StudyZone&menuId={1}&type=-1", StudyZoneItemId, BLL.Const.StudyZoneMenuId)));
}
else
{
if (string.IsNullOrEmpty(this.StudyZoneItemId))
{
SaveData(false);
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/StudyZone&menuId={1}", StudyZoneItemId, BLL.Const.StudyZoneMenuId)));
}
}
#endregion
#region 按钮权限
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.StudyZoneMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnSave.Hidden = false;
}
}
}
#endregion
}
}
@@ -0,0 +1,152 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.EduTrain
{
public partial class StudyZoneItemSave
{
/// <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>
/// txtStudyZoneItemCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtStudyZoneItemCode;
/// <summary>
/// txtStudyZoneItemName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtStudyZoneItemName;
/// <summary>
/// txtCompileMan 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCompileMan;
/// <summary>
/// txtCompileDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtCompileDate;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// lbTemp 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lbTemp;
/// <summary>
/// btnAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAttachUrl;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnClose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnClose;
/// <summary>
/// hdCompileMan 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdCompileMan;
/// <summary>
/// WindowAtt 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
}
}
@@ -0,0 +1,52 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudyZoneSave.aspx.cs"
Inherits="FineUIPro.Web.HSSE.EduTrain.StudyZoneSave" %>
<!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">
<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" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtStudyZoneCode" runat="server" Label="编号" Required="true"
ShowRedStar="true" FocusOnPageLoad="true" MaxLength="50">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtStudyZoneName" runat="server" Label="名称" Required="true"
ShowRedStar="true" MaxLength="50" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpIsEndLever" Label="是否末级" AutoPostBack="false" EnableSimulateTree="true"
runat="server">
</f:DropDownList>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1"
OnClick="btnSave_Click" Hidden="true">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
</form>
</body>
</html>
@@ -0,0 +1,154 @@
using System;
using System.Linq;
using BLL;
namespace FineUIPro.Web.HSSE.EduTrain
{
public partial class StudyZoneSave : PageBase
{
#region 定义变量
/// <summary>
/// 主键
/// </summary>
public string StudyZoneId
{
get
{
return (string)ViewState["StudyZoneId"];
}
set
{
ViewState["StudyZoneId"] = value;
}
}
/// <summary>
/// 上级ID
/// </summary>
public string SupStudyZoneId
{
get
{
return (string)ViewState["SupStudyZoneId"];
}
set
{
ViewState["SupStudyZoneId"] = value;
}
}
#endregion
#region 加载
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.GetButtonPower();
btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.drpIsEndLever.DataTextField = "TypeName";
drpIsEndLever.DataValueField = "TypeId";
drpIsEndLever.DataSource = BLL.TrainingService.GetIsEndLeverList();
drpIsEndLever.DataBind();
this.StudyZoneId = Request.QueryString["StudyZoneId"];
this.SupStudyZoneId = Request.QueryString["SupStudyZoneId"];
if (!string.IsNullOrEmpty(StudyZoneId))
{
var q = BLL.StudyZoneService.GetStudyZoneById(StudyZoneId);
if (q != null)
{
txtStudyZoneCode.Text = q.StudyZoneCode;
txtStudyZoneName.Text = q.StudyZoneName;
if (q.IsEndLever == true)
{
this.drpIsEndLever.SelectedValue = "true";
}
else
{
this.drpIsEndLever.SelectedValue = "false";
}
}
}
}
}
#endregion
#region 保存
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
Model.Training_StudyZone model = new Model.Training_StudyZone();
model.StudyZoneCode = this.txtStudyZoneCode.Text.Trim();
model.StudyZoneName = this.txtStudyZoneName.Text.Trim();
model.IsEndLever = Convert.ToBoolean(drpIsEndLever.SelectedValue);
if (!string.IsNullOrEmpty(this.StudyZoneId))
{
Model.Training_StudyZone t = BLL.StudyZoneService.GetStudyZoneById(this.StudyZoneId);
if (t != null)
{
model.SupStudyZoneId = t.SupStudyZoneId;
}
model.StudyZoneId = this.StudyZoneId;
BLL.StudyZoneService.UpdateStudyZone(model);
}
else
{
model.SupStudyZoneId = this.SupStudyZoneId;
this.StudyZoneId = SQLHelper.GetNewID(typeof(Model.Training_StudyZone));
model.StudyZoneId = this.StudyZoneId;
BLL.StudyZoneService.AddStudyZone(model);
}
// 2. 关闭本窗体,然后刷新父窗体
// PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
// 2. 关闭本窗体,然后回发父窗体
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
//PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(trainingId) + ActiveWindow.GetHideReference());
}
#endregion
#region 验证学习园地资料名称是否存在
/// <summary>
/// 验证学习园地资料名称是否存在
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
var model = Funs.DB.Training_StudyZone.FirstOrDefault(x => x.SupStudyZoneId == this.SupStudyZoneId && x.StudyZoneName == this.txtStudyZoneName.Text.Trim() && (x.StudyZoneId != this.StudyZoneId || (this.StudyZoneId == null && x.StudyZoneId != null)));
if (model != null)
{
ShowNotify("输入的名称已存在!", MessageBoxIcon.Warning);
}
}
#endregion
#region 按钮权限
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.StudyZoneMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnSave.Hidden = false;
}
}
}
#endregion
}
}
@@ -0,0 +1,98 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.EduTrain
{
public partial class StudyZoneSave
{
/// <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>
/// txtStudyZoneCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtStudyZoneCode;
/// <summary>
/// txtStudyZoneName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtStudyZoneName;
/// <summary>
/// drpIsEndLever 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpIsEndLever;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnClose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnClose;
}
}
@@ -0,0 +1,101 @@
using System;
namespace Model
{
public class StudyZoneItemItem
{
/// <summary>
/// 学习园地教材明细ID
/// </summary>
public string StudyZoneItemId
{
get;
set;
}
/// <summary>
/// 学习园地教材类型ID
/// </summary>
public string StudyZoneId
{
get;
set;
}
/// <summary>
/// 学习园地教材类型Code
/// </summary>
public string StudyZoneCode
{
get;
set;
}
/// <summary>
/// 学习园地教材类型名称
/// </summary>
public string StudyZoneName
{
get;
set;
}
/// <summary>
/// 学习园地教材明细Code
/// </summary>
public string StudyZoneItemCode
{
get;
set;
}
/// <summary>
/// 学习园地教材名称
/// </summary>
public string StudyZoneItemName
{
get;
set;
}
/// <summary>
/// 教材附件
/// </summary>
public string AttachUrl
{
get;
set;
}
// /// <summary>
// /// 开始时间
// /// </summary>
//public DateTime? StartTime
// {
// get;
// set;
// }
// /// <summary>
// /// 学习时长(秒)
// /// </summary>
//public int? LearningTime
// {
// get;
// set;
// }
// /// <summary>
// /// 教材时长(秒)
// /// </summary>
// public int? AttachTime
// {
// get;
// set;
// }
// public DateTime? EndTime
// {
// get;
// set;
// }
// /// <summary>
// /// 视频进度(秒)
// /// </summary>
//public int? VideoProgress
// {
// get;
// set;
// }
}
}
+48
View File
@@ -0,0 +1,48 @@
using System;
namespace Model
{
public class StudyZoneType
{
/// <summary>
/// 学习园地教材类型ID
/// </summary>
public string StudyZoneId
{
get;
set;
}
/// <summary>
/// 上级Id
/// </summary>
public string SupStudyZoneId
{
get;
set;
}
/// <summary>
/// 学习园地教材类型Code
/// </summary>
public string StudyZoneCode
{
get;
set;
}
/// <summary>
/// 学习园地教材类型名称
/// </summary>
public string StudyZoneName
{
get;
set;
}
/// <summary>
/// 是否末级
/// </summary>
public bool IsEndLever
{
get;
set;
}
}
}
+599
View File
@@ -2525,6 +2525,12 @@ namespace Model
partial void InsertTraining_PlanItem(Training_PlanItem instance);
partial void UpdateTraining_PlanItem(Training_PlanItem instance);
partial void DeleteTraining_PlanItem(Training_PlanItem instance);
partial void InsertTraining_StudyZone(Training_StudyZone instance);
partial void UpdateTraining_StudyZone(Training_StudyZone instance);
partial void DeleteTraining_StudyZone(Training_StudyZone instance);
partial void InsertTraining_StudyZoneItem(Training_StudyZoneItem instance);
partial void UpdateTraining_StudyZoneItem(Training_StudyZoneItem instance);
partial void DeleteTraining_StudyZoneItem(Training_StudyZoneItem instance);
partial void InsertTraining_Task(Training_Task instance);
partial void UpdateTraining_Task(Training_Task instance);
partial void DeleteTraining_Task(Training_Task instance);
@@ -9425,6 +9431,22 @@ namespace Model
}
}
public System.Data.Linq.Table<Training_StudyZone> Training_StudyZone
{
get
{
return this.GetTable<Training_StudyZone>();
}
}
public System.Data.Linq.Table<Training_StudyZoneItem> Training_StudyZoneItem
{
get
{
return this.GetTable<Training_StudyZoneItem>();
}
}
public System.Data.Linq.Table<Training_Task> Training_Task
{
get
@@ -403639,6 +403661,583 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Training_StudyZone")]
public partial class Training_StudyZone : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private string _StudyZoneId;
private string _StudyZoneCode;
private string _StudyZoneName;
private string _SupStudyZoneId;
private System.Nullable<bool> _IsEndLever;
private EntitySet<Training_StudyZoneItem> _Training_StudyZoneItem;
#region 可扩展性方法定义
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnStudyZoneIdChanging(string value);
partial void OnStudyZoneIdChanged();
partial void OnStudyZoneCodeChanging(string value);
partial void OnStudyZoneCodeChanged();
partial void OnStudyZoneNameChanging(string value);
partial void OnStudyZoneNameChanged();
partial void OnSupStudyZoneIdChanging(string value);
partial void OnSupStudyZoneIdChanged();
partial void OnIsEndLeverChanging(System.Nullable<bool> value);
partial void OnIsEndLeverChanged();
#endregion
public Training_StudyZone()
{
this._Training_StudyZoneItem = new EntitySet<Training_StudyZoneItem>(new Action<Training_StudyZoneItem>(this.attach_Training_StudyZoneItem), new Action<Training_StudyZoneItem>(this.detach_Training_StudyZoneItem));
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StudyZoneId", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
public string StudyZoneId
{
get
{
return this._StudyZoneId;
}
set
{
if ((this._StudyZoneId != value))
{
this.OnStudyZoneIdChanging(value);
this.SendPropertyChanging();
this._StudyZoneId = value;
this.SendPropertyChanged("StudyZoneId");
this.OnStudyZoneIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StudyZoneCode", DbType="NVarChar(50)")]
public string StudyZoneCode
{
get
{
return this._StudyZoneCode;
}
set
{
if ((this._StudyZoneCode != value))
{
this.OnStudyZoneCodeChanging(value);
this.SendPropertyChanging();
this._StudyZoneCode = value;
this.SendPropertyChanged("StudyZoneCode");
this.OnStudyZoneCodeChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StudyZoneName", DbType="NVarChar(100)")]
public string StudyZoneName
{
get
{
return this._StudyZoneName;
}
set
{
if ((this._StudyZoneName != value))
{
this.OnStudyZoneNameChanging(value);
this.SendPropertyChanging();
this._StudyZoneName = value;
this.SendPropertyChanged("StudyZoneName");
this.OnStudyZoneNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SupStudyZoneId", DbType="NVarChar(50)")]
public string SupStudyZoneId
{
get
{
return this._SupStudyZoneId;
}
set
{
if ((this._SupStudyZoneId != value))
{
this.OnSupStudyZoneIdChanging(value);
this.SendPropertyChanging();
this._SupStudyZoneId = value;
this.SendPropertyChanged("SupStudyZoneId");
this.OnSupStudyZoneIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsEndLever", DbType="Bit")]
public System.Nullable<bool> IsEndLever
{
get
{
return this._IsEndLever;
}
set
{
if ((this._IsEndLever != value))
{
this.OnIsEndLeverChanging(value);
this.SendPropertyChanging();
this._IsEndLever = value;
this.SendPropertyChanged("IsEndLever");
this.OnIsEndLeverChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_StudyZoneItem_Training_StudyZone", Storage="_Training_StudyZoneItem", ThisKey="StudyZoneId", OtherKey="StudyZoneId", DeleteRule="NO ACTION")]
public EntitySet<Training_StudyZoneItem> Training_StudyZoneItem
{
get
{
return this._Training_StudyZoneItem;
}
set
{
this._Training_StudyZoneItem.Assign(value);
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private void attach_Training_StudyZoneItem(Training_StudyZoneItem entity)
{
this.SendPropertyChanging();
entity.Training_StudyZone = this;
}
private void detach_Training_StudyZoneItem(Training_StudyZoneItem entity)
{
this.SendPropertyChanging();
entity.Training_StudyZone = null;
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Training_StudyZoneItem")]
public partial class Training_StudyZoneItem : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private string _StudyZoneItemId;
private string _StudyZoneId;
private string _StudyZoneItemCode;
private string _StudyZoneItemName;
private string _AttachUrl;
private string _CompileMan;
private System.Nullable<System.DateTime> _CompileDate;
private string _WorkPostIds;
private System.Nullable<int> _LearningTime;
private string _TestTrainingIds;
private string _WorkPostNames;
private System.Nullable<int> _Outcome;
private System.Nullable<double> _Durations;
private EntityRef<Training_StudyZone> _Training_StudyZone;
#region 可扩展性方法定义
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnStudyZoneItemIdChanging(string value);
partial void OnStudyZoneItemIdChanged();
partial void OnStudyZoneIdChanging(string value);
partial void OnStudyZoneIdChanged();
partial void OnStudyZoneItemCodeChanging(string value);
partial void OnStudyZoneItemCodeChanged();
partial void OnStudyZoneItemNameChanging(string value);
partial void OnStudyZoneItemNameChanged();
partial void OnAttachUrlChanging(string value);
partial void OnAttachUrlChanged();
partial void OnCompileManChanging(string value);
partial void OnCompileManChanged();
partial void OnCompileDateChanging(System.Nullable<System.DateTime> value);
partial void OnCompileDateChanged();
partial void OnWorkPostIdsChanging(string value);
partial void OnWorkPostIdsChanged();
partial void OnLearningTimeChanging(System.Nullable<int> value);
partial void OnLearningTimeChanged();
partial void OnTestTrainingIdsChanging(string value);
partial void OnTestTrainingIdsChanged();
partial void OnWorkPostNamesChanging(string value);
partial void OnWorkPostNamesChanged();
partial void OnOutcomeChanging(System.Nullable<int> value);
partial void OnOutcomeChanged();
partial void OnDurationsChanging(System.Nullable<double> value);
partial void OnDurationsChanged();
#endregion
public Training_StudyZoneItem()
{
this._Training_StudyZone = default(EntityRef<Training_StudyZone>);
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StudyZoneItemId", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
public string StudyZoneItemId
{
get
{
return this._StudyZoneItemId;
}
set
{
if ((this._StudyZoneItemId != value))
{
this.OnStudyZoneItemIdChanging(value);
this.SendPropertyChanging();
this._StudyZoneItemId = value;
this.SendPropertyChanged("StudyZoneItemId");
this.OnStudyZoneItemIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StudyZoneId", DbType="NVarChar(50)")]
public string StudyZoneId
{
get
{
return this._StudyZoneId;
}
set
{
if ((this._StudyZoneId != value))
{
if (this._Training_StudyZone.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
this.OnStudyZoneIdChanging(value);
this.SendPropertyChanging();
this._StudyZoneId = value;
this.SendPropertyChanged("StudyZoneId");
this.OnStudyZoneIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StudyZoneItemCode", DbType="NVarChar(50)")]
public string StudyZoneItemCode
{
get
{
return this._StudyZoneItemCode;
}
set
{
if ((this._StudyZoneItemCode != value))
{
this.OnStudyZoneItemCodeChanging(value);
this.SendPropertyChanging();
this._StudyZoneItemCode = value;
this.SendPropertyChanged("StudyZoneItemCode");
this.OnStudyZoneItemCodeChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StudyZoneItemName", DbType="NVarChar(100)")]
public string StudyZoneItemName
{
get
{
return this._StudyZoneItemName;
}
set
{
if ((this._StudyZoneItemName != value))
{
this.OnStudyZoneItemNameChanging(value);
this.SendPropertyChanging();
this._StudyZoneItemName = value;
this.SendPropertyChanged("StudyZoneItemName");
this.OnStudyZoneItemNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttachUrl", DbType="NVarChar(2000)")]
public string AttachUrl
{
get
{
return this._AttachUrl;
}
set
{
if ((this._AttachUrl != value))
{
this.OnAttachUrlChanging(value);
this.SendPropertyChanging();
this._AttachUrl = value;
this.SendPropertyChanged("AttachUrl");
this.OnAttachUrlChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileMan", DbType="NVarChar(50)")]
public string CompileMan
{
get
{
return this._CompileMan;
}
set
{
if ((this._CompileMan != value))
{
this.OnCompileManChanging(value);
this.SendPropertyChanging();
this._CompileMan = value;
this.SendPropertyChanged("CompileMan");
this.OnCompileManChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileDate", DbType="DateTime")]
public System.Nullable<System.DateTime> CompileDate
{
get
{
return this._CompileDate;
}
set
{
if ((this._CompileDate != value))
{
this.OnCompileDateChanging(value);
this.SendPropertyChanging();
this._CompileDate = value;
this.SendPropertyChanged("CompileDate");
this.OnCompileDateChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPostIds", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
public string WorkPostIds
{
get
{
return this._WorkPostIds;
}
set
{
if ((this._WorkPostIds != value))
{
this.OnWorkPostIdsChanging(value);
this.SendPropertyChanging();
this._WorkPostIds = value;
this.SendPropertyChanged("WorkPostIds");
this.OnWorkPostIdsChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LearningTime", DbType="Int")]
public System.Nullable<int> LearningTime
{
get
{
return this._LearningTime;
}
set
{
if ((this._LearningTime != value))
{
this.OnLearningTimeChanging(value);
this.SendPropertyChanging();
this._LearningTime = value;
this.SendPropertyChanged("LearningTime");
this.OnLearningTimeChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TestTrainingIds", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
public string TestTrainingIds
{
get
{
return this._TestTrainingIds;
}
set
{
if ((this._TestTrainingIds != value))
{
this.OnTestTrainingIdsChanging(value);
this.SendPropertyChanging();
this._TestTrainingIds = value;
this.SendPropertyChanged("TestTrainingIds");
this.OnTestTrainingIdsChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPostNames", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
public string WorkPostNames
{
get
{
return this._WorkPostNames;
}
set
{
if ((this._WorkPostNames != value))
{
this.OnWorkPostNamesChanging(value);
this.SendPropertyChanging();
this._WorkPostNames = value;
this.SendPropertyChanged("WorkPostNames");
this.OnWorkPostNamesChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Outcome", DbType="Int")]
public System.Nullable<int> Outcome
{
get
{
return this._Outcome;
}
set
{
if ((this._Outcome != value))
{
this.OnOutcomeChanging(value);
this.SendPropertyChanging();
this._Outcome = value;
this.SendPropertyChanged("Outcome");
this.OnOutcomeChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Durations", DbType="Float")]
public System.Nullable<double> Durations
{
get
{
return this._Durations;
}
set
{
if ((this._Durations != value))
{
this.OnDurationsChanging(value);
this.SendPropertyChanging();
this._Durations = value;
this.SendPropertyChanged("Durations");
this.OnDurationsChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_StudyZoneItem_Training_StudyZone", Storage="_Training_StudyZone", ThisKey="StudyZoneId", OtherKey="StudyZoneId", IsForeignKey=true)]
public Training_StudyZone Training_StudyZone
{
get
{
return this._Training_StudyZone.Entity;
}
set
{
Training_StudyZone previousValue = this._Training_StudyZone.Entity;
if (((previousValue != value)
|| (this._Training_StudyZone.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._Training_StudyZone.Entity = null;
previousValue.Training_StudyZoneItem.Remove(this);
}
this._Training_StudyZone.Entity = value;
if ((value != null))
{
value.Training_StudyZoneItem.Add(this);
this._StudyZoneId = value.StudyZoneId;
}
else
{
this._StudyZoneId = default(string);
}
this.SendPropertyChanged("Training_StudyZone");
}
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Training_Task")]
public partial class Training_Task : INotifyPropertyChanging, INotifyPropertyChanged
{
+2
View File
@@ -132,7 +132,9 @@
<Compile Include="APIItem\HSSE\ReEvaluator.cs" />
<Compile Include="APIItem\HSSE\RoutingInspectionItem.cs" />
<Compile Include="APIItem\HSSE\BonusScoreSelfManagementItem.cs" />
<Compile Include="APIItem\HSSE\StudyZoneType.cs" />
<Compile Include="APIItem\HSSE\TrainingRecordItemItem.cs" />
<Compile Include="APIItem\HSSE\StudyZoneItemItem.cs" />
<Compile Include="APIItem\OperationReportDto.cs" />
<Compile Include="APIItem\ProjectGpsPointItem.cs" />
<Compile Include="APIItem\ProjectItem.cs" />
+15
View File
@@ -0,0 +1,15 @@
[
{
"Name": "新建配置文件",
"Projects": [
{
"Path": "FineUIPro.Web\\FineUIPro.Web.csproj",
"Action": "Start"
},
{
"Path": "WebAPI\\WebAPI.csproj",
"Action": "Start"
}
]
}
]
@@ -0,0 +1,77 @@
using System;
using System.Linq;
using System.Web.Http;
using BLL;
namespace WebAPI.Controllers
{
/// <summary>
/// 学习园地
/// </summary>
public class StudyZoneController : ApiController
{
#region 获取学习园地资源明细列表
/// <summary>
/// 获取学习园地资源大类列表
/// </summary>
/// <param name="supId"></param>
/// <param name="pageIndex"></param>
/// <returns></returns>
public Model.ResponeData getStudyZoneTypeList(string supId, int pageIndex)
{
var responeData = new Model.ResponeData();
try
{
if (string.IsNullOrWhiteSpace(supId))
{//默认顶级
supId = "0";
}
var getQualityLists = APIStudyZoneService.getStudyZoneTypeList(supId);
int pageCount = getQualityLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
var getdata = from x in getQualityLists.OrderBy(u => u.StudyZoneCode).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize)
select x;
responeData.data = new { pageCount, getdata };
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 获取学习园地资源明细列表
/// </summary>
/// <param name="typeId"></param>
/// <param name="itemName"></param>
/// <param name="pageIndex"></param>
/// <returns></returns>
public Model.ResponeData getStudyZoneItemList(string typeId, string itemName, int pageIndex)
{
var responeData = new Model.ResponeData();
try
{
var getQualityLists = APIStudyZoneService.getStudyZoneItemList(typeId, itemName);
int pageCount = getQualityLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
var getdata = from x in getQualityLists.OrderBy(u => u.StudyZoneItemCode).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize)
select x;
responeData.data = new { pageCount, getdata };
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}
@@ -173,7 +173,9 @@ namespace WebAPI.Filter
"BonusScoreSelfManagement*getBonusScoreSelfManagementList",
"BonusScoreSelfManagement*getBonusScoreSelfManagementById",
"BonusScoreSelfManagement*saveBonusScoreSelfManagement",
"BonusScoreSelfManagement*deleteBonusScoreSelfManagementById"
"BonusScoreSelfManagement*deleteBonusScoreSelfManagementById",
"StudyZone*getStudyZoneTypeList",
"StudyZone*getStudyZoneItemList"
};
+1
View File
@@ -206,6 +206,7 @@
<Compile Include="Controllers\HSSE\MaterialController.cs" />
<Compile Include="Controllers\HSSE\BonusScoreSelfManagementController.cs" />
<Compile Include="Controllers\HSSE\TrainingRecordController.cs" />
<Compile Include="Controllers\HSSE\StudyZoneController.cs" />
<Compile Include="Controllers\HSSE\TrainTestRecordController.cs" />
<Compile Include="Controllers\Person\PersonCheckController.cs" />
<Compile Include="Controllers\CQMS\CheckEquipmentController.cs" />