private static DateTime GetExpectedDate(Referential item, Calendar calendar) { var u3 = item.Date.Split('-'); var year = int.Parse(u3[0]); var month = int.Parse(u3[1]); var day = int.Parse(u3[2]); if (!(calendar is GregorianCalendar)) { if (year > 2010 && year < 2050) { calendar = new GregorianCalendar(); } } DateTime expected; try { expected = new DateTime(year, month, day, calendar); } catch (Exception) { throw; } return(expected); }
public IActionResult OnPostValidateAnswers() { Score = Referential.GetScore(Answers .Where(a => a.Answer != 0) .ToDictionary(a => a.Id, a => a.Answer)); return(Page()); }
protected override List <ProjectionItem> List() { var configViewpoint = Referential.GetCooperationViewpoint(this.Diagram.ViewpointType); if (configViewpoint != null) { var item1 = this.ModelElement; var result = new List <ProjectionItem>(300); if (item1 is Bb.ApplicationCooperationViewPoint.ModelElement me) { foreach (var e in configViewpoint.Elements) { var query = new ResolveQuery() { Kind = Galileo.ElementEnum.Entity, TypeName = e.Name }; var items = query.GetReferentials(this.Referential); result.AddRange(GetReferentials(items)); } } else if (item1 is Concept co) { foreach (var e in configViewpoint.Concepts) { var query = new ResolveQuery() { Kind = Galileo.ElementEnum.Entity, TypeName = e.Name }; var items = query.GetReferentials(this.Referential); result.AddRange(GetReferentials(items)); } } else if (item1 is SubElement se) { if (!string.IsNullOrEmpty(se.Parent.Type)) { foreach (var element in configViewpoint.Elements.Where(c => c.Name == se.Parent.Type)) { foreach (CooperationRelationship sElement in element.Children) { RelationshipDefinition itemDef = sElement.GetRelationshipDefinition(this.Referential); ResolveQuery parentQuery = se.Parent.ReferenceSource.AsQuery(); var p = parentQuery.GetReferentials(this.Referential).OfType <ReferentialEntity>().FirstOrDefault(); var children = p.GetTargetEntities(itemDef).ToList(); result.AddRange(GetReferentials(children)); } } } } else if (item1 is ConceptElement ce) { if (!string.IsNullOrEmpty(ce.Parent.Type)) { foreach (var element in configViewpoint.Elements.Where(c => c.Name == ce.Parent.Type)) { foreach (CooperationRelationship sElement in element.Children) { RelationshipDefinition itemDef = sElement.GetRelationshipDefinition(this.Referential); var parentQuery = ce.Parent.ReferenceSource.AsQuery(); var p = parentQuery.GetReferentials(this.Referential).OfType <ReferentialEntity>().FirstOrDefault(); var children = p.GetTargetEntities(itemDef).ToList(); result.AddRange(GetReferentials(children)); } } } } else if (item1 is ConceptSubElement cs) { } else if (item1 is Relationship re) { } return(result.OrderBy(c => c.Name).Cast <ProjectionItem>().ToList()); } throw new System.NotImplementedException(); }
public void OnGet() { Questions = Referential.GetRandomQuestions(_questionsCount); Score = null; }