1代码合并
This commit is contained in:
@@ -1660,302 +1660,5 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region 根据培训类型获取项目培训人员信息
|
||||
/// <summary>
|
||||
/// 根据培训类型获取项目培训人员信息
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <param name="unitIds">培训单位ID</param>
|
||||
/// <param name="workPostIds">培训岗位ID</param>
|
||||
/// <param name="trainTypeId">培训类型ID</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.PersonItem> getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string departIds, string trainTypeId, string InTime, string strParam)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
DateTime inDateTime = DateTime.Now;
|
||||
if (!string.IsNullOrEmpty(InTime) && !"null".Equals(InTime))
|
||||
{
|
||||
inDateTime = DateTime.Parse(InTime);
|
||||
}
|
||||
|
||||
List<string> unitIdList = Funs.GetStrListByStr(unitIds, ',');
|
||||
var getPersons = (from x in db.View_SitePerson_Person
|
||||
where x.ProjectId == projectId && unitIdList.Contains(x.UnitId) && x.IsUsed == true && (string.IsNullOrEmpty(strParam) || x.PersonName.Contains(strParam)) && (string.IsNullOrEmpty(InTime) || x.InTime < inDateTime)
|
||||
&& x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now)
|
||||
select new Model.PersonItem
|
||||
{
|
||||
PersonId = x.PersonId,
|
||||
CardNo = x.CardNo,
|
||||
PersonName = x.PersonName,
|
||||
SexName = x.SexName,
|
||||
IdentityCard = x.IdentityCard,
|
||||
Address = x.Address,
|
||||
ProjectId = x.ProjectId,
|
||||
ProjectCode = x.ProjectCode,
|
||||
ProjectName = x.ProjectName,
|
||||
UnitId = x.UnitId,
|
||||
UnitCode = x.UnitCode,
|
||||
UnitName = x.UnitName,
|
||||
TeamGroupId = x.TeamGroupId,
|
||||
TeamGroupName = x.TeamGroupName,
|
||||
WorkPostId = x.WorkPostId,
|
||||
WorkPostName = x.WorkPostName,
|
||||
InTime = string.Format("{0:yyyy-MM-dd}", x.InTime),
|
||||
OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime),
|
||||
OutResult = x.OutResult,
|
||||
Telephone = x.Telephone,
|
||||
PhotoUrl = x.PhotoUrl,
|
||||
DepartName = x.DepartName,
|
||||
}).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(workPostIds))
|
||||
{
|
||||
List<string> workPostIdList = Funs.GetStrListByStr(workPostIds, ',');
|
||||
getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId)).ToList();
|
||||
}
|
||||
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.WorkPostId)).ToList();
|
||||
}
|
||||
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
|
||||
var getTrainType = TrainTypeService.GetTrainTypeById(trainTypeId);
|
||||
if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat.Value == false))
|
||||
{
|
||||
int score = 80;
|
||||
var sysTestRule = db.Sys_TestRule.FirstOrDefault();
|
||||
if (sysTestRule != null)
|
||||
{
|
||||
if (sysTestRule.PassingScore > 0)
|
||||
{
|
||||
score = sysTestRule.PassingScore;
|
||||
}
|
||||
}
|
||||
foreach (var item in getPersons)
|
||||
{
|
||||
var getTrainPersonIdList3 = (from x in db.Training_TestRecord
|
||||
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
|
||||
where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId
|
||||
where x.TestScores > score
|
||||
select x).FirstOrDefault();
|
||||
if (getTrainPersonIdList3 != null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail
|
||||
join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId
|
||||
where y.ProjectId == projectId && 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 == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId
|
||||
|
||||
select x).FirstOrDefault();
|
||||
if (getTrainPersonIdList2 == null)
|
||||
{
|
||||
getTrainPersonList.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return getTrainPersonList;
|
||||
}
|
||||
else if (getTrainType != null && getTrainType.IsRepeat.HasValue && getTrainType.IsRepeat.Value == true)//重复的 过滤人员
|
||||
{
|
||||
foreach (var item in getPersons)
|
||||
{
|
||||
//int score = 80;
|
||||
//var sysTestRule = db.Sys_TestRule.FirstOrDefault();
|
||||
//if (sysTestRule != null)
|
||||
//{
|
||||
// if (sysTestRule.PassingScore > 0)
|
||||
// {
|
||||
// score = sysTestRule.PassingScore;
|
||||
// }
|
||||
//}
|
||||
//var getTrainPersonIdList2 = (from x in db.Training_TestRecord
|
||||
// join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
|
||||
// where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId
|
||||
// where x.TestScores > score
|
||||
// select x).FirstOrDefault();
|
||||
//if (getTrainPersonIdList2 != null)
|
||||
//{
|
||||
// continue;
|
||||
//}
|
||||
getTrainPersonList.Add(item);
|
||||
}
|
||||
return getTrainPersonList;
|
||||
}
|
||||
//else if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))//重复的 过滤人员
|
||||
//{
|
||||
// int score = 80;
|
||||
// var sysTestRule = db.Sys_TestRule.FirstOrDefault();
|
||||
// if (sysTestRule != null)
|
||||
// {
|
||||
// if (sysTestRule.PassingScore > 0)
|
||||
// {
|
||||
// score = sysTestRule.PassingScore;
|
||||
// }
|
||||
// }
|
||||
// foreach (var item in getPersons)
|
||||
// {
|
||||
|
||||
// var getTrainPersonIdList2 = (from x in db.Training_TestRecord
|
||||
// join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
|
||||
// where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId
|
||||
// where x.TestScores > score
|
||||
// select x).FirstOrDefault();
|
||||
// if (getTrainPersonIdList2 != null)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// getTrainPersonList.Add(item);
|
||||
// }
|
||||
// return getTrainPersonList;
|
||||
//}
|
||||
else
|
||||
{
|
||||
return getPersons.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 根据培训类型获取项目培训人员信息
|
||||
/// <summary>
|
||||
/// 根据培训类型获取项目培训人员信息
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <param name="unitIds">培训单位ID</param>
|
||||
/// <param name="departIds">培训岗位ID</param>
|
||||
/// <param name="trainTypeId">培训类型ID</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.PersonItem> getTrainingPersonListByDepartAndTrainTypeId(string unitIds, string departIds, string trainTypeId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
List<string> unitIdList = Funs.GetStrListByStr(unitIds, ',');
|
||||
var getPersons = from x in db.Sys_User
|
||||
where unitIdList.Contains(x.UnitId)
|
||||
|
||||
select new Model.PersonItem
|
||||
{
|
||||
PersonId = x.UserId,
|
||||
PersonName = x.UserName,
|
||||
SexName = x.Sex,
|
||||
IdentityCard = x.IdentityCard,
|
||||
UnitId = x.UnitId,
|
||||
WorkPostId = x.WorkPostId,
|
||||
Telephone = x.Telephone,
|
||||
PhotoUrl = x.PhotoUrl,
|
||||
DepartId = x.DepartId
|
||||
};
|
||||
if (!string.IsNullOrEmpty(departIds))
|
||||
{
|
||||
List<string> departIdList = Funs.GetStrListByStr(departIds, ',');
|
||||
getPersons = getPersons.Where(x => departIdList.Contains(x.DepartId));
|
||||
}
|
||||
foreach (var item in getPersons)
|
||||
{
|
||||
Model.Base_Unit unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == item.UnitId);
|
||||
if (!string.IsNullOrEmpty(item.UnitId))
|
||||
{
|
||||
if (unit != null)
|
||||
{
|
||||
item.UnitCode = unit.UnitCode;
|
||||
item.UnitName = unit.UnitName;
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(item.DepartId))
|
||||
{
|
||||
Model.Base_Depart depart = db.Base_Depart.FirstOrDefault(x => x.DepartId == item.DepartId);
|
||||
if (depart != null)
|
||||
{
|
||||
item.DepartName = depart.DepartName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
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.WorkPostId));
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
int score = 80;
|
||||
var sysTestRule = db.Sys_TestRule.FirstOrDefault();
|
||||
if (sysTestRule != null)
|
||||
{
|
||||
if (sysTestRule.PassingScore > 0)
|
||||
{
|
||||
score = sysTestRule.PassingScore;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (var item in getPersons)
|
||||
{
|
||||
var getTrainPersonIdList3 = (from x in db.Training_TestRecord
|
||||
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
|
||||
where y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId
|
||||
where x.TestScores > score
|
||||
select x).FirstOrDefault();
|
||||
if (getTrainPersonIdList3 != null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,37 +17,7 @@ namespace BLL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getUser = db.View_Sys_User.FirstOrDefault(x => (x.Account == userInfo.Account || x.Telephone == userInfo.Telephone) && x.IsPost == true && x.Password == Funs.EncryptionPassword(userInfo.Password));
|
||||
if (getUser != null)
|
||||
{
|
||||
return ObjectMapperManager.DefaultInstance.GetMapper<Model.View_Sys_User, Model.UserItem>().Map(getUser);
|
||||
}
|
||||
else
|
||||
{
|
||||
var getPerson = from x in db.SitePerson_Person
|
||||
where (x.Telephone == userInfo.Account || x.PersonName == userInfo.Account)
|
||||
&& (x.Password == Funs.EncryptionPassword(userInfo.Password)
|
||||
|| (x.IdentityCard != null && x.IdentityCard.Substring(x.IdentityCard.Length - 4) == userInfo.Password))
|
||||
&& x.IsUsed == true
|
||||
orderby x.InTime descending
|
||||
select new Model.UserItem
|
||||
{
|
||||
UserId = x.PersonId,
|
||||
UserCode = x.CardNo,
|
||||
Password = x.Password,
|
||||
UserName = x.PersonName,
|
||||
UnitId = x.UnitId,
|
||||
LoginProjectId = x.ProjectId,
|
||||
IdentityCard = x.IdentityCard,
|
||||
Account = x.PersonName,
|
||||
UnitName = db.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName,
|
||||
LoginProjectName = db.Base_Project.First(u => u.ProjectId == x.ProjectId).ProjectName,
|
||||
Telephone = x.Telephone,
|
||||
WorkPostId = x.WorkPostId,
|
||||
WorkPostName = db.Base_WorkPost.First(w => w.WorkPostId == x.WorkPostId).WorkPostName,
|
||||
};
|
||||
return getPerson.FirstOrDefault();
|
||||
}
|
||||
|
||||
return ObjectMapperManager.DefaultInstance.GetMapper<Model.View_Sys_User, Model.UserItem>().Map(getUser);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,53 +24,24 @@ namespace BLL
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
if (string.IsNullOrEmpty(projectId))
|
||||
{
|
||||
var getDataLists = (from x in db.Training_TestPlan
|
||||
where (x.ProjectId == null || x.ProjectId=="") && (x.States == states || states == null)
|
||||
orderby x.TestStartTime descending
|
||||
select new Model.TestPlanItem
|
||||
{
|
||||
TestPlanId = x.TestPlanId,
|
||||
TestPlanCode = x.PlanCode,
|
||||
TestPlanName = x.PlanName,
|
||||
ProjectId = x.ProjectId,
|
||||
DepartIds = x.DepartIds,
|
||||
DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds),
|
||||
TestPlanManId = x.PlanManId,
|
||||
TestPlanManName = db.Sys_User.First(y => y.UserId == x.PlanManId).UserName,
|
||||
TestPalce = x.TestPalce,
|
||||
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
|
||||
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
|
||||
States = x.States,
|
||||
QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'),
|
||||
}).ToList();
|
||||
return getDataLists;
|
||||
}
|
||||
else
|
||||
{
|
||||
var getDataLists = (from x in db.Training_TestPlan
|
||||
where x.ProjectId == projectId && (x.States == states || states == null)
|
||||
orderby x.TestStartTime descending
|
||||
select new Model.TestPlanItem
|
||||
{
|
||||
TestPlanId = x.TestPlanId,
|
||||
TestPlanCode = x.PlanCode,
|
||||
TestPlanName = x.PlanName,
|
||||
ProjectId = x.ProjectId,
|
||||
TestPlanManId = x.PlanManId,
|
||||
DepartIds = x.DepartIds,
|
||||
DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds),
|
||||
TestPlanManName = db.Sys_User.First(y => y.UserId == x.PlanManId).UserName,
|
||||
TestPalce = x.TestPalce,
|
||||
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
|
||||
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
|
||||
States = x.States,
|
||||
QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'),
|
||||
}).ToList();
|
||||
return getDataLists;
|
||||
|
||||
}
|
||||
var getDataLists = (from x in db.Training_TestPlan
|
||||
where x.ProjectId == projectId && (x.States == states || states == null)
|
||||
orderby x.TestStartTime descending
|
||||
select new Model.TestPlanItem
|
||||
{
|
||||
TestPlanId = x.TestPlanId,
|
||||
TestPlanCode = x.PlanCode,
|
||||
TestPlanName = x.PlanName,
|
||||
ProjectId = x.ProjectId,
|
||||
TestPlanManId = x.PlanManId,
|
||||
TestPlanManName = db.Sys_User.First(y => y.UserId == x.PlanManId).UserName,
|
||||
TestPalce = x.TestPalce,
|
||||
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
|
||||
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
|
||||
States = x.States,
|
||||
QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'),
|
||||
}).ToList();
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -109,13 +80,9 @@ namespace BLL
|
||||
UnitNames = UnitService.getUnitNamesUnitIds(x.UnitIds),
|
||||
WorkPostIds = x.WorkPostIds,
|
||||
WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostIds),
|
||||
DepartIds = x.DepartIds,
|
||||
DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds),
|
||||
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()
|
||||
};
|
||||
return getDataLists.FirstOrDefault();
|
||||
}
|
||||
@@ -263,9 +230,8 @@ namespace BLL
|
||||
////新增考试人员明细
|
||||
foreach (var item in getTestPlan.TestRecordItems)
|
||||
{
|
||||
var user = db.Sys_User.FirstOrDefault(e => e.UserId == item.TestManId);
|
||||
var person = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == item.TestManId);
|
||||
if (user != null || person != null)
|
||||
var person = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == item.TestManId);
|
||||
if (person != null)
|
||||
{
|
||||
Model.Training_TestRecord newTrainDetail = new Model.Training_TestRecord
|
||||
{
|
||||
@@ -388,17 +354,15 @@ namespace BLL
|
||||
TestStartTime = DateTime.Now,
|
||||
TestPalce = getTrainingPlan.TeachAddress,
|
||||
UnitIds = getTrainingPlan.UnitIds,
|
||||
UnitNames = UnitService.getUnitNamesUnitIdsForApi(getTrainingPlan.UnitIds),
|
||||
UnitNames = UnitService.getUnitNamesUnitIds(getTrainingPlan.UnitIds),
|
||||
WorkPostIds = getTrainingPlan.WorkPostId,
|
||||
WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIdsForApi(getTrainingPlan.WorkPostId),
|
||||
DepartIds = getTrainingPlan.DepartIds,
|
||||
DepartNames = WorkPostService.getDepartNamesByIdsForApi(getTrainingPlan.DepartIds),
|
||||
WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(getTrainingPlan.WorkPostId),
|
||||
PlanId = getTrainingPlan.PlanId,
|
||||
States = "0",
|
||||
};
|
||||
|
||||
string unitId = string.Empty;
|
||||
var user = db.Sys_User.FirstOrDefault(e => e.UserId == userId);
|
||||
var user = db.Sys_User.FirstOrDefault(e => e.UserId == userId);
|
||||
if (user != null)
|
||||
{
|
||||
unitId = user.UnitId;
|
||||
@@ -448,7 +412,7 @@ namespace BLL
|
||||
{
|
||||
db.Training_TestPlan.InsertOnSubmit(newTestPlan);
|
||||
db.SubmitChanges();
|
||||
CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectTestPlanMenuId, newTestPlan.ProjectId, null, testPlanId, newTestPlan.PlanDate);
|
||||
CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTestPlanMenuId, newTestPlan.ProjectId, null, testPlanId, newTestPlan.PlanDate);
|
||||
///培训人员
|
||||
var getTrainingTask = (from x in db.Training_Task where x.PlanId == trainingPlanId select x).ToList();
|
||||
foreach (var itemTask in getTrainingTask)
|
||||
@@ -459,7 +423,7 @@ namespace BLL
|
||||
ProjectId = getTrainingPlan.ProjectId,
|
||||
TestPlanId = testPlanId,
|
||||
TestManId = itemTask.UserId,
|
||||
TestType = db.Base_TrainType.First(z => z.TrainTypeId == getTrainingPlan.TrainTypeId).TrainTypeName,
|
||||
TestType= db.Base_TrainType.First(z=>z.TrainTypeId == getTrainingPlan.TrainTypeId).TrainTypeName,
|
||||
};
|
||||
|
||||
db.Training_TestRecord.InsertOnSubmit(newTestRecord);
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace BLL
|
||||
ProjectId = x.ProjectId,
|
||||
TestPlanId = x.TestPlanId,
|
||||
TestManId = x.TestManId,
|
||||
TestManName = getPname(x.TestManId),
|
||||
TestManName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.TestManId).PersonName,
|
||||
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
|
||||
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
|
||||
TestScores = x.TestScores ?? 0,
|
||||
@@ -39,26 +39,6 @@ namespace BLL
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
|
||||
private static string getPname(string TestManId) {
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) {
|
||||
var pname = "";
|
||||
var personModel = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == TestManId);
|
||||
if (personModel==null)
|
||||
{
|
||||
var unameModel = db.Sys_User.FirstOrDefault(p=>p.UserId== TestManId);
|
||||
if (unameModel!=null)
|
||||
{
|
||||
pname = unameModel.UserName;
|
||||
}
|
||||
}
|
||||
else {
|
||||
pname = personModel.PersonName;
|
||||
}
|
||||
|
||||
return pname;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据试卷ID获取试卷记录详细
|
||||
@@ -101,7 +81,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="testPlanId"></param>
|
||||
/// <returns></returns>
|
||||
public static string CreateTestRecordItem(Model.Training_TestPlan getTestPlan, string testRecordId, Model.SitePerson_Person person, Model.Sys_User user)
|
||||
public static string CreateTestRecordItem(Model.Training_TestPlan getTestPlan, string testRecordId, Model.SitePerson_Person person)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
@@ -128,22 +108,9 @@ namespace BLL
|
||||
int sumTestType3Count = testPlanTrainings.Sum(x => x.TestType3Count) ?? 0;
|
||||
|
||||
////获取类型下适合岗位试题集合
|
||||
List<Model.Training_TestTrainingItem> getTestTrainingItemALLs;
|
||||
string WorkPostId = "";
|
||||
string DepartId = "";
|
||||
if (person != null)
|
||||
{
|
||||
WorkPostId = person.WorkPostId;
|
||||
}
|
||||
if (user != null)
|
||||
{
|
||||
DepartId = user.DepartId;
|
||||
}
|
||||
|
||||
getTestTrainingItemALLs = (from x in db.Training_TestTrainingItem
|
||||
where x.TrainingId != null && (x.WorkPostIds == null || string.IsNullOrEmpty(WorkPostId) || x.WorkPostIds.Contains(WorkPostId)) || (x.DepartIds == null || string.IsNullOrEmpty(DepartId) || x.DepartIds.Contains(DepartId))
|
||||
|
||||
select x).ToList();
|
||||
var getTestTrainingItemALLs = from x in db.Training_TestTrainingItem
|
||||
where x.TrainingId != null && (x.WorkPostIds == null || (x.WorkPostIds.Contains(person.WorkPostId) && person.WorkPostId != null))
|
||||
select x;
|
||||
foreach (var itemT in testPlanTrainings)
|
||||
{
|
||||
//// 获取类型下的题目
|
||||
@@ -234,170 +201,12 @@ namespace BLL
|
||||
|
||||
db.Training_TestRecordItem.InsertAllOnSubmit(getItems);
|
||||
db.SubmitChanges();
|
||||
BLL.RedisHelper redis = new BLL.RedisHelper();
|
||||
redis.SetObjString(testRecordId, getItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
return testRecordId;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static string CreateTestRecordItem(Model.Training_CompanyTrainingItem getCompanyTraining, string testRecordId, Model.SitePerson_Person person, Model.Sys_User user)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var trainingIds = getCompanyTraining.TestTrainingIds.Split(',');
|
||||
var testTrainings = db.Training_TestTraining.Where(x => trainingIds.Contains(x.TrainingId));
|
||||
var getTestRecord = db.Training_TestRecord.FirstOrDefault(x => x.TestRecordId == testRecordId);
|
||||
if (getTestRecord != null && !getTestRecord.TestStartTime.HasValue)
|
||||
{
|
||||
////考试时长
|
||||
getTestRecord.Duration = 120;
|
||||
getTestRecord.TestStartTime = DateTime.Now;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
////当前人考试记录 未加入考试计划的 当考试开始扫码时 不允许再参与考试
|
||||
var item = db.Training_TestRecordItem.FirstOrDefault(x => x.TestRecordId == getTestRecord.TestRecordId);
|
||||
if (item == null)
|
||||
{
|
||||
List<Model.Training_TestTrainingItem> getTestTrainingItemList = new List<Model.Training_TestTrainingItem>();
|
||||
//var testPlanTrainings = from x in db.Training_TestPlanTraining
|
||||
// where x.TestPlanId == getTestPlan.TestPlanId
|
||||
// select x;
|
||||
//// 计划考试中单选、多选、判断题总数
|
||||
var sysTestRule = Funs.DB.Sys_TestRule.FirstOrDefault();
|
||||
|
||||
int sumTestType1Count = 0;// testPlanTrainings.Sum(x => x.TestType1Count) ?? 0;
|
||||
int sumTestType2Count = 0;//testPlanTrainings.Sum(x => x.TestType2Count) ?? 0;
|
||||
int sumTestType3Count = 0;//testPlanTrainings.Sum(x => x.TestType3Count) ?? 0;
|
||||
if (sysTestRule != null)
|
||||
{
|
||||
|
||||
sumTestType1Count = sysTestRule.SCount;
|
||||
sumTestType2Count = sysTestRule.MCount;
|
||||
sumTestType3Count = sysTestRule.JCount;
|
||||
}
|
||||
////获取类型下适合岗位试题集合
|
||||
List<Model.Training_TestTrainingItem> getTestTrainingItemALLs;
|
||||
string WorkPostId = "";
|
||||
string DepartId = "";
|
||||
if (person != null)
|
||||
{
|
||||
WorkPostId = person.WorkPostId;
|
||||
}
|
||||
if (user != null)
|
||||
{
|
||||
DepartId = user.DepartId;
|
||||
}
|
||||
|
||||
getTestTrainingItemALLs = (from x in db.Training_TestTrainingItem
|
||||
where x.TrainingId != null && (x.WorkPostIds == null || string.IsNullOrEmpty(WorkPostId) || x.WorkPostIds.Contains(WorkPostId)) || (x.DepartIds == null || string.IsNullOrEmpty(DepartId) || x.DepartIds.Contains(DepartId))
|
||||
select x).ToList();
|
||||
foreach (var itemT in testTrainings)
|
||||
{
|
||||
//// 获取类型下的题目
|
||||
var getTestTrainingItems = getTestTrainingItemALLs.Where(x => x.TrainingId == itemT.TrainingId).ToList();
|
||||
if (getTestTrainingItems.Count() > 0)
|
||||
{
|
||||
////单选题
|
||||
var getSItem = getTestTrainingItems.Where(x => x.TestType == "1").OrderBy(x => Guid.NewGuid()).Take(sumTestType1Count);
|
||||
if (getSItem.Count() > 0)
|
||||
{
|
||||
getTestTrainingItemList.AddRange(getSItem);
|
||||
}
|
||||
///多选题
|
||||
var getMItem = getTestTrainingItems.Where(x => x.TestType == "2").OrderBy(x => Guid.NewGuid()).Take(sumTestType2Count);
|
||||
if (getMItem.Count() > 0)
|
||||
{
|
||||
getTestTrainingItemList.AddRange(getMItem);
|
||||
}
|
||||
///判断题
|
||||
var getJItem = getTestTrainingItems.Where(x => x.TestType == "3").OrderBy(x => Guid.NewGuid()).Take(sumTestType3Count);
|
||||
if (getJItem.Count() > 0)
|
||||
{
|
||||
getTestTrainingItemList.AddRange(getJItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
//// 获取得到的单选题、多选题、判断题 数量
|
||||
int getDiffTestType1Count = sumTestType1Count - getTestTrainingItemList.Where(x => x.TestType == "1").Count();
|
||||
int getDiffTestType2Count = sumTestType2Count - getTestTrainingItemList.Where(x => x.TestType == "2").Count();
|
||||
int getDiffTestType3Count = sumTestType3Count - getTestTrainingItemList.Where(x => x.TestType == "3").Count();
|
||||
if (getDiffTestType1Count > 0 || getDiffTestType2Count > 0 || getDiffTestType3Count > 0)
|
||||
{
|
||||
var getTestTrainingItemNulls = getTestTrainingItemALLs.Where(x => x.WorkPostIds == null).ToList();
|
||||
if (getTestTrainingItemNulls.Count() > 0)
|
||||
{
|
||||
/// 通用且未选择的题目
|
||||
var getTestTrainingItemDiffs = getTestTrainingItemNulls.Except(getTestTrainingItemList).ToList();
|
||||
////单选题
|
||||
if (getDiffTestType1Count > 0)
|
||||
{
|
||||
var getSItemD = getTestTrainingItemDiffs.Where(x => x.TestType == "1").OrderBy(x => Guid.NewGuid()).Take(getDiffTestType1Count);
|
||||
if (getSItemD.Count() > 0)
|
||||
{
|
||||
getTestTrainingItemList.AddRange(getSItemD);
|
||||
}
|
||||
}
|
||||
///多选题
|
||||
if (getDiffTestType2Count > 0)
|
||||
{
|
||||
var getMItemD = getTestTrainingItemDiffs.Where(x => x.TestType == "2").OrderBy(x => Guid.NewGuid()).Take(getDiffTestType2Count);
|
||||
if (getMItemD.Count() > 0)
|
||||
{
|
||||
getTestTrainingItemList.AddRange(getMItemD);
|
||||
}
|
||||
}
|
||||
///判断题
|
||||
if (getDiffTestType3Count > 0)
|
||||
{
|
||||
var getJItemD = getTestTrainingItemDiffs.Where(x => x.TestType == "3").OrderBy(x => Guid.NewGuid()).Take(getDiffTestType3Count);
|
||||
if (getJItemD.Count() > 0)
|
||||
{
|
||||
getTestTrainingItemList.AddRange(getJItemD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (getTestTrainingItemList.Count() > 0)
|
||||
{
|
||||
var getItems = from x in getTestTrainingItemList
|
||||
select new Model.Training_TestRecordItem
|
||||
{
|
||||
TestRecordItemId = SQLHelper.GetNewID(),
|
||||
TestRecordId = getTestRecord.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.TestType == "1" ? sysTestRule.SValue : (x.TestType == "2" ? sysTestRule.MValue : sysTestRule.JValue),
|
||||
};
|
||||
|
||||
db.Training_TestRecordItem.InsertAllOnSubmit(getItems);
|
||||
db.SubmitChanges();
|
||||
BLL.RedisHelper redis = new BLL.RedisHelper();
|
||||
redis.SetObjString(testRecordId, getItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
return testRecordId;
|
||||
}
|
||||
|
||||
|
||||
#region 根据PersonId、TestPlanId生成试卷 扫码生成试卷
|
||||
/// <summary>
|
||||
/// 根据PersonId、TestPlanId生成试卷 扫码生成试卷
|
||||
@@ -580,7 +389,7 @@ namespace BLL
|
||||
var getDataLists = (from x in db.Training_TestRecord
|
||||
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
|
||||
join z in db.SitePerson_Person on x.TestManId equals z.PersonId
|
||||
where ((string.IsNullOrEmpty(projectId) && x.ProjectId == null) || (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId)) && x.TestStartTime.HasValue && x.TestEndTime.HasValue
|
||||
where x.ProjectId == projectId && x.TestStartTime.HasValue && x.TestEndTime.HasValue
|
||||
orderby x.TestStartTime descending
|
||||
select new Model.TestRecordItem
|
||||
{
|
||||
@@ -864,103 +673,29 @@ namespace BLL
|
||||
/// <param name="testRecord"></param>
|
||||
public static string getResitTestRecord(Model.Training_TestRecord getTestRecord)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
|
||||
{
|
||||
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
|
||||
{
|
||||
TestRecordId = SQLHelper.GetNewID(),
|
||||
ProjectId = getTestRecord.ProjectId,
|
||||
TestPlanId = getTestRecord.TestPlanId,
|
||||
TestManId = getTestRecord.TestManId,
|
||||
TestType = getTestRecord.TestType,
|
||||
TemporaryUser = getTestRecord.TemporaryUser,
|
||||
Duration = getTestRecord.Duration,
|
||||
// TestStartTime = DateTime.Now,
|
||||
};
|
||||
TestRecordId = SQLHelper.GetNewID(),
|
||||
ProjectId = getTestRecord.ProjectId,
|
||||
TestPlanId = getTestRecord.TestPlanId,
|
||||
TestManId = getTestRecord.TestManId,
|
||||
TestType = getTestRecord.TestType,
|
||||
TemporaryUser = getTestRecord.TemporaryUser,
|
||||
Duration = getTestRecord.Duration,
|
||||
// TestStartTime = DateTime.Now,
|
||||
};
|
||||
|
||||
db.Training_TestRecord.InsertOnSubmit(newTestRecord);
|
||||
db.SubmitChanges();
|
||||
Funs.DB.Training_TestRecord.InsertOnSubmit(newTestRecord);
|
||||
Funs.DB.SubmitChanges();
|
||||
|
||||
var getTestPlan = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == newTestRecord.TestPlanId);
|
||||
var user = db.Sys_User.FirstOrDefault(x => x.UserId == newTestRecord.TestManId);
|
||||
var person = PersonService.GetPersonByUserIdForApi(newTestRecord.TestManId, getTestPlan.ProjectId);
|
||||
if (getTestPlan != null && person != null)
|
||||
{
|
||||
CreateTestRecordItem(getTestPlan, newTestRecord.TestRecordId, person, user);
|
||||
}
|
||||
return newTestRecord.TestRecordId;
|
||||
var getTestPlan = Funs.DB.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == newTestRecord.TestPlanId);
|
||||
var person = PersonService.GetPersonByUserId(newTestRecord.TestManId, getTestPlan.ProjectId);
|
||||
if (getTestPlan != null && person != null)
|
||||
{
|
||||
CreateTestRecordItem(getTestPlan, newTestRecord.TestRecordId, person);
|
||||
}
|
||||
return newTestRecord.TestRecordId;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static List<Model.TestRecordItem> getTrainingTestRecordListByDepartId(string unitId, string departId, string strPass, string strParam)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.Training_TestRecord
|
||||
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
|
||||
join z in db.Sys_User on x.TestManId equals z.UserId
|
||||
where x.ProjectId == null && x.TestStartTime.HasValue && x.TestEndTime.HasValue
|
||||
orderby x.TestStartTime descending
|
||||
select new Model.TestRecordItem
|
||||
{
|
||||
TestRecordId = x.TestRecordId,
|
||||
ProjectId = x.ProjectId,
|
||||
TestPlanId = x.TestPlanId,
|
||||
TestPlanName = y.PlanName,
|
||||
UnitId = z.UnitId,
|
||||
UnitName = getUnitName(z.UnitId),
|
||||
WorkPostId = z.WorkPostId,
|
||||
WorkPostName = db.Base_WorkPost.FirstOrDefault(p => p.WorkPostId == z.WorkPostId).WorkPostName,
|
||||
DepartId = z.DepartId,
|
||||
TestManId = x.TestManId,
|
||||
TestManName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.TestManId).PersonName,
|
||||
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
|
||||
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
|
||||
Duration = x.Duration,
|
||||
TestPlanEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime.Value.AddMinutes(x.Duration)),
|
||||
TotalScore = y.TotalScore ?? 0,
|
||||
TestScores = x.TestScores ?? 0,
|
||||
TestType = x.TestType,
|
||||
TemporaryUser = x.TemporaryUser,
|
||||
});
|
||||
if (!string.IsNullOrEmpty(unitId))
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.UnitId == unitId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(departId))
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.DepartId == departId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(strParam))
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.TestManName.Contains(strParam));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(strPass))
|
||||
{
|
||||
int PassingScore = SysConstSetService.getPassScoreForApi();
|
||||
if (strPass == "0")
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.TestScores < PassingScore);
|
||||
}
|
||||
else
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.TestScores >= PassingScore);
|
||||
}
|
||||
}
|
||||
foreach (var item in getDataLists)
|
||||
{
|
||||
var depart = db.Base_Depart.FirstOrDefault(x => x.DepartId == item.DepartId);
|
||||
if (depart != null)
|
||||
{
|
||||
item.DepartName = depart.DepartName;
|
||||
}
|
||||
|
||||
}
|
||||
return getDataLists.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,7 @@ namespace BLL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.EduTrain_TrainRecord
|
||||
where ((string.IsNullOrEmpty(projectId) && x.ProjectId == null)
|
||||
|| (!string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == ""))) && x.TrainTypeId == trainTypeId
|
||||
where x.ProjectId == projectId && x.TrainTypeId == trainTypeId
|
||||
orderby x.TrainStartDate descending
|
||||
select new Model.TrainRecordItem
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BLL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.Training_TrainTestRecord
|
||||
where ((string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == "")) || (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId))
|
||||
where x.ProjectId == projectId
|
||||
orderby x.DateA descending
|
||||
select new Model.HSSE.TrainTestRecordItem
|
||||
{
|
||||
|
||||
@@ -21,15 +21,7 @@ namespace BLL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.Training_Plan
|
||||
where
|
||||
(
|
||||
(string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == ""))
|
||||
||
|
||||
(!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId)
|
||||
)
|
||||
|
||||
&& (x.States == states || states == null)
|
||||
&& x.TrainTypeId == trainTypeId
|
||||
where x.ProjectId == projectId && (x.States == states || states == null) && x.TrainTypeId == trainTypeId
|
||||
orderby x.TrainStartDate descending
|
||||
select new Model.TrainingPlanItem
|
||||
{
|
||||
@@ -84,18 +76,14 @@ namespace BLL
|
||||
TeachMan = x.TeachMan,
|
||||
UnitIds = x.UnitIds,
|
||||
WorkPostId = x.WorkPostId,
|
||||
DepartIds = x.DepartIds,
|
||||
DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds),
|
||||
TrainContent = x.TrainContent,
|
||||
UnitNames = UnitService.getUnitNamesUnitIdsForApi(x.UnitIds),
|
||||
WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIdsForApi(x.WorkPostId),
|
||||
UnitNames = UnitService.getUnitNamesUnitIds(x.UnitIds),
|
||||
WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostId),
|
||||
DesignerId = x.DesignerId,
|
||||
DesignerName = db.Sys_User.First(y => y.UserId == x.DesignerId).UserName,
|
||||
DesignerDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.TrainStartDate),
|
||||
States = x.States,
|
||||
QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'),
|
||||
|
||||
TrainingTasks = getTrainingTasks(x.PlanId)
|
||||
};
|
||||
return getDataLists.FirstOrDefault();
|
||||
}
|
||||
@@ -148,7 +136,7 @@ namespace BLL
|
||||
{
|
||||
PlanId = trainingPlan.PlanId,
|
||||
PlanCode = trainingPlan.PlanCode,
|
||||
|
||||
ProjectId = trainingPlan.ProjectId,
|
||||
DesignerId = trainingPlan.DesignerId,
|
||||
PlanName = trainingPlan.PlanName,
|
||||
TrainContent = trainingPlan.TrainContent,
|
||||
@@ -159,15 +147,9 @@ namespace BLL
|
||||
TrainTypeId = trainingPlan.TrainTypeId,
|
||||
UnitIds = trainingPlan.UnitIds,
|
||||
WorkPostId = trainingPlan.WorkPostId,
|
||||
DepartIds = trainingPlan.DepartIds,
|
||||
DepartNames = trainingPlan.DepartNames,
|
||||
States = trainingPlan.States,
|
||||
};
|
||||
if (!string.IsNullOrEmpty(trainingPlan.ProjectId))
|
||||
{
|
||||
newTrainingPlan.ProjectId = trainingPlan.ProjectId;
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(trainingPlan.TrainLevelId))
|
||||
{
|
||||
newTrainingPlan.TrainLevelId = trainingPlan.TrainLevelId;
|
||||
@@ -218,8 +200,6 @@ namespace BLL
|
||||
isUpdate.UnitIds = newTrainingPlan.UnitIds;
|
||||
isUpdate.WorkPostId = newTrainingPlan.WorkPostId;
|
||||
isUpdate.States = newTrainingPlan.States;
|
||||
isUpdate.DepartIds = newTrainingPlan.DepartIds;
|
||||
isUpdate.DepartNames = newTrainingPlan.DepartNames;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
////删除培训任务
|
||||
@@ -295,24 +275,6 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Model.TrainingTaskItem> getTrainingTasks(string planId) {
|
||||
var list = new List<Model.TrainingTaskItem>();
|
||||
var taskList = Funs.DB.Training_Task.Where(x => x.PlanId == planId);
|
||||
if (taskList.Count()>0)
|
||||
{
|
||||
foreach (var item in taskList)
|
||||
{
|
||||
var model = new Model.TrainingTaskItem();
|
||||
model.TaskId = item.TaskId;
|
||||
model.PlanId = item.PlanId;
|
||||
model.PersonId = item.UserId;
|
||||
model.PersonName = UserService.GetUserNameByUserId(item.UserId);
|
||||
list.Add(model);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增 培训人员明细
|
||||
/// </summary>
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace BLL
|
||||
personId = PersonService.GetPersonIdByUserId(personId);
|
||||
var getDataLists = (from x in db.Training_Task
|
||||
join y in db.Training_Plan on x.PlanId equals y.PlanId
|
||||
where ((string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == "")) || (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId)) && x.UserId == personId && y.States != "0"
|
||||
where x.ProjectId == projectId && x.UserId == personId && y.States != "0"
|
||||
orderby x.TaskDate descending
|
||||
select new Model.TrainingTaskItem
|
||||
{
|
||||
@@ -31,30 +31,17 @@ namespace BLL
|
||||
PlanName = y.PlanName,
|
||||
TrainStartDate = string.Format("{0:yyyy-MM-dd HH:mm}", y.TrainStartDate),
|
||||
TeachAddress = y.TeachAddress,
|
||||
PersonId = x.UserId,
|
||||
//PersonId = x.UserId,
|
||||
PersonName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.UserId).PersonName,
|
||||
TaskDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.TaskDate),
|
||||
TrainTypeName = db.Base_TrainType.FirstOrDefault(b => b.TrainTypeId == y.TrainTypeId).TrainTypeName,
|
||||
TrainLevelName = db.Base_TrainLevel.FirstOrDefault(b => b.TrainLevelId == y.TrainLevelId).TrainLevelName,
|
||||
PlanStatesName = y.States == "3" ? "已完成" : "培训中",
|
||||
TaskStatesName = x.States == "2" ? "已完成" : "培训中",
|
||||
TrainingItemCode = getTrainingItemCode(y.PlanId)
|
||||
}).ToList();
|
||||
|
||||
}).ToList();
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
|
||||
public static string getTrainingItemCode(string PlanId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var ids = db.Training_PlanItem.Where(xx => xx.PlanId == PlanId).Select(x => x.CompanyTrainingItemId).ToList();
|
||||
var codes = db.Training_CompanyTrainingItem.Where(x => ids.Contains(x.CompanyTrainingItemId)).Select(x => x.CompanyTrainingItemCode);
|
||||
string res = string.Join(",", codes);
|
||||
return res;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据TaskId获取培训任务教材明细列表
|
||||
@@ -71,8 +58,6 @@ 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
|
||||
from y in temp.DefaultIfEmpty()
|
||||
where x.TaskId == taskId
|
||||
orderby x.TrainingItemCode
|
||||
select new Model.TrainingTaskItemItem
|
||||
@@ -80,16 +65,15 @@ namespace BLL
|
||||
TaskItemId = x.TaskItemId,
|
||||
TaskId = x.TaskId,
|
||||
PlanId = x.PlanId,
|
||||
StartTime = x.StartTime,
|
||||
EndTime = x.EndTime,
|
||||
LearningTime = x.LearnTime,
|
||||
AttachTime = y.LearningTime,
|
||||
VideoProgress = x.VideoProgress,
|
||||
PersonId = x.PersonId,
|
||||
TrainingItemCode = x.TrainingItemCode,
|
||||
StartTime = x.StartTime,
|
||||
EndTime = x.EndTime,
|
||||
LearnTime = x.LearnTime,
|
||||
VideoProgress = x.VideoProgress,
|
||||
TrainingItemCode = x.TrainingItemCode,
|
||||
TrainingItemName = x.TrainingItemName,
|
||||
AttachUrl = x.AttachUrl.Replace('\\', '/'),
|
||||
}).ToList();
|
||||
}).ToList();
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
@@ -226,29 +210,10 @@ namespace BLL
|
||||
TaskId = x.TaskId,
|
||||
PlanId = x.PlanId,
|
||||
PersonId = x.UserId,
|
||||
|
||||
PersonName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.UserId).PersonName,
|
||||
TaskDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.TaskDate),
|
||||
States = x.States,
|
||||
States = x.States,
|
||||
}).ToList();
|
||||
|
||||
foreach (var item in getDataLists)
|
||||
{
|
||||
var person = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == item.PersonId);
|
||||
if (person != null)
|
||||
{
|
||||
item.PersonName = person.PersonName;
|
||||
}
|
||||
else
|
||||
{
|
||||
var sysUser = db.Sys_User.FirstOrDefault(p => p.UserId == item.PersonId);
|
||||
if (sysUser != null)
|
||||
{
|
||||
item.PersonName = sysUser.UserName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
@@ -276,41 +241,19 @@ namespace BLL
|
||||
item.StartTime = startTime;
|
||||
}
|
||||
|
||||
//if (!item.LearnTime.HasValue)
|
||||
//{
|
||||
// item.LearnTime = 0;
|
||||
//}
|
||||
if (!item.LearnTime.HasValue)
|
||||
{
|
||||
item.LearnTime = 0;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(VideoProgress))
|
||||
{
|
||||
//if (!item.VideoProgress.HasValue)
|
||||
//{
|
||||
// item.VideoProgress = 0;
|
||||
//}
|
||||
item.VideoProgress = int.Parse(VideoProgress);
|
||||
}
|
||||
var span = endTime.Subtract(startTime);
|
||||
if (!item.LearnTime.HasValue)
|
||||
{
|
||||
item.LearnTime = 0;
|
||||
}
|
||||
item.LearnTime = item.LearnTime.Value + (int)span.TotalSeconds;
|
||||
item.EndTime = endTime;
|
||||
|
||||
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;
|
||||
return item;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
+2
-43
@@ -21,8 +21,6 @@
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -68,11 +66,8 @@
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.3.11, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpZipLib.1.3.3\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\lib\net461\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Office.Interop.Excel.15.0.4795.1001\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
|
||||
@@ -105,18 +100,12 @@
|
||||
<HintPath>..\packages\MicrosoftOfficeCore.15.0.0\lib\net35\Office.dll</HintPath>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.2.8\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Quartz, Version=3.7.0.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Quartz.3.7.0\lib\netstandard2.0\Quartz.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\StackExchange.Redis.2.8.16\lib\net461\StackExchange.Redis.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
@@ -133,14 +122,6 @@
|
||||
</Reference>
|
||||
<Reference Include="System.DirectoryServices" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.Pipelines, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.5.0.1\lib\net461\System.IO.Pipelines.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
@@ -157,11 +138,6 @@
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
@@ -175,12 +151,6 @@
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Threading.Channels, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Channels.5.0.0\lib\net461\System.Threading.Channels.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.DataVisualization" />
|
||||
@@ -200,7 +170,6 @@
|
||||
<Compile Include="API\APICommonService.cs" />
|
||||
<Compile Include="API\APIGetHttpService.cs" />
|
||||
<Compile Include="API\APIIDCardInfoService.cs" />
|
||||
<Compile Include="API\APIIndexService.cs" />
|
||||
<Compile Include="API\APIPersonService.cs" />
|
||||
<Compile Include="API\APIProjectService.cs" />
|
||||
<Compile Include="API\APIUnitService.cs" />
|
||||
@@ -299,9 +268,6 @@
|
||||
<Compile Include="Common\NPOIHelper.cs" />
|
||||
<Compile Include="Common\PrinterDocService.cs" />
|
||||
<Compile Include="Common\ProjectDataFlowSetService.cs" />
|
||||
<Compile Include="Common\Redis\ICache.cs" />
|
||||
<Compile Include="Common\Redis\Redis.cs" />
|
||||
<Compile Include="Common\Redis\RedisHelper.cs" />
|
||||
<Compile Include="Common\UploadFileService.cs" />
|
||||
<Compile Include="Common\UpLoadImageService.cs" />
|
||||
<Compile Include="Common\UserShowColumnsService.cs" />
|
||||
@@ -1175,13 +1141,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -260,84 +260,5 @@ namespace BLL
|
||||
return workPostName;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static string getDepartNamesByIds(object departIdsIds)
|
||||
{
|
||||
string departName = string.Empty;
|
||||
if (departIdsIds != null)
|
||||
{
|
||||
string[] ids = departIdsIds.ToString().Split(',');
|
||||
foreach (string id in ids)
|
||||
{
|
||||
var q = GetDepartById(id);
|
||||
if (q != null)
|
||||
{
|
||||
departName += q.DepartName + ",";
|
||||
}
|
||||
}
|
||||
if (departName != string.Empty)
|
||||
{
|
||||
departName = departName.Substring(0, departName.Length - 1); ;
|
||||
}
|
||||
}
|
||||
|
||||
return departName;
|
||||
}
|
||||
public static Model.Base_Depart GetDepartById(string departId)
|
||||
{
|
||||
return Funs.DB.Base_Depart.FirstOrDefault(e => e.DepartId == departId);
|
||||
}
|
||||
|
||||
public static string getDepartNamesByIdsForApi(object departIdsIds)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string departName = string.Empty;
|
||||
if (departIdsIds != null)
|
||||
{
|
||||
string[] ids = departIdsIds.ToString().Split(',');
|
||||
foreach (string id in ids)
|
||||
{
|
||||
var q = db.Base_Depart.FirstOrDefault(e => e.DepartId == id);
|
||||
if (q != null)
|
||||
{
|
||||
departName += q.DepartName + ",";
|
||||
}
|
||||
}
|
||||
if (departName != string.Empty)
|
||||
{
|
||||
departName = departName.Substring(0, departName.Length - 1); ;
|
||||
}
|
||||
}
|
||||
|
||||
return departName;
|
||||
}
|
||||
}
|
||||
|
||||
public static string getWorkPostNamesWorkPostIdsForApi(object workPostIds)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string workPostName = string.Empty;
|
||||
if (workPostIds != null)
|
||||
{
|
||||
string[] ids = workPostIds.ToString().Split(',');
|
||||
foreach (string id in ids)
|
||||
{
|
||||
var q = db.Base_WorkPost.FirstOrDefault(e => e.WorkPostId == id);
|
||||
if (q != null)
|
||||
{
|
||||
workPostName += q.WorkPostName + ",";
|
||||
}
|
||||
}
|
||||
if (workPostName != string.Empty)
|
||||
{
|
||||
workPostName = workPostName.Substring(0, workPostName.Length - 1); ;
|
||||
}
|
||||
}
|
||||
|
||||
return workPostName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -468,135 +468,5 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static string InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(string menuId, string projectId, string unitId, string dataId, DateTime? compileDate)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string ruleCode = string.Empty;
|
||||
var IsHaveCodeRecords = db.Sys_CodeRecords.FirstOrDefault(x => x.DataId == dataId);
|
||||
if (IsHaveCodeRecords == null) ///是否已存在编码
|
||||
{
|
||||
string ruleCodeower = string.Empty;
|
||||
int digit = 4; ///流水位数
|
||||
string symbolower = "-"; ///业主间隔符
|
||||
int digitower = 4; ///业主流水位数
|
||||
string symbol = "-"; ///间隔符
|
||||
var project = db.Base_Project.FirstOrDefault(e => e.ProjectId == projectId); ////项目
|
||||
if (project != null && !string.IsNullOrEmpty(dataId))
|
||||
{
|
||||
string projectCode = project.ProjectCode; ///项目编号
|
||||
////编码规则表
|
||||
var sysCodeTemplateRule = db.ProjectData_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId && x.ProjectId == projectId);
|
||||
if (sysCodeTemplateRule != null)
|
||||
{
|
||||
symbol = sysCodeTemplateRule.Symbol;
|
||||
symbolower = sysCodeTemplateRule.OwerSymbol;
|
||||
|
||||
if (sysCodeTemplateRule.Digit.HasValue)
|
||||
{
|
||||
digit = sysCodeTemplateRule.Digit.Value;
|
||||
}
|
||||
if (sysCodeTemplateRule.OwerDigit.HasValue)
|
||||
{
|
||||
digitower = sysCodeTemplateRule.OwerDigit.Value;
|
||||
}
|
||||
if (sysCodeTemplateRule.IsProjectCode == true)
|
||||
{
|
||||
ruleCode = projectCode + symbol;
|
||||
}
|
||||
if (sysCodeTemplateRule.OwerIsProjectCode == true)
|
||||
{
|
||||
ruleCodeower = projectCode + symbolower;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(sysCodeTemplateRule.Prefix))
|
||||
{
|
||||
ruleCode += sysCodeTemplateRule.Prefix + symbol;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(sysCodeTemplateRule.OwerPrefix))
|
||||
{
|
||||
ruleCodeower += sysCodeTemplateRule.OwerPrefix + symbolower;
|
||||
}
|
||||
if (sysCodeTemplateRule.IsUnitCode == true || sysCodeTemplateRule.OwerIsUnitCode == true)
|
||||
{
|
||||
var unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == unitId);
|
||||
if (unit != null)
|
||||
{
|
||||
if (sysCodeTemplateRule.IsUnitCode == true)
|
||||
{ ruleCode = unit.UnitCode + symbol; }
|
||||
|
||||
if (sysCodeTemplateRule.OwerIsUnitCode == true)
|
||||
{
|
||||
ruleCodeower = unit.UnitCode + symbolower;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////获取编码记录表最大排列序号
|
||||
int maxNewSortIndex = 0;
|
||||
if (!String.IsNullOrEmpty(projectId))
|
||||
{
|
||||
var maxSortIndex = db.Sys_CodeRecords.Where(x => x.ProjectId == projectId && x.MenuId == menuId).Select(x => x.SortIndex).Max();
|
||||
if (maxSortIndex.HasValue)
|
||||
{
|
||||
maxNewSortIndex = maxSortIndex.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var maxSortIndexNull = db.Sys_CodeRecords.Where(x => x.MenuId == menuId).Select(x => x.SortIndex).Max();
|
||||
if (maxSortIndexNull.HasValue)
|
||||
{
|
||||
maxNewSortIndex = maxSortIndexNull.Value;
|
||||
}
|
||||
}
|
||||
maxNewSortIndex = maxNewSortIndex + 1;
|
||||
////插入数据库
|
||||
Model.Sys_CodeRecords newCodeRecords = new Model.Sys_CodeRecords
|
||||
{
|
||||
CodeRecordId = SQLHelper.GetNewID(typeof(Model.Sys_CodeRecords))
|
||||
};
|
||||
if (project != null)
|
||||
{
|
||||
newCodeRecords.ProjectId = project.ProjectId;
|
||||
}
|
||||
newCodeRecords.MenuId = menuId;
|
||||
newCodeRecords.DataId = dataId;
|
||||
newCodeRecords.UnitId = unitId;
|
||||
newCodeRecords.SortIndex = maxNewSortIndex;
|
||||
newCodeRecords.CompileDate = compileDate;
|
||||
newCodeRecords.RuleCodes = ruleCode;
|
||||
newCodeRecords.Digit = digit;
|
||||
newCodeRecords.OwnerRuleCodes = ruleCodeower;
|
||||
newCodeRecords.OwerDigit = digitower;
|
||||
if (!string.IsNullOrEmpty(ruleCode))
|
||||
{
|
||||
newCodeRecords.Code = ruleCode + (maxNewSortIndex.ToString().PadLeft(digit, '0')); ///字符自动补零 编码
|
||||
}
|
||||
else
|
||||
{
|
||||
newCodeRecords.Code = (maxNewSortIndex.ToString().PadLeft(digit, '0'));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(ruleCodeower))
|
||||
{
|
||||
newCodeRecords.OwnerCode = ruleCodeower + (maxNewSortIndex.ToString().PadLeft(digitower, '0')); ///字符自动补零 业主编码
|
||||
}
|
||||
else
|
||||
{
|
||||
newCodeRecords.OwnerCode = (maxNewSortIndex.ToString().PadLeft(digitower, '0'));
|
||||
}
|
||||
db.Sys_CodeRecords.InsertOnSubmit(newCodeRecords);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
ruleCode = IsHaveCodeRecords.Code;
|
||||
}
|
||||
|
||||
return ruleCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6415,20 +6415,5 @@ namespace BLL
|
||||
/// 施工作业风险
|
||||
/// </summary>
|
||||
public const string ConstructionRiskMenuId = "F531D523-35BC-4D13-88D3-CB2554C4185C";
|
||||
|
||||
/// <summary>
|
||||
/// 专项安全培训 id
|
||||
/// </summary>
|
||||
public static string SpecialSafeTrainId = "0e7fdf78-eaa0-4d00-a60b-490040bbea18";
|
||||
|
||||
/// <summary>
|
||||
/// 公司看板数据维护
|
||||
/// </summary>
|
||||
public const string BoardDataMenuId = "B06DD352-61C6-453C-A9C7-9CF10918AF08";
|
||||
|
||||
/// <summary>
|
||||
/// 项目看板数据维护
|
||||
/// </summary>
|
||||
public const string ProjectBoardDataMenuId = "087F4FAF-3B00-462A-9040-4CB3556F8177";
|
||||
}
|
||||
}
|
||||
@@ -1412,7 +1412,7 @@
|
||||
sb.Append("<meta http-equiv=\"content-type\" content=\"application/word; charset=UTF-8\"/>");
|
||||
sb.Append("<table width=\"100% \" cellspacing=\"0\" rules=\"all\" border=\"0\" style=\"border-collapse:collapse;font-size: 12pt;\">");
|
||||
sb.Append("<tr style=\"height: 35px\">");
|
||||
sb.AppendFormat("<td align=\"center\" style=\"width: 100%; font-size: 12pt; font-weight: bold;\">{0}</td> ", "新疆邮建" + ProjectService.GetProjectNameByProjectId(getTestRecord.ProjectId));
|
||||
sb.AppendFormat("<td align=\"center\" style=\"width: 100%; font-size: 12pt; font-weight: bold;\">{0}</td> ", "中国天辰" + ProjectService.GetProjectNameByProjectId(getTestRecord.ProjectId));
|
||||
sb.Append("</tr>");
|
||||
sb.Append("<tr style=\"height:35px\">");
|
||||
var getTrainTypeName = (from x in db.Training_TestPlan
|
||||
|
||||
@@ -33,8 +33,6 @@ namespace BLL
|
||||
newCompanyTrainingItem.AttachUrl = companyTrainingItem.AttachUrl;
|
||||
newCompanyTrainingItem.CompileMan = companyTrainingItem.CompileMan;
|
||||
newCompanyTrainingItem.CompileDate = companyTrainingItem.CompileDate;
|
||||
newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime;
|
||||
newCompanyTrainingItem.TestTrainingIds = companyTrainingItem.TestTrainingIds;
|
||||
db.Training_CompanyTrainingItem.InsertOnSubmit(newCompanyTrainingItem);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
@@ -53,8 +51,6 @@ namespace BLL
|
||||
newCompanyTrainingItem.AttachUrl = companyTrainingItem.AttachUrl;
|
||||
newCompanyTrainingItem.CompileMan = companyTrainingItem.CompileMan;
|
||||
newCompanyTrainingItem.CompileDate = companyTrainingItem.CompileDate;
|
||||
newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime;
|
||||
newCompanyTrainingItem.TestTrainingIds = companyTrainingItem.TestTrainingIds;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,37 +152,5 @@ namespace BLL
|
||||
}
|
||||
return icount;
|
||||
}
|
||||
|
||||
public static void AddTestRecordForApi(Model.Training_TestRecord testRecord)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
|
||||
{
|
||||
TestRecordId = testRecord.TestRecordId,
|
||||
ProjectId = testRecord.ProjectId,
|
||||
TestPlanId = testRecord.TestPlanId,
|
||||
TestManId = testRecord.TestManId,
|
||||
TestType = testRecord.TestType,
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(newTestRecord.TestType))
|
||||
{
|
||||
var getTrainTypeName = (from x in db.Training_TestPlan
|
||||
join y in db.Training_Plan on x.PlanId equals y.PlanId
|
||||
join z in db.Base_TrainType on y.TrainTypeId equals z.TrainTypeId
|
||||
where x.TestPlanId == testRecord.TestPlanId
|
||||
select z).FirstOrDefault();
|
||||
|
||||
if (getTrainTypeName != null)
|
||||
{
|
||||
testRecord.TestType = getTrainTypeName.TrainTypeName;
|
||||
}
|
||||
}
|
||||
|
||||
db.Training_TestRecord.InsertOnSubmit(newTestRecord);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,7 @@ namespace BLL
|
||||
ResourcesFromType = trainingItem.ResourcesFromType,
|
||||
IsPass = trainingItem.IsPass,
|
||||
UnitId = trainingItem.UnitId,
|
||||
UpState = trainingItem.UpState,
|
||||
LearningTime = trainingItem.LearningTime
|
||||
UpState = trainingItem.UpState
|
||||
};
|
||||
|
||||
db.Training_TrainingItem.InsertOnSubmit(newTrainingItem);
|
||||
@@ -81,7 +80,6 @@ namespace BLL
|
||||
newTrainingItem.ResourcesFrom = trainingItem.ResourcesFrom;
|
||||
newTrainingItem.ResourcesFromType = trainingItem.ResourcesFromType;
|
||||
newTrainingItem.UpState = trainingItem.UpState;
|
||||
newTrainingItem.LearningTime = trainingItem.LearningTime;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
@@ -750,23 +750,5 @@ namespace BLL
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static Model.SitePerson_Person GetPersonByUserIdForApi(string userId, string projectId)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == userId);
|
||||
if (getPerson == null)
|
||||
{
|
||||
var getUser = db.Sys_User.FirstOrDefault(e => e.UserId == userId);
|
||||
if (getUser != null)
|
||||
{
|
||||
getPerson = db.SitePerson_Person.FirstOrDefault(e => e.IdentityCard == getUser.IdentityCard && e.ProjectId == projectId);
|
||||
}
|
||||
}
|
||||
|
||||
return getPerson;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,34 +53,6 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
var getSysuser = db.Sys_User.FirstOrDefault(e => e.UserId == item.UserId);
|
||||
if (getSysuser!=null)
|
||||
{
|
||||
////获取计划下 人员培训教材明细
|
||||
var getDataList = db.Sp_GetTraining_TaskItemTraining(item.PlanId, getSysuser.WorkPostId);
|
||||
foreach (var dataItem in getDataList)
|
||||
{
|
||||
Model.Training_TaskItem newTaskItem = new Model.Training_TaskItem
|
||||
{
|
||||
TaskId = item.TaskId,
|
||||
PlanId = item.PlanId,
|
||||
PersonId = item.UserId,
|
||||
TrainingItemCode = dataItem.TrainingItemCode,
|
||||
TrainingItemName = dataItem.TrainingItemName,
|
||||
AttachUrl = dataItem.AttachUrl,
|
||||
};
|
||||
|
||||
var getTaskItem = db.Training_TaskItem.FirstOrDefault(x => x.TaskId == item.TaskId && x.TrainingItemName == newTaskItem.TrainingItemName && x.AttachUrl == newTaskItem.AttachUrl);
|
||||
if (getTaskItem == null)
|
||||
{
|
||||
newTaskItem.TaskItemId = SQLHelper.GetNewID();
|
||||
db.Training_TaskItem.InsertOnSubmit(newTaskItem);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////更新培训任务
|
||||
item.States = Const.State_1;
|
||||
|
||||
@@ -972,29 +972,5 @@ namespace BLL
|
||||
maxId = GetIntValue(str);
|
||||
return maxId;
|
||||
}
|
||||
|
||||
public static DataTable GetDataTableRunCommand(SqlCommand cmd)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(connectionString))
|
||||
{
|
||||
cmd.Connection = conn;
|
||||
conn.Open();
|
||||
|
||||
using (SqlDataAdapter adapter = new SqlDataAdapter(cmd))
|
||||
{
|
||||
DataTable dataTable = new DataTable();
|
||||
adapter.Fill(dataTable);
|
||||
return dataTable;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,19 +380,5 @@
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static int getPassScoreForApi()
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
int passScore = 80;
|
||||
var testRule = db.Sys_TestRule.FirstOrDefault();
|
||||
if (testRule != null)
|
||||
{
|
||||
passScore = testRule.PassingScore;
|
||||
}
|
||||
return passScore;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -927,31 +927,5 @@ namespace BLL
|
||||
return q;
|
||||
}
|
||||
}
|
||||
|
||||
public static string getUnitNamesUnitIdsForApi(object unitIds)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string unitName = string.Empty;
|
||||
if (unitIds != null)
|
||||
{
|
||||
string[] ids = unitIds.ToString().Split(',');
|
||||
foreach (string id in ids)
|
||||
{
|
||||
var q = db.Base_Unit.FirstOrDefault(x => x.UnitId == id);
|
||||
if (q != null)
|
||||
{
|
||||
unitName += q.UnitName + ",";
|
||||
}
|
||||
}
|
||||
if (unitName != string.Empty)
|
||||
{
|
||||
unitName = unitName.Substring(0, unitName.Length - 1); ;
|
||||
}
|
||||
}
|
||||
|
||||
return unitName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user