修改公司级培训
This commit is contained in:
@@ -152,5 +152,37 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,5 +750,23 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user