/// <summary> /// Checks if the given parameters constitute a match for this <see cref="Acl"/> object. /// </summary> /// <param name="authentication">The signatures available.</param> /// <param name="path">The path of the record being tested.</param> /// <param name="recursiveOnly">Whether this object must be a recursive permission.</param> /// <param name="recordName">The name of the record being tested.</param> /// <returns>A boolean indicating whether the given parameters match.</returns> public bool IsMatch(IReadOnlyList <SignatureEvidence> authentication, LedgerPath path, bool recursiveOnly, string recordName) { return(Path.FullPath == path.FullPath && (!recursiveOnly || Recursive) && RecordName.IsMatch(recordName) && Subjects.Any(subject => subject.IsMatch(authentication))); }
private void FindImplementation() { Subjects = StationManager.DataStorage.GetSubjectsStatistics(SelectedClass, SelectedType); OnPropertyChanged("Subjects"); Margin = (Subjects != null && Subjects.Any())?BigMargin:SmallMargin; OnPropertyChanged("Margin"); Title = "Сводная ведомость успеваемости " + SelectedClass.NumberLetter + " класса за " + SelectedYear + " " + SelectedType; OnPropertyChanged("Title"); }
public override string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { if (!Subjects.Any()) { return(null); } var multiple = Subjects.Count() > 1; var canGuard = FriendlyGuardableUnits(world, mi) .Any(a => multiple || a != Subjects.First()); return(canGuard ? Cursor : "move-blocked"); }
/// <summary> /// Returns a string representation of the VerbPhrase. /// </summary> /// <returns>A string representation of the VerbPhrase.</returns> public override string ToString() { var empty = string.Empty; return(!VerboseOutput? base.ToString() : string.Join("\n", base.ToString(), Subjects.Any() ? $"Subjects: {Subjects.Format(s => s.Text)}" : empty, SubjectComplement != null ? $"\nAttached Subject Complement{SubjectComplement.Text}" : empty, DirectObjects.Any() ? $"Direct Objects: {DirectObjects.Format(o => o.Text)}" : empty, IndirectObjects.Any() ? $"Indirect Objects: {IndirectObjects.Format(o => o.Text)}" : empty, ObjectOfThePreposition != null ? $"Via Preposition Object: {ObjectOfThePreposition.Text}" : empty, Modality != null ? $"Modality: {Modality.Text}" : empty, AdverbialModifiers.Any() ? $"Modifiers: {AdverbialModifiers.Format(m => m.Text)}" : empty, $"\nPossessive: [{(IsPossessive ? "Yes" : "No")}]", $"\nClassifier: [{(IsClassifier ? "Yes" : "No")}]", $"\nPrevailing Form: [{PrevailingForm.SpaceByCase().RemoveSubstrings("Verb").Trim()}]" )); }
public void AddSubject() { if (NewSubject.Length > 0 && !Subjects.Any(n => n.SubjectName == NewSubject)) { //Zapisanie przedmiotu do bazy danych var dbsubject = new DBSubject { SubjectName = newSubject }; using (var context = new StudentAppContext()) { context.DBSubjects.Add(dbsubject); context.SaveChanges(); } Subjects.Add(new SubjectModel { SubjectName = NewSubject, Grades = new BindableCollection <GradeModel>() }); NewSubject = ""; } }
public bool HasSubject(string subject) { return(Subjects.Any(s => string.Compare(s.Trim(), subject) == 0)); }
public async Task InitAsync(ApplicationDbContext dbContext, bool modelStateIsValid = true) { try { Subjects = Subjects?.Any() == true ? Subjects : await dbContext.Subjects .Where(s => s.Id < 14) .OrderBy(s => s.Id) .Select(s => new PropertyDto { Id = s.Id, Name = s.Name, Score = s.Id == 6 ? (int?)100 : null }).ToListAsync(); var subjectNotInFilter = await dbContext.Subjects .Where(s => s.Id > 13) .OrderBy(s => s.Id) .Select(s => new PropertyDto { Id = s.Id, Name = s.Name, Score = 100 }).ToListAsync(); var filterSubject = Subjects.Where(s => s.Score > 0) .ToList(); var hasValues = filterSubject.Any(); filterSubject.AddRange(subjectNotInFilter); var subjectIds = filterSubject .Select(s => s.Id) .ToList(); if (hasValues && modelStateIsValid) { var query = dbContext.Directions .Include(d => d.EducationalDivision.University) .Include(d => d.SubjectScores) .ThenInclude(ss => ss.Subject) .Where(d => d.SubjectScores.All(ss => subjectIds.Contains(ss.SubjectId))) .Where(d => d.SubjectScores.Any()) .Where(d => d.SubjectScores.All(ss => ss.SubjectId == Subjects[0].Id && Subjects[0].Score >= ss.MinimumScore || ss.SubjectId == Subjects[1].Id && Subjects[1].Score >= ss.MinimumScore || ss.SubjectId == Subjects[2].Id && Subjects[2].Score >= ss.MinimumScore || ss.SubjectId == Subjects[3].Id && Subjects[3].Score >= ss.MinimumScore || ss.SubjectId == Subjects[4].Id && Subjects[4].Score >= ss.MinimumScore || ss.SubjectId == Subjects[5].Id && Subjects[5].Score >= ss.MinimumScore || ss.SubjectId == Subjects[6].Id && Subjects[6].Score >= ss.MinimumScore || ss.SubjectId == Subjects[7].Id && Subjects[7].Score >= ss.MinimumScore || ss.SubjectId == Subjects[8].Id && Subjects[8].Score >= ss.MinimumScore || ss.SubjectId == Subjects[9].Id && Subjects[9].Score >= ss.MinimumScore || ss.SubjectId == Subjects[10].Id && Subjects[10].Score >= ss.MinimumScore || ss.SubjectId == Subjects[11].Id && Subjects[11].Score >= ss.MinimumScore || ss.SubjectId == Subjects[12].Id && Subjects[12].Score >= ss.MinimumScore )); var directions = await query .ToListAsync(); Results = await directions.GroupBy(d => d.EducationalDivision.University, (u, dir) => new UniversityDto { UniversityName = u.Name, UniversityUrl = u.Page, Logo = u.logo, Color = u.Color, Divisions = dir.GroupBy(x => x.EducationalDivision, (d, dir) => new DivisionDto { DivisionName = d.Name, DivisionUrl = d.PageUrl, Directions = dir.Select(d => new DirectionDto { DirectionName = d.Name, DirectionUrl = d.PageUrl, SubjectScores = d.SubjectScores.Select(x => $"{x.Subject.Name}({x.MinimumScore})").ToList(), BudgetPlacesCount = d.BudgetPlacesCount, Form = d.EducationalForm, Level = d.Level, logo = d.EducationalDivision.University.logo, PaidPlacesCount = d.PaidPlacesCount, PeriodOfStudy = d.PeriodOfStudy, Price = d.Price, Code = d.Code }).ToList() }).ToList() }).ToListAsync(); } if (Results?.Any() != true) { Universities = await dbContext.Universities .Include(u => u.Divisions) .ThenInclude(d => d.EducationalDirections) .Select(x => new UniversityDto { Logo = x.logo, Color = x.Color, DirectionsCount = x.Divisions.SelectMany(d => d.EducationalDirections).Count(), DivisionsCount = x.Divisions.Count, UniversityName = x.Name, UniversityUrl = x.Page }).ToListAsync(); } } catch (Exception ex) { throw ex; } }