private IEnumerable <TenderingCriterionResponse> PrePopulateNoLotResponses(TenderingCriterionPropertyGroup propertyGroup) { foreach (var lotProp in propertyGroup.TenderingCriterionProperties.Where(p => p.TypeCode.Equals(CriterionElementType.Question) && p.ValueDataTypeCode.Equals(ResponseDataTypeCode.LotIdentifier))) { yield return(new TenderingCriterionResponse() { ID = EuComGrowId.Random(), ResponseValue = new ResponseValue[] { new ResponseValue() { ResponseID = new IdentifierType("0") } }, ValidatedCriterionPropertyID = lotProp.ID, }); } if (propertyGroup.SubsidiaryTenderingCriterionPropertyGroups != null) { var subEvidences = propertyGroup.SubsidiaryTenderingCriterionPropertyGroups.SelectMany(PrePopulateNoLotResponses); foreach (var evidence in subEvidences) { yield return(evidence); } } }
public static ResponseValue CreateResponseValue(TenderingCriterionProperty property) { var responseValue = new ResponseValue() { ID = EuComGrowId.Random() }; switch (property.ValueDataTypeCode.Value) { case "AMOUNT": responseValue.ResponseAmount = new AmountType(100m) { CurrencyID = "EUR" }; break; case "QUANTITY": responseValue.ResponseQuantity = new QuantityType(200m) { UnitCode = "pcs" }; break; case "QUANTITY_YEAR": responseValue.ResponseQuantity = new QuantityType(200m) { UnitCode = "YEAR" }; break; case "QUANTITY_INTEGER": responseValue.ResponseQuantity = new QuantityType(200m) { UnitCode = "PCS" }; break; case "CODE": responseValue.ResponseCode = new CodeType("FOO"); break; case "MEASURE": responseValue.ResponseMeasure = new MeasureType(123, "m"); break; case "DATE": responseValue.ResponseDate = new DateType(new DateTime(2020, 1, 1)); break; case "INDICATOR": responseValue.ResponseIndicator = true; break; default: responseValue.Description = new[] { "Some description" }; break; } return(responseValue); }
public static IEnumerable <TenderingCriterionResponse> CreateResponses(QualificationApplicationResponse response) { foreach (var property in response.TenderingCriteria.SelectMany(c => c.DescendantProperties().Where(p => p.TypeCode.Equals(CriterionElementType.Question)))) { var isPeriod = property.ValueDataTypeCode.Equals(ResponseDataTypeCode.Period); var isEvidence = property.ValueDataTypeCode.Equals(ResponseDataTypeCode.EvidenceIdentifier); var isResponseValue = !(isPeriod || isEvidence); yield return(new TenderingCriterionResponse() { ID = EuComGrowId.Random(), ValidatedCriterionPropertyID = property.ID, EvidenceSupplied = isEvidence ? new EvidenceSupplied() { ID = response.Evidences[0].ID } : null, ApplicablePeriod = isPeriod ? new Period() { StartDate = new DateTime(2020, 1, 1), EndDate = new DateTime(2020, 12, 31) } : null, ResponseValue = isResponseValue ? new[] { CreateResponseValue(property) } : new ResponseValue[0] }); } }
private static void FinalizeCriterion(TenderingCriterion criterion, QualificationApplicationRequest request, string[] selectedLots) { var procurementHasLots = request.IsProcurementDividedIntoLots; criterion.TenderingCriterionPropertyGroups = FinalizeGroups(criterion.TenderingCriterionPropertyGroups).ToArray(); IEnumerable <TenderingCriterionPropertyGroup> FinalizeGroups(IEnumerable <TenderingCriterionPropertyGroup> groups) { if (groups == null) { yield break; } foreach (var group in groups) { yield return(FinalizeGroup(@group)); } } TenderingCriterionPropertyGroup FinalizeGroup(TenderingCriterionPropertyGroup propertyGroup) { if (propertyGroup == null) { throw new ArgumentNullException(nameof(propertyGroup)); } if (propertyGroup?.TenderingCriterionProperties?.Any() ?? false) { propertyGroup.TenderingCriterionProperties = FilterAndFinalizeProperties(propertyGroup) .ToArray(); } else { // Set empty property to conform to espd schema propertyGroup.TenderingCriterionProperties = new[] { CriterionHelper.EmptyCaptionProperty }; } if (propertyGroup.SubsidiaryTenderingCriterionPropertyGroups != null) { propertyGroup.SubsidiaryTenderingCriterionPropertyGroups = FinalizeGroups(propertyGroup?.SubsidiaryTenderingCriterionPropertyGroups).ToArray(); } return(propertyGroup); } IEnumerable <TenderingCriterionProperty> FilterAndFinalizeProperties( TenderingCriterionPropertyGroup group) { foreach (var property in group.TenderingCriterionProperties) { if (IsLotIdentifier(property) && IsRequirementProperty(property)) { foreach (var lotProperty in SetRequirementLotIdentifierValue(property)) { yield return(lotProperty); } } else { // Set default value to Contributions threshold value as per Comission suggestion if (group.ID.Value == ContributionThresholdGroupId.ToString()) { if (property.ValueDataTypeCode.Equals(ResponseDataTypeCode.Amount)) { // Set default threshold to 0 property.ExpectedAmount = new AmountType { Value = 0, CurrencyID = "EUR" }; } if (property.ValueDataTypeCode.Equals(ResponseDataTypeCode.Description)) { // Set default threshold to 0 property.ExpectedDescription = string.Empty; } } // Generate new if for property property.ID = EuComGrowId.Random(); yield return(property); } } IEnumerable <TenderingCriterionProperty> SetRequirementLotIdentifierValue(TenderingCriterionProperty property) { if (procurementHasLots) { // Duplicate requirement lot property for each lot foreach (var projectLot in selectedLots) { yield return(new TenderingCriterionProperty() { _cardinality = property._cardinality, ID = EuComGrowId.Random(), Name = property.Name, Description = property.Description, ExpectedID = new EuComGrowId(projectLot), TypeCode = CriterionElementType.Requirement, ValueDataTypeCode = ResponseDataTypeCode.LotIdentifier }); } } else { property.ID = EuComGrowId.Random(); property.ExpectedID = new EuComGrowId(0.ToString()); yield return(property); } } bool IsLotIdentifier(TenderingCriterionProperty property) { return(property.ValueDataTypeCode.Value == ResponseDataTypeCode.LotIdentifier.Value); } bool IsRequirementProperty(TenderingCriterionProperty property) { return(property?.TypeCode?.Equals(CriterionElementType.Requirement) ?? false); } } }
public static EconomicOperatorParty EconomicOperatorParty() { return(new EconomicOperatorParty { QualifyingParty = new QualifyingParty() { BusinessClassificationScheme = new BusinessClassificationScheme() { ID = EuComGrowId.Random(), Description = new string[] { "My description" }, ClassificationCategory = new ClassificationCategory() }, EmployeeQuantity = new QuantityType() { Value = 10 }, FinancialCapability = new FinancialCapability() { ValueAmount = new AmountType(1000000m) { CurrencyID = "EUR", CurrencyCodeListVersionID = "1.0" } }, Party = new Party() { IndustryClassificationCode = new CodeType("SMALL") { ListID = "EOIndustryClassificationCode", ListAgencyID = "EU-COM-GROW", ListVersionID = "2.1.1" }, PartyIdentification = new PartyIdentification { ID = new IdentifierType("FI1234560") { SchemeID = "VAT", SchemeAgencyID = "VIES" } } } }, EconomicOperatorRole = new EconomicOperatorRole() { RoleCode = new EuComGrowCodeType("SC") { ListID = "EORoleType" }, RoleDescription = new string[0] }, Party = new Party { PartyIdentification = new PartyIdentification { ID = new IdentifierType("FI1234560") { SchemeID = "VAT", SchemeAgencyID = "VIES" } }, IndustryClassificationCode = new CodeType("SMALL") { ListID = "EOIndustryClassificationCode", ListAgencyID = "EU-COM-GROW", ListVersionID = "2.1.1" }, WebsiteURI = new IdentifierType("http://foo.fi"), PartyName = new PartyName { Name = "Foo business" }, PostalAddress = new Address { AddressLines = new[] { "Foo str 1" }, CityName = "Foocity", PostalZone = "00100", Country = new Country { IdentificationCode = new EuComGrowCodeType { ListVersionID = "1.0", ListAgencyID = "ISO", ListName = "CountryCodeIdentifier", ListID = "CountryCodeIdentifier", Value = "FI" }, Name = "Finland" } }, Contact = new Contact { Name = "Mr. Foo", ElectronicMail = "*****@*****.**", Telephone = "+3580441234455" }, PowerOfAttorneys = new PowerOfAttorney[] { new PowerOfAttorney() { AgentParty = new Party() { Person = new Person() { FirstName = "Foo", FamilyName = "Foobar", ResidenceAddress = new Address() { AddressLines = new[] { "Fooavenue 1" }, CityName = "Foocity", Country = new Country() { IdentificationCode = new CodeType("FI") { ListID = "CountryCodeIdentifier", ListVersionID = "1.0", ListAgencyID = "ISO" }, Name = "Finland" } } } }, } } } }); }
public static QualificationApplicationResponse QualificationApplicationResponse(IEnumerable <TenderingCriterion> additionalCriteria = null) { var request = CriteriaTaxonomyExtendedV2_1_1; request.AdditionalDocumentReferences = new AdditionalDocumentReference[] { new AdditionalDocumentReference { ID = new IdentifierType { Value = "2020/S 100-000001", SchemeAgencyID = "EU-COM-OP" }, DocumentTypeCode = new EuComGrowCodeType { ListID = "DocRefContentType", ListAgencyID = "EU-COM-GROW", ListVersionID = "2.1.1", Value = "TED_CN" }, Attachment = new Attachment { ExternalReference = new ExternalReference { URI = new IdentifierType { Value = "http://ted.europa.eu" }, FileName = "Hankinta X", Description = new[] { "Hankinta X", "0000/S 000-000000", } } } } }; if (additionalCriteria != null) { request.TenderingCriteria = request.TenderingCriteria.Union(additionalCriteria).ToArray(); } var factory = new QualificationApplicationFactory(); var espdUrl = "http://localhost/espd/request/12345"; var response = factory.CreateEspd2_1_1ExtendedResponse( request, EconomicOperatorParty(), new EuComGrowId(Guid.NewGuid()), Guid.NewGuid(), espdUrl ); var evidences = new[] { new Evidence() { ID = EuComGrowId.Random(), Description = new[] { "Evidence stuff" }, DocumentReference = new DocumentReference[] { new DocumentReference() { ID = EuComGrowId.Random(), IssuerParty = new Party() { PartyName = new PartyName() { Name = "Issuer" } } } } } }; response.Evidences = evidences; response.TenderingCriterionResponses = CreateResponses(response).ToArray(); return(response); }