/// <summary>
        /// Section IV: Procedure Information
        /// </summary>
        /// <returns>The PROCEDURES_ICAR XElement</returns>
        private XElement ProcedureInformation()
        {
            var previousOjs = _notice.TenderingInformation.Defence?.PreviousPriorInformationNoticeOjsNumber ?? new OjsNumber();

            if (_notice.Type == NoticeType.DefenceContractAward)
            {
                previousOjs = _notice.TenderingInformation.Defence.PreviousContractNoticeOjsNumber;
            }
            if (_notice.Type == NoticeType.ExAnte)
            {
                previousOjs = _notice.TenderingInformation.Defence.PreviousExAnteOjsNumber;
            }
            return(TedHelpers.Element("PROCEDURES_ICAR",
                                      TedHelpers.Element("TYPE_OF_PROCEDURE_CORRIGENDUM",
                                                         TedHelpers.ElementWithAttribute("TYPE_OF_PROCEDURE_DETAIL_FOR_ICAR", "VALUE", ProcedureType())),
                                      TedHelpers.Element("ADMINISTRATIVE_INFORMATION",
                                                         TedHelpers.PElement("FILE_REFERENCE_NUMBER", _notice.Project?.ReferenceNumber),
                                                         TedHelpers.Element("SIMAP_ESENDER_NOTICE_REFERENCE",
                                                                            TedHelpers.ElementWithAttribute("SIMAP_ESENDER", "VALUE", "OJS_ESENDER"),
                                                                            TedHelpers.ElementWithAttribute("LOGIN", "CLASS", "B",
                                                                                                            TedHelpers.Element("ESENDER_LOGIN", _eSenderLogin)),
                                                                            TedHelpers.Element("NO_DOC_EXT", _notice.NoticeNumber)),
                                                         TedHelpers.Element("NOTICE_PUBLICATION",
                                                                            TedHelpers.Element("NOTICE_NUMBER_OJ", previousOjs.Number),
                                                                            TedHelpers.DateElement("DATE_OJ", previousOjs.Date)),
                                                         TedHelpers.DateElement("ORIGINAL_DISPATCH_DATE", _parent.TedPublishRequestSentDate != DateTime.MinValue ? _parent.TedPublishRequestSentDate :  null))
                                      //TODO (TuomasT): Allow setting original date manually
                                      ));
        }
        private List <XElement> ChangesToXml(List <Change> changes)
        {
            var result = new List <XElement>();

            foreach (var change in changes)
            {
                var(newElement, newType) = NewValue(change);
                var(oldElement, oldType) = OldValue(change);
                // Can be CPV_MAIN, CPV_ADDITIONAL, NUTS, DATE_TIME or TEXT
                result.Add(
                    TedHelpers.Element("CORR",
                                       newType != ChangeType.Undefined && oldType == ChangeType.Undefined ?
                                       TedHelpers.ElementWithAttribute("ADD", "OBJECT", newType.ToString().ToUpper(),
                                                                       TedHelpers.Element("WHERE", $"{change.Section}: {change.Label}"),
                                                                       TedHelpers.Element("NEW_VALUE", newElement)) : null,
                                       newType == ChangeType.Undefined && oldType != ChangeType.Undefined ?
                                       TedHelpers.ElementWithAttribute("DELETE", "OBJECT", oldType.ToString().ToUpper(),
                                                                       TedHelpers.Element("WHERE", $"{change.Section}: {change.Label}"),
                                                                       TedHelpers.Element("OLD_VALUE", oldElement)) : null,
                                       newType != ChangeType.Undefined && oldType != ChangeType.Undefined ?
                                       TedHelpers.ElementWithAttribute("REPLACE", "OBJECT", newType.ToString().ToUpper(),
                                                                       TedHelpers.Element("WHERE", $"{change.Section}: {change.Label}"),
                                                                       TedHelpers.Element("OLD_VALUE", oldElement),
                                                                       TedHelpers.Element("NEW_VALUE", newElement)) : null));
            }

            return(result);
        }
 /// <summary>
 /// Creates the XML document that is sent to TED.
 /// </summary>
 /// <returns></returns>
 public XDocument CreateForm()
 {
     return(new XDocument(
                new XDeclaration("1.0", "utf-8", null), TedHelpers.Element("TED_ESENDERS",
                                                                           new XAttribute(XNamespace.Xmlns + nameof(TedHelpers.n2016), TedHelpers.n2016),
                                                                           new XAttribute(XNamespace.Xmlns + nameof(TedHelpers.xs), TedHelpers.xs),
                                                                           TedHelpers.LoginPart(_notice, _eSenderLogin, _tedESenderOrganisation, _tedContactEmail),
                                                                           NoticeBody())));
 }
 /// <summary>
 /// #  XSD name : F14_2014
 /// #  RELEASE : "R2.0.9.S03"
 /// #  Intermediate release number 007-20181030
 /// #  Last update : 08/06/2018
 /// #  Form : Corrigendum
 /// </summary>
 private XElement NoticeBody()
 {
     return(TedHelpers.Element("FORM_SECTION",
                               TedHelpers.Element("ADDITIONAL_INFORMATION_CORRIGENDUM", new XAttribute("LG", _notice.Language), new XAttribute("CATEGORY", "ORIGINAL"), new XAttribute("FORM", "14"), new XAttribute("VERSION", "R2.0.8.S04"),
                                                  TedHelpers.Element("FD_ADDITIONAL_INFORMATION_CORRIGENDUM",
                                                                     ContractingBody(_notice.Project.Organisation, _notice.ContactPerson, _notice.CommunicationInformation),
                                                                     ObjectContract(),
                                                                     ProcedureInformation(),
                                                                     ComplementaryInformation()))));
 }
 /// <summary>
 /// Section I: Contracting authority
 /// </summary>
 /// <param name="organisation">The organisation</param>
 /// <param name="contactPerson">The contact person</param>
 /// <param name="communicationInformation">I.3 Communication</param>
 /// <returns>CONTRACTING_BODY XElement</returns>
 private XElement ContractingBody(OrganisationContract organisation, ContactPerson contactPerson, CommunicationInformation communicationInformation)
 {
     return(TedHelpers.Element("AUTH_ENTITY_ICAR",
                               TedHelpers.Element("NAME_ADDRESSES_CONTACT_ICAR",
                                                  TedHelpers.INC_01("CA_CE_CONCESSIONAIRE_PROFILE", organisation, contactPerson),
                                                  TedHelpers.Element("INTERNET_ADDRESSES_ICAR",
                                                                     TedHelpers.Element("URL_GENERAL", _notice.Project.Organisation.Information.MainUrl),
                                                                     TedHelpers.Element("URL_INFORMATION", communicationInformation.ElectronicAccess))),
                               // DIRECTIVE_2004_17 = CA
                               // DIRECTIVE_2004_18 = CE
                               TedHelpers.ElementWithAttribute("TYPE_OF_PURCHASING_BODY", "VALUE", "DIRECTIVE_2004_17")));
 }
        /// <summary>
        /// Section II: Object
        /// </summary>
        /// <returns>OBJECT_CONTRACT XElement</returns>
        private XElement ObjectContract()
        {
            var contract = TedHelpers.Element("OBJECT_ICAR",
                                              TedHelpers.Element("DESCRIPTION_ICAR",
                                                                 TedHelpers.PElement("TITLE_CONTRACT", _notice.Project.Title),
                                                                 TedHelpers.PElement("SHORT_DESCRIPTION_CONTRACT", _notice.ProcurementObject.ShortDescription),
                                                                 TedHelpers.Element("CPV",
                                                                                    TedHelpers.CpvCodeElement("CPV_MAIN", new CpvCode[] { _notice.ProcurementObject.MainCpvCode }),
                                                                                    TedHelpers.CpvCodeElement("CPV_ADDITIONAL", _notice.ProcurementObject.Defence.AdditionalCpvCodes))));

            return(contract);
        }
        private static Tuple <List <XElement>, ChangeType> NewValue(Change change)
        {
            List <XElement> newValue;
            ChangeType      type;

            if (change.NewText != null && change.NewText.Length > 0 && !string.IsNullOrEmpty(change.NewText[0]))
            {
                type     = ChangeType.Text;
                newValue = new List <XElement> {
                    TedHelpers.PElement("TEXT", change.NewText)
                };
            }
            else if (change.NewNutsCodes != null && change.NewNutsCodes.Length > 0 && !string.IsNullOrEmpty(change.NewNutsCodes[0]))
            {
                type     = ChangeType.Nuts;
                newValue = new List <XElement> {
                    TedHelpers.PElement("NUTS", change.NewText)
                };
            }
            else if (change.NewDate != null && change.NewDate != DateTime.MinValue)
            {
                type     = ChangeType.Date;
                newValue = new List <XElement> {
                    TedHelpers.DateTimeElement("DATE_TIME", change.NewDate)
                };
            }
            else if (change.NewMainCpvCode != null && !string.IsNullOrEmpty(change.NewMainCpvCode.Code))
            {
                type     = ChangeType.Cpv;
                newValue = new List <XElement> {
                    TedHelpers.Element("CPV_MAIN",
                                       TedHelpers.ElementWithAttribute("CPV_CODE", "CODE", change.NewMainCpvCode.Code),
                                       change.NewMainCpvCode.VocCodes?.Select(x => TedHelpers.ElementWithAttribute("CPV_SUPPLEMENTARY_CODE", "CODE", x.Code)))
                };
            }
            else if (change.NewAdditionalCpvCodes != null && change.NewAdditionalCpvCodes.Count > 0)
            {
                type     = ChangeType.Cpv;
                newValue = change.NewAdditionalCpvCodes.Select(x =>
                                                               TedHelpers.Element("CPV_ADDITIONAL",
                                                                                  TedHelpers.ElementWithAttribute("CPV_CODE", "CODE", x.Code),
                                                                                  x.VocCodes?.Select(y => TedHelpers.ElementWithAttribute("CPV_SUPPLEMENTARY_CODE", "CODE", y.Code)))
                                                               ).ToList();
            }
            else
            {
                type     = ChangeType.Undefined;
                newValue = null;
            }

            return(new Tuple <List <XElement>, ChangeType>(newValue, type));
        }
Beispiel #8
0
        private IEnumerable <XElement> AnnexD3Defence()
        {
            var annex = _notice?.Annexes?.D3 ?? throw new NullReferenceException("Annex D3 not set!");

            // AD3.1.1-2
            if (annex.NoTenders)
            {
                string value;
                switch (annex.ProcedureType)
                {
                case AnnexProcedureType.DProcNegotiatedPriorCallCompetition:
                    value = "NEGOTIATED_PROCEDURE_COMPETITION";
                    break;

                case AnnexProcedureType.DProcRestricted:
                    value = "RESTRICTED_PROCEDURE";
                    break;

                case AnnexProcedureType.DProcCompetitiveDialogue:
                    value = "COMPETITIVE_DIALOGUE";
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                yield return(TedHelpers.Element("NO_OPEN_RESTRICTED",
                                                new XAttribute("VALUE", value)));
            }

            if (annex.AllTenders)
            {
                yield return(TedHelpers.Element("ONLY_IRREGULAR_INACCEPTABLE_TENDERERS"));
            }
            else
            {
                yield return(TedHelpers.Element("NO_ONLY_IRREGULAR_INACCEPTABLE_TENDERERS"));
            }

            if (_notice.ProcedureInformation.ProcedureType == ProcedureType.AwardWoPriorPubD1)
            {
                yield return(TedHelpers.Element("JUSTIFICATION_CHOICE_NEGOCIATED_PROCEDURE",
                                                JUSTIFICATION_C(annex)));
            }
            else if (_notice.ProcedureInformation.ProcedureType == ProcedureType.AwardWoPriorPubD1Other)
            {
                yield return(TedHelpers.Element("OTHER_JUSTIFICATION",
                                                OTHER_JUSTIFICATION(annex)));
            }

            yield return(TedHelpers.PElement("REASON_CONTRACT_LAWFUL", annex.Justification));
        }
 /// <summary>
 /// #  XSD name : F02_2014
 /// #  RELEASE : "R2.0.9.S03"
 /// #  Intermediate release number 007-20181030
 /// #  Last update : 30/10/2018
 /// #  Form : Contract notice
 /// </summary>
 private XElement NoticeBody()
 {
     return(TedHelpers.Element("FORM_SECTION",
                               TedHelpers.Element("PRIOR_INFORMATION_DEFENCE", new XAttribute("LG", _notice.Language), new XAttribute("CATEGORY", "ORIGINAL"), new XAttribute("FORM", "16"), new XAttribute("VERSION", "R2.0.8.S04"),
                                                  TedHelpers.ElementWithAttribute("FD_PRIOR_INFORMATION_DEFENCE", "CTYPE", _notice.Project.ContractType.ToTEDFormat(),
                                                                                  _helper.ContractingBody(_notice.Project, _notice.ContactPerson, _notice.CommunicationInformation, _notice.Type),
                                                                                  _helper.ObjectContract(),
                                                                                  _helper.ConditionsInformation(_notice.ConditionsInformationDefence),
                                                                                  _helper.Procedure(_notice.ProcedureInformation),
                                                                                  _helper.ComplementaryInformation()
                                                                                  )
                                                  )
                               ));
 }
 private XElement CAFields(string elementName, OrganisationContract organisation, ContactPerson contactPerson)
 {
     return(TedHelpers.Element(elementName,
                               TedHelpers.Element("OFFICIALNAME", organisation.Information.OfficialName),
                               TedHelpers.Element("NATIONALID", organisation.Information.NationalRegistrationNumber),
                               TedHelpers.Element("ADDRESS", organisation.Information.PostalAddress.StreetAddress),
                               TedHelpers.Element("TOWN", organisation.Information.PostalAddress.Town),
                               TedHelpers.Element("POSTAL_CODE", organisation.Information.PostalAddress.PostalCode),
                               TedHelpers.ElementWithAttribute("COUNTRY", "VALUE", organisation.Information.PostalAddress.Country),
                               TedHelpers.Element("CONTACT_POINT", contactPerson.Name), TedHelpers.Element("PHONE", contactPerson.Phone),
                               TedHelpers.Element("E_MAIL", contactPerson.Email),
                               organisation.Information.NutsCodes.ToList().Select(x => new XElement(TedHelpers.n2016 + "NUTS", new XAttribute("CODE", x))),
                               TedHelpers.Element("URL_GENERAL", organisation.Information.MainUrl)
                               ));
 }
Beispiel #11
0
        private IEnumerable <XElement> OTHER_JUSTIFICATION(AnnexD3 annex)
        {
            switch (annex.OtherJustification)
            {
            case D3OtherJustificationOptions.ContractServicesListedInDirective:
                yield return(TedHelpers.Element("CONTRACT_SERVICES_LISTED_IN_DIRECTIVE"));

                break;

            case D3OtherJustificationOptions.ContractServicesOutsideDirective:
                yield return(TedHelpers.Element("CONTRACT_SERVICES_OUTSIDE_DIRECTIVE"));

                break;

            default:
                yield break;
            }
        }
 /// <summary>
 /// Section IV: COMPLEMENTARY INFORMATION
 /// </summary>
 /// <returns>The COMPLEMENTARY_ICAR XElement</returns>
 private XElement ComplementaryInformation()
 {
     return(TedHelpers.Element("COMPLEMENTARY_ICAR",
                               TedHelpers.Element("NOTICE_INVOLVES_ICAR",
                                                  TedHelpers.Element("CORRECTION_ADDITIONAL_INFO",
                                                                     TedHelpers.Element("CORRECTION"),
                                                                     TedHelpers.Element("INFORMATION_CORRECTED_ADDED",
                                                                                        TedHelpers.Element("MODIFICATION_ORIGINAL_PUBLICATION_TED",
                                                                                                           TedHelpers.Element("MODIFICATION_ORIGINAL")),
                                                                                        TedHelpers.Element("ORIGINAL_NOTICE_CORRESPONDING_TENDER",
                                                                                                           TedHelpers.Element("ORIGINAL_NOTICE",
                                                                                                                              ChangesToXml(new DefenceChangesFactory(_notice, _parent, _translationProvider).Changes()),
                                                                                                                              TedHelpers.Element("ADDR_CORR",
                                                                                                                                                 TedHelpers.Element("WHERE", $"I.1"),
                                                                                                                                                 TedHelpers.Element("MODIFIED_ADDRESS",
                                                                                                                                                                    TedHelpers.INC_01("CA_CE_CONCESSIONAIRE_PROFILE", _notice.Project.Organisation, _notice.ContactPerson),
                                                                                                                                                                    TedHelpers.Element("MODIFIED_INTERNET",
                                                                                                                                                                                       TedHelpers.Element("URL_INFORMATION", _notice.CommunicationInformation.ElectronicAccess),
                                                                                                                                                                                       TedHelpers.Element("URL_PARTICIPATE", _notice.CommunicationInformation.ElectronicAddressToSendTenders))))))))),
                               TedHelpers.PElement("OTHER_ADDITIONAL_INFO", _notice.CorrigendumAdditionalInformation),
                               TedHelpers.DateElement("NOTICE_DISPATCH_DATE", DateTime.Now)));
 }
 /// <summary>
 /// Creates the XML document that is sent to TED.
 /// </summary>
 /// <returns></returns>
 public XDocument CreateForm()
 {
     return(TedHelpers.CreateTedDocument(
                TedHelpers.LoginPart(_notice, _eSenderLogin, _tedESenderOrganisation, _tedContactEmail),
                NoticeBody()));
 }
Beispiel #14
0
        private IEnumerable <XElement> JUSTIFICATION_C(AnnexD3 annex)
        {
            if (annex.CrisisUrgency)
            {
                yield return(TedHelpers.Element("PERIOD_FOR_PROCEDURE_INCOMPATIBLE_WITH_CRISIS"));
            }
            else
            {
                yield return(TedHelpers.Element("NO_PERIOD_FOR_PROCEDURE_INCOMPATIBLE_WITH_CRISIS"));
            }

            if (annex.ExtremeUrgency)
            {
                yield return(TedHelpers.Element("EXTREME_URGENCY_EVENTS_UNFORESEEABLE"));
            }
            else
            {
                yield return(TedHelpers.Element("NO_EXTREME_URGENCY_EVENTS_UNFORESEEABLE"));
            }

            if (annex.ProvidedByOnlyParticularOperator)
            {
                switch (annex.ReasonForNoCompetition)
                {
                case ReasonForNoCompetition.DTechnical:
                    yield return(TedHelpers.Element("REASONS_PROVIDED_PARTICULAR_TENDERER",
                                                    TedHelpers.Element("REASONS_PROVIDED_PARTICULAR_TENDERER_TECHNICAL")));

                    break;

                case ReasonForNoCompetition.DExistenceExclusive:
                    yield return(TedHelpers.Element("REASONS_PROVIDED_PARTICULAR_TENDERER",
                                                    TedHelpers.Element("REASONS_PROVIDED_PARTICULAR_TENDERER_EXCLUSIVE_RIGHTS")));

                    break;
                }
            }

            if (_notice.Project.ContractType == ContractType.Supplies ||
                _notice.Project.ContractType == ContractType.Services)
            {
                if (annex.OtherServices)
                {
                    yield return(TedHelpers.Element("CONTRACT_RESEARCH_DIRECTIVE"));
                }
                else
                {
                    yield return(TedHelpers.Element("NO_CONTRACT_RESEARCH_DIRECTIVE"));
                }

                if (annex.ProductsManufacturedForResearch)
                {
                    yield return(TedHelpers.Element("MANUFACTURED_BY_DIRECTIVE"));
                }
                else
                {
                    yield return(TedHelpers.Element("NO_MANUFACTURED_BY_DIRECTIVE"));
                }
            }

            if (annex.AdditionalDeliveries)
            {
                yield return(TedHelpers.Element("ADDITIONAL_WORKS"));
            }
            else
            {
                yield return(TedHelpers.Element("NO_ADDITIONAL_WORKS"));
            }

            if (annex.CommodityMarket)
            {
                yield return(TedHelpers.Element("SUPPLIES_QUOTED_PURCHASED_COMMODITY_MARKET"));
            }
            else
            {
                yield return(TedHelpers.Element("NO_SUPPLIES_QUOTED_PURCHASED_COMMODITY_MARKET"));
            }

            if (annex.AdvantageousTerms)
            {
                var reasonElement = annex.AdvantageousPurchaseReason == AdvantageousPurchaseReason.DFromReceivers
                    ? TedHelpers.Element("RECEIVERS_ARRANGEMENT_CREDITORS")
                    : TedHelpers.Element("SUPPLIER_WINDING_UP_BUSINESS");
                yield return(TedHelpers.Element("PURCHASE_SUPPLIES_ADVANTAGEOUS_TERMS", reasonElement));
            }

            if (_notice.Project.ContractType == ContractType.Works ||
                _notice.Project.ContractType == ContractType.Services)
            {
                if (annex.RepetitionExisting)
                {
                    yield return(TedHelpers.Element("WORKS_REPETITION_EXISTING_WORKS"));
                }
                else
                {
                    yield return(TedHelpers.Element("NO_WORKS_REPETITION_EXISTING_WORKS"));
                }
            }

            if (annex.MaritimeService)
            {
                yield return(TedHelpers.Element("AIR_MARITIME_TRANSPORT_FOR_ARMED_FORCES_DEPLOYMENT"));
            }
            else
            {
                yield return(TedHelpers.Element("NO_AIR_MARITIME_TRANSPORT_FOR_ARMED_FORCES_DEPLOYMENT"));
            }
        }