1代码合并
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user