private XElement ContractAward()
        {
            var lot = _notice.ObjectDescriptions.FirstOrDefault();

            if (lot == null)
            {
                return(null);
            }

            return(TedHelpers.Element("AWARD_CONTRACT",
                                      TedHelpers.Element("CONTRACT_NO", lot.AwardContract?.AwardedContract?.ContractNumber),
                                      _notice.LotsInfo.DivisionLots ? TedHelpers.Element("LOT_NO", lot.LotNumber.ToString()) : null,
                                      TedHelpers.PElement("TITLE", lot.AwardContract?.AwardedContract?.ContractTitle),
                                      TedHelpers.Element("AWARDED_CONTRACT",
                                                         TedHelpers.DateElement("DATE_CONCLUSION_CONTRACT", lot.AwardContract?.AwardedContract?.ConclusionDate <= DateTime.Now ? lot.AwardContract?.AwardedContract?.ConclusionDate : DateTime.Now),
                                                         TedHelpers.Element("CONTRACTORS",
                                                                            lot.AwardContract?.AwardedContract?.Contractors?.Count > 1 ? TedHelpers.Element("AWARDED_TO_GROUP") : TedHelpers.Element("NO_AWARDED_TO_GROUP"),
                                                                            lot.AwardContract?.AwardedContract?.Contractors?.Select((contractor, a) =>
                                                                                                                                    TedHelpers.Element("CONTRACTOR",
                                                                                                                                                       TedHelpers.ADDRS5(contractor),
                                                                                                                                                       contractor.IsSmallMediumEnterprise ? TedHelpers.Element("SME") : TedHelpers.Element("NO_SME")))
                                                                            ),
                                                         TedHelpers.Element("VALUES",
                                                                            lot.AwardContract?.AwardedContract?.FinalTotalValue.Value > 0 ?
                                                                            TedHelpers.ElementWithAttribute("VAL_TOTAL", "CURRENCY", lot.AwardContract.AwardedContract.FinalTotalValue.Currency, lot.AwardContract.AwardedContract.FinalTotalValue.Value)
                                : null))));
        }
        private List <XElement> ChangesToXml(List <Change> changes)
        {
            var result = new List <XElement>
            {
                new XElement(xmlns + "MODIFICATION_ORIGINAL", new XAttribute("PUBLICATION", "NO"))
            };

            foreach (var change in changes)
            {
                // Can be NOTHING, CPV_MAIN, CPV_ADDITIONAL, TEXT or DATE
                result.Add(
                    TedHelpers.Element("CHANGE",
                                       TedHelpers.Element("WHERE",
                                                          TedHelpers.Element("SECTION", change.Section),
                                                          TedHelpers.Element("LOT_NO", change.LotNumber),
                                                          TedHelpers.Element("LABEL", change.Label)),
                                       TedHelpers.Element("OLD_VALUE",
                                                          OldValue(change)
                                                          ),
                                       TedHelpers.Element("NEW_VALUE",
                                                          NewValue(change)
                                                          )));
            }

            return(result);
        }
        private XElement NoticeType()
        {
            var noticeType = string.Empty;

            switch (_notice.Type)
            {
            case Enums.NoticeType.SocialUtilitiesPriorInformation:
                noticeType = "PER_ONLY";
                break;

            case Enums.NoticeType.SocialUtilities:
                noticeType = "CONTRACT";
                break;

            case Enums.NoticeType.SocialUtilitiesContractAward:
                noticeType = "AWARD_CONTRACT";
                break;

            case Enums.NoticeType.SocialUtilitiesQualificationSystem:
                noticeType = "QSU_ONLY";
                break;

            default:
                throw new NotImplementedException();
            }

            return(TedHelpers.ElementWithAttribute("NOTICE", "TYPE", noticeType));
        }
Пример #4
0
        private XElement AdvantageousTermsElement(bool advantageousTerms, AdvantageousPurchaseReason reason)
        {
            if (advantageousTerms &&
                (_notice.Project.ContractType == ContractType.Services ||
                 _notice.Project.ContractType == ContractType.SocialServices ||
                 _notice.Project.ContractType == ContractType.EducationalServices ||
                 _notice.Project.ContractType == ContractType.Supplies))
            {
                var servOrSupp = _notice.Project.ContractType == ContractType.Supplies
                    ? "SUPPLIES"
                    : "SERVICES";
                var showCtype = _notice.Type != NoticeType.SocialContractAward && _notice.Type != NoticeType.SocialUtilitiesContractAward;
                switch (reason)
                {
                case AdvantageousPurchaseReason.DFromWindingSupplier:
                    return(showCtype ? TedHelpers.Element("D_FROM_WINDING_PROVIDER", new XAttribute("CTYPE", servOrSupp)) : TedHelpers.Element("D_FROM_WINDING_PROVIDER"));

                case AdvantageousPurchaseReason.DFromReceivers:
                    return(showCtype ? TedHelpers.Element("D_FROM_LIQUIDATOR_CREDITOR", new XAttribute("CTYPE", servOrSupp)) : TedHelpers.Element("D_FROM_LIQUIDATOR_CREDITOR"));

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            return(null);
        }
        private IEnumerable <XElement> JointProcurement(ProcurementProjectContract project)
        {
            if (project == null)
            {
                yield break;
            }

            var elements = new List <XElement>();

            if (project.JointProcurement)
            {
                if (project.CoPurchasers == null)
                {
                    throw new HilmaMalformedRequestException(
                              "project.CoPurchasers array must be provided when project.JointProcurement is set to true");
                }

                foreach (var coPurchaser in project.CoPurchasers)
                {
                    yield return(TedHelpers.ADDRS1("ADDRESS_CONTRACTING_BODY_ADDITIONAL",
                                                   new OrganisationContract
                    {
                        Information = coPurchaser
                    },
                                                   new ContactPerson
                    {
                        Email = coPurchaser.Email,
                        Phone = coPurchaser.TelephoneNumber,
                        Name = coPurchaser.ContactPerson
                    }
                                                   ));
                }
            }
        }
        /// <summary>
        /// Section II: Object
        /// </summary>
        /// <returns>OBJECT_CONTRACT XElement</returns>
        private XElement ObjectContract()
        {
            var shortDescr = _notice.ProcurementObject.ShortDescription;

            // Using object description in design contest, because it cannot be lotted and doesn't have ShortDescription
            if (_notice.Type == NoticeType.DesignContest || _notice.Type == NoticeType.DesignContestResults)
            {
                shortDescr = _notice.ObjectDescriptions.FirstOrDefault().DescrProcurement;
            }

            if (_notice.Type == NoticeType.DefencePriorInformation)
            {
                shortDescr = _notice.ProcurementObject.Defence.TotalQuantity;
            }

            var contract = TedHelpers.Element("OBJECT_CONTRACT",
                                              TedHelpers.PElement("TITLE", _notice.Project.Title),
                                              TedHelpers.Element("REFERENCE_NUMBER", _notice.Project.ReferenceNumber),
                                              TedHelpers.CpvCodeElement("CPV_MAIN", new CpvCode[] { _notice.ProcurementObject.MainCpvCode }),
                                              TedHelpers.ElementWithAttribute("TYPE_CONTRACT", "CTYPE", _notice.Project.ContractType.ToTEDFormat()),
                                              TedHelpers.PElement("SHORT_DESCR", shortDescr)
                                              );

            return(contract);
        }
 /// <summary>
 /// Section VI: Complementary information
 /// </summary>
 /// <returns>The COMPLEMENTARY_INFO XElement</returns>
 private XElement ComplementaryInformation()
 {
     return(TedHelpers.Element("COMPLEMENTARY_INFO",
                               TedHelpers.PElement("INFO_ADD", _notice.ComplementaryInformation?.AdditionalInformation),
                               TedHelpers.ADDRS6("ADDRESS_REVIEW_BODY", _notice.ProceduresForReview?.ReviewBody),
                               TedHelpers.PElement("REVIEW_PROCEDURE", _notice.ProceduresForReview?.ReviewProcedure),
                               TedHelpers.DateElement("DATE_DISPATCH_NOTICE", DateTime.Now)));
 }
Пример #8
0
 /// <summary>
 /// Creates the XML document that is sent to TED.
 /// </summary>
 /// <returns></returns>
 public XDocument CreateForm() =>
 new XDocument(
     new XDeclaration("1.0", "utf-8", null), TedHelpers.Element("TED_ESENDERS",
                                                                new XAttribute(XNamespace.Xmlns + nameof(TedHelpers.n2016), TedHelpers.n2016),
                                                                new XAttribute("VERSION", "R2.0.9.S03"),
                                                                new XAttribute(XNamespace.Xmlns + nameof(TedHelpers.xs), TedHelpers.xs),
                                                                TedHelpers.LoginPart(_notice, _eSenderLogin, _tedESenderOrganisation, _tedContactEmail),
                                                                NoticeBody()));
Пример #9
0
        private XElement CommodityMarketElement(bool commodityMarket)
        {
            if (commodityMarket && _notice.Project.ContractType == ContractType.Supplies)
            {
                return(TedHelpers.Element("D_COMMODITY_MARKET", new XAttribute("CTYPE", "SUPPLIES")));
            }

            return(null);
        }
Пример #10
0
 internal static XDocument CreateTedDocument(params XElement[] xElements)
 {
     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("VERSION", "R2.0.9.S04"),
                                                                           new XAttribute(XNamespace.Xmlns + nameof(TedHelpers.xs), TedHelpers.xs),
                                                                           xElements)));
 }
        private XElement Modifications()
        {
            var modifications = _notice.Modifications;

            if (modifications == null)
            {
                return(null);
            }

            try
            {
                return(TedHelpers.Element("MODIFICATIONS_CONTRACT",
                                          TedHelpers.Element("DESCRIPTION_PROCUREMENT",
                                                             TedHelpers.CpvCodeElement("CPV_MAIN", new CpvCode[] { modifications.MainCpvCode }),
                                                             TedHelpers.CpvCodeElement("CPV_ADDITIONAL", modifications.AdditionalCpvCodes),
                                                             modifications.NutsCodes.Select(n =>
                                                                                            new XElement(TedHelpers.n2016 + "NUTS", new XAttribute("CODE", n))),
                                                             TedHelpers.PElement("MAIN_SITE", modifications.MainsiteplaceWorksDelivery),
                                                             TedHelpers.PElement("SHORT_DESCR", modifications.DescrProcurement),
                                                             Duration(modifications.TimeFrame, modifications.JustificationForDurationOverFourYears,
                                                                      modifications.JustificationForDurationOverEightYears),
                                                             TedHelpers.Element("VALUES", TedHelpers.ElementWithAttribute("VAL_TOTAL", "CURRENCY",
                                                                                                                          modifications.TotalValue?.Currency, modifications.TotalValue?.Value)),
                                                             TedHelpers.Element("CONTRACTORS",
                                                                                modifications.Contractors?.Count > 1
                                ? TedHelpers.Element("AWARDED_TO_GROUP")
                                : TedHelpers.Element("NO_AWARDED_TO_GROUP"),
                                                                                modifications.Contractors?.Select((contractor, a) =>
                                                                                                                  TedHelpers.Element("CONTRACTOR",
                                                                                                                                     TedHelpers.ADDRS5(contractor),
                                                                                                                                     contractor.IsSmallMediumEnterprise
                                        ? TedHelpers.Element("SME")
                                        : TedHelpers.Element("NO_SME"))))
                                                             ),
                                          TedHelpers.Element("INFO_MODIFICATIONS",
                                                             TedHelpers.PElement("SHORT_DESCR", modifications.Description),
                                                             modifications.Reason == ModificationReason.ModNeedForAdditional
                            ? TedHelpers.PElement("ADDITIONAL_NEED", modifications.ReasonDescriptionEconomic)
                            : TedHelpers.PElement("UNFORESEEN_CIRCUMSTANCE",
                                                  modifications.ReasonDescriptionCircumstances),
                                                             TedHelpers.Element("VALUES",
                                                                                TedHelpers.ElementWithAttribute("VAL_TOTAL_BEFORE", "CURRENCY",
                                                                                                                modifications.IncreaseBeforeModifications?.Currency,
                                                                                                                modifications.IncreaseBeforeModifications?.Value),
                                                                                TedHelpers.ElementWithAttribute("VAL_TOTAL_AFTER", "CURRENCY",
                                                                                                                modifications.IncreaseAfterModifications?.Currency,
                                                                                                                modifications.IncreaseAfterModifications?.Value)))
                                          ));
            }
            catch (HilmaMalformedRequestException e)
            {
                throw new HilmaMalformedRequestException($"Invalid content in notice.Modifications: {e.Message}");
            }
        }
 // <summary>
 //  XSD name : F06_2014
 //  RELEASE : "R2.0.9.S03"
 //  Intermediate release number 007-20181030
 //  Last update : 30/10/2018
 //  Form : Contract award notice - utilities
 // </summary>
 private XElement NoticeBody()
 {
     return(TedHelpers.Element("FORM_SECTION",
                               TedHelpers.Element("F06_2014", new XAttribute("LG", _notice.Language), new XAttribute("CATEGORY", "ORIGINAL"), new XAttribute("FORM", "F06"),
                                                  TedHelpers.LegalBasis(_notice),
                                                  _helper.ContractingBody(_notice.Project, _notice.ContactPerson, _notice.CommunicationInformation, _notice.Type),
                                                  _helper.ObjectContract(),
                                                  _helper.Procedure(),
                                                  _helper.ContractAward(),
                                                  _helper.ComplementaryInformation())));
 }
Пример #13
0
 private XElement NoticeBody() =>
 TedHelpers.Element("FORM_SECTION",
                    TedHelpers.Element("F21_2014", new XAttribute("LG", _notice.Language), new XAttribute("CATEGORY", "ORIGINAL"), new XAttribute("FORM", "F21"),
                                       TedHelpers.LegalBasis(_notice),
                                       NoticeType(),
                                       _helper.ContractingBody(_notice.Project, _notice.ContactPerson, _notice.CommunicationInformation, _notice.Type),
                                       _helper.ObjectContract(),
                                       _helper.ConditionsInformation(),
                                       _configuration.ProcedureInformation != null ? _helper.Procedure() : null,
                                       _notice.Type == Enums.NoticeType.SocialContractAward ? _helper.ContractAward() : null,
                                       _helper.ComplementaryInformation()));
 /// <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("F14_2014", new XAttribute("LG", _notice.Language), new XAttribute("CATEGORY", "ORIGINAL"), new XAttribute("FORM", "F14"),
                                                  TedHelpers.LegalBasis(_notice, _parent),
                                                  ContractingBody(_notice.Project, _notice.ContactPerson, _notice.CommunicationInformation),
                                                  ObjectContract(),
                                                  ComplementaryInformation(),
                                                  TedHelpers.Element("CHANGES",
                                                                     ChangesToXml(new NoticeChangesFactory(_notice, _parent, _translationProvider).Changes()),
                                                                     TedHelpers.PElement("INFO_ADD", _notice.CorrigendumAdditionalInformation)))));
 }
Пример #15
0
 /// <summary>
 /// #  XSD name : F04_2014
 /// #  RELEASE : "R2.0.9.S04"
 /// #  Intermediate release number 007-20181030
 /// #  Last update : 30/10/2018
 /// #  Form : Periodic indicative notice - utilities
 /// </summary>
 private XElement NoticeBody()
 {
     return(TedHelpers.Element("FORM_SECTION",
                               TedHelpers.Element("F04_2014", new XAttribute("LG", _notice.Language), new XAttribute("CATEGORY", "ORIGINAL"), new XAttribute("FORM", "F04"),
                                                  TedHelpers.LegalBasis(_notice),
                                                  TedHelpers.ElementWithAttribute("NOTICE", "TYPE", _notice.Type == NoticeType.PeriodicIndicativeUtilitiesReduceTimeLimits ? "PER_REDUCING_TIME_LIMITS" : "PER_ONLY"),
                                                  _helper.ContractingBody(_notice.Project, _notice.ContactPerson, _notice.CommunicationInformation, _notice.Type),
                                                  _helper.ObjectContract(),
                                                  _helper.ConditionsInformation(),
                                                  _helper.Procedure(),
                                                  _helper.ComplementaryInformation())));
 }
Пример #16
0
        private XElement DesignContestServiceElement(bool designContestAward)
        {
            if (designContestAward &&
                (_notice.Project.ContractType == ContractType.Services ||
                 _notice.Project.ContractType == ContractType.SocialServices ||
                 _notice.Project.ContractType == ContractType.EducationalServices))
            {
                return(TedHelpers.Element("D_CONTRACT_AWARDED_DESIGN_CONTEST", new XAttribute("CTYPE", "SERVICES")));
            }

            return(null);
        }
 /// <summary>
 /// #  XSD name : F01_2014
 /// #  RELEASE : "R2.0.9.S03"
 /// #  Intermediate release number 007-20181030
 /// #  Last update : 30/10/2018
 /// #  Form : Prior information notice
 /// </summary>
 private XElement NoticeBody()
 {
     return(TedHelpers.Element("FORM_SECTION",
                               TedHelpers.Element("F20_2014", new XAttribute("LG", _notice.Language), new XAttribute("CATEGORY", "ORIGINAL"), new XAttribute("FORM", "F20"),
                                                  TedHelpers.LegalBasis(_notice, _parent),
                                                  ContractingBody(_notice.Project.Organisation, _notice.ContactPerson, _notice.CommunicationInformation),
                                                  ObjectContract(),
                                                  Procedure(),
                                                  ContractAward(),
                                                  ComplementaryInformation(),
                                                  Modifications())));
 }
        /// <summary>
        /// Section II: Object
        /// </summary>
        /// <returns>OBJECT_CONTRACT XElement</returns>
        private XElement ObjectContract()
        {
            var contract = TedHelpers.Element("OBJECT_CONTRACT",
                                              TedHelpers.PElement("TITLE", _notice.Project?.Title),
                                              TedHelpers.Element("REFERENCE_NUMBER", _notice.Project?.ReferenceNumber),
                                              TedHelpers.CpvCodeElement("CPV_MAIN", new CpvCode[] { _notice.ProcurementObject?.MainCpvCode }),
                                              TedHelpers.ElementWithAttribute("TYPE_CONTRACT", "CTYPE", _notice.Project?.ContractType.ToTEDFormat())
                                              );

            contract.Add(ObjectDescriptions());

            return(contract);
        }
 private XElement NoticeBody()
 {
     return(TedHelpers.Element("FORM_SECTION",
                               TedHelpers.Element("F23_2014", new XAttribute("LG", _notice.Language), new XAttribute("CATEGORY", "ORIGINAL"), new XAttribute("FORM", "F23"),
                                                  TedHelpers.LegalBasis(_notice),
                                                  TedHelpers.ElementWithAttribute("NOTICE", "TYPE", _notice.Type == NoticeType.SocialConcessionPriorInformation ? "PRI" : "CONCESSION_AWARD_CONTRACT"),
                                                  _helper.ContractingBody(_notice.Project, _notice.ContactPerson, _notice.CommunicationInformation, _notice.Type),
                                                  _helper.ObjectContract(),
                                                  _helper.ConditionsInformation(),
                                                  _helper.Procedure(),
                                                  _notice.Type == NoticeType.SocialConcessionAward ? _helper.ContractAward() : null,
                                                  _helper.ComplementaryInformation())));
 }
Пример #20
0
 private XElement Procedure() =>
 TedHelpers.Element("PROCEDURE",
                    TedHelpers.Element(_helper.DirectiveSelector(), _annexHelper.SelectAnnexD()),
                    _notice.ProcedureInformation.FrameworkAgreement.IncludesFrameworkAgreement
             ? TedHelpers.Element("FRAMEWORK")
             : null,
                    _notice.ProcedureInformation.ProcurementGovernedByGPA
             ? TedHelpers.Element("CONTRACT_COVERED_GPA")
             : TedHelpers.Element("NO_CONTRACT_COVERED_GPA"),
                    string.IsNullOrEmpty(_notice.PreviousNoticeOjsNumber)
             ? null
             : TedHelpers.Element("NOTICE_NUMBER_OJ", _notice.PreviousNoticeOjsNumber)
                    );
 /// <summary>
 /// Section VI: Complementary information
 /// </summary>
 /// <returns>The COMPLEMENTARY_INFO XElement</returns>
 private XElement ComplementaryInformation()
 {
     return(TedHelpers.Element("COMPLEMENTARY_INFO",
                               TedHelpers.Element("DATE_DISPATCH_NOTICE", DateTime.Now.ToString("yyyy-MM-dd")),
                               TedHelpers.ElementWithAttribute("ORIGINAL_ENOTICES", "PUBLICATION", "NO"),
                               TedHelpers.ElementWithAttribute("ESENDER_LOGIN", "PUBLICATION", "NO", _eSenderLogin),
                               TedHelpers.ElementWithAttribute("CUSTOMER_LOGIN", "PUBLICATION", "NO", _eSenderLogin),
                               TedHelpers.ElementWithAttribute("NO_DOC_EXT", "PUBLICATION", "NO", _parent?.NoticeNumber),
                               _parent?.TedPublishState == TedPublishState.PublishedInTed ? TedHelpers.Element("NOTICE_NUMBER_OJ", _notice?.PreviousNoticeOjsNumber) : null,
                               _parent?.TedPublishRequestSentDate.HasValue ?? false ? TedHelpers.ElementWithAttribute("DATE_DISPATCH_ORIGINAL", "PUBLICATION", "NO", _parent.TedPublishRequestSentDate.Value.ToString("yyyy-MM-dd")) : null
                               //TODO (TuomasT): Allow setting original date manually
                               ));
 }
 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)
                               ));
 }
        /// <summary>
        /// Section I: Contracting authority
        /// </summary>
        /// <param name="project"></param>
        /// <param name="contactPerson">The contact person</param>
        /// <param name="communicationInformation">I.3 Communication</param>
        /// <returns>CONTRACTING_BODY XElement</returns>
        private XElement ContractingBody(
            ProcurementProjectContract project,
            ContactPerson contactPerson,
            CommunicationInformation communicationInformation
            )
        {
            var organisation = project?.Organisation;

            if (organisation == null)
            {
                return(null);
            }

            return(TedHelpers.Element("CONTRACTING_BODY",
                                      TedHelpers.ADDRS1("ADDRESS_CONTRACTING_BODY", organisation, contactPerson),
                                      JointProcurement(project)
                                      ));
        }
Пример #24
0
        private XElement RepetitionWorksOrServices(bool repeatExisting)
        {
            if (repeatExisting)
            {
                var showCtype = _notice.Type != NoticeType.SocialContractAward && _notice.Type != NoticeType.SocialUtilitiesContractAward;
                switch (_notice.Project.ContractType)
                {
                case ContractType.Services:
                case ContractType.SocialServices:
                case ContractType.EducationalServices:
                    return(showCtype ? TedHelpers.Element("D_REPETITION_EXISTING", new XAttribute("CTYPE", "SERVICES")) : TedHelpers.Element("D_REPETITION_EXISTING"));

                case ContractType.Works:
                    return(TedHelpers.Element("D_REPETITION_EXISTING", showCtype ? new XAttribute("CTYPE", "WORKS") : null));
                }
            }

            return(null);
        }
        private static List <XElement> NewValue(Change change)
        {
            List <XElement> newValue;

            if (change.NewText != null && change.NewText.Length > 0 && !string.IsNullOrEmpty(change.NewText[0]))
            {
                newValue = new List <XElement> {
                    TedHelpers.PElement("TEXT", change.NewText)
                };
            }
            else if (change.NewDate != null && change.NewDate != DateTime.MinValue)
            {
                newValue = new List <XElement> {
                    TedHelpers.DateElement("DATE", change.NewDate)
                };
            }
            else if (change.NewMainCpvCode != null && !string.IsNullOrEmpty(change.NewMainCpvCode.Code))
            {
                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 &&
                     change.NewAdditionalCpvCodes.Any(x => !string.IsNullOrEmpty(x.Code)))
            {
                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
            {
                newValue = new List <XElement> {
                    TedHelpers.Element("NOTHING")
                };
            }

            return(newValue);
        }
Пример #26
0
        private XElement ObjectContract()
        {
            var configuration    = _configuration.ProcurementObject;
            var projectConfig    = _configuration.Project;
            var procuremenObject = _notice.ProcurementObject;

            var contract = TedHelpers.Element("OBJECT_CONTRACT",
                                              projectConfig.Title
                    ? TedHelpers.PElement("TITLE", _notice.Project.Title)
                    : null,
                                              projectConfig.ReferenceNumber
                    ? TedHelpers.Element("REFERENCE_NUMBER", _notice.Project.ReferenceNumber)
                    : null,
                                              configuration.MainCpvCode.Code
                    ? TedHelpers.CpvCodeElement("CPV_MAIN", new [] { procuremenObject.MainCpvCode })
                    : null,
                                              projectConfig.ContractType
                    ? TedHelpers.ElementWithAttribute("TYPE_CONTRACT", "CTYPE", _notice.Project.ContractType.ToTEDFormat(_notice.Project.ProcurementCategory))
                    : null,
                                              configuration.ShortDescription
                    ? TedHelpers.PElement("SHORT_DESCR", procuremenObject.ShortDescription)
                    : null,
                                              procuremenObject.TotalValue != null ? procuremenObject.TotalValue.Type == ContractValueType.Exact
                    ? TedHelpers.Element("VAL_TOTAL",
                                         _notice.Project.ProcurementCategory == ProcurementCategory.Utility
                            ? new XAttribute("PUBLICATION", (!procuremenObject.TotalValue?.DisagreeToBePublished ?? false).ToYesNo("EN").ToUpperInvariant())
                            : null,
                                         new XAttribute("CURRENCY", procuremenObject.TotalValue.Currency),
                                         procuremenObject.TotalValue.Value)
                    : TedHelpers.Element("VAL_RANGE_TOTAL",
                                         _notice.Project.ProcurementCategory == ProcurementCategory.Utility
                            ? new XAttribute("PUBLICATION", (!procuremenObject.TotalValue.DisagreeToBePublished ?? false).ToYesNo("EN").ToUpperInvariant())
                            : null,
                                         new XAttribute("CURRENCY", procuremenObject.TotalValue.Currency),
                                         TedHelpers.Element("LOW", procuremenObject.TotalValue.MinValue),
                                         TedHelpers.Element("HIGH", procuremenObject.TotalValue.MaxValue)) : null,
                                              _helper.LotDivision(_notice.LotsInfo),
                                              _helper.ObjectDescriptions(_notice.ObjectDescriptions)
                                              );

            return(contract);
        }
        /// <summary>
        /// Section II.2: Description
        /// </summary>
        /// <returns></returns>
        private XElement ObjectDescriptions()
        {
            var lot = _notice.ObjectDescriptions?.FirstOrDefault();

            if (lot == null)
            {
                return(null);
            }

            return(TedHelpers.Element("OBJECT_DESCR",
                                      TedHelpers.PElement("TITLE", lot.Title),
                                      TedHelpers.Element("LOT_NO", lot.LotNumber),
                                      TedHelpers.CpvCodeElement("CPV_ADDITIONAL", lot.AdditionalCpvCodes),
                                      lot.NutsCodes.Select(n => new XElement(TedHelpers.n2016 + "NUTS", new XAttribute("CODE", n))),
                                      TedHelpers.PElement("MAIN_SITE", lot.MainsiteplaceWorksDelivery),
                                      TedHelpers.PElement("SHORT_DESCR", lot.DescrProcurement),
                                      Duration(lot.TimeFrame, _notice.ProcedureInformation?.FrameworkAgreement?.JustificationForDurationOverFourYears, _notice.ProcedureInformation?.FrameworkAgreement?.JustificationForDurationOverEightYears),
                                      lot.EuFunds?.ProcurementRelatedToEuProgram ?? false ? TedHelpers.PElement("EU_PROGR_RELATED", lot.EuFunds?.ProjectIdentification) : TedHelpers.Element("NO_EU_PROGR_RELATED")
                                      ));
        }
Пример #28
0
        private IEnumerable <XElement> AnnexD4()
        {
            var annex = _notice?.Annexes?.D4 ?? throw new NullReferenceException("Annex D4 not set!");

            // AD4.1.1
            if (annex.NoTenders)
            {
                yield return(TedHelpers.Element("D_NO_TENDERS_REQUESTS"));
            }

            // AD4.1.2-3
            if (annex.ProvidedByOnlyParticularOperator)
            {
                switch (annex.ReasonForNoCompetition)
                {
                case ReasonForNoCompetition.DTechnical:
                    yield return(TedHelpers.Element("D_TECHNICAL"));

                    break;

                case ReasonForNoCompetition.DProtectRights:
                    yield return(TedHelpers.Element("D_PROTECT_RIGHTS"));

                    break;

                case ReasonForNoCompetition.DArtistic:
                    yield return(TedHelpers.Element("D_ARTISTIC"));

                    break;

                case ReasonForNoCompetition.DExistenceExclusive:
                    yield return(TedHelpers.Element("D_EXCLUSIVE_RIGHT"));

                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
Пример #29
0
        private XElement WrapAnnex(IEnumerable <XElement> annex,
                                   ProcedureType annexType      = ProcedureType.AwardWoPriorPubD1,
                                   string annexElement          = "PT_NEGOTIATED_WITHOUT_PUBLICATION",
                                   ProcedureType outOfScopeType = ProcedureType.ProctypeNegotiatedWoNotice,
                                   string outOfScopeElement     = "PT_AWARD_CONTRACT_WITHOUT_CALL"
                                   )
        {
            if (_notice.ProcedureInformation.ProcedureType == annexType)
            {
                return(TedHelpers.Element(annexElement,
                                          TedHelpers.Element("D_ACCORDANCE_ARTICLE", annex),
                                          TedHelpers.PElement("D_JUSTIFICATION", SelectJustification().Justification)));
            }
            else if (_notice.ProcedureInformation.ProcedureType == outOfScopeType)
            {
                return(TedHelpers.Element(outOfScopeElement,
                                          TedHelpers.Element("D_OUTSIDE_SCOPE"),
                                          TedHelpers.PElement("D_JUSTIFICATION", SelectJustification().Justification)));
            }

            return(null);
        }
        private IEnumerable <XElement> Duration(TimeFrame timeFrame, string[] justificationIsOverFourYears, string[] justificationIsOverEightYears)
        {
            if (timeFrame == null)
            {
                yield break;
            }

            switch (timeFrame.Type)
            {
            case TimeFrameType.Days:
                yield return(TedHelpers.ElementWithAttribute("DURATION", "TYPE", "DAY", timeFrame.Days));

                break;

            case TimeFrameType.Months:
                yield return(TedHelpers.ElementWithAttribute("DURATION", "TYPE", "MONTH", timeFrame.Months));

                break;

            case TimeFrameType.BeginAndEndDate:
                yield return(TedHelpers.DateElement("DATE_START", timeFrame.BeginDate));

                yield return(TedHelpers.DateElement("DATE_END", timeFrame.EndDate));

                break;

            default:
                throw new HilmaMalformedRequestException("Undefined is not allowed value for time frame type");
            }

            if (justificationIsOverFourYears != null && justificationIsOverFourYears.HasAnyContent() && timeFrame.IsOverFourYears)
            {
                yield return(TedHelpers.PElement("JUSTIFICATION", justificationIsOverFourYears));
            }
            if (justificationIsOverEightYears != null && justificationIsOverEightYears.HasAnyContent() && timeFrame.IsOverEightYears)
            {
                yield return(TedHelpers.PElement("JUSTIFICATION", justificationIsOverEightYears));
            }
        }