考试调整
This commit is contained in:
parent
53473b9f66
commit
49283a7433
|
@ -52,38 +52,38 @@ namespace BLL
|
||||||
|
|
||||||
db.Training_TestRecord.InsertOnSubmit(newTestRecord);
|
db.Training_TestRecord.InsertOnSubmit(newTestRecord);
|
||||||
db.SubmitChanges();
|
db.SubmitChanges();
|
||||||
}
|
}
|
||||||
public static void AddTestRecordForApi(Model.Training_TestRecord testRecord)
|
public static void AddTestRecordForApi(Model.Training_TestRecord testRecord)
|
||||||
|
{
|
||||||
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||||
{
|
{
|
||||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
|
||||||
{
|
{
|
||||||
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
|
TestRecordId = testRecord.TestRecordId,
|
||||||
{
|
ProjectId = testRecord.ProjectId,
|
||||||
TestRecordId = testRecord.TestRecordId,
|
TestPlanId = testRecord.TestPlanId,
|
||||||
ProjectId = testRecord.ProjectId,
|
TestManId = testRecord.TestManId,
|
||||||
TestPlanId = testRecord.TestPlanId,
|
TestType = testRecord.TestType,
|
||||||
TestManId = testRecord.TestManId,
|
};
|
||||||
TestType = testRecord.TestType,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(newTestRecord.TestType))
|
if (string.IsNullOrEmpty(newTestRecord.TestType))
|
||||||
{
|
{
|
||||||
var getTrainTypeName = (from x in db.Training_TestPlan
|
var getTrainTypeName = (from x in db.Training_TestPlan
|
||||||
join y in db.Training_Plan on x.PlanId equals y.PlanId
|
join y in db.Training_Plan on x.PlanId equals y.PlanId
|
||||||
join z in db.Base_TrainType on y.TrainTypeId equals z.TrainTypeId
|
join z in db.Base_TrainType on y.TrainTypeId equals z.TrainTypeId
|
||||||
where x.TestPlanId == testRecord.TestPlanId
|
where x.TestPlanId == testRecord.TestPlanId
|
||||||
select z).FirstOrDefault();
|
select z).FirstOrDefault();
|
||||||
|
|
||||||
if (getTrainTypeName != null)
|
if (getTrainTypeName != null)
|
||||||
{
|
{
|
||||||
testRecord.TestType = getTrainTypeName.TrainTypeName;
|
testRecord.TestType = getTrainTypeName.TrainTypeName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
db.Training_TestRecord.InsertOnSubmit(newTestRecord);
|
db.Training_TestRecord.InsertOnSubmit(newTestRecord);
|
||||||
db.SubmitChanges();
|
db.SubmitChanges();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 修改考试记录信息
|
/// 修改考试记录信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -79,24 +79,41 @@ namespace WebAPI.Controllers
|
||||||
var responeData = new Model.ResponeData();
|
var responeData = new Model.ResponeData();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var getTasks = new Model.SGGLDB(Funs.ConnString).Training_Task.FirstOrDefault(x => x.PlanId == trainingPlanId);
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||||
if (getTasks != null)
|
|
||||||
{
|
{
|
||||||
if (CommonService.IsMainUnitOrAdmin(userId))
|
var getTasks =db.Training_Task.FirstOrDefault(x => x.PlanId == trainingPlanId);
|
||||||
|
if (getTasks != null)
|
||||||
{
|
{
|
||||||
responeData.data = APITestPlanService.SaveTestPlanByTrainingPlanId(trainingPlanId, userId);
|
bool result = false;
|
||||||
|
if (userId == Const.sysglyId || userId == Const.hfnbdId)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var user = db.Sys_User.FirstOrDefault(e => e.UserId == userId);
|
||||||
|
if (user != null && user.UnitId == Const.UnitId_CD)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( result)
|
||||||
|
//if (CommonService.IsMainUnitOrAdmin(userId))
|
||||||
|
{
|
||||||
|
responeData.data = APITestPlanService.SaveTestPlanByTrainingPlanId(trainingPlanId, userId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
responeData.code = 0;
|
||||||
|
responeData.message = "非本单位用户,不能生成考试计划!";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
responeData.code = 0;
|
responeData.code = 0;
|
||||||
responeData.message = "非本单位用户,不能生成考试计划!";
|
responeData.message = "培训计划下没有培训人员,不能生成考试计划!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
responeData.code = 0;
|
|
||||||
responeData.message = "培训计划下没有培训人员,不能生成考试计划!";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -201,11 +218,11 @@ namespace WebAPI.Controllers
|
||||||
Model.SitePerson_Person person;
|
Model.SitePerson_Person person;
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
person = Funs.DB.SitePerson_Person.FirstOrDefault(e => (e.PersonId == personId || e.IdentityCard == user.IdentityCard) && e.ProjectId == getTestPlan.ProjectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
|
person = db.SitePerson_Person.FirstOrDefault(e => (e.PersonId == personId || e.IdentityCard == user.IdentityCard) && e.ProjectId == getTestPlan.ProjectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
person = Funs.DB.SitePerson_Person.FirstOrDefault(e => e.PersonId == personId && e.ProjectId == getTestPlan.ProjectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
|
person = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == personId && e.ProjectId == getTestPlan.ProjectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (person != null || user != null)
|
if (person != null || user != null)
|
||||||
|
@ -246,7 +263,7 @@ namespace WebAPI.Controllers
|
||||||
TestPlanId = getTestPlan.TestPlanId,
|
TestPlanId = getTestPlan.TestPlanId,
|
||||||
TestManId = personId,
|
TestManId = personId,
|
||||||
};
|
};
|
||||||
TestRecordService.AddTestRecord(newTestRecord);
|
TestRecordService.AddTestRecordForApi(newTestRecord);
|
||||||
responeData.code = 3;
|
responeData.code = 3;
|
||||||
responeData.message = "您已加入考试计划!";
|
responeData.message = "您已加入考试计划!";
|
||||||
}
|
}
|
||||||
|
@ -265,7 +282,7 @@ namespace WebAPI.Controllers
|
||||||
TestPlanId = getTestPlan.TestPlanId,
|
TestPlanId = getTestPlan.TestPlanId,
|
||||||
TestManId = personId,
|
TestManId = personId,
|
||||||
};
|
};
|
||||||
TestRecordService.AddTestRecord(newTestRecord);
|
TestRecordService.AddTestRecordForApi(newTestRecord);
|
||||||
responeData.code = 3;
|
responeData.code = 3;
|
||||||
responeData.message = "您已加入考试计划!";
|
responeData.message = "您已加入考试计划!";
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ namespace WebAPI.Controllers
|
||||||
var responeData = new Model.ResponeData();
|
var responeData = new Model.ResponeData();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
personId = PersonService.GetPersonIdByUserId(personId);
|
personId = PersonService.GetPersonIdByUserIdForApi(personId);
|
||||||
var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectIdPersonId(projectId, personId);
|
var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectIdPersonId(projectId, personId);
|
||||||
int pageCount = getDataLists.Count;
|
int pageCount = getDataLists.Count;
|
||||||
if (pageCount > 0 && pageIndex > 0)
|
if (pageCount > 0 && pageIndex > 0)
|
||||||
|
|
|
@ -101,14 +101,31 @@ namespace WebAPI.Controllers
|
||||||
var responeData = new Model.ResponeData();
|
var responeData = new Model.ResponeData();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (CommonService.IsMainUnitOrAdmin(trainingPlan.DesignerId))
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||||
{
|
{
|
||||||
APITrainingPlanService.SaveTrainingPlan(trainingPlan);
|
bool result = false;
|
||||||
}
|
if (trainingPlan.DesignerId == Const.sysglyId || trainingPlan.DesignerId == Const.hfnbdId)
|
||||||
else
|
{
|
||||||
{
|
result = true;
|
||||||
responeData.code = 0;
|
}
|
||||||
responeData.message = "非本单位用户,不能制定培训计划!";
|
else
|
||||||
|
{
|
||||||
|
var user = db.Sys_User.FirstOrDefault(e => e.UserId == trainingPlan.DesignerId);
|
||||||
|
if (user != null && user.UnitId == Const.UnitId_CD)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result)
|
||||||
|
// if (CommonService.IsMainUnitOrAdmin(trainingPlan.DesignerId))
|
||||||
|
{
|
||||||
|
APITrainingPlanService.SaveTrainingPlan(trainingPlan);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
responeData.code = 0;
|
||||||
|
responeData.message = "非本单位用户,不能制定培训计划!";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace WebAPI.Controllers
|
||||||
var responeData = new Model.ResponeData();
|
var responeData = new Model.ResponeData();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string newPersonId = PersonService.GetPersonIdByUserId(personId);
|
string newPersonId = PersonService.GetPersonIdByUserIdForApi(personId);
|
||||||
responeData.message = APITrainingTaskService.getTrainingTaskByPlanIdPersonIdCondition(planId, newPersonId);
|
responeData.message = APITrainingTaskService.getTrainingTaskByPlanIdPersonIdCondition(planId, newPersonId);
|
||||||
if (string.IsNullOrEmpty(responeData.message))
|
if (string.IsNullOrEmpty(responeData.message))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue