合并最新

This commit is contained in:
2022-12-20 09:32:32 +08:00
parent 844e9f1488
commit 1abdaa9476
654 changed files with 73563 additions and 9746 deletions
+88 -26
View File
@@ -24,24 +24,53 @@ namespace BLL
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
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;
if (string.IsNullOrEmpty(projectId))
{
var getDataLists = (from x in db.Training_TestPlan
where x.ProjectId ==null && (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.getDepartNamesByIds(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.getDepartNamesByIds(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;
}
}
}
#endregion
@@ -56,7 +85,7 @@ namespace BLL
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getDataLists = from x in db.Training_TestPlan
var getDataLists = (from x in db.Training_TestPlan
where x.TestPlanId == testPlanId
select new Model.TestPlanItem
{
@@ -65,7 +94,6 @@ namespace BLL
TestPlanCode = x.PlanCode,
TestPlanName = x.PlanName,
TestPlanManId = x.PlanManId,
TestPlanManName = db.Sys_User.First(y => y.UserId == x.TestPlanId).UserName,
TestPlanDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.PlanDate),
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
@@ -80,11 +108,36 @@ namespace BLL
UnitNames = UnitService.getUnitNamesUnitIds(x.UnitIds),
WorkPostIds = x.WorkPostIds,
WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostIds),
DepartIds = x.DepartIds,
DepartNames = WorkPostService.getDepartNamesByIds(x.DepartIds),
States = x.States,
QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'),
TrainingPlanId = x.PlanId,
};
return getDataLists.FirstOrDefault();
}).FirstOrDefault();
if (getDataLists != null)
{
var user = db.Sys_User.FirstOrDefault(y => y.UserId == getDataLists.TestPlanManId);
if (user != null)
getDataLists.TestPlanManName = user.UserName;
if (!string.IsNullOrEmpty(getDataLists.UnitIds))
{
string[] uids = getDataLists.UnitIds.Split(',');
var units = db.Base_Unit.Where(x => uids.Contains(x.UnitId)).ToList();
string unitName = "";
foreach(var u in units)
{
unitName += u.UnitName + ",";
}
if (!string.IsNullOrEmpty(unitName))
{
getDataLists.UnitNames = unitName;
}
}
}
return getDataLists;
}
}
#endregion
@@ -102,7 +155,7 @@ namespace BLL
Model.Training_TestPlan newTestPlan = new Model.Training_TestPlan
{
TestPlanId = getTestPlan.TestPlanId,
ProjectId = getTestPlan.ProjectId,
PlanCode = getTestPlan.TestPlanCode,
PlanName = getTestPlan.TestPlanName,
PlanManId = getTestPlan.TestPlanManId,
@@ -118,10 +171,14 @@ namespace BLL
TestPalce = getTestPlan.TestPalce,
UnitIds = getTestPlan.UnitIds,
WorkPostIds = getTestPlan.WorkPostIds,
DepartIds = getTestPlan.DepartIds,
States = getTestPlan.States,
PlanDate = DateTime.Now,
};
if (!string.IsNullOrEmpty(getTestPlan.ProjectId))
{
newTestPlan.ProjectId = getTestPlan.ProjectId;
}
if (!string.IsNullOrEmpty(getTestPlan.TrainingPlanId))
{
newTestPlan.PlanId = getTestPlan.TrainingPlanId;
@@ -162,6 +219,7 @@ namespace BLL
isUpdate.TestPalce = newTestPlan.TestPalce;
isUpdate.UnitIds = newTestPlan.UnitIds;
isUpdate.WorkPostIds = newTestPlan.WorkPostIds;
isUpdate.DepartIds = newTestPlan.DepartIds;
////删除 考生记录
var deleteRecords = from x in db.Training_TestRecord
where x.TestPlanId == isUpdate.TestPlanId
@@ -230,8 +288,9 @@ namespace BLL
////新增考试人员明细
foreach (var item in getTestPlan.TestRecordItems)
{
var person = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == item.TestManId);
if (person != null)
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)
{
Model.Training_TestRecord newTrainDetail = new Model.Training_TestRecord
{
@@ -245,6 +304,7 @@ namespace BLL
db.Training_TestRecord.InsertOnSubmit(newTrainDetail);
db.SubmitChanges();
}
}
}
if (getTestPlan.TestPlanTrainingItems.Count() > 0)
@@ -357,6 +417,8 @@ namespace BLL
UnitNames = UnitService.getUnitNamesUnitIds(getTrainingPlan.UnitIds),
WorkPostIds = getTrainingPlan.WorkPostId,
WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(getTrainingPlan.WorkPostId),
DepartIds=getTrainingPlan.DepartIds,
DepartNames = WorkPostService.getDepartNamesByIds(getTrainingPlan.DepartIds),
PlanId = getTrainingPlan.PlanId,
States = "0",
};