From 29b15d4b542987d9e34908e070eaccab1f5e64ca Mon Sep 17 00:00:00 2001 From: xiaju <1784803958@qq.com> Date: Tue, 13 Oct 2026 15:32:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E5=9B=AD=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0-xiaj(Sp_CheckProblem_Safety_Statistics).sql} | 0 .../SGGLDB_V2026-10-11-xiaj(学习园地).sql | 84 +++ SGGL/BLL/API/HSSE/APIStudyZoneService.cs | 81 +++ SGGL/BLL/BLL.csproj | 3 + SGGL/BLL/Common/Const.cs | 8 + .../BLL/HSSE/EduTrain/StudyZoneItemService.cs | 121 ++++ SGGL/BLL/HSSE/EduTrain/StudyZoneService.cs | 174 +++++ SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 32 + .../HSSE/EduTrain/StudyZone.aspx | 174 +++++ .../HSSE/EduTrain/StudyZone.aspx.cs | 573 +++++++++++++++++ .../HSSE/EduTrain/StudyZone.aspx.designer.cs | 287 +++++++++ .../HSSE/EduTrain/StudyZoneItemIn.aspx | 86 +++ .../HSSE/EduTrain/StudyZoneItemIn.aspx.cs | 419 ++++++++++++ .../EduTrain/StudyZoneItemIn.aspx.designer.cs | 143 +++++ .../HSSE/EduTrain/StudyZoneItemSave.aspx | 153 +++++ .../HSSE/EduTrain/StudyZoneItemSave.aspx.cs | 286 +++++++++ .../StudyZoneItemSave.aspx.designer.cs | 152 +++++ .../HSSE/EduTrain/StudyZoneSave.aspx | 52 ++ .../HSSE/EduTrain/StudyZoneSave.aspx.cs | 154 +++++ .../EduTrain/StudyZoneSave.aspx.designer.cs | 98 +++ SGGL/Model/APIItem/HSSE/StudyZoneItemItem.cs | 101 +++ SGGL/Model/APIItem/HSSE/StudyZoneType.cs | 48 ++ SGGL/Model/Model.cs | 599 ++++++++++++++++++ SGGL/Model/Model.csproj | 2 + SGGL/SGGL.slnLaunch | 15 + .../Controllers/HSSE/StudyZoneController.cs | 77 +++ SGGL/WebAPI/Filter/TestPermissionAttribute.cs | 4 +- SGGL/WebAPI/WebAPI.csproj | 1 + 28 files changed, 3926 insertions(+), 1 deletion(-) rename DataBase/版本日志/{SGGLDB_V2026-10-10-xiaj(Sp_CheckProblem_Safety_Statistics]).sql => SGGLDB_V2026-10-10-xiaj(Sp_CheckProblem_Safety_Statistics).sql} (100%) create mode 100644 DataBase/版本日志/SGGLDB_V2026-10-11-xiaj(学习园地).sql create mode 100644 SGGL/BLL/API/HSSE/APIStudyZoneService.cs create mode 100644 SGGL/BLL/HSSE/EduTrain/StudyZoneItemService.cs create mode 100644 SGGL/BLL/HSSE/EduTrain/StudyZoneService.cs create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx.cs create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx.cs create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx.cs create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx.cs create mode 100644 SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx.designer.cs create mode 100644 SGGL/Model/APIItem/HSSE/StudyZoneItemItem.cs create mode 100644 SGGL/Model/APIItem/HSSE/StudyZoneType.cs create mode 100644 SGGL/SGGL.slnLaunch create mode 100644 SGGL/WebAPI/Controllers/HSSE/StudyZoneController.cs diff --git a/DataBase/版本日志/SGGLDB_V2026-10-10-xiaj(Sp_CheckProblem_Safety_Statistics]).sql b/DataBase/版本日志/SGGLDB_V2026-10-10-xiaj(Sp_CheckProblem_Safety_Statistics).sql similarity index 100% rename from DataBase/版本日志/SGGLDB_V2026-10-10-xiaj(Sp_CheckProblem_Safety_Statistics]).sql rename to DataBase/版本日志/SGGLDB_V2026-10-10-xiaj(Sp_CheckProblem_Safety_Statistics).sql diff --git a/DataBase/版本日志/SGGLDB_V2026-10-11-xiaj(学习园地).sql b/DataBase/版本日志/SGGLDB_V2026-10-11-xiaj(学习园地).sql new file mode 100644 index 00000000..8b3d5406 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-10-11-xiaj(学习园地).sql @@ -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 + + diff --git a/SGGL/BLL/API/HSSE/APIStudyZoneService.cs b/SGGL/BLL/API/HSSE/APIStudyZoneService.cs new file mode 100644 index 00000000..ce4d0832 --- /dev/null +++ b/SGGL/BLL/API/HSSE/APIStudyZoneService.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace BLL +{ + /// + /// 学习园地 + /// + public static class APIStudyZoneService + { + /// + /// 获取学习园地列表 + /// + /// + /// + public static List 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 获取学习园地教材列表 + + /// + /// 获取学习园地列表 + /// + /// + /// + /// + public static List 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 + } +} diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index abc96f42..1862bcce 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -247,6 +247,7 @@ + @@ -575,7 +576,9 @@ + + diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index c2876bf1..1bb09b5d 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -2065,6 +2065,10 @@ namespace BLL #region 安全教育 /// + /// 学习园地资料库 + /// + public const string StudyZoneMenuId = "B0491FC1-804A-4A41-A959-F165EA32D9DD"; + /// /// 培训教材库 /// public const string TrainDBMenuId = "9D99A981-7380-4085-84FA-8C3B1AFA6202"; @@ -3947,6 +3951,10 @@ namespace BLL /// public const string TrainRecordTemplateUrl = "File\\Excel\\DataIn\\人员培训导入模板.xls"; /// + /// 学习园地资源库模板文件原始的虚拟路径 + /// + public const string StudyZoneTemplateUrl = "File\\Excel\\DataIn\\学习园地资源库导入模板.xls"; + /// /// 公司教材库模板文件原始的虚拟路径 /// public const string CompanyTrainingTemplateUrl = "File\\Excel\\DataIn\\公司教材库导入模板.xls"; diff --git a/SGGL/BLL/HSSE/EduTrain/StudyZoneItemService.cs b/SGGL/BLL/HSSE/EduTrain/StudyZoneItemService.cs new file mode 100644 index 00000000..3dc81280 --- /dev/null +++ b/SGGL/BLL/HSSE/EduTrain/StudyZoneItemService.cs @@ -0,0 +1,121 @@ +using System.Collections.Generic; +using System.Linq; + +namespace BLL +{ + /// + /// 学习园地明细表——教材库 + /// + public class StudyZoneItemService + { + + /// + /// 根据主键获取学习园地明细信息 + /// + /// + /// + public static Model.Training_StudyZoneItem GetStudyZoneItemById(string companyTrainingItemId) + { + Model.CNPCDB db = Funs.DB; + return db.Training_StudyZoneItem.FirstOrDefault(e => e.StudyZoneItemId == companyTrainingItemId); + } + + /// + /// 添加学习园地明细 + /// + /// + 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(); + } + + /// + /// 修改学习园地明细 + /// + /// + 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(); + } + } + + /// + /// 根据主键删除明细信息 + /// + /// + 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(); + } + } + + + /// + /// 教材库下拉框 + /// + /// 下拉框名字 + /// 职务Id + /// 是否显示请选择 + 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); + } + } + + /// + /// 获取教材库下拉项 + /// + /// + /// + public static List 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; + } + + } +} \ No newline at end of file diff --git a/SGGL/BLL/HSSE/EduTrain/StudyZoneService.cs b/SGGL/BLL/HSSE/EduTrain/StudyZoneService.cs new file mode 100644 index 00000000..f6c8ea8b --- /dev/null +++ b/SGGL/BLL/HSSE/EduTrain/StudyZoneService.cs @@ -0,0 +1,174 @@ +using System.Collections.Generic; +using System.Linq; + +namespace BLL +{ + /// + /// 学习园地主表 + /// + public class StudyZoneService + { + + /// + /// 根据主键获取学习园地 + /// + /// + /// + public static Model.Training_StudyZone GetStudyZoneById(string companyTrainingId) + { + var db = Funs.DB; + return db.Training_StudyZone.FirstOrDefault(e => e.StudyZoneId == companyTrainingId); + } + + /// + /// 添加学习园地 + /// + /// + 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(); + } + + /// + /// 修改学习园地 + /// + /// + 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(); + } + } + + /// + /// 根据主键删除学习园地 + /// + /// + 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(); + } + } + + /// + /// 是否可删除资源节点 + /// + /// + /// true-可以,false-不可以 + 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; + } + + /// + /// 根据上级Id查询所有学习园地 + /// + /// 上级Id + /// 学习园地的集合 + public static List GetStudyZoneBySupItem(string supItem) + { + return (from x in Funs.DB.Training_StudyZone where x.SupStudyZoneId == supItem select x).ToList(); + } + + /// + /// 根据上级Id查询所有学习园地 + /// + /// 上级Id + /// 学习园地的集合 + public static List GetStudyZoneIsEnd() + { + return (from x in Funs.DB.Training_StudyZone + where x.IsEndLever == true + orderby x.StudyZoneCode + select x).ToList(); + } + + /// + /// 教材类型下拉框 + /// + /// + /// + /// + 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); + } + } + + /// + /// 教材类型下拉框(末级) + /// + /// + /// + /// + 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); + } + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 368df17b..8c7d7999 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -1881,6 +1881,10 @@ + + + + @@ -12883,6 +12887,34 @@ AccidentCaseSave.aspx + + StudyZoneItemIn.aspx + ASPXCodeBehind + + + StudyZoneItemIn.aspx + + + StudyZoneItemSave.aspx + ASPXCodeBehind + + + StudyZoneItemSave.aspx + + + StudyZoneSave.aspx + ASPXCodeBehind + + + StudyZoneSave.aspx + + + StudyZone.aspx + ASPXCodeBehind + + + StudyZone.aspx + PlanEdit.aspx ASPXCodeBehind diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx new file mode 100644 index 00000000..04c98a8d --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx @@ -0,0 +1,174 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudyZone.aspx.cs" + Inherits="FineUIPro.Web.HSSE.EduTrain.StudyZone" %> + + + + + + 学习园地 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + <%----%> + + + + + + + <%-- + + + + --%> + + + + + + + + + + + <%-- + --%> + <%-- + + + + + --%> + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx.cs new file mode 100644 index 00000000..d680154d --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx.cs @@ -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 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.GetButtonPower(); + //WorkPostService.InitWorkPostDropDownList(drpWorkPost, true); + InitTreeMenu(); + } + } + #endregion + + #region 加载树 + /// + /// 初始化树 + /// + 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); + } + } + } + + /// + /// 得到菜单方法 + /// + /// + /// + private List GetNewTraining(string parentId) + { + return (from x in Funs.DB.Training_StudyZone where x.SupStudyZoneId == parentId orderby x.StudyZoneCode select x).ToList(); ; + } + #endregion + + #region 增加、修改、删除学习园地类别 + /// + /// 增加学习园地类别 + /// + /// + /// + 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); + } + } + + /// + /// 修改学习园地类别 + /// + /// + /// + 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); + } + } + + /// + /// 删除学习园地类别 + /// + /// + /// + 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 树点击事件 + /// + /// 树点击事件 + /// + /// + /// + protected void trStudyZone_NodeCommand(object sender, FineUIPro.TreeCommandEventArgs e) + { + BindGrid(); + } + + #endregion + + #region 下拉触发事件 + + /// + /// 适用岗位下拉触发事件 + /// + /// + /// + protected void drp_SelectedIndexChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + #endregion + + #region 绑定数据 + /// + /// 绑定数据 + /// + 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 listStr = new List + { + 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 查询 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 增加、修改、删除明细信息 + #region 新增明细 + /// + /// 新增明细 + /// + /// + /// + 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(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + 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(); + } + + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + 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 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + 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 导入 + /// + /// 导入按钮 + /// + /// + /// + 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 + + /// + /// 导出 + /// + /// + /// + 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 导出方法 + /// + /// 导出方法 + /// + /// + /// + public static string GetGridTableHtml(Grid grid, int count) + { + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.Append(""); + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + if (column.ColumnIndex < count) + { + sb.AppendFormat("", column.HeaderText); + } + } + sb.Append(""); + foreach (GridRow row in grid.Rows) + { + sb.Append(""); + 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("", html); + } + } + sb.Append(""); + } + sb.Append("
{0}
{0}
"); + return sb.ToString(); + } + #endregion + + /// + /// 行事件 + /// + /// + /// + 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) + { + + } + } + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx.designer.cs new file mode 100644 index 00000000..ecee807d --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZone.aspx.designer.cs @@ -0,0 +1,287 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class StudyZone + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// panelLeftRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelLeftRegion; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// btnEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnEdit; + + /// + /// btnDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDelete; + + /// + /// trStudyZone 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tree trStudyZone; + + /// + /// panelCenterRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelCenterRegion; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// txtStudyZoneItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtStudyZoneItemCode; + + /// + /// txtStudyZoneItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtStudyZoneItemName; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNewDetail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNewDetail; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// lbStudyZoneItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbStudyZoneItemCode; + + /// + /// lbStudyZoneItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbStudyZoneItemName; + + /// + /// lbCompileDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbCompileDate; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + + /// + /// Window3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window3; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx new file mode 100644 index 00000000..99bbc910 --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx @@ -0,0 +1,86 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudyZoneItemIn.aspx.cs" Inherits="FineUIPro.Web.HSSE.EduTrain.StudyZoneItemIn" %> + + + + + + 导入学习园地资料 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx.cs new file mode 100644 index 00000000..1a9a1f7b --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx.cs @@ -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 定义变量 + /// + /// 上传预设的虚拟路径 + /// + private string initPath = Const.ExcelUrl; + + /// + /// 导入集合 + /// + public static List viewTrainingItems = new List(); + + /// + /// 错误集合 + /// + public static List errorInfos = new List(); + + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + 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 数据导入 + /// + /// 数据导入 + /// + /// + /// + 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提取数据 + /// + /// 从Excel提取数据--》Dataset + /// + /// Excel文件路径名 + 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的数据导入数据库 + /// + /// 将Dataset的数据导入数据库 + /// + /// 数据集 + /// 数据集行数 + /// + 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 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 保存 + /// + /// 保存 + /// + /// + /// + 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 关闭弹出窗口 + /// + /// 关闭导入弹出窗口 + /// + /// + /// + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + if (Session["trainingItem"] != null) + { + viewTrainingItems = Session["trainingItem"] as List; + } + if (viewTrainingItems.Count > 0) + { + this.gvErrorInfo.Hidden = false; + this.gvErrorInfo.DataSource = viewTrainingItems; + this.gvErrorInfo.DataBind(); + } + } + + #endregion + + #region 下载模板 + /// + /// 下载模板按钮 + /// + /// + /// + 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"))); + } + + /// + /// 下载导入模板 + /// + /// + /// + 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 + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx.designer.cs new file mode 100644 index 00000000..d9ca6917 --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemIn.aspx.designer.cs @@ -0,0 +1,143 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class StudyZoneItemIn + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// btnAudit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAudit; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnDownLoad 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDownLoad; + + /// + /// fuAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FileUpload fuAttachUrl; + + /// + /// gvErrorInfo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid gvErrorInfo; + + /// + /// lblPageIndex 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblPageIndex; + + /// + /// hdFileName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdFileName; + + /// + /// hdCheckResult 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCheckResult; + + /// + /// lblBottom 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lblBottom; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + } +} diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx new file mode 100644 index 00000000..fbd31bcf --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx @@ -0,0 +1,153 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudyZoneItemSave.aspx.cs" + Inherits="FineUIPro.Web.HSSE.EduTrain.StudyZoneItemSave" %> + + + + + 编辑学习园地资料 + + + +
+ + + + + + + + + + + + + + + + <%-- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx.cs new file mode 100644 index 00000000..64b063fc --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx.cs @@ -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 定义变量 + /// + /// 主键 + /// + public string StudyZoneItemId + { + get + { + return (string)ViewState["StudyZoneItemId"]; + } + set + { + ViewState["StudyZoneItemId"] = value; + } + } + + /// + /// 主表主键 + /// + 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 workPostList = BLL.WorkPostService.GetWorkPostList(); + // RadioButtonList1.DataTextField = "WorkPostName"; + // RadioButtonList1.DataValueField = "WorkPostId"; + // RadioButtonList1.DataSource = workPostList; + // RadioButtonList1.DataBind(); + + // Enums.InitOutcomeDropDownList(drpOutcome, false); + //} + + #endregion + //private List 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 保存 + /// + /// 保存数据 + /// + 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()); + } + } + + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + SaveData(true); + } + #endregion + + #region 验证教材名称是否存在 + /// + /// 验证教材名称是否存在 + /// + /// + /// + 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 上传附件资源 + /// + /// 上传附件资源 + /// + /// + /// + 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 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + 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 + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx.designer.cs new file mode 100644 index 00000000..b1f8ce5e --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneItemSave.aspx.designer.cs @@ -0,0 +1,152 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class StudyZoneItemSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtStudyZoneItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtStudyZoneItemCode; + + /// + /// txtStudyZoneItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtStudyZoneItemName; + + /// + /// txtCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompileMan; + + /// + /// txtCompileDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtCompileDate; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// lbTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbTemp; + + /// + /// btnAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAttachUrl; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// hdCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCompileMan; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + } +} diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx new file mode 100644 index 00000000..762f1951 --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx @@ -0,0 +1,52 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudyZoneSave.aspx.cs" + Inherits="FineUIPro.Web.HSSE.EduTrain.StudyZoneSave" %> + + + + + 编辑学习园地资料类别 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx.cs new file mode 100644 index 00000000..8a772e7d --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx.cs @@ -0,0 +1,154 @@ +using System; +using System.Linq; +using BLL; + +namespace FineUIPro.Web.HSSE.EduTrain +{ + public partial class StudyZoneSave : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string StudyZoneId + { + get + { + return (string)ViewState["StudyZoneId"]; + } + set + { + ViewState["StudyZoneId"] = value; + } + } + + /// + /// 上级ID + /// + public string SupStudyZoneId + { + get + { + return (string)ViewState["SupStudyZoneId"]; + } + set + { + ViewState["SupStudyZoneId"] = value; + } + } + #endregion + + #region 加载 + /// + /// 加载页面 + /// + /// + /// + 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 保存 + /// + /// 保存按钮 + /// + /// + /// + 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 验证学习园地资料名称是否存在 + /// + /// 验证学习园地资料名称是否存在 + /// + /// + /// + 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 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + 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 + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx.designer.cs new file mode 100644 index 00000000..a44f6fc0 --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/StudyZoneSave.aspx.designer.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class StudyZoneSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtStudyZoneCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtStudyZoneCode; + + /// + /// txtStudyZoneName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtStudyZoneName; + + /// + /// drpIsEndLever 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpIsEndLever; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SGGL/Model/APIItem/HSSE/StudyZoneItemItem.cs b/SGGL/Model/APIItem/HSSE/StudyZoneItemItem.cs new file mode 100644 index 00000000..2b549c06 --- /dev/null +++ b/SGGL/Model/APIItem/HSSE/StudyZoneItemItem.cs @@ -0,0 +1,101 @@ +using System; + +namespace Model +{ + public class StudyZoneItemItem + { + /// + /// 学习园地教材明细ID + /// + public string StudyZoneItemId + { + get; + set; + } + /// + /// 学习园地教材类型ID + /// + public string StudyZoneId + { + get; + set; + } + /// + /// 学习园地教材类型Code + /// + public string StudyZoneCode + { + get; + set; + } + /// + /// 学习园地教材类型名称 + /// + public string StudyZoneName + { + get; + set; + } + /// + /// 学习园地教材明细Code + /// + public string StudyZoneItemCode + { + get; + set; + } + /// + /// 学习园地教材名称 + /// + public string StudyZoneItemName + { + get; + set; + } + /// + /// 教材附件 + /// + public string AttachUrl + { + get; + set; + } + // /// + // /// 开始时间 + // /// + //public DateTime? StartTime + // { + // get; + // set; + // } + // /// + // /// 学习时长(秒) + // /// + //public int? LearningTime + // { + // get; + // set; + // } + // /// + // /// 教材时长(秒) + // /// + // public int? AttachTime + // { + // get; + // set; + // } + // public DateTime? EndTime + // { + // get; + // set; + // } + // /// + // /// 视频进度(秒) + // /// + //public int? VideoProgress + // { + // get; + // set; + // } + } +} diff --git a/SGGL/Model/APIItem/HSSE/StudyZoneType.cs b/SGGL/Model/APIItem/HSSE/StudyZoneType.cs new file mode 100644 index 00000000..2bbebb1a --- /dev/null +++ b/SGGL/Model/APIItem/HSSE/StudyZoneType.cs @@ -0,0 +1,48 @@ +using System; + +namespace Model +{ + public class StudyZoneType + { + /// + /// 学习园地教材类型ID + /// + public string StudyZoneId + { + get; + set; + } + /// + /// 上级Id + /// + public string SupStudyZoneId + { + get; + set; + } + /// + /// 学习园地教材类型Code + /// + public string StudyZoneCode + { + get; + set; + } + /// + /// 学习园地教材类型名称 + /// + public string StudyZoneName + { + get; + set; + } + /// + /// 是否末级 + /// + public bool IsEndLever + { + get; + set; + } + } +} diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 6fe8e317..2de199f1 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -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 + { + get + { + return this.GetTable(); + } + } + + public System.Data.Linq.Table Training_StudyZoneItem + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table 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 _IsEndLever; + + private EntitySet _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 value); + partial void OnIsEndLeverChanged(); + #endregion + + public Training_StudyZone() + { + this._Training_StudyZoneItem = new EntitySet(new Action(this.attach_Training_StudyZoneItem), new Action(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 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 + { + 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 _CompileDate; + + private string _WorkPostIds; + + private System.Nullable _LearningTime; + + private string _TestTrainingIds; + + private string _WorkPostNames; + + private System.Nullable _Outcome; + + private System.Nullable _Durations; + + private EntityRef _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 value); + partial void OnCompileDateChanged(); + partial void OnWorkPostIdsChanging(string value); + partial void OnWorkPostIdsChanged(); + partial void OnLearningTimeChanging(System.Nullable 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 value); + partial void OnOutcomeChanged(); + partial void OnDurationsChanging(System.Nullable value); + partial void OnDurationsChanged(); + #endregion + + public Training_StudyZoneItem() + { + this._Training_StudyZone = default(EntityRef); + 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 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 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 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 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 { diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index f516a96e..b1fec937 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -132,7 +132,9 @@ + + diff --git a/SGGL/SGGL.slnLaunch b/SGGL/SGGL.slnLaunch new file mode 100644 index 00000000..bda7a9f7 --- /dev/null +++ b/SGGL/SGGL.slnLaunch @@ -0,0 +1,15 @@ +[ + { + "Name": "新建配置文件", + "Projects": [ + { + "Path": "FineUIPro.Web\\FineUIPro.Web.csproj", + "Action": "Start" + }, + { + "Path": "WebAPI\\WebAPI.csproj", + "Action": "Start" + } + ] + } +] \ No newline at end of file diff --git a/SGGL/WebAPI/Controllers/HSSE/StudyZoneController.cs b/SGGL/WebAPI/Controllers/HSSE/StudyZoneController.cs new file mode 100644 index 00000000..fa4aada4 --- /dev/null +++ b/SGGL/WebAPI/Controllers/HSSE/StudyZoneController.cs @@ -0,0 +1,77 @@ +using System; +using System.Linq; +using System.Web.Http; +using BLL; + +namespace WebAPI.Controllers +{ + /// + /// 学习园地 + /// + public class StudyZoneController : ApiController + { + #region 获取学习园地资源明细列表 + + /// + /// 获取学习园地资源大类列表 + /// + /// + /// + /// + 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; + } + + /// + /// 获取学习园地资源明细列表 + /// + /// + /// + /// + /// + 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 + } +} diff --git a/SGGL/WebAPI/Filter/TestPermissionAttribute.cs b/SGGL/WebAPI/Filter/TestPermissionAttribute.cs index 40d82c76..a0861dea 100644 --- a/SGGL/WebAPI/Filter/TestPermissionAttribute.cs +++ b/SGGL/WebAPI/Filter/TestPermissionAttribute.cs @@ -173,7 +173,9 @@ namespace WebAPI.Filter "BonusScoreSelfManagement*getBonusScoreSelfManagementList", "BonusScoreSelfManagement*getBonusScoreSelfManagementById", "BonusScoreSelfManagement*saveBonusScoreSelfManagement", - "BonusScoreSelfManagement*deleteBonusScoreSelfManagementById" + "BonusScoreSelfManagement*deleteBonusScoreSelfManagementById", + "StudyZone*getStudyZoneTypeList", + "StudyZone*getStudyZoneItemList" }; diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj index 115e7efc..71280ce7 100644 --- a/SGGL/WebAPI/WebAPI.csproj +++ b/SGGL/WebAPI/WebAPI.csproj @@ -206,6 +206,7 @@ +