冗余代码清理

This commit is contained in:
2026-06-15 19:05:39 +08:00
parent 1fd3ca5094
commit eacb45828c
57 changed files with 134 additions and 31930 deletions
+13 -17
View File
@@ -30,10 +30,10 @@ namespace BLL
newTestRecord.TestPlanName = getTestPlan.PlanName;
newTestRecord.TestPlanId = testPlanId;
newTestRecord.TestPlanStartTime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", getTestPlan.TestStartTime);
newTestRecord.TestPlanEndTime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", getTestPlan.TestEndTime);
newTestRecord.TestManId = testManId;
newTestRecord.TestPlanEndTime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", getTestPlan.TestEndTime);
newTestRecord.TestManId = testManId;
newTestRecord.UserType = userType;
var getUpdateTestRecord = db.Test_TestRecord.FirstOrDefault(x => x.TestPlanId == testPlanId && x.IdentityCard == identityCard);
var getUpdateTestRecord = db.Test_TestRecord.FirstOrDefault(x => x.TestPlanId == testPlanId && x.IdentityCard == identityCard);
if (getUpdateTestRecord == null && userType != "2")
{
getUpdateTestRecord = db.Test_TestRecord.FirstOrDefault(x => x.TestPlanId == testPlanId && x.TestManId == testManId);
@@ -41,9 +41,9 @@ namespace BLL
if (getUpdateTestRecord != null)
{
newTestRecord.TestRecordId = getUpdateTestRecord.TestRecordId;
newTestRecord.DepartId = getUpdateTestRecord.DepartId;
newTestRecord.UnitId = getUpdateTestRecord.UnitId;
newTestRecord.ProjectId = getUpdateTestRecord.ProjectId;
newTestRecord.DepartId = getUpdateTestRecord.DepartId;
newTestRecord.UnitId = getUpdateTestRecord.UnitId;
newTestRecord.ProjectId = getUpdateTestRecord.ProjectId;
newTestRecord.TestManName = getUpdateTestRecord.TestManName;
newTestRecord.Telephone = getUpdateTestRecord.Telephone;
newTestRecord.IdentityCard = getUpdateTestRecord.IdentityCard;
@@ -91,7 +91,7 @@ namespace BLL
else
{
newTestRecord.IsThiUnit = false;
}
}
}
return newTestRecord;
}
@@ -142,11 +142,7 @@ namespace BLL
if (string.IsNullOrEmpty(newTestRecord.ManType))
{
if (testRecord.TestManId == Const.sedinId)
{
newTestRecord.ManType = "2";
}
else if (UserService.GetUserByUserId(testRecord.TestManId) != null)
if (UserService.GetUserByUserId(testRecord.TestManId) != null)
{
newTestRecord.ManType = "1";
}
@@ -157,7 +153,7 @@ namespace BLL
}
Model.Test_TestRecord getUpdateTestRecord = new Model.Test_TestRecord();
; getUpdateTestRecord = db.Test_TestRecord.FirstOrDefault(x => x.TestRecordId == testRecord.TestRecordId);
; getUpdateTestRecord = db.Test_TestRecord.FirstOrDefault(x => x.TestRecordId == testRecord.TestRecordId);
if (getUpdateTestRecord == null)
{
getUpdateTestRecord = db.Test_TestRecord.FirstOrDefault(x => x.TestPlanId == testRecord.TestPlanId && x.IdentityCard == testRecord.IdentityCard);
@@ -186,7 +182,7 @@ namespace BLL
{
if (getTestPlan.TestEndTime > DateTime.Now)
{
var getTestPlanTraining = db.Test_TestPlanTraining.Where(x => x.TestPlanId == getTestPlan.TestPlanId && x.UserType == testRecord.UserType );
var getTestPlanTraining = db.Test_TestPlanTraining.Where(x => x.TestPlanId == getTestPlan.TestPlanId && x.UserType == testRecord.UserType);
if (getTestPlanTraining.Count() > 0)
{
int cout1 = getTestPlanTraining.Sum(x => x.TestType1Count ?? 0);
@@ -311,8 +307,8 @@ namespace BLL
{
var getTestPlan = db.Test_TestPlan.FirstOrDefault(x => x.TestPlanId == testPlanId);
var getTestRecord = db.Test_TestRecord.FirstOrDefault(x => x.TestRecordId == testRecordId);
if(getTestPlan != null && getTestRecord != null)
{
if (getTestPlan != null && getTestRecord != null)
{
////是否已经存在试卷
var item = db.Test_TestRecordItem.FirstOrDefault(x => x.TestRecordId == testRecordId);
if (item == null)
@@ -419,7 +415,7 @@ namespace BLL
Score = x.TestType == "1" ? getTestPlan.SValue : (x.TestType == "2" ? getTestPlan.MValue : getTestPlan.JValue),
};
db.Test_TestRecordItem.InsertAllOnSubmit(getItems);
db.Test_TestRecordItem.InsertAllOnSubmit(getItems);
getTestRecord.TestStartTime = DateTime.Now;
db.SubmitChanges();
}