diff --git a/SGGL/BLL/API/HSSE/APITrainingTaskService.cs b/SGGL/BLL/API/HSSE/APITrainingTaskService.cs
index 13aa098..565e820 100644
--- a/SGGL/BLL/API/HSSE/APITrainingTaskService.cs
+++ b/SGGL/BLL/API/HSSE/APITrainingTaskService.cs
@@ -76,7 +76,7 @@ namespace BLL
GetDataService.CreateTrainingTaskItemByTaskId(taskId);
var getDataLists = (from x in db.Training_TaskItem
- join y in db.Training_CompanyTrainingItem on x.TrainingItemCode equals y.CompanyTrainingItemCode into temp
+ join y in db.Training_CompanyTrainingItem on x.CompanyTrainingItemId equals y.CompanyTrainingItemId into temp
from y in temp.DefaultIfEmpty()
where x.TaskId == taskId
orderby x.TrainingItemCode
@@ -93,7 +93,8 @@ namespace BLL
PersonId = x.PersonId,
TrainingItemCode = x.TrainingItemCode,
TrainingItemName = x.TrainingItemName,
- AttachUrl = x.AttachUrl.Replace('\\', '/'),
+ AttachUrl = db.AttachFile.FirstOrDefault(y => y.ToKeyId == x.CompanyTrainingItemId).AttachUrl.Replace("\\", "/"),
+ //AttachUrl = x.AttachUrl.Replace('\\', '/'),
}).ToList();
return getDataLists;
}
@@ -325,6 +326,17 @@ namespace BLL
item.LearnTime = item.LearnTime.Value + (int)span.TotalMinutes;
item.EndTime = endTime;
db.SubmitChanges();
+ var companyTrainingItem = db.Training_CompanyTrainingItem.FirstOrDefault(x => x.CompanyTrainingItemCode == item.TrainingItemCode);
+ int companyTrainingItemLearnTime = companyTrainingItem?.LearningTime ?? 0; //培训教材时长(秒)
+
+ //如果学习时长大于培训教材时长,则关闭状态
+ if (item.LearnTime > companyTrainingItemLearnTime)
+ {
+ var taskModel = db.Training_Task.FirstOrDefault(x => x.TaskId == item.TaskId);
+ taskModel.States = "2";
+ db.SubmitChanges();
+ }
+
return item;
}
}
diff --git a/SGGL/BLL/HSSE/EduTrain/TrainingPlanService.cs b/SGGL/BLL/HSSE/EduTrain/TrainingPlanService.cs
index ecba009..ee13d04 100644
--- a/SGGL/BLL/HSSE/EduTrain/TrainingPlanService.cs
+++ b/SGGL/BLL/HSSE/EduTrain/TrainingPlanService.cs
@@ -42,11 +42,15 @@ namespace BLL
///
public static List GetThisYearPlanByCompanyTrainingItemId(string projectId, string itemId, int year)
{
- return db.Training_Plan.Where(e => e.ProjectId == projectId && e.CompanyTrainingItemId == itemId && e.IsRetakeCourse != 1 && ((DateTime)e.DesignerDate).Year == year).ToList();
+ var list = db.Training_Plan.Where(e => e.CompanyTrainingItemId == itemId && e.IsRetakeCourse != 1 && ((DateTime)e.DesignerDate).Year == year).ToList();
+ if (!string.IsNullOrWhiteSpace(projectId))
+ {
+ list = list.Where(x => x.ProjectId == projectId).ToList();
+ }
+ return list;
}
-
///
/// 添加培训计划
///
@@ -297,86 +301,103 @@ namespace BLL
}
}
- //生成培训计划
- string planId = SQLHelper.GetNewID();
- string code = ProjectService.GetProjectByProjectId(info.CurrProjectId).ProjectCode + "-";
- string planCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", info.CurrProjectId, code);
+ #region 生成培训计划
- Model.Training_Plan planModel = new Model.Training_Plan
+ List projectIds = new List();
+ if (!string.IsNullOrWhiteSpace(info.CurrProjectId))
{
- PlanId = planId,
- PlanCode = planCode,
- ProjectId = info.CurrProjectId,
- DesignerId = info.CurrUserId,
- DesignerDate = DateTime.Now,
- PlanName = companyTrainingItem.CompanyTrainingItemName,
- TrainContent = companyTrainingItem.CompanyTrainingItemName,
- TrainStartDate = DateTime.Now,
- TrainEndDate = info.TrainEndDate,
- TeachHour = teachHour,
- //TeachMan = companyTrainingItem.,
- //TeachAddress = model.TeachAddress,
- TrainTypeId = Const.EntryTrainTypeId,
- TrainLevelId = Const.OtherTrainLevelId,
- UnitIds = unitIds,
- WorkPostId = companyTrainingItem.WorkPostIds,
- States = "1",
- Cycle = "",
- //IsRetakeCourse = 0,
- //CheckType = info.CheckType.ToString(),
- //CheckId = info.CheckId,
- CompanyTrainingItemId = info.CompanyTrainingItemId
- };
- AddPlan(planModel);
-
- //新增培训明细
- Model.Training_PlanItem newPlanItem = new Model.Training_PlanItem
+ projectIds.Add(info.CurrProjectId);
+ }
+ else
{
- PlanItemId = SQLHelper.GetNewID(),
- PlanId = planId,
- CompanyTrainingItemId = info.CompanyTrainingItemId,
- CompanyTrainingId = companyTrainingItem.CompanyTrainingId
- };
- TrainingPlanItemService.AddPlanItem(newPlanItem);
-
- List newTasks = new List();
- List newTaskItems = new List();
- //循环给人员添加任务
- foreach (var person in workPostPersons)
- {
- string taskId = SQLHelper.GetNewID();
- //新增培训任务
- Model.Training_Task newTask = new Model.Training_Task
- {
- TaskId = taskId,
- ProjectId = info.CurrProjectId,
- PlanId = planId,
- UserId = person.PersonId,
- TaskDate = DateTime.Now,
- States = Const.State_1,
- };
- newTasks.Add(newTask);
-
- //新增培训任务明细
- Model.Training_TaskItem newTaskItem = new Model.Training_TaskItem
- {
- TaskItemId = SQLHelper.GetNewID(),
- TaskId = taskId,
- PlanId = planId,
- PersonId = person.PersonId,
- TrainingItemCode = companyTrainingItem.CompanyTrainingItemCode,
- TrainingItemName = companyTrainingItem.CompanyTrainingItemName,
- AttachUrl = companyTrainingItem.AttachUrl,
- CompanyTrainingItemId = info.CompanyTrainingItemId,
- //LearnTime = trainingItem.LearningTime,
- //VideoProgress = 0,
- };
- newTaskItems.Add(newTaskItem);
+ var getProjects = ProjectService.GetProjectWorkList();
+ projectIds = getProjects.Select(x => x.ProjectId).ToList();
}
- db.Training_Task.InsertAllOnSubmit(newTasks);
- db.Training_TaskItem.InsertAllOnSubmit(newTaskItems);
- db.SubmitChanges();
+ foreach (var pid in projectIds)
+ {
+ string planId = SQLHelper.GetNewID();
+ string code = ProjectService.GetProjectByProjectId(pid).ProjectCode + "-";
+ string planCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", pid, code);
+
+ Model.Training_Plan planModel = new Model.Training_Plan
+ {
+ PlanId = planId,
+ PlanCode = planCode,
+ ProjectId = pid,
+ DesignerId = info.CurrUserId,
+ DesignerDate = DateTime.Now,
+ PlanName = companyTrainingItem.CompanyTrainingItemName,
+ TrainContent = companyTrainingItem.CompanyTrainingItemName,
+ TrainStartDate = DateTime.Now,
+ TrainEndDate = info.TrainEndDate,
+ TeachHour = teachHour,
+ //TeachMan = companyTrainingItem.,
+ //TeachAddress = model.TeachAddress,
+ TrainTypeId = Const.EntryTrainTypeId,
+ TrainLevelId = Const.OtherTrainLevelId,
+ UnitIds = unitIds,
+ WorkPostId = companyTrainingItem.WorkPostIds,
+ States = "1",
+ Cycle = "",
+ //IsRetakeCourse = 0,
+ //CheckType = info.CheckType.ToString(),
+ //CheckId = info.CheckId,
+ CompanyTrainingItemId = info.CompanyTrainingItemId
+ };
+ AddPlan(planModel);
+
+ //新增培训明细
+ Model.Training_PlanItem newPlanItem = new Model.Training_PlanItem
+ {
+ PlanItemId = SQLHelper.GetNewID(),
+ PlanId = planId,
+ CompanyTrainingItemId = info.CompanyTrainingItemId,
+ CompanyTrainingId = companyTrainingItem.CompanyTrainingId
+ };
+ TrainingPlanItemService.AddPlanItem(newPlanItem);
+
+ List newTasks = new List();
+ List newTaskItems = new List();
+ //循环给人员添加任务
+ foreach (var person in workPostPersons)
+ {
+ string taskId = SQLHelper.GetNewID();
+ //新增培训任务
+ Model.Training_Task newTask = new Model.Training_Task
+ {
+ TaskId = taskId,
+ ProjectId = pid,
+ PlanId = planId,
+ UserId = person.PersonId,
+ TaskDate = DateTime.Now,
+ States = Const.State_1,
+ };
+ newTasks.Add(newTask);
+
+ //新增培训任务明细
+ Model.Training_TaskItem newTaskItem = new Model.Training_TaskItem
+ {
+ TaskItemId = SQLHelper.GetNewID(),
+ TaskId = taskId,
+ PlanId = planId,
+ PersonId = person.PersonId,
+ TrainingItemCode = companyTrainingItem.CompanyTrainingItemCode,
+ TrainingItemName = companyTrainingItem.CompanyTrainingItemName,
+ AttachUrl = companyTrainingItem.AttachUrl,
+ CompanyTrainingItemId = info.CompanyTrainingItemId,
+ //LearnTime = trainingItem.LearningTime,
+ //VideoProgress = 0,
+ };
+ newTaskItems.Add(newTaskItem);
+ }
+
+ db.Training_Task.InsertAllOnSubmit(newTasks);
+ db.Training_TaskItem.InsertAllOnSubmit(newTaskItems);
+ db.SubmitChanges();
+ }
+
+ #endregion
}
///
diff --git a/SGGL/BLL/HSSE/SitePerson/PersonService.cs b/SGGL/BLL/HSSE/SitePerson/PersonService.cs
index f65c130..38706e1 100644
--- a/SGGL/BLL/HSSE/SitePerson/PersonService.cs
+++ b/SGGL/BLL/HSSE/SitePerson/PersonService.cs
@@ -336,7 +336,7 @@ namespace BLL
{
foreach (var work in workPostIds)
{
- var plist = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && x.ProjectId == projectId && x.WorkPostId == work select x).ToList();
+ var plist = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && x.WorkPostId == work select x).ToList();
if (plist.Any())
{
list.AddRange(plist);
@@ -345,7 +345,12 @@ namespace BLL
}
else
{
- list = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && x.ProjectId == projectId select x).ToList();
+ list = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true select x).ToList();
+ }
+
+ if (!string.IsNullOrWhiteSpace(projectId))
+ {
+ list = list.Where(x => x.ProjectId == projectId).ToList();
}
return list;
}
diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainFind.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainFind.aspx.cs
index ae93069..42b04a5 100644
--- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainFind.aspx.cs
+++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainFind.aspx.cs
@@ -111,7 +111,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
strSql += " AND PersonName LIKE @PersonName";
listStr.Add(new SqlParameter("@PersonName", "%" + this.txtPersonName.Text.Trim() + "%"));
}
- if (this.drpUnitId.SelectedValue != BLL.Const._Null)
+ if (this.drpUnitId.SelectedValue != null && this.drpUnitId.SelectedValue != BLL.Const._Null)
{
strSql += " AND UnitId = @UnitId";
listStr.Add(new SqlParameter("@UnitId", this.drpUnitId.SelectedValue.Trim()));
diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs
index 62c1af5..d6c7872 100644
--- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs
+++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs
@@ -78,7 +78,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
this.GetButtonPower();
this.btnMenuDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!");
this.btnMenuDelete.ConfirmText = String.Format("你确定要删除选中的 行数据吗?", Grid1.GetSelectedCountReference());
-
+
//培训类型
BLL.TrainTypeService.InitTrainTypeDropDownList(this.drpTrainType, true);
trainType = Request.Params["trainType"];
@@ -129,7 +129,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
{
this.UnitId = "";
}
- this.BindGrid();
+ this.BindGrid();
this.GetButtonPower();
if (string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
{
@@ -172,7 +172,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
strSql += " AND TrainRecord.TrainTitle LIKE @TrainTitle";
listStr.Add(new SqlParameter("@TrainTitle", "%" + this.txtName.Text + "%"));
}
-
+
if (!string.IsNullOrEmpty(this.ProjectId))
{
@@ -216,7 +216,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
strSql += " AND TrainRecord.UnitIds LIKE @UnitId1";
listStr.Add(new SqlParameter("@UnitId1", "%" + this.CurrUser.UnitId + "%"));
}
- if (this.drpUnitId.SelectedValue != BLL.Const._Null)
+ if (this.drpUnitId.SelectedValue != null && this.drpUnitId.SelectedValue != BLL.Const._Null)
{
strSql += " AND TrainRecord.UnitIds LIKE @UnitIds";
listStr.Add(new SqlParameter("@UnitIds", "%" + this.drpUnitId.SelectedValue.Trim() + "%"));
diff --git a/SGGL/FineUIPro.Web/HSSE/Meeting/ClassMeeting.aspx b/SGGL/FineUIPro.Web/HSSE/Meeting/ClassMeeting.aspx
index 308a80e..785b513 100644
--- a/SGGL/FineUIPro.Web/HSSE/Meeting/ClassMeeting.aspx
+++ b/SGGL/FineUIPro.Web/HSSE/Meeting/ClassMeeting.aspx
@@ -1,5 +1,6 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ClassMeeting.aspx.cs" Inherits="FineUIPro.Web.HSSE.Meeting.ClassMeeting" %>
+<%@ Register Src="~/Controls/UnitProjectTControl.ascx" TagName="UnitProjectTControl" TagPrefix="uc1" %>
@@ -8,105 +9,124 @@
行数据吗?", Grid1.GetSelectedCountReference());
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
@@ -69,6 +77,27 @@ namespace FineUIPro.Web.HSSE.SitePerson
this.InitTreeMenu();//加载树
}
}
+ ///
+ /// 公司级树加载
+ ///
+ ///
+ ///
+ protected void changeTree(object sender, EventArgs e)
+ {
+ this.ProjectId = this.ucTree.ProjectId;
+ this.InitTreeMenu();
+ this.BindGrid();
+ this.GetButtonPower();
+ if (string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
+ {
+ btnNew.Hidden = true;
+ btnImport.Hidden = true;
+ btnPersonOut.Hidden = true;
+ btnMenuEdit.Hidden = true;
+ btnMenuDelete.Hidden = true;
+ //btnMenuBlackList.Hidden = true;
+ }
+ }
///
/// 加载树
@@ -79,46 +108,18 @@ namespace FineUIPro.Web.HSSE.SitePerson
var project = BLL.ProjectService.GetProjectByProjectId(this.ProjectId);
if (project != null)
{
- //var personLists = BLL.PersonService.GetPersonList(project.ProjectId);
-
- String strSql1 = @"select UnitId,count( * ) num from SitePerson_Person
- where ProjectId='" + this.CurrUser.LoginProjectId + @"'
- group by UnitId";
-
- String strSql2 = @" select UnitId,count( * ) num from SitePerson_Person
- where ProjectId='" + this.CurrUser.LoginProjectId + @"' and IsUsed =1 and InTime<='" + DateTime.Now.ToString("yyyy-MM-dd") + "' and (OutTime is null or OutTime>'" + DateTime.Now.ToString("yyyy-MM-dd") + @"' )
- group by UnitId";
-
-
- DataTable dt1 = SQLHelper.GetDataTableRunText(strSql1, null);
- DataTable dt2 = SQLHelper.GetDataTableRunText(strSql2, null);
- int proTotal = 0;
- int proIn = 0;
- if (dt1 != null && dt1.Rows.Count > 0)
- {
- foreach (DataRow row in dt1.Rows)
- {
- proTotal += int.Parse(row["num"].ToString());
- }
- }
- if (dt2 != null && dt2.Rows.Count > 0)
- {
- foreach (DataRow row in dt2.Rows)
- {
- proIn += int.Parse(row["num"].ToString());
- }
- }
+ var personLists = BLL.PersonService.GetPersonList(project.ProjectId);
TreeNode rootNode = new TreeNode();
rootNode = new TreeNode
{
Text = project.ProjectName,
NodeID = project.ProjectId
};
- if (proTotal > 0)
+ if (personLists.Count() > 0)
{
- //var personIn = personLists.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.IsUsed == true
- // && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime > DateTime.Now)).ToList();
- rootNode.ToolTip = "当前项目人员总数:" + proTotal + ";在场人员数:" + proIn + ";离场人员数:" + (proTotal - proIn);
+ var personIn = personLists.Where(x => x.ProjectId == this.ProjectId && x.IsUsed == true
+ && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime > DateTime.Now)).ToList();
+ rootNode.ToolTip = "当前项目人员总数:" + personLists.Count() + ";在场人员数:" + personIn.Count() + ";离场人员数:" + (personLists.Count() - personIn.Count());
}
else
{
@@ -126,7 +127,117 @@ namespace FineUIPro.Web.HSSE.SitePerson
}
rootNode.Expanded = true;
this.tvProjectAndUnit.Nodes.Add(rootNode);
- GetUnitLists(rootNode.Nodes, this.ProjectId, dt1, dt2);
+ GetUnitLists(rootNode.Nodes, this.ProjectId, personLists);
+
+ ////var personLists = BLL.PersonService.GetPersonList(project.ProjectId);
+
+ //String strSql1 = @"select UnitId,count( * ) num from SitePerson_Person
+ // where ProjectId='" + this.CurrUser.LoginProjectId + @"'
+ // group by UnitId";
+
+ //String strSql2 = @" select UnitId,count( * ) num from SitePerson_Person
+ // where ProjectId='" + this.CurrUser.LoginProjectId + @"' and IsUsed =1 and InTime<='" + DateTime.Now.ToString("yyyy-MM-dd") + "' and (OutTime is null or OutTime>'" + DateTime.Now.ToString("yyyy-MM-dd") + @"' )
+ // group by UnitId";
+
+
+ //DataTable dt1 = SQLHelper.GetDataTableRunText(strSql1, null);
+ //DataTable dt2 = SQLHelper.GetDataTableRunText(strSql2, null);
+ //int proTotal = 0;
+ //int proIn = 0;
+ //if (dt1 != null && dt1.Rows.Count > 0)
+ //{
+ // foreach (DataRow row in dt1.Rows)
+ // {
+ // proTotal += int.Parse(row["num"].ToString());
+ // }
+ //}
+ //if (dt2 != null && dt2.Rows.Count > 0)
+ //{
+ // foreach (DataRow row in dt2.Rows)
+ // {
+ // proIn += int.Parse(row["num"].ToString());
+ // }
+ //}
+ //TreeNode rootNode = new TreeNode();
+ //rootNode = new TreeNode
+ //{
+ // Text = project.ProjectName,
+ // NodeID = project.ProjectId
+ //};
+ //if (proTotal > 0)
+ //{
+ // //var personIn = personLists.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.IsUsed == true
+ // // && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime > DateTime.Now)).ToList();
+ // rootNode.ToolTip = "当前项目人员总数:" + proTotal + ";在场人员数:" + proIn + ";离场人员数:" + (proTotal - proIn);
+ //}
+ //else
+ //{
+ // rootNode.ToolTip = "当前项目人员总数:0";
+ //}
+ //rootNode.Expanded = true;
+ //this.tvProjectAndUnit.Nodes.Add(rootNode);
+ //GetUnitLists(rootNode.Nodes, this.ProjectId, dt1, dt2);
+ }
+ }
+
+ ///
+ /// 加载单位
+ ///
+ ///
+ ///
+ private void GetUnitLists(TreeNodeCollection nodes, string parentId, List personLists)
+ {
+ List unitLists = BLL.UnitService.GetUnitByProjectIdList(parentId);
+ if (unitLists.Count() > 0)
+ {
+ if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(parentId, this.CurrUser.UnitId))
+ {
+ unitLists = unitLists.Where(x => x.UnitId == this.CurrUser.UnitId).ToList();
+ }
+
+ //添加其他单位/无单位人员
+ Model.Base_Unit otherUnit = new Model.Base_Unit
+ {
+ UnitId = "0",
+ UnitName = "其他"
+ };
+ unitLists.Add(otherUnit);
+
+ TreeNode newNode = null;
+ foreach (var q in unitLists)
+ {
+ newNode = new TreeNode
+ {
+ Text = q.UnitName,
+ NodeID = q.UnitId + "|" + parentId,
+ ToolTip = q.UnitName
+ };
+ if (personLists.Count() > 0)
+ {
+ var personUnitLists = personLists.Where(x => x.UnitId == q.UnitId);
+ if (q.UnitId == "0")
+ {
+ personUnitLists = personLists.Where(x => x.UnitId == null);
+ }
+
+ if (personUnitLists.Count() > 0)
+ {
+ var personIn = personUnitLists.Where(x => x.InTime <= System.DateTime.Now && x.IsUsed == true
+ && (!x.OutTime.HasValue || x.OutTime >= System.DateTime.Now));
+ newNode.ToolTip = q.UnitName + "人员总数:" + personUnitLists.Count() + ";在场人员数:" + personIn.Count() + ";离场人员数:" + (personUnitLists.Count() - personIn.Count());
+ }
+ else
+ {
+ newNode.ToolTip = q.UnitName + "人员总数:0";
+ }
+ }
+ else
+ {
+ newNode.ToolTip = q.UnitName + "人员总数:0";
+ }
+ newNode.EnableClickEvent = true;
+ nodes.Add(newNode);
+ }
}
}
diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.designer.cs
index daead55..b684ae9 100644
--- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.designer.cs
@@ -50,6 +50,33 @@ namespace FineUIPro.Web.HSSE.SitePerson
///
protected global::FineUIPro.Panel panelLeftRegion;
+ ///
+ /// ContentPanel1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.ContentPanel ContentPanel1;
+
+ ///
+ /// ucTree 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Web.Controls.UnitProjectTControl ucTree;
+
+ ///
+ /// panelLeftRegion1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Panel panelLeftRegion1;
+
///
/// tvProjectAndUnit 控件。
///
diff --git a/SGGL/FineUIPro.Web/common/main.aspx.cs b/SGGL/FineUIPro.Web/common/main.aspx.cs
index f9a7edf..8902ef2 100644
--- a/SGGL/FineUIPro.Web/common/main.aspx.cs
+++ b/SGGL/FineUIPro.Web/common/main.aspx.cs
@@ -86,10 +86,10 @@ namespace FineUIPro.Web.common
workSafetyDay10 = ((workSafetyDays % 100) / 10),
workSafetyDay100 = ((workSafetyDays % 1000) / 100),
workSafetyDay1000 = ((workSafetyDays % 10000) / 1000),
- projectsUnderConstruction = hsseData.BeUnderConstructionNum ?? 0,
- shutdownProject = hsseData.ShutdownNum ?? 0,
- participateInNum = hsseData.JoinConstructionPersonNum ?? 0,
- dangerousProject = hsseData.MajorProjectsUnderConstructionNum ?? 0
+ projectsUnderConstruction = hsseData != null ? hsseData.BeUnderConstructionNum ?? 0 : 0,
+ shutdownProject = hsseData != null ? hsseData.ShutdownNum ?? 0 : 0,
+ participateInNum = hsseData != null ? hsseData.JoinConstructionPersonNum ?? 0 : 0,
+ dangerousProject = hsseData != null ? hsseData.MajorProjectsUnderConstructionNum ?? 0 : 0,
},
//项目地图数据
chinaData = projects.Select(p => new
diff --git a/SGGL/Model/APIItem/HSSE/TestRecordItem.cs b/SGGL/Model/APIItem/HSSE/TestRecordItem.cs
index 5e63106..9933710 100644
--- a/SGGL/Model/APIItem/HSSE/TestRecordItem.cs
+++ b/SGGL/Model/APIItem/HSSE/TestRecordItem.cs
@@ -248,7 +248,21 @@ namespace Model
set;
}
-
-
+
+ ///
+ /// 签名
+ ///
+ public string Signature
+ {
+ get;
+ set;
+ }
+
+ public string Fingerprint
+ {
+ get;
+ set;
+ }
+
}
}
diff --git a/SGGL/WebAPI.zip b/SGGL/WebAPI.zip
deleted file mode 100644
index ccde669..0000000
Binary files a/SGGL/WebAPI.zip and /dev/null differ
diff --git a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs
index d7f2a1c..1195f1a 100644
--- a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs
+++ b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs
@@ -1,10 +1,14 @@
-using System;
+using BLL;
+using Model;
+using System;
using System.Collections.Generic;
+using System.Configuration;
+using System.Drawing;
+using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
-using BLL;
namespace WebAPI.Controllers
{
///
@@ -366,5 +370,132 @@ namespace WebAPI.Controllers
return responeData;
}
#endregion
+
+ #region 交卷
+ ///
+ /// 交卷
+ ///
+ public Model.ResponeData SaveSubmitTestRecordByTestRecordId(Model.TestRecordItem testRecordItem)
+ {
+ string testRecordId = testRecordItem.TestRecordId;
+ string Signature = testRecordItem.Signature;
+ string Fingerprint = testRecordItem.Fingerprint;
+ var responeData = new Model.ResponeData();
+ try
+ {
+ using (Model.CNPCDB db = new Model.CNPCDB(Funs.ConnString))
+ {
+ #region 将答题记录保存到数据库
+ RedisHelper redis = new RedisHelper();
+ var trainingTestRecordItems = redis.GetObjString>(testRecordId);
+
+ if (trainingTestRecordItems != null)
+ {
+ var modeltestRecordItem = from x in db.Training_TestRecordItem
+ where x.TestRecordId == testRecordId
+ select x;
+ if (modeltestRecordItem.Any())
+ {
+ db.Training_TestRecordItem.DeleteAllOnSubmit(modeltestRecordItem);
+ db.SubmitChanges();
+ }
+ db.Training_TestRecordItem.InsertAllOnSubmit(trainingTestRecordItems);
+ }
+ #endregion
+
+
+ var getTestRecord = db.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId);
+ if (getTestRecord != null)
+ {
+ string rootUrl = ConfigurationManager.AppSettings["localRoot"];
+ string SignatureUrl = @"FileUpload\TestRecord\" + getTestRecord.TestRecordId + "~签名" + ".png";
+ string FingerprintUrl = @"FileUpload\TestRecord\" + getTestRecord.TestRecordId + "~指纹" + ".png";
+ string Signaturefilename = rootUrl + SignatureUrl;
+ string Fingerprintfilename = rootUrl + FingerprintUrl;
+
+ if (!string.IsNullOrEmpty(Signature))
+ {
+ Signature = Signature.Replace("data:image/svg+xml;base64,", "").Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "").Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", "");//将base64头部信息替换
+ byte[] bytes = Convert.FromBase64String(Signature);
+
+ MemoryStream memStream = new MemoryStream(bytes);
+ Image mImage = Image.FromStream(memStream);
+ Bitmap bp = new Bitmap(mImage);
+ MemoryStream ms = new MemoryStream();
+ bp.Save(Signaturefilename, System.Drawing.Imaging.ImageFormat.Png);
+ // System.IO.File.WriteAllBytes(Signaturefilename, Convert.FromBase64String(Signature));
+
+ getTestRecord.Signature = Signaturefilename.Replace(rootUrl, "");
+
+ }
+ if (!string.IsNullOrEmpty(Fingerprint))
+ {
+ Fingerprint = Fingerprint.Replace("data:image/svg+xml;base64,", "").Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "").Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", "");//将base64头部信息替换
+
+ byte[] bytes = Convert.FromBase64String(Fingerprint);
+
+ MemoryStream memStream = new MemoryStream(bytes);
+ Image mImage = Image.FromStream(memStream);
+ Bitmap bp = new Bitmap(mImage);
+ MemoryStream ms = new MemoryStream();
+ bp.Save(Fingerprintfilename, System.Drawing.Imaging.ImageFormat.Png);
+
+ getTestRecord.Fingerprint = Fingerprintfilename.Replace(rootUrl, "");
+
+ }
+ db.SubmitChanges();
+ // APITestRecordService.updateTestRecord(getTestRecord);
+ string returnTestRecordId = string.Empty;
+ ////考试分数
+ decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord);
+
+ if (!string.IsNullOrEmpty(getTestRecord.TestPlanId))
+ { ////及格分数
+ int getPassScores = 80;
+ var testRule = db.Sys_TestRule.FirstOrDefault();
+ if (testRule != null)
+ {
+ getPassScores = testRule.PassingScore;
+ }
+ 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 };
+
+ }
+ else
+ {
+ responeData.data = new { getTestScores };
+
+ }
+
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+ return responeData;
+ }
+ #endregion
}
}