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}"); } }
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)))); }