diff --git a/DataBase/版本日志/SGGLDB_2025-04-14-geh.sql b/DataBase/版本日志/SGGLDB_2025-04-14-geh.sql index ceb9bce..1789d1a 100644 --- a/DataBase/版本日志/SGGLDB_2025-04-14-geh.sql +++ b/DataBase/版本日志/SGGLDB_2025-04-14-geh.sql @@ -1,5 +1,9 @@ ALTER TABLE Training_TestRecord -ADD Signature NVARCHAR(1000), -ADD Fingerprint NVARCHAR(1000), +ADD Signature NVARCHAR(1000); +go +ALTER TABLE Training_TestRecord +ADD Fingerprint NVARCHAR(1000); +go +ALTER TABLE Training_TestRecord ADD CompanyTrainingItemId NVARCHAR(50); go \ No newline at end of file diff --git a/DataBase/版本日志/SGGLDB_2025-04-29-geh.sql b/DataBase/版本日志/SGGLDB_2025-04-29-geh.sql new file mode 100644 index 0000000..d5da9ab --- /dev/null +++ b/DataBase/版本日志/SGGLDB_2025-04-29-geh.sql @@ -0,0 +1,25 @@ +-- 分值 +ALTER TABLE Training_TestTrainingItem +ADD Score int; +go + +-- 菜单 +INSERT INTO [dbo].[Sys_Menu] ( [MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed] ) +VALUES + ( N'2D889FC1-6B76-4F16-B19B-2D586B569B65', N'岗位试题库', NULL, N'HSSE/EduTrain/WorkPostTestTraining.aspx', 40, N'E26D223B-4CA2-4A6D-82D0-224CC9C8676D', N'Menu_DigData', '1', '1', '1' ); + + INSERT INTO [dbo].[Sys_ButtonToMenu] ( [ButtonToMenuId], [MenuId], [ButtonName], [SortIndex] ) +VALUES + ( NewID(), N'2D889FC1-6B76-4F16-B19B-2D586B569B65', N'删除', 3 ); +INSERT INTO [dbo].[Sys_ButtonToMenu] ( [ButtonToMenuId], [MenuId], [ButtonName], [SortIndex] ) +VALUES + ( NewID(), N'2D889FC1-6B76-4F16-B19B-2D586B569B65', N'导出', 5 ); +INSERT INTO [dbo].[Sys_ButtonToMenu] ( [ButtonToMenuId], [MenuId], [ButtonName], [SortIndex] ) +VALUES + ( NewID(), N'2D889FC1-6B76-4F16-B19B-2D586B569B65', N'保存', 4 ); +INSERT INTO [dbo].[Sys_ButtonToMenu] ( [ButtonToMenuId], [MenuId], [ButtonName], [SortIndex] ) +VALUES + ( NewID(), N'2D889FC1-6B76-4F16-B19B-2D586B569B65', N'增加', 1 ); +INSERT INTO [dbo].[Sys_ButtonToMenu] ( [ButtonToMenuId], [MenuId], [ButtonName], [SortIndex] ) +VALUES + ( NewID(), N'2D889FC1-6B76-4F16-B19B-2D586B569B65', N'修改', 2 ); \ No newline at end of file diff --git a/SUBQHSE/BLL/HSSE/EduTrain/TestTrainingItemService.cs b/SUBQHSE/BLL/HSSE/EduTrain/TestTrainingItemService.cs index 52ebb1f..713100f 100644 --- a/SUBQHSE/BLL/HSSE/EduTrain/TestTrainingItemService.cs +++ b/SUBQHSE/BLL/HSSE/EduTrain/TestTrainingItemService.cs @@ -45,6 +45,7 @@ namespace BLL DItem = TestTrainingItem.DItem, EItem = TestTrainingItem.EItem, AnswerItems = TestTrainingItem.AnswerItems, + Score = TestTrainingItem.Score, }; db.Training_TestTrainingItem.InsertOnSubmit(newTestTrainingItem); db.SubmitChanges(); @@ -74,6 +75,7 @@ namespace BLL newTestTrainingItem.DItem = TestTrainingItem.DItem; newTestTrainingItem.EItem = TestTrainingItem.EItem; newTestTrainingItem.AnswerItems = TestTrainingItem.AnswerItems; + newTestTrainingItem.Score = TestTrainingItem.Score; db.SubmitChanges(); } } diff --git a/SUBQHSE/FineUIPro.Web/File/Excel/DataIn/岗位考试试题模版.xls b/SUBQHSE/FineUIPro.Web/File/Excel/DataIn/岗位考试试题模版.xls new file mode 100644 index 0000000..c57d440 Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Excel/DataIn/岗位考试试题模版.xls differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(司索信号工).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(司索信号工).doc new file mode 100644 index 0000000..e54ff12 Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(司索信号工).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(塔吊司机).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(塔吊司机).doc new file mode 100644 index 0000000..d380bf7 Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(塔吊司机).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(挖机司机).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(挖机司机).doc new file mode 100644 index 0000000..6f524f2 Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(挖机司机).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(施工电梯司机).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(施工电梯司机).doc new file mode 100644 index 0000000..89fcc5f Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(施工电梯司机).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(普工).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(普工).doc new file mode 100644 index 0000000..ebad9f9 Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(普工).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(木工).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(木工).doc new file mode 100644 index 0000000..9e86d7c Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(木工).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(架子工).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(架子工).doc new file mode 100644 index 0000000..4df39a3 Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(架子工).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(桩基).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(桩基).doc new file mode 100644 index 0000000..cc8fe44 Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(桩基).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(水电工).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(水电工).doc new file mode 100644 index 0000000..8727a91 Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(水电工).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(渣土车司机).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(渣土车司机).doc new file mode 100644 index 0000000..dfd4af2 Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(渣土车司机).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(班组管理员).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(班组管理员).doc new file mode 100644 index 0000000..92afdfd Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(班组管理员).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(瓦工).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(瓦工).doc new file mode 100644 index 0000000..048bf35 Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(瓦工).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(电焊工).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(电焊工).doc new file mode 100644 index 0000000..b136a76 Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(电焊工).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(管理人员).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(管理人员).doc new file mode 100644 index 0000000..4357f1d Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(管理人员).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(装配、灌浆工).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(装配、灌浆工).doc new file mode 100644 index 0000000..48fdd3a Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(装配、灌浆工).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(钢筋工).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(钢筋工).doc new file mode 100644 index 0000000..6e602de Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(钢筋工).doc differ diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(防水普工).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(防水普工).doc new file mode 100644 index 0000000..d9052ab Binary files /dev/null and b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(防水普工).doc differ diff --git a/SUBQHSE/FineUIPro.Web/FineUIPro.Web.csproj b/SUBQHSE/FineUIPro.Web/FineUIPro.Web.csproj index b86f715..89f83dd 100644 --- a/SUBQHSE/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SUBQHSE/FineUIPro.Web/FineUIPro.Web.csproj @@ -708,6 +708,24 @@ + + + + + + + + + + + + + + + + + + @@ -1016,6 +1034,11 @@ + + + + + @@ -11783,6 +11806,26 @@ TrainTestView.aspx + + ASPXCodeBehind + + + + ASPXCodeBehind + + + + ASPXCodeBehind + + + + ASPXCodeBehind + + + + ASPXCodeBehind + + DrillRecordList.aspx ASPXCodeBehind diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/TestTraining.aspx.cs b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/TestTraining.aspx.cs index 2daa5ee..e9be936 100644 --- a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/TestTraining.aspx.cs +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/TestTraining.aspx.cs @@ -85,7 +85,7 @@ namespace FineUIPro.Web.HSSE.EduTrain private List GetNewTraining(string parentId) { return (from x in Funs.DB.Training_TestTraining - where x.SupTrainingId == parentId + where x.SupTrainingId == parentId && x.TrainingId != "99ccf4c8-6f8e-47da-a900-53b12a278f25" orderby x.TrainingCode select x).ToList(); } diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTraining.aspx b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTraining.aspx new file mode 100644 index 0000000..343295d --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTraining.aspx @@ -0,0 +1,198 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WorkPostTestTraining.aspx.cs" Inherits="FineUIPro.Web.HSSE.EduTrain.WorkPostTestTraining" %> + + + + + + + + + + +
+ + + + + + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTraining.aspx.cs b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTraining.aspx.cs new file mode 100644 index 0000000..300aa8b --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTraining.aspx.cs @@ -0,0 +1,557 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.HSSE.EduTrain +{ + public partial class WorkPostTestTraining : PageBase + { + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.GetButtonPower(); + this.InitTreeMenu(); + } + } + + /// + /// 初始化树 + /// + private void InitTreeMenu() + { + tvTestTraining.Nodes.Clear(); + tvTestTraining.ShowBorder = false; + tvTestTraining.ShowHeader = false; + tvTestTraining.EnableIcons = true; + tvTestTraining.AutoScroll = true; + tvTestTraining.EnableSingleClickExpand = true; + TreeNode rootNode = new TreeNode + { + Text = "考试试题库", + NodeID = "0", + Expanded = true + }; + this.tvTestTraining.Nodes.Add(rootNode); + BoundTree(rootNode.Nodes, rootNode.NodeID); + } + + 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); + } + } + } + } + + /// + /// 得到培训类型 + /// + /// + /// + private List GetNewTraining(string parentId) + { + return (from x in Funs.DB.Training_TestTraining + where x.SupTrainingId == parentId && x.TrainingId == "99ccf4c8-6f8e-47da-a900-53b12a278f25" + orderby x.TrainingCode + select x).ToList(); + } + + //protected void btnNew_Click(object sender, EventArgs e) + //{ + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainingSave.aspx", "编辑 - "))); + //} + + + protected void btnMenuADD_Click(object sender, EventArgs e) + { + if (this.tvTestTraining.SelectedNode != null) + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WorkPostTestTrainingSave.aspx?SupTrainingId={0}", this.tvTestTraining.SelectedNode.NodeID, "新增 - "))); + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + protected void btnTreeMenuEdit_Click(object sender, EventArgs e) + { + if (this.tvTestTraining.SelectedNode != null) + { + if (this.tvTestTraining.SelectedNode.NodeID != "0") //非根节点可以编辑 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WorkPostTestTrainingSave.aspx?TrainingId={0}", this.tvTestTraining.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("根节点无法编辑!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + protected void btnTreeMenuDelete_Click(object sender, EventArgs e) + { + if (this.tvTestTraining.SelectedNode != null && this.tvTestTraining.SelectedNodeID != "0") + { + var edu = Funs.DB.Training_TestTraining.FirstOrDefault(x => x.SupTrainingId == this.tvTestTraining.SelectedNode.NodeID); + if (edu == null) + { + BLL.TestTrainingService.DeleteTestTrainingById(this.tvTestTraining.SelectedNode.NodeID); + InitTreeMenu(); + Grid1.DataSource = null; + Grid1.DataBind(); + } + else + { + ShowNotify("存在子目录,不能删除!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择删除项!", MessageBoxIcon.Warning); + } + } + + protected void tvTestTraining_NodeCommand(object sender, FineUIPro.TreeCommandEventArgs e) + { + BindGrid(); + } + + #region BindGrid + + private void BindGrid() + { + if (this.tvTestTraining.SelectedNode != null && !string.IsNullOrEmpty(this.tvTestTraining.SelectedNode.NodeID)) + { + string strSql = @"SELECT TrainingItemId,TrainingId,TrainingItemCode,TrainingItemName,Abstracts,AttachUrl,VersionNum,TestType " + + @" ,(CASE WHEN TestType = '1' THEN '单选题' WHEN TestType = '2' THEN '多选题' ELSE '判断题' END) AS TestTypeName " + + @" ,(CASE WHEN WorkPostNames IS NULL THEN '通用' ELSE WorkPostNames END) AS WorkPostNames,AItem,BItem,CItem,DItem,EItem,AnswerItems,Score " + + @" FROM dbo.Training_TestTrainingItem" + + @" WHERE TrainingId=@TrainingId "; + List listStr = new List + { + new SqlParameter("@TrainingId", this.tvTestTraining.SelectedNode.NodeID) + }; + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + strSql += " AND (TrainingItemCode LIKE @Name OR TrainingItemName LIKE @Name OR Abstracts LIKE @Name OR WorkPostNames LIKE @Name)"; + listStr.Add(new SqlParameter("@Name", "%" + this.txtName.Text.Trim() + "%")); + } + if (this.drptype.SelectedValue != "0") + { + strSql += " AND TestType=@TestType"; + listStr.Add(new SqlParameter("@TestType", this.drptype.SelectedValue)); + } + if (this.ckIsItem.Checked) + { + strSql += " AND (AItem IS NULL OR BItem IS NULL OR AItem ='' OR BItem ='')"; + } + + 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 Events + protected void Window1_Close(object sender, EventArgs e) + { + this.InitTreeMenu(); + } + + protected void Window2_Close(object sender, EventArgs e) + { + this.BindGrid(); + } + protected void Window3_Close(object sender, EventArgs e) + { + this.InitTreeMenu(); + this.BindGrid(); + } + + /// + /// 右键删除事件 + /// + /// + /// + 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(); + var getD = BLL.TestTrainingItemService.GetTestTrainingItemById(rowID); + if (getD != null) + { + BLL.LogService.AddSys_Log(this.CurrUser, getD.TrainingItemCode, getD.TrainingItemId, BLL.Const.TestTrainingMenuId, BLL.Const.BtnDelete); + BLL.TestTrainingItemService.DeleteTestTrainingItemById(rowID); + } + } + + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + #endregion + + #region GV排序页面 + /// + /// + /// + /// + /// + 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 + + /// + /// 编辑试题 + /// + /// + /// + 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 trainingItemId = Grid1.SelectedRowID; + + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("WorkPostTestTrainingItemSave.aspx?TrainingItemId={0}", trainingItemId, "编辑 - "))); + } + + /// + /// 增加 + /// + /// + /// + protected void btnNewDetail_Click(object sender, EventArgs e) + { + if (this.tvTestTraining.SelectedNode != null) + { + string id = this.tvTestTraining.SelectedNodeID; + var testTrain = BLL.TestTrainingService.GetTestTrainingById(id); + if (testTrain != null && testTrain.IsEndLever == true) + { + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("WorkPostTestTrainingItemSave.aspx?TrainingId={0}", this.tvTestTraining.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("请选择末级树节点!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TestTrainingMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnMenuADD.Hidden = false; + this.btnImport.Hidden = false; + this.btnNewDetail.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnTreeMenuEdit.Hidden = false; + this.btnMenuEdit.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnTreeMenuDelete.Hidden = false; + this.btnMenuDelete.Hidden = false; + } + } + + //if (this.CurrUser.UserId == BLL.Const.sysglyId) + //{ + // this.btnRefresh.Hidden = false; + // this.btnRefresh1.Hidden = false; + //} + } + #endregion + + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + #region 导入 + /// + /// 导入按钮 + /// + /// + /// + protected void btnImport_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("WorkPostTestTrainingItemIn.aspx", "导入 - "))); + } + #endregion + + #region 导出 + /// + /// 导出按钮 + /// + /// + /// + protected void btnMenuOut_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("WorkPostTestTrainingOut.aspx", "导出 - "))); + } + /// + /// 导出按钮 + /// + /// + /// + protected void btnMenuOut1_Click(object sender, EventArgs e) + { + if (this.tvTestTraining.SelectedNode != null && this.tvTestTraining.SelectedNodeID != "0") + { + 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)); + Response.End(); + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + #endregion + + #region 刷新装置 + /// + /// 刷新 + /// + /// + /// + protected void Refresh_Click(object sender, EventArgs e) + { + var trainingItems = from x in Funs.DB.Training_TestTrainingItem select x; + if (trainingItems.Count() > 0) + { + foreach (var trainingItem in trainingItems) + { + if (trainingItem.TestType == "3" && string.IsNullOrEmpty(trainingItem.AItem)) + { + trainingItem.AItem = "对"; + trainingItem.BItem = "错"; + } + + if (!string.IsNullOrEmpty(trainingItem.WorkPostIds)) + { + string name = string.Empty; + var workPostList = Funs.GetStrListByStr(trainingItem.WorkPostIds, ','); + if (workPostList.Count() > 0) + { + foreach (var workPostId in workPostList) + { + var workPost = BLL.WorkPostService.GetWorkPostById(workPostId).WorkPostName; + if (!string.IsNullOrEmpty(workPost)) + { + name += workPost + ","; + } + } + } + + if (!string.IsNullOrEmpty(name)) + { + trainingItem.WorkPostNames = name.Substring(0, name.LastIndexOf(",")); + } + } + + BLL.TestTrainingItemService.UpdateTestTrainingItem(trainingItem); + } + } + + Alert.ShowInTop("操作完成!", MessageBoxIcon.Success); + } + + /// + /// 刷新 + /// + /// + /// + protected void Refresh1_Click(object sender, EventArgs e) + { + var trainingItems = from x in Funs.DB.Training_TestTrainingItem select x; + if (trainingItems.Count() > 0) + { + foreach (var trainingItem in trainingItems) + { + if (trainingItem.TestType == "3" && string.IsNullOrEmpty(trainingItem.AItem)) + { + trainingItem.AItem = "对"; + trainingItem.BItem = "错"; + } + + if (!string.IsNullOrEmpty(trainingItem.WorkPostNames)) + { + string getInstallationId = string.Empty; + var installList = Funs.GetStrListByStr(trainingItem.WorkPostNames, ','); + if (installList.Count() > 0) + { + foreach (var installItem in installList) + { + var install = Funs.DB.Base_WorkPost.FirstOrDefault(x => x.WorkPostName == installItem); + if (install != null && !string.IsNullOrEmpty(install.WorkPostId)) + { + getInstallationId += install.WorkPostId + ","; + } + } + } + + if (!string.IsNullOrEmpty(getInstallationId)) + { + trainingItem.WorkPostIds = getInstallationId.Substring(0, getInstallationId.LastIndexOf(",")); + } + } + + BLL.TestTrainingItemService.UpdateTestTrainingItem(trainingItem); + } + } + + Alert.ShowInTop("操作完成!", MessageBoxIcon.Success); + } + #endregion + + /// + /// 显示选项不全的题目 + /// + /// + /// + protected void ckIsItem_CheckedChanged(object sender, CheckedEventArgs e) + { + this.BindGrid(); + } + + /// + /// 查看二维码 + /// + /// + /// + protected void btnQR_Click(object sender, EventArgs e) + { + + PageContext.RegisterStartupScript(Window1.GetShowReference + (String.Format("~/Controls/SeeQRImage.aspx?TrainingId={0}&strCode={1}", this.tvTestTraining.SelectedNode.NodeID + , "testTraining$" + this.tvTestTraining.SelectedNode.NodeID), + + "二维码查看", 400, 400)); + } + } +} \ No newline at end of file diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTraining.aspx.designer.cs b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTraining.aspx.designer.cs new file mode 100644 index 0000000..17400bf --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTraining.aspx.designer.cs @@ -0,0 +1,296 @@ +//------------------------------------------------------------------------------ +// <Զ> +// ˴ɹɡ +// +// ԴļĸĿܵ²ȷΪ +// ɴ룬Ľʧ +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class WorkPostTestTraining + { + + /// + /// 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; + + /// + /// btnOut ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.Button btnOut; + + /// + /// tvTestTraining ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.Tree tvTestTraining; + + /// + /// panelCenterRegion ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.Panel panelCenterRegion; + + /// + /// Grid1 ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar3 ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// txtName ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// drptype ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.DropDownList drptype; + + /// + /// ckIsItem ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.CheckBox ckIsItem; + + /// + /// ToolbarFill1 ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNewDetail ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.Button btnNewDetail; + + /// + /// btnImport ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.Button btnImport; + + /// + /// Button1 ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.Button Button1; + + /// + /// 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; + + /// + /// Menu1 ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuDelete ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + + /// + /// Menu2 ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.Menu Menu2; + + /// + /// btnMenuADD ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.MenuButton btnMenuADD; + + /// + /// btnTreeMenuEdit ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.MenuButton btnTreeMenuEdit; + + /// + /// btnQR ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.MenuButton btnQR; + + /// + /// btnTreeMenuDelete ؼ + /// + /// + /// ԶɵֶΡ + /// Ҫ޸ģ뽫ֶļƵļ + /// + protected global::FineUIPro.MenuButton btnTreeMenuDelete; + } +} diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemIn.aspx b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemIn.aspx new file mode 100644 index 0000000..bb8bb7e --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemIn.aspx @@ -0,0 +1,109 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WorkPostTestTrainingItemIn.aspx.cs" Inherits="FineUIPro.Web.HSSE.EduTrain.WorkPostTestTrainingItemIn" %> + + + + + + 导入考试试题 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemIn.aspx.cs b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemIn.aspx.cs new file mode 100644 index 0000000..1cd8e14 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemIn.aspx.cs @@ -0,0 +1,452 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data.OleDb; +using System.Data; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.HSSE.EduTrain +{ + public partial class WorkPostTestTrainingItemIn : PageBase + { + #region 定义变量 + /// + /// 上传预设的虚拟路径 + /// + private string initPath = Const.ExcelUrl; + + /// + /// 导入集合 + /// + public static List viewTrainingItems = new List(); + + /// + /// 错误集合 + /// + public static string errorInfos = string.Empty; + #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(); + } + errorInfos = string.Empty; + } + } + #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 (!string.IsNullOrEmpty(errorInfos)) + { + errorInfos = string.Empty; + } + string rootPath = Server.MapPath("~/"); + string initFullPath = rootPath + initPath; + if (!Directory.Exists(initFullPath)) + { + Directory.CreateDirectory(initFullPath); + } + + this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls; + string filePath = initFullPath + this.hdFileName.Text; + this.fuAttachUrl.PostedFile.SaveAs(filePath); + ImportXlsToData(rootPath + initPath + this.hdFileName.Text); + } + catch (Exception ex) + { + ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning); + } + } + + #region 读Excel提取数据 + /// + /// 从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 trainings = from x in Funs.DB.Training_TestTraining select x; + ///岗位 + var workPosts = from x in Funs.DB.Base_WorkPost select x; + for (int i = 0; i < ir; i++) + { + Model.View_Training_TestTrainingItem newViewTrainingItem = new Model.View_Training_TestTrainingItem + { + TrainingCode = pds.Rows[i][0].ToString().Trim(), + TrainingItemCode = pds.Rows[i][2].ToString().Trim(), + Abstracts = pds.Rows[i][5].ToString().Trim(), + AItem = pds.Rows[i][6].ToString().Trim(), + BItem = pds.Rows[i][7].ToString().Trim(), + }; + + if (!string.IsNullOrEmpty(pds.Rows[i][12].ToString().Trim())) + { + newViewTrainingItem.Score = int.Parse(pds.Rows[i][12].ToString().Trim()); + } + + ////试题类型 + string col1 = pds.Rows[i][1].ToString().Trim(); + if (string.IsNullOrEmpty(col1)) + { + result += "第" + (i + 2).ToString() + "行," + "导入试题类型" + "," + "此项为必填项!" + "|"; + } + else + { + var standard = trainings.FirstOrDefault(x => x.TrainingName == col1); + if (standard != null) + { + newViewTrainingItem.TrainingId = standard.TrainingId; + newViewTrainingItem.TrainingCode = standard.TrainingCode; + newViewTrainingItem.TrainingName = standard.TrainingName; + } + else + { + Model.Training_TestTraining newTraining = new Model.Training_TestTraining(); + newViewTrainingItem.TrainingId = newTraining.TrainingId = SQLHelper.GetNewID(typeof(Model.Training_TestTraining)); + newViewTrainingItem.TrainingName = newTraining.TrainingName = col1; + newTraining.TrainingCode = newViewTrainingItem.TrainingCode; + BLL.TestTrainingService.AddTestTraining(newTraining); + } + } + ///试题题型 + string col3 = pds.Rows[i][3].ToString().Trim(); + if (string.IsNullOrEmpty(col3)) + { + result += "第" + (i + 2).ToString() + "行," + "导入试题题型" + "," + "此项为必填项!" + "|"; + } + else + { + + if (col3 == "单选题") + { + newViewTrainingItem.TestType = "1"; + //newViewTrainingItem.Score = SValue; + newViewTrainingItem.CItem = pds.Rows[i][8].ToString().Trim(); + newViewTrainingItem.DItem = pds.Rows[i][9].ToString().Trim(); + //if (string.IsNullOrEmpty(newViewTrainingItem.AItem) || string.IsNullOrEmpty(newViewTrainingItem.BItem) || string.IsNullOrEmpty(newViewTrainingItem.CItem) || string.IsNullOrEmpty(newViewTrainingItem.DItem)) + //{ + // result += "第" + (i + 2).ToString() + "行," + "单选题ABCD都不能为空!" + "|"; + //} + + } + else if (col3 == "多选题") + { + newViewTrainingItem.TestType = "2"; + //newViewTrainingItem.Score = MValue; + newViewTrainingItem.CItem = pds.Rows[i][8].ToString().Trim(); + newViewTrainingItem.DItem = pds.Rows[i][9].ToString().Trim(); + newViewTrainingItem.EItem = pds.Rows[i][10].ToString().Trim(); + //if (string.IsNullOrEmpty(newViewTrainingItem.AItem) || string.IsNullOrEmpty(newViewTrainingItem.BItem) || string.IsNullOrEmpty(newViewTrainingItem.CItem) || string.IsNullOrEmpty(newViewTrainingItem.DItem)) + //{ + // result += "第" + (i + 2).ToString() + "行," + "多选题ABCD都不能为空!" + "|"; + //} + } + else + { + newViewTrainingItem.TestType = "3"; + //newViewTrainingItem.Score = JValue; + //if (string.IsNullOrEmpty(newViewTrainingItem.AItem) || string.IsNullOrEmpty(newViewTrainingItem.BItem)) + //{ + // result += "第" + (i + 2).ToString() + "行," + "判断题AB不能为空!" + "|"; + //} + } + } + ////适合岗位 + string col4 = pds.Rows[i][4].ToString().Trim(); + if (!string.IsNullOrEmpty(col4)) + { + + List WorkPostSels = Funs.GetStrListByStr(col4, ','); + if (WorkPostSels.Count() > 0) + { + string ids = string.Empty; + foreach (var item in WorkPostSels) + { + var wp = workPosts.FirstOrDefault(x => x.WorkPostName == item); + if (wp != null) + { + ids += wp.WorkPostId + ","; + } + else + { + result += "第" + (i + 2).ToString() + "行," + "导入适合岗位" + item + "," + "此项基础表不存在!" + "|"; + } + } + if (!string.IsNullOrEmpty(ids)) + { + newViewTrainingItem.WorkPostNames = col4; + newViewTrainingItem.WorkPostIds = ids.Substring(0, ids.LastIndexOf(",")); + } + } + } + + ////正确答案 + string col11 = pds.Rows[i][11].ToString().Trim(); + if (string.IsNullOrEmpty(col11)) + { + result += "第" + (i + 2).ToString() + "行," + "导入正确答案项" + "," + "为必填项!" + "|"; + } + else + { + int icount = 0; + List selecItem = Funs.GetStrListByStr(col11, ','); + foreach (var item in selecItem) + { + if (item != "A" && item != "a" && item != "B" && item != "b" && item != "C" && item != "c" && item != "D" && item != "d" && item != "E" && item != "e") + { + icount++; + } + } + if (icount == 0) + { + newViewTrainingItem.AnswerItems = col11.Replace("a", "A").Replace("b", "B").Replace("c", "C").Replace("d", "D").Replace("e", "E"); + } + else + { + result += "第" + (i + 2).ToString() + "行," + "正确答案项只能输入ABCDE且用','隔开!" + "|"; + } + } + + ////试题内容 + if (string.IsNullOrEmpty(newViewTrainingItem.Abstracts)) + { + result += "第" + (i + 2).ToString() + "行," + "导入试题内容" + "," + "为必填项!" + "|"; + } + else + { + var addTrainingItem = Funs.DB.Training_TestTrainingItem.FirstOrDefault(x => x.Abstracts == newViewTrainingItem.Abstracts + && x.TrainingId == newViewTrainingItem.TrainingId); + if (addTrainingItem == null) + { + Model.Training_TestTrainingItem newTrainingItem = new Model.Training_TestTrainingItem + { + TrainingItemId = newViewTrainingItem.TrainingItemId = SQLHelper.GetNewID(typeof(Model.Training_TestTraining)), + TrainingId = newViewTrainingItem.TrainingId, + TrainingItemCode = newViewTrainingItem.TrainingItemCode, + TrainingItemName = newViewTrainingItem.TrainingItemName, + + AttachUrl = newViewTrainingItem.AttachUrl, + VersionNum = newViewTrainingItem.VersionNum, + TestType = newViewTrainingItem.TestType, + WorkPostIds = newViewTrainingItem.WorkPostIds, + WorkPostNames = newViewTrainingItem.WorkPostNames, + AItem = newViewTrainingItem.AItem, + BItem = newViewTrainingItem.BItem, + CItem = newViewTrainingItem.CItem, + DItem = newViewTrainingItem.DItem, + EItem = newViewTrainingItem.EItem, + Score = newViewTrainingItem.Score, + AnswerItems = newViewTrainingItem.AnswerItems, + }; + if (newViewTrainingItem.Abstracts.Contains("(") || newViewTrainingItem.Abstracts.Contains(")") + || newViewTrainingItem.Abstracts.Contains("(") || newViewTrainingItem.Abstracts.Contains(")")) + { + newTrainingItem.Abstracts = newViewTrainingItem.Abstracts; + } + else + { + newTrainingItem.Abstracts = newViewTrainingItem.Abstracts + "( )"; + } + + BLL.TestTrainingItemService.AddTestTrainingItem(newTrainingItem); + ///加入培训试题库 + viewTrainingItems.Add(newViewTrainingItem); + } + else + { + result += "第" + (i + 2).ToString() + "行," + "导入试题重复" + "|"; + } + } + } + if (viewTrainingItems.Count > 0) + { + viewTrainingItems = viewTrainingItems.Distinct().ToList(); + this.Grid1.Hidden = false; + this.Grid1.DataSource = viewTrainingItems; + this.Grid1.DataBind(); + } + + if (!string.IsNullOrEmpty(result)) + { + viewTrainingItems.Clear(); + result = "数据导入完成,未成功数据:" + result.Substring(0, result.LastIndexOf("|")); + errorInfos = result; + Alert alert = new Alert + { + Message = result, + Target = Target.Self + }; + alert.Show(); + } + else + { + errorInfos = string.Empty; + ShowNotify("导入成功!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + } + else + { + Alert.ShowInTop("导入数据为空!", MessageBoxIcon.Warning); + } + return true; + } + #endregion + #endregion + + #region 关闭弹出窗口 + /// + /// 关闭导入弹出窗口 + /// + /// + /// + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + if (Session["trainingItem"] != null) + { + viewTrainingItems = Session["trainingItem"] as List; + } + if (viewTrainingItems.Count > 0) + { + this.Grid1.Hidden = false; + this.Grid1.DataSource = viewTrainingItems; + this.Grid1.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 = "File\\Excel\\DataIn\\岗位考试试题模版.xls";; + 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/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemIn.aspx.designer.cs b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemIn.aspx.designer.cs new file mode 100644 index 0000000..ea12525 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemIn.aspx.designer.cs @@ -0,0 +1,143 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class WorkPostTestTrainingItemIn + { + + /// + /// 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; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnAudit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAudit; + + /// + /// btnDownLoad 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDownLoad; + + /// + /// fuAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FileUpload fuAttachUrl; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label2; + + /// + /// 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/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemSave.aspx b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemSave.aspx new file mode 100644 index 0000000..74b4d62 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemSave.aspx @@ -0,0 +1,145 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WorkPostTestTrainingItemSave.aspx.cs" Inherits="FineUIPro.Web.HSSE.EduTrain.WorkPostTestTrainingItemSave" %> + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ + +
+
+
+ + + + + + + + + + + + + +
+ + + diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemSave.aspx.cs b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemSave.aspx.cs new file mode 100644 index 0000000..df3c809 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemSave.aspx.cs @@ -0,0 +1,391 @@ +using BLL; +using Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.HSSE.EduTrain +{ + public partial class WorkPostTestTrainingItemSave : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string TrainingItemId + { + get + { + return (string)ViewState["TrainingItemId"]; + } + set + { + ViewState["TrainingItemId"] = value; + } + } + + /// + /// 主表主键 + /// + public string TrainingId + { + get + { + return (string)ViewState["TrainingId"]; + } + set + { + ViewState["TrainingId"] = value; + } + } + + /// + /// 附件 + /// + private string AttachUrl + { + get + { + return (string)ViewState["AttachUrl"]; + } + set + { + ViewState["AttachUrl"] = value; + } + } + /// + /// 单选题分值 + /// + private int SValue + { + get + { + return (int)ViewState["SValue"]; + } + set + { + ViewState["SValue"] = value; + } + } + /// + /// 多选题分值 + /// + private int MValue + { + get + { + return (int)ViewState["MValue"]; + } + set + { + ViewState["MValue"] = value; + } + } + + /// + /// 判断题分值 + /// + private int JValue + { + get + { + return (int)ViewState["JValue"]; + } + set + { + ViewState["JValue"] = value; + } + } + #endregion + + #region 加载页面 + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + SValue = 1; + MValue = 2; + JValue = 1; + var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); + if (testRule != null) + { + SValue = testRule.SValue; + MValue = testRule.MValue; + JValue = testRule.JValue; + } + + this.GetButtonPower(); + LoadData(); + BindEnumrableToDropDownList(); + this.TrainingItemId = Request.QueryString["TrainingItemId"]; + this.TrainingId = Request.QueryString["TrainingId"]; + if (!String.IsNullOrEmpty(this.TrainingItemId)) + { + var q = BLL.TestTrainingItemService.GetTestTrainingItemById(this.TrainingItemId); + if (q != null) + { + txtTrainingItemCode.Text = q.TrainingItemCode; + if (!string.IsNullOrEmpty(q.TestType)) + { + this.rblTestType.SelectedValue = q.TestType; + if (q.TestType == "1") + { + this.lbScore.Text = SValue.ToString(); + this.trE.Hidden = true; + } + else if (q.TestType == "2") + { + this.lbScore.Text = MValue.ToString(); + } + else if (q.TestType == "3") + { + this.lbScore.Text = JValue.ToString(); + this.trC.Hidden = true; + this.trD.Hidden = true; + this.trE.Hidden = true; + } + + System.Web.UI.WebControls.ListItem[] myList2 = BLL.TestTrainingItemService.GetAnswerItemsList(this.rblTestType.SelectedValue); + RadioButtonList2.DataTextField = "Text"; + RadioButtonList2.DataValueField = "Value"; + RadioButtonList2.DataSource = myList2; + RadioButtonList2.DataBind(); + + if (!string.IsNullOrEmpty(q.AnswerItems)) + { + string[] ids2 = q.AnswerItems.Split(','); + DropDownBox2.Values = ids2; + } + } + txtAbstracts.Text = q.Abstracts; + if (!string.IsNullOrEmpty(q.WorkPostIds)) + { + string[] ids1 = q.WorkPostIds.Split(','); + DropDownBox1.Values = ids1; + } + this.txtAItem.Text = q.AItem; + this.txtBItem.Text = q.BItem; + this.txtCItem.Text = q.CItem; + this.txtDItem.Text = q.DItem; + this.txtEItem.Text = q.EItem; + + this.AttachUrl = q.AttachUrl; + if (!string.IsNullOrEmpty(this.AttachUrl)) + { + this.trImageUrl.Visible = true; + this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../../", this.AttachUrl); + this.divBeImageUrl.InnerHtml = BLL.UploadAttachmentService.ShowImage("../../", this.AttachUrl); + } + } + } + else + { + this.lbScore.Text = SValue.ToString(); + this.trE.Hidden = true; + } + } + } + + /// + /// 删除附件 + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + this.trImageUrl.Visible = false; + this.AttachUrl = string.Empty; + this.divFile.InnerHtml = string.Empty; + this.divBeImageUrl.InnerHtml = string.Empty; ; + } + + private void LoadData() + { + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + } + + private void BindEnumrableToDropDownList() + { + List myList = BLL.WorkPostService.GetWorkPostList(); + RadioButtonList1.DataTextField = "WorkPostName"; + RadioButtonList1.DataValueField = "WorkPostId"; + RadioButtonList1.DataSource = myList; + RadioButtonList1.DataBind(); + System.Web.UI.WebControls.ListItem[] myList2 = BLL.TestTrainingItemService.GetAnswerItemsList(this.rblTestType.SelectedValue); + RadioButtonList2.DataTextField = "Text"; + RadioButtonList2.DataValueField = "Value"; + RadioButtonList2.DataSource = myList2; + RadioButtonList2.DataBind(); + } + #endregion + + #region 保存 + /// + /// 保存数据 + /// + private void SaveData(bool isClosed) + { + Model.Training_TestTrainingItem trainingItem = new Training_TestTrainingItem + { + TrainingItemCode = txtTrainingItemCode.Text.Trim(), + Abstracts = txtAbstracts.Text.Trim(), + TestType = this.rblTestType.SelectedValue, + AItem = txtAItem.Text.Trim(), + BItem = txtBItem.Text.Trim(), + CItem = txtCItem.Text.Trim(), + DItem = txtDItem.Text.Trim(), + EItem = txtEItem.Text.Trim(), + AttachUrl = this.AttachUrl, + + }; + if (!string.IsNullOrEmpty(DropDownBox1.Text)) + { + trainingItem.WorkPostIds = String.Join(",", DropDownBox1.Values); + trainingItem.WorkPostNames = String.Join(",", DropDownBox1.Texts); + } + if (!string.IsNullOrEmpty(DropDownBox2.Text)) + { + trainingItem.AnswerItems = String.Join(",", DropDownBox2.Values); + } + else + { + trainingItem.AnswerItems = string.Empty; + } + if (String.IsNullOrEmpty(TrainingItemId)) + { + trainingItem.TrainingItemId = SQLHelper.GetNewID(typeof(Model.Training_TestTrainingItem)); + trainingItem.TrainingId = this.TrainingId; + this.TrainingItemId = trainingItem.TrainingItemId; + BLL.TestTrainingItemService.AddTestTrainingItem(trainingItem); + BLL.LogService.AddSys_Log(this.CurrUser, trainingItem.TrainingItemCode, trainingItem.TrainingItemId, BLL.Const.TestTrainingMenuId, BLL.Const.BtnAdd); + } + else + { + Model.Training_TestTrainingItem t = BLL.TestTrainingItemService.GetTestTrainingItemById(TrainingItemId); + trainingItem.TrainingItemId = TrainingItemId; + if (t != null) + { + trainingItem.TrainingId = t.TrainingId; + } + BLL.TestTrainingItemService.UpdateTestTrainingItem(trainingItem); + BLL.LogService.AddSys_Log(this.CurrUser, trainingItem.TrainingItemCode, trainingItem.TrainingItemId, BLL.Const.TestTrainingMenuId, BLL.Const.BtnModify); + } + if (isClosed) + { + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + } + + protected void btnSave_Click(object sender, EventArgs e) + { + SaveData(true); + } + #endregion + + #region 附件上传 + /// + /// 附件上传 + /// + /// + /// + protected void btnFile_Click(object sender, EventArgs e) + { + if (btnFile.HasFile) + { + this.AttachUrl = BLL.UploadFileService.UploadAttachment(BLL.Funs.RootPath, this.btnFile, this.AttachUrl, UploadFileService.TrainingFilePath); + if (!string.IsNullOrEmpty(this.AttachUrl)) + { + this.trImageUrl.Visible = true; + this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../../", this.AttachUrl); + this.divBeImageUrl.InnerHtml = BLL.UploadAttachmentService.ShowImage("../../", this.AttachUrl); + } + } + } + #endregion + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TestTrainingMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + + #region 验证教材名称是否存在 + /// + /// 验证教材名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + //var q = Funs.DB.Training_TrainingItem.FirstOrDefault(x => x.IsPass == true && x.TrainingId == this.TrainingId && x.TrainingItemName == this.txtTrainingItemName.Text.Trim() && (x.TrainingItemId != this.TrainingItemId || (this.TrainingItemId == null && x.TrainingItemId != null))); + //if (q != null) + //{ + // ShowNotify("输入的教材名称已存在!", MessageBoxIcon.Warning); + //} + } + #endregion + + /// + /// 题型变换事件 + /// + /// + /// + protected void rblTestType_SelectedIndexChanged(object sender, EventArgs e) + { + this.trC.Hidden = false; + this.trD.Hidden = false; + this.trE.Hidden = false; + + this.txtAItem.Text = string.Empty; + this.txtBItem.Text = string.Empty; + this.txtCItem.Text = string.Empty; + this.txtDItem.Text = string.Empty; + this.txtEItem.Text = string.Empty; + + string testType = this.rblTestType.SelectedValue; + System.Web.UI.WebControls.ListItem[] myList2 = BLL.TestTrainingItemService.GetAnswerItemsList(testType); + RadioButtonList2.DataTextField = "Text"; + RadioButtonList2.DataValueField = "Value"; + RadioButtonList2.DataSource = myList2; + RadioButtonList2.DataBind(); + + DropDownBox2.Text = string.Empty; + DropDownBox2.Values = null; + + if (testType == "1") + { + this.lbScore.Text = SValue.ToString(); + this.trE.Hidden = true; + } + else if (testType == "2") + { + this.lbScore.Text = MValue.ToString(); + } + else if (testType == "3") + { + this.lbScore.Text = JValue.ToString(); + this.trC.Hidden = true; + this.trD.Hidden = true; + this.trE.Hidden = true; + this.txtAItem.Text = "对"; + this.txtBItem.Text = "错"; + } + } + } +} \ No newline at end of file diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemSave.aspx.designer.cs b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemSave.aspx.designer.cs new file mode 100644 index 0000000..008c321 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingItemSave.aspx.designer.cs @@ -0,0 +1,332 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class WorkPostTestTrainingItemSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtTrainingItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingItemCode; + + /// + /// rblTestType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.RadioButtonList rblTestType; + + /// + /// lbScore 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbScore; + + /// + /// DropDownBox1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownBox DropDownBox1; + + /// + /// SimpleForm2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.SimpleForm SimpleForm2; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label1; + + /// + /// RadioButtonList1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBoxList RadioButtonList1; + + /// + /// txtAbstracts 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtAbstracts; + + /// + /// txtAItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAItem; + + /// + /// txtBItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtBItem; + + /// + /// trC 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow trC; + + /// + /// txtCItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCItem; + + /// + /// trD 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow trD; + + /// + /// txtDItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtDItem; + + /// + /// trE 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow trE; + + /// + /// txtEItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtEItem; + + /// + /// DropDownBox2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownBox DropDownBox2; + + /// + /// SimpleForm3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.SimpleForm SimpleForm3; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label2; + + /// + /// RadioButtonList2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBoxList RadioButtonList2; + + /// + /// btnFile 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FileUpload btnFile; + + /// + /// ContentPanel2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ContentPanel ContentPanel2; + + /// + /// divFile 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divFile; + + /// + /// trImageUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trImageUrl; + + /// + /// divBeImageUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divBeImageUrl; + + /// + /// btnDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDelete; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// lbTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbTemp; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// hdCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCompileMan; + } +} diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingOut.aspx b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingOut.aspx new file mode 100644 index 0000000..426214a --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingOut.aspx @@ -0,0 +1,97 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WorkPostTestTrainingOut.aspx.cs" Inherits="FineUIPro.Web.HSSE.EduTrain.WorkPostTestTrainingOut" %> + + + + + + 培训试题 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingOut.aspx.cs b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingOut.aspx.cs new file mode 100644 index 0000000..9d3d9eb --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingOut.aspx.cs @@ -0,0 +1,124 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.HSSE.EduTrain +{ + public partial class WorkPostTestTrainingOut : PageBase + { + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + this.BindGrid(); + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = @"SELECT TrainingItemId,Training.TrainingCode,Training.TrainingName,TrainingItemCode,TrainingItemName,Abstracts,AttachUrl,VersionNum,TestType,WorkPostIds " + + @" ,(CASE WHEN TestType = '1' THEN '单选题' WHEN TestType = '2' THEN '多选题' ELSE '判断题' END) AS TestTypeName,WorkPostNames,AItem,BItem,CItem,DItem,EItem " + + @" ,Score,Replace(Replace(Replace(Replace(Replace(AnswerItems,'1','A'),'2', 'B'),'3', 'C'),'4', 'D'),'5', 'E') AS AnswerItems " + + @" FROM dbo.Training_TestTrainingItem AS Item" + + @" LEFT JOIN Training_TestTraining AS Training ON Item.TrainingId=Training.TrainingId" + + @" WHERE 1 = 1"; + List listStr = new List(); + + //if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + //{ + // strSql += " AND (JobActivityName LIKE @Name OR JobActivityCode LIKE @Name OR JobActivitys.Remark LIKE @Name OR WorkAreas.WorkAreaName LIKE @Name OR Installation.InstallationName LIKE @Name)"; + // listStr.Add(new SqlParameter("@Name", "%" + this.txtName.Text.Trim() + "%")); + //} + + 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(); + } + + #region 查询 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 分页 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + 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) + { + BindGrid(); + } + #endregion + + #region 导出按钮 + /// + /// 导出事件 + /// + /// + /// + protected void btnMenuOut_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)); + Response.End(); + } + #endregion + } +} \ No newline at end of file diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingOut.aspx.designer.cs b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingOut.aspx.designer.cs new file mode 100644 index 0000000..1c99950 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingOut.aspx.designer.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class WorkPostTestTrainingOut + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + } +} diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingSave.aspx b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingSave.aspx new file mode 100644 index 0000000..e954375 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingSave.aspx @@ -0,0 +1,53 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WorkPostTestTrainingSave.aspx.cs" Inherits="FineUIPro.Web.HSSE.EduTrain.WorkPostTestTrainingSave" %> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingSave.aspx.cs b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingSave.aspx.cs new file mode 100644 index 0000000..2409011 --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingSave.aspx.cs @@ -0,0 +1,154 @@ +using BLL; +using Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.HSSE.EduTrain +{ + public partial class WorkPostTestTrainingSave : PageBase + { + #region 自定义项 + /// + /// 主键 + /// + public string TrainingId + { + get + { + return (string)ViewState["TrainingId"]; + } + set + { + ViewState["TrainingId"] = value; + } + } + + /// + /// 上级主键 + /// + public string SupTrainingId + { + get + { + return (string)ViewState["SupTrainingId"]; + } + set + { + ViewState["SupTrainingId"] = value; + } + } + #endregion + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.GetButtonPower(); + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + this.TrainingId = Request.QueryString["TrainingId"]; + this.SupTrainingId = Request.QueryString["SupTrainingId"]; + if (!String.IsNullOrEmpty(TrainingId)) + { + var q = BLL.TestTrainingService.GetTestTrainingById(TrainingId); + if (q != null) + { + this.SupTrainingId = q.SupTrainingId; + txtTrainingCode.Text = q.TrainingCode; + txtTrainingName.Text = q.TrainingName; + if (q.IsEndLever == true) + { + ckIsEndLever.Checked = true; + } + else + { + ckIsEndLever.Checked = false; + } + } + } + var supq = BLL.TestTrainingService.GetTestTrainingById(this.SupTrainingId); + if (supq != null) + { + this.txtSupTraining.Text = supq.TrainingName; + } + else + { + this.SupTrainingId = "0"; + this.txtSupTraining.Text = "考试试题库"; + } + } + } + + /// + /// + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + Model.Training_TestTraining training = new Training_TestTraining + { + TrainingCode = txtTrainingCode.Text.Trim(), + TrainingName = txtTrainingName.Text.Trim(), + SupTrainingId = this.SupTrainingId, + IsEndLever = this.ckIsEndLever.Checked, + }; + + if (String.IsNullOrEmpty(TrainingId)) + { + TrainingId = SQLHelper.GetNewID(typeof(Model.Training_TestTraining)); + training.TrainingId = TrainingId; + BLL.TestTrainingService.AddTestTraining(training); + } + else + { + training.TrainingId = TrainingId; + BLL.TestTrainingService.UpdateTestTraining(training); + } + // 2. 关闭本窗体,然后刷新父窗体 + // PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + // 2. 关闭本窗体,然后回发父窗体 + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + //PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(trainingId) + ActiveWindow.GetHideReference()); + + } + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TestTrainingMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + + #region 验证考试试题库名称是否存在 + /// + /// 验证考试试题库名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + var standard = Funs.DB.Training_TestTraining.FirstOrDefault(x => x.TrainingName == this.txtTrainingName.Text.Trim() && (x.TrainingId != this.TrainingId || (this.TrainingId == null && x.TrainingId != null))); + if (standard != null) + { + ShowNotify("输入的名称已存在!", MessageBoxIcon.Warning); + } + } + #endregion + } +} \ No newline at end of file diff --git a/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingSave.aspx.designer.cs b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingSave.aspx.designer.cs new file mode 100644 index 0000000..9a94c6e --- /dev/null +++ b/SUBQHSE/FineUIPro.Web/HSSE/EduTrain/WorkPostTestTrainingSave.aspx.designer.cs @@ -0,0 +1,107 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class WorkPostTestTrainingSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtSupTraining 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSupTraining; + + /// + /// txtTrainingCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingCode; + + /// + /// txtTrainingName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtTrainingName; + + /// + /// ckIsEndLever 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBox ckIsEndLever; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs b/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs index 54c0fed..5ed4d58 100644 --- a/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs +++ b/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs @@ -822,70 +822,74 @@ namespace FineUIPro.Web.HSSE.SitePerson { initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(电工).doc"; } - // else if (person.WorkPostName == "电焊工") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(电焊工).doc"; - // } - // else if (person.WorkPostName == "防水普工") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(防水普工).doc"; - // } - // else if (person.WorkPostName == "钢筋工") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(钢筋工).doc"; - // } - // else if (person.WorkPostName == "管理人员") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(管理人员).doc"; - // } - // else if (person.WorkPostName == "架子工") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(架子工).doc"; - // } - // else if (person.WorkPostName == "木工") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(木工).doc"; - // } - // else if (person.WorkPostName == "普工") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(普工).doc"; - // } - // else if (person.WorkPostName == "施工电梯司机") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(施工电梯司机).doc"; - // } - // else if (person.WorkPostName == "水电工") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(水电工).doc"; - // } - // else if (person.WorkPostName == "司索信号工") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(司索信号工).doc"; - // } - // else if (person.WorkPostName == "塔吊司机") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(塔吊司机).doc"; - // } - // else if (person.WorkPostName == "挖机司机") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(挖机司机).doc"; - // } - // else if (person.WorkPostName == "瓦工") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(瓦工).doc"; - // } - // else if (person.WorkPostName == "渣土车司机") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(渣土车司机).doc"; - // } - // else if (person.WorkPostName == "桩基") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(桩基).doc"; - // } - // else if (person.WorkPostName == "装配、灌浆工") - // { - // initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(装配、灌浆工).doc"; - // } + else if (person.WorkPostName == "电焊工") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(电焊工).doc"; + } + else if (person.WorkPostName == "防水普工") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(防水普工).doc"; + } + else if (person.WorkPostName == "钢筋工") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(钢筋工).doc"; + } + else if (person.WorkPostName == "管理人员") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(管理人员).doc"; + } + else if (person.WorkPostName == "架子工") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(架子工).doc"; + } + else if (person.WorkPostName == "木工") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(木工).doc"; + } + else if (person.WorkPostName == "普工") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(普工).doc"; + } + else if (person.WorkPostName == "施工电梯司机") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(施工电梯司机).doc"; + } + else if (person.WorkPostName == "水电工") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(水电工).doc"; + } + else if (person.WorkPostName == "司索信号工") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(司索信号工).doc"; + } + else if (person.WorkPostName == "塔吊司机") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(塔吊司机).doc"; + } + else if (person.WorkPostName == "挖机司机") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(挖机司机).doc"; + } + else if (person.WorkPostName == "瓦工") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(瓦工).doc"; + } + else if (person.WorkPostName == "渣土车司机") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(渣土车司机).doc"; + } + else if (person.WorkPostName == "桩基") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(桩基).doc"; + } + else if (person.WorkPostName == "装配、灌浆工") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(装配、灌浆工).doc"; + } + else if (person.WorkPostName == "班组管理员") + { + initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(班组管理员).doc"; + } else { Alert.ShowInTop("当前岗位类型不可导出!", MessageBoxIcon.Warning); @@ -965,7 +969,7 @@ namespace FineUIPro.Web.HSSE.SitePerson int MValueCount = 0; int JValue = 0; int JValueCount = 0; - Sys_TestRule sysTestRule = null; + // Sys_TestRule sysTestRule = null; IQueryable getTestItems = null; List getSingleItem = new List(); List getMultipleItem = new List(); @@ -985,21 +989,21 @@ namespace FineUIPro.Web.HSSE.SitePerson unitName = BLL.UnitService.GetUnitNameByUnitId(person.UnitId); workPostName = WorkPostService.getWorkPostNamesWorkPostIds(person.WorkPostId); - sysTestRule = Funs.DB.Sys_TestRule.FirstOrDefault(); + // sysTestRule = Funs.DB.Sys_TestRule.FirstOrDefault(); getTestItems = from x in Funs.DB.Training_TestRecordItem where x.TestRecordId == TestRecordId select x; getSingleItem = getTestItems.Where(x => x.TestType == "1").ToList(); - SValue = sysTestRule.SValue; //每题分数 - SValueCount = sysTestRule.SValue * getSingleItem.Count; //总分 + // SValue = sysTestRule.SValue; //每题分数 + // SValueCount = sysTestRule.SValue * getSingleItem.Count; //总分 getMultipleItem = getTestItems.Where(x => x.TestType == "2").ToList(); - MValue = sysTestRule.MValue; //每题分数 - MValueCount = sysTestRule.MValue * getMultipleItem.Count; //总分 + // MValue = sysTestRule.MValue; //每题分数 + // MValueCount = sysTestRule.MValue * getMultipleItem.Count; //总分 getIsTrueItem = getTestItems.Where(x => x.TestType == "3").ToList(); - JValue = sysTestRule.JValue; //每题分数 - JValueCount = sysTestRule.JValue * getIsTrueItem.Count; //总分 + // JValue = sysTestRule.JValue; //每题分数 + // JValueCount = sysTestRule.JValue * getIsTrueItem.Count; //总分 } if (!string.IsNullOrEmpty(sign1)) @@ -1081,6 +1085,8 @@ namespace FineUIPro.Web.HSSE.SitePerson if (getSingleItem.Count > 0) { + SValue = (int)getSingleItem.FirstOrDefault().Score; //每题分数 + SValueCount = (int)getSingleItem.Sum(item => item.Score); //总分 int num = 1; foreach (var item in getSingleItem) { @@ -1132,6 +1138,8 @@ namespace FineUIPro.Web.HSSE.SitePerson tableM.Columns.Add("MOption"); if (getMultipleItem.Count > 0) { + MValue = (int)getMultipleItem.FirstOrDefault().Score; //每题分数 + MValueCount = (int)getMultipleItem.Sum(item => item.Score); //总分 int num = 1; foreach (var item in getMultipleItem) { @@ -1183,6 +1191,8 @@ namespace FineUIPro.Web.HSSE.SitePerson if (getIsTrueItem.Count > 0) { + JValue = (int)getIsTrueItem.FirstOrDefault().Score; //每题分数 + JValueCount = (int)getIsTrueItem.Sum(item => item.Score); //总分 int num = 1; foreach (var item in getIsTrueItem) { diff --git a/SUBQHSE/Model/Model.cs b/SUBQHSE/Model/Model.cs index d98d96b..ac4badf 100644 --- a/SUBQHSE/Model/Model.cs +++ b/SUBQHSE/Model/Model.cs @@ -439196,6 +439196,8 @@ namespace Model private string _EItemRussian; + private System.Nullable _Score; + private EntityRef _Training_TestTraining; private EntityRef _Training; @@ -439260,6 +439262,8 @@ namespace Model partial void OnDItemRussianChanged(); partial void OnEItemRussianChanging(string value); partial void OnEItemRussianChanged(); + partial void OnScoreChanging(System.Nullable value); + partial void OnScoreChanged(); #endregion public Training_TestTrainingItem() @@ -439833,6 +439837,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Score", DbType="Int")] + public System.Nullable Score + { + get + { + return this._Score; + } + set + { + if ((this._Score != value)) + { + this.OnScoreChanging(value); + this.SendPropertyChanging(); + this._Score = value; + this.SendPropertyChanged("Score"); + this.OnScoreChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_TestTrainingItem_Training_TestTraining", Storage="_Training_TestTraining", ThisKey="TrainingId", OtherKey="TrainingId", IsForeignKey=true)] public Training_TestTraining Training_TestTraining { @@ -486479,6 +486503,8 @@ namespace Model private System.Nullable _TrainCount; + private System.Nullable _TestCount; + private string _AuditorId; private string _AuditorName; @@ -487217,6 +487243,22 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TestCount", DbType="Int")] + public System.Nullable TestCount + { + get + { + return this._TestCount; + } + set + { + if ((this._TestCount != value)) + { + this._TestCount = value; + } + } + } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AuditorId", DbType="NVarChar(50)")] public string AuditorId { @@ -492417,6 +492459,8 @@ namespace Model private string _EItemEng; + private System.Nullable _Score; + private string _AnswerItems; public View_Training_TestTrainingItem() @@ -492791,6 +492835,22 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Score", DbType="Int")] + public System.Nullable Score + { + get + { + return this._Score; + } + set + { + if ((this._Score != value)) + { + this._Score = value; + } + } + } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AnswerItems", DbType="NVarChar(50)")] public string AnswerItems { diff --git a/SUBQHSE/WebAPI/Controllers/HSSE/TestPlanController.cs b/SUBQHSE/WebAPI/Controllers/HSSE/TestPlanController.cs index 7d89ac7..6e88831 100644 --- a/SUBQHSE/WebAPI/Controllers/HSSE/TestPlanController.cs +++ b/SUBQHSE/WebAPI/Controllers/HSSE/TestPlanController.cs @@ -429,5 +429,104 @@ namespace WebAPI.Controllers } #endregion + + #region 根据PersonId的岗位获取试卷 + + /// + /// 根据PersonId的岗位获取试卷 + /// + /// 人员ID + /// + public Model.ResponeData getTestPlanRecordItemByPersonId(string personId, string projectId) + { + var responeData = new Model.ResponeData(); + try + { + var person = Funs.DB.View_SitePerson_Person.FirstOrDefault(x => x.PersonId == personId); + if (person != null) + { + Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord + { + TestRecordId = SQLHelper.GetNewID(), + ProjectId = projectId, + TestManId = person.PersonId + }; + TestRecordService.AddTestRecord(newTestRecord); + + var testRecordId = CreateTestRecordItemNew(newTestRecord.TestRecordId, person); + responeData.code = 1; + responeData.data = new { testRecordId }; + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + + public static string CreateTestRecordItemNew(string testRecordId, Model.View_SitePerson_Person person) + { + using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString)) + { + var getTestTrainingItemList = (from x in Funs.DB.Training_TestTrainingItem + where x.TrainingId == "99ccf4c8-6f8e-47da-a900-53b12a278f25" && + x.WorkPostNames.Contains(person.WorkPostName) + orderby x.TestType, x.TrainingItemCode + select new + { + x.TrainingItemId, + x.TrainingId, + x.TrainingItemName, + x.TrainingItemCode, + x.Abstracts, + x.AttachUrl, + x.TestType, + x.WorkPostIds, + x.WorkPostNames, + x.AItem, + x.BItem, + x.CItem, + x.DItem, + x.EItem, + x.AnswerItems, + x.Score + }).ToList(); + + + if (getTestTrainingItemList.Count() > 0) + { + var getItems = from x in getTestTrainingItemList + select new Model.Training_TestRecordItem + { + TestRecordItemId = SQLHelper.GetNewID(), + TestRecordId = testRecordId, + TrainingItemName = x.TrainingItemName, + TrainingItemCode = x.TrainingItemCode, + Abstracts = x.Abstracts, + AttachUrl = x.AttachUrl, + TestType = x.TestType, + AItem = x.AItem, + BItem = x.BItem, + CItem = x.CItem, + DItem = x.DItem, + EItem = x.EItem, + AnswerItems = x.AnswerItems, + Score = x.Score, + }; + + db.Training_TestRecordItem.InsertAllOnSubmit(getItems); + db.SubmitChanges(); + } + + return testRecordId; + } + } + + #endregion + } } diff --git a/SUBQHSE/WebAPI/Controllers/HSSE/TestRecordController.cs b/SUBQHSE/WebAPI/Controllers/HSSE/TestRecordController.cs index ceffeb2..387c9a7 100644 --- a/SUBQHSE/WebAPI/Controllers/HSSE/TestRecordController.cs +++ b/SUBQHSE/WebAPI/Controllers/HSSE/TestRecordController.cs @@ -634,5 +634,73 @@ namespace WebAPI.Controllers #endregion + + + #region 岗位交卷 + /// + /// 岗位交卷 + /// 试卷ID + /// + public Model.ResponeData SaveSubmitTestRecord(string testRecordId,string Signature) + { + var responeData = new Model.ResponeData(); + try + { + using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString)) + { + string returnTestRecordId = string.Empty; + decimal getTestScores = 0; + var getTestRecord = db.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId); + if (getTestRecord != null) + { + if (getTestRecord.TestStartTime.HasValue) + { + getTestRecord.Signature = Signature; + getTestRecord.TestEndTime = DateTime.Now; + getTestRecord.TestScores = db.Training_TestRecordItem.Where(x => x.TestRecordId == testRecordId).Sum(x => x.SubjectScore ?? 0); + db.SubmitChanges(); + getTestScores = getTestRecord.TestScores ?? 0; + } + + ////考试分数 + int getPassScores = 70; + if (getTestScores < getPassScores) + { + int testCount = db.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count(); + if (testCount < 2) + { + ////重新生成一条考试记录 以及考试试卷 + returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord); + responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。"; + } + else + { + // APITestRecordService.updateAll(getTestRecord.TestPlanId); + responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。"; + } + } + else + { + // APITestRecordService.updateAll(getTestRecord.TestPlanId); + responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。"; + } + + responeData.data = new { getTestScores, getPassScores, returnTestRecordId }; + } + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + + #endregion + + } } diff --git a/SUBQHSE/WebAPI/Controllers/PersonController.cs b/SUBQHSE/WebAPI/Controllers/PersonController.cs index 5340c0c..bb6d14e 100644 --- a/SUBQHSE/WebAPI/Controllers/PersonController.cs +++ b/SUBQHSE/WebAPI/Controllers/PersonController.cs @@ -1158,15 +1158,24 @@ namespace WebAPI.Controllers { if (person != null && !string.IsNullOrEmpty(person.IdentityCard)) { - var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == person.IdentityCard.Trim() && x.ProjectId == person.ProjectId); + var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == person.IdentityCard.Trim() && x.UnitId == person.UnitId); if (getPerson != null) { responeData.code = -1; - responeData.message = "该身份证号码已存在两条记录,请联系管理员处理!"; + responeData.message = "该身份证号码在次单位下已存在两条记录,请联系管理员处理!"; } else { - + var items = db.SitePerson_Person.Where(x => x.IdentityCard == person.IdentityCard.Trim()).ToList(); + if (items.Count > 0) + { + foreach (var item in items) + { + item.IsUsedType = "0"; + PersonService.UpdatePerson(item); + } + } + Model.SitePerson_Person newPerson = new Model.SitePerson_Person { PersonId = SQLHelper.GetNewID(), diff --git a/SUBQHSE/WebAPI/Filter/TestPermissionAttribute.cs b/SUBQHSE/WebAPI/Filter/TestPermissionAttribute.cs index 0ed799a..d05779f 100644 --- a/SUBQHSE/WebAPI/Filter/TestPermissionAttribute.cs +++ b/SUBQHSE/WebAPI/Filter/TestPermissionAttribute.cs @@ -154,6 +154,11 @@ namespace WebAPI.Filter , "ProjectUnitPenetrate*getDataByProjectUnitId" , "Rectify*getRectifyList" , "Rectify*getRectifyItemListBy" + , "TestPlan*getTestPlanRecordItemByPersonId" + , "TestRecord*getTestRecordItemListByTestRecordId" + , "TestRecord*getTestTimesByTestRecordId" + , "TestRecord*getTestRecordItemAnswerBySelectedItem" + , "TestRecord*SaveSubmitTestRecord" }; /// diff --git a/SUBQHSE/WebAPI/WebAPI.csproj b/SUBQHSE/WebAPI/WebAPI.csproj index 31706d2..9253e70 100644 --- a/SUBQHSE/WebAPI/WebAPI.csproj +++ b/SUBQHSE/WebAPI/WebAPI.csproj @@ -204,6 +204,7 @@ +