public List <Course> GetCourseByConditon(string courseName, string coordinator, int scope, int status, string trainer, string trainee, string skillName, DateTime expectedTimeFrom, DateTime expectedTimeTo, DateTime actualTimeFrom, DateTime actualTimeTo, decimal expctedCostFrom, decimal expectedCostTo, decimal actaulCostFrom, decimal actualCostTo, Account loginUser) { List <Course> returnCourse = new List <Course>(); //协调员账号 List <Account> coordinatorList = _IAccountBll.GetAccountByBaseCondition(coordinator, -1, -1, null, false, null); coordinatorList = Tools.RemoteUnAuthAccount(coordinatorList, AuthType.HRMIS, loginUser, HrmisPowers.A801); if (coordinatorList.Count == 0) { return(returnCourse); } //培训人员查询 List <Account> traineeList = _IAccountBll.GetAccountByBaseCondition(trainee, -1, -1, null, false, null); traineeList = Tools.RemoteUnAuthAccount(traineeList, AuthType.HRMIS, loginUser, HrmisPowers.A801); if (traineeList.Count == 0) { return(returnCourse); } List <Course> courses = _dalTrain.GetCourseByConditon(courseName, coordinator, scope, status, trainer, trainee, skillName, expectedTimeFrom, expectedTimeTo, actualTimeFrom, actualTimeTo, expctedCostFrom, expectedCostTo, actaulCostFrom, actualCostTo); foreach (Course course in courses) { //查找课程中是否包含不被管理的协调员 Course newcourse = GetTrainCourseByPKID(course.CourseID); List <int> coordinatorListid = new List <int>(); foreach (Account account in coordinatorList) { coordinatorListid.Add(account.Id); } if (!coordinatorListid.Contains(course.Coordinator.Id)) { break; } //查找课程中是否包含不被管理的培训人员 List <int> traineeListid = new List <int>(); foreach (Account account in traineeList) { traineeListid.Add(account.Id); } bool isFind = true; for (int i = 0; i < newcourse.TrainFBResult.TrainEmployeeFBs.Count; i++) { if (traineeListid.Contains(newcourse.TrainFBResult.TrainEmployeeFBs[i].Trainee.Id)) { isFind = false; break; } } if (!isFind) { course.TrainFBResult = newcourse.TrainFBResult; } returnCourse.Add(course); } return(returnCourse); }