public static List <TurnList> GetListTurn(string nameTypeWork, string nameStudent, string nameDiscipline, string nameCp, string nameGroup, string nameTerm) { List <TurnList> list = new List <TurnList>(); var reposTurn = RepositoryFactory <Turn> .Create(); var reposStud = RepositoryFactory <Student> .Create(); var reposDiscip = RepositoryFactory <Discipline> .Create(); var reposCp = RepositoryFactory <CP> .Create(); var idGroup = reposStud.GetIdGroupForStudent(nameGroup); var idStudent = reposStud.GetIdStudent(nameStudent); var idDiscipline = WorkWithDB.GetDisciplineId(nameDiscipline); var idCp = WorkWithDB.GetIdCp(nameCp, idGroup, nameDiscipline, nameTerm); var _listTurn = reposTurn.GetAll(); foreach (var item in _listTurn) { if (item.EntityCpDataShort.IdCp == idCp && item.EntityCpDataShort.IdDiscipline == idDiscipline && item.EntityCpDataShort.IdStudent == idStudent && item.TypeOfWorkId == item.GetTypeId(nameTypeWork)) { list.Add(new TurnList(item.Name, item.Point, nameStudent)); } else { continue; } } return(list); }
public static IEnumerable <CP> GetAllCpForGroupAndDiscipline(string nameGroup, string nameDiscipline, string nameTerm) { IEnumerable <CP> listCpForGroup = null; var reposStudent = RepositoryFactory <Student> .Create(); var outThread = Task.Factory.StartNew(() => { var _idGroup = reposStudent.GetIdGroupForStudent(nameGroup); var _idTerm = WorkWithDB.GetIdTermForCp(nameTerm); var _idDiscipline = GetDisciplineId(nameDiscipline); var repositoryCp = RepositoryFactory <CP> .Create(); var listCp = repositoryCp.GetAll(); var innerThread = Task.Factory.StartNew(() => { listCpForGroup = from Cp in listCp where Cp.GroupId == _idGroup where Cp.DisciplineId == _idDiscipline where Cp.TermId == _idTerm select Cp; }, TaskCreationOptions.AttachedToParent); }); outThread.Wait(); return((IEnumerable <CP>)listCpForGroup); }
public static long GetIdCp(string nameCp, long idGroup, string nameDiscipline, string termName) { var reposCp = RepositoryFactory <CP> .Create(); var _listCp = reposCp.GetAll(); long _id; long _termId = WorkWithDB.GetIdTermForCp(termName); try { var cp = _listCp.First(o => o.GroupId == idGroup && o.Name == nameCp && o.DisciplineId == GetDisciplineId(nameDiscipline) && o.TermId == _termId); _id = cp.ID; } catch { _id = 0; } return(_id); }
public static long GetIdCp(string nameCp, long idGroup, string nameDiscipline, string termName) { var reposCp = RepositoryFactory <CP> .Create(); var _listCp = reposCp.GetAll(); long _id; try { long _termId = WorkWithDB.GetIdTermForCp(termName); var cp = _listCp.First(o => o.GroupId == idGroup && o.Name == nameCp && o.DisciplineId == GetDisciplineId(nameDiscipline) && o.TermId == _termId); _id = cp.ID; } catch (Exception ex) { _logger.Error("Ошибка при получении id контрольной точки. {0}.", ex.ToString()); _id = 0; } return(_id); }