/// <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 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 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));
        }
        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}");
            }
        }
Пример #5
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())));
 }
 /// <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 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())));
 }
        /// <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 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)
                               ));
 }
        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);
        }
Пример #11
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);
        }
        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));
            }
        }
Пример #13
0
        private XElement NoticeType()
        {
            string noticeType;

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

            case Enums.NoticeType.SocialPriorInformation:
                noticeType = "PRI_ONLY";
                break;

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

            default:
                throw new NotImplementedException();
            }

            return(TedHelpers.ElementWithAttribute("NOTICE", "TYPE", noticeType));
        }