培训类型
This commit is contained in:
parent
156069a20b
commit
5e48a4ad91
|
@ -1,4 +1,5 @@
|
|||
using Newtonsoft.Json;
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SgManager.AI;
|
||||
using System;
|
||||
|
@ -520,31 +521,41 @@ namespace BLL
|
|||
}
|
||||
|
||||
}
|
||||
//List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
|
||||
//var getTrainType = db.Base_TrainType.FirstOrDefault(e => e.TrainTypeId == trainTypeId);
|
||||
//if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))
|
||||
//{
|
||||
// foreach (var item in getPersons)
|
||||
// {
|
||||
// var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail
|
||||
// join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId
|
||||
// where y.ProjectId ==null && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId
|
||||
// select x).FirstOrDefault();
|
||||
// if (getTrainPersonIdList1 == null)
|
||||
// {
|
||||
// var getTrainPersonIdList2 = (from x in db.Training_Task
|
||||
// join y in db.Training_Plan on x.PlanId equals y.PlanId
|
||||
// where y.ProjectId == null && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId
|
||||
// select x).FirstOrDefault();
|
||||
// if (getTrainPersonIdList2 == null)
|
||||
// {
|
||||
// getTrainPersonList.Add(item);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return getTrainPersonList;
|
||||
//}
|
||||
//else
|
||||
if (!string.IsNullOrEmpty(trainTypeId) && trainTypeId == Const.SpecialSafeTrainId)//专项安全培训
|
||||
{
|
||||
var ids = db.Base_WorkPost.Where(x => x.PostType == "2").Select(x => x.WorkPostId).ToList();
|
||||
getPersons = getPersons.Where(x => ids.Contains(x.DepartId));
|
||||
}
|
||||
|
||||
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
|
||||
var getTrainType = db.Base_TrainType.FirstOrDefault(e => e.TrainTypeId == trainTypeId);
|
||||
|
||||
|
||||
|
||||
|
||||
if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))
|
||||
{
|
||||
foreach (var item in getPersons)
|
||||
{
|
||||
var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail
|
||||
join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId
|
||||
where y.ProjectId == null && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId
|
||||
select x).FirstOrDefault();
|
||||
if (getTrainPersonIdList1 == null)
|
||||
{
|
||||
var getTrainPersonIdList2 = (from x in db.Training_Task
|
||||
join y in db.Training_Plan on x.PlanId equals y.PlanId
|
||||
where y.ProjectId == null && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId
|
||||
select x).FirstOrDefault();
|
||||
if (getTrainPersonIdList2 == null)
|
||||
{
|
||||
getTrainPersonList.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return getTrainPersonList;
|
||||
}
|
||||
else
|
||||
{
|
||||
return getPersons.ToList();
|
||||
}
|
||||
|
@ -611,7 +622,11 @@ namespace BLL
|
|||
List<string> workPostIdList = Funs.GetStrListByStr(workPostIds, ',');
|
||||
getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(trainTypeId) &&trainTypeId == Const.SpecialSafeTrainId)//专项安全培训
|
||||
{
|
||||
var ids = db.Base_WorkPost.Where(x => x.PostType == "2").Select(x => x.WorkPostId).ToList();
|
||||
getPersons = getPersons.Where(x => ids.Contains(x.DepartId));
|
||||
}
|
||||
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
|
||||
var getTrainType = TrainTypeService.GetTrainTypeById(trainTypeId);
|
||||
if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))
|
||||
|
|
|
@ -113,6 +113,8 @@ namespace BLL
|
|||
States = x.States,
|
||||
QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'),
|
||||
TrainingPlanId = x.PlanId,
|
||||
TrainTypeId= x.TrainTypeId,
|
||||
TrainTypeName = db.Base_TrainType.Where(xx=>xx.TrainTypeId==x.TrainTypeId).Select(xx=>xx.TrainTypeName).FirstOrDefault()
|
||||
}).FirstOrDefault();
|
||||
|
||||
if (getDataLists != null)
|
||||
|
@ -174,6 +176,7 @@ namespace BLL
|
|||
DepartIds = getTestPlan.DepartIds,
|
||||
States = getTestPlan.States,
|
||||
PlanDate = DateTime.Now,
|
||||
TrainTypeId=getTestPlan.TrainTypeId
|
||||
};
|
||||
if (!string.IsNullOrEmpty(getTestPlan.ProjectId))
|
||||
{
|
||||
|
@ -200,7 +203,6 @@ namespace BLL
|
|||
|
||||
db.Training_TestPlan.InsertOnSubmit(newTestPlan);
|
||||
db.SubmitChanges();
|
||||
|
||||
CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTestPlanMenuId, newTestPlan.ProjectId, null, newTestPlan.TestPlanId, newTestPlan.PlanDate);
|
||||
}
|
||||
else
|
||||
|
@ -220,6 +222,7 @@ namespace BLL
|
|||
isUpdate.UnitIds = newTestPlan.UnitIds;
|
||||
isUpdate.WorkPostIds = newTestPlan.WorkPostIds;
|
||||
isUpdate.DepartIds = newTestPlan.DepartIds;
|
||||
isUpdate.TrainTypeId = newTestPlan.TrainTypeId;
|
||||
////删除 考生记录
|
||||
var deleteRecords = from x in db.Training_TestRecord
|
||||
where x.TestPlanId == isUpdate.TestPlanId
|
||||
|
@ -239,7 +242,7 @@ namespace BLL
|
|||
}
|
||||
|
||||
db.Training_TestRecord.DeleteAllOnSubmit(deleteRecords);
|
||||
db.SubmitChanges();
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
////删除 考试题目类型
|
||||
|
|
|
@ -5954,6 +5954,10 @@ namespace BLL
|
|||
/// 实业数据
|
||||
/// </summary>
|
||||
public const string Project_SYHSEData_SYHSEMenuId = "";
|
||||
/// <summary>
|
||||
/// 专项安全培训 id
|
||||
/// </summary>
|
||||
public static string SpecialSafeTrainId = "0e7fdf78-eaa0-4d00-a60b-490040bbea18";
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1511,3 +1511,21 @@ IP地址:::1
|
|||
|
||||
出错时间:05/25/2023 07:44:21
|
||||
|
||||
|
||||
错误信息开始=====>
|
||||
错误类型:NullReferenceException
|
||||
错误信息:未将对象引用设置到对象的实例。
|
||||
错误堆栈:
|
||||
在 FineUIPro.Web.HSSE.EduTrain.TestTraining.GetButtonPower() 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\HSSE\EduTrain\TestTraining.aspx.cs:行号 345
|
||||
在 FineUIPro.Web.HSSE.EduTrain.TestTraining.Page_Load(Object sender, EventArgs e) 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\HSSE\EduTrain\TestTraining.aspx.cs:行号 22
|
||||
在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
|
||||
在 System.EventHandler.Invoke(Object sender, EventArgs e)
|
||||
在 System.Web.UI.Control.OnLoad(EventArgs e)
|
||||
在 System.Web.UI.Control.LoadRecursive()
|
||||
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
|
||||
出错时间:05/25/2023 16:49:49
|
||||
出错文件:http://localhost:1295/HSSE/EduTrain/TestTraining.aspx
|
||||
IP地址:::1
|
||||
|
||||
出错时间:05/25/2023 16:49:49
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
|||
{
|
||||
public partial class TestTrainingItemIn : PageBase
|
||||
{
|
||||
|
||||
#region 定义变量
|
||||
/// <summary>
|
||||
/// 上传预设的虚拟路径
|
||||
|
@ -162,16 +161,15 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
|||
var trainings = from x in Funs.DB.Training_TestTraining select x;
|
||||
///岗位
|
||||
var workPosts = from x in Funs.DB.Base_WorkPost select x;
|
||||
var departs = from x in Funs.DB.Base_Depart 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][6].ToString().Trim(),
|
||||
AItem = pds.Rows[i][7].ToString().Trim(),
|
||||
BItem = pds.Rows[i][8].ToString().Trim(),
|
||||
Abstracts = pds.Rows[i][5].ToString().Trim(),
|
||||
AItem = pds.Rows[i][6].ToString().Trim(),
|
||||
BItem = pds.Rows[i][7].ToString().Trim(),
|
||||
};
|
||||
|
||||
////试题类型
|
||||
|
@ -211,8 +209,8 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
|||
{
|
||||
newViewTrainingItem.TestType = "1";
|
||||
//newViewTrainingItem.Score = SValue;
|
||||
newViewTrainingItem.CItem = pds.Rows[i][9].ToString().Trim();
|
||||
newViewTrainingItem.DItem = pds.Rows[i][10].ToString().Trim();
|
||||
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都不能为空!" + "|";
|
||||
|
@ -223,9 +221,9 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
|||
{
|
||||
newViewTrainingItem.TestType = "2";
|
||||
//newViewTrainingItem.Score = MValue;
|
||||
newViewTrainingItem.CItem = pds.Rows[i][9].ToString().Trim();
|
||||
newViewTrainingItem.DItem = pds.Rows[i][10].ToString().Trim();
|
||||
newViewTrainingItem.EItem = pds.Rows[i][11].ToString().Trim();
|
||||
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都不能为空!" + "|";
|
||||
|
@ -268,46 +266,18 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
|||
newViewTrainingItem.WorkPostIds = ids.Substring(0, ids.LastIndexOf(","));
|
||||
}
|
||||
}
|
||||
} ////适合部门
|
||||
string col5 = pds.Rows[i][5].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(col5))
|
||||
{
|
||||
|
||||
List<string> DepartSels = Funs.GetStrListByStr(col5, ',');
|
||||
if (DepartSels.Count() > 0)
|
||||
{
|
||||
string ids = string.Empty;
|
||||
foreach (var item in DepartSels)
|
||||
{
|
||||
var wp = departs.FirstOrDefault(x => x.DepartName == item);
|
||||
if (wp != null)
|
||||
{
|
||||
ids += wp.DepartId + ",";
|
||||
}
|
||||
else
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "导入适合部门" + item + "," + "此项基础表不存在!" + "|";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(ids))
|
||||
{
|
||||
newViewTrainingItem.DepartNames = col5;
|
||||
newViewTrainingItem.DepartIds = ids.Substring(0, ids.LastIndexOf(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////正确答案
|
||||
string col12 = pds.Rows[i][12].ToString().Trim();
|
||||
if (string.IsNullOrEmpty(col12))
|
||||
string col11 = pds.Rows[i][11].ToString().Trim();
|
||||
if (string.IsNullOrEmpty(col11))
|
||||
{
|
||||
result += "第" + (i + 2).ToString() + "行," + "导入正确答案项" + "," + "为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
int icount = 0;
|
||||
List<string> selecItem = Funs.GetStrListByStr(col12, ',');
|
||||
List<string> 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")
|
||||
|
@ -317,7 +287,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
|||
}
|
||||
if (icount == 0)
|
||||
{
|
||||
newViewTrainingItem.AnswerItems = col12.Replace("a", "A").Replace("b", "B").Replace("c", "C").Replace("d", "D").Replace("e", "E");
|
||||
newViewTrainingItem.AnswerItems = col11.Replace("a", "A").Replace("b", "B").Replace("c", "C").Replace("d", "D").Replace("e", "E");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -245,5 +245,19 @@ namespace Model
|
|||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 培训类型ID
|
||||
/// </summary>
|
||||
public string TrainTypeId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string TrainTypeName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360387,6 +360387,8 @@ namespace Model
|
|||
|
||||
private int _JValue;
|
||||
|
||||
private string _TrainTypeId;
|
||||
|
||||
private EntityRef<Sys_User> _Sys_User;
|
||||
|
||||
private EntityRef<Training_Plan> _Training_Plan;
|
||||
|
@ -360447,6 +360449,8 @@ namespace Model
|
|||
partial void OnMValueChanged();
|
||||
partial void OnJValueChanging(int value);
|
||||
partial void OnJValueChanged();
|
||||
partial void OnTrainTypeIdChanging(string value);
|
||||
partial void OnTrainTypeIdChanged();
|
||||
#endregion
|
||||
|
||||
public Training_TestPlan()
|
||||
|
@ -360946,6 +360950,26 @@ namespace Model
|
|||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TrainTypeId", DbType="NVarChar(50)")]
|
||||
public string TrainTypeId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._TrainTypeId;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._TrainTypeId != value))
|
||||
{
|
||||
this.OnTrainTypeIdChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._TrainTypeId = value;
|
||||
this.SendPropertyChanged("TrainTypeId");
|
||||
this.OnTrainTypeIdChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_TestPlan_Sys_User", Storage="_Sys_User", ThisKey="PlanManId", OtherKey="UserId", IsForeignKey=true)]
|
||||
public Sys_User Sys_User
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue