/// <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);
        }
        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>
        /// 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);
        }
Exemple #4
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")
                                      ));
        }