public bool Validate(OrganisationContract organisation, NoticeType type, ProcurementProjectContract project) { var isUtilitiesNotice = type.IsUtilities() || (type == NoticeType.ExAnte && project.ProcurementCategory == ProcurementCategory.Utility); return(ValidateAll(Valid(organisation != null, "Organisation"), Valid(isUtilitiesNotice ? organisation?.MainActivityUtilities != MainActivityUtilities.Undefined : (organisation?.MainActivity != MainActivity.Undefined || organisation?.ContractingAuthorityType == ContractingAuthorityType.MaintypeFarmer), "Organisation.MainActivity"), Valid(organisation?.ContractingAuthorityType != ContractingAuthorityType.Undefined, "Organisation.ContractingAuthorityType"), Valid(organisation?.Id != Guid.Empty, "Organisation.Id"), Validate(organisation?.Information))); }
/// <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"))); }
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> /// INC01 without contact person and emails /// </summary> /// <param name="elementName">Name of element</param> /// <param name="organisation">Organisation</param> /// <returns>Xelement</returns> public static XElement INC_01(string elementName, OrganisationContract organisation) { var information = organisation?.Information; return(Element(elementName, Element("ORGANISATION", Element("OFFICIALNAME", information?.OfficialName), Element("NATIONALID", information?.NationalRegistrationNumber) ), Element("ADDRESS", information?.PostalAddress?.StreetAddress), Element("TOWN", information?.PostalAddress?.Town), Element("POSTAL_CODE", information?.PostalAddress?.PostalCode), ElementWithAttribute("COUNTRY", "VALUE", information?.PostalAddress?.Country) )); }
/// <summary> /// CA/CE/Concessionaire profile /// </summary> /// <param name="elementName">Name of element</param> /// <param name="organisation">Organisation</param> /// <param name="contactPerson">Contact person</param> /// <returns>Xelement</returns> public static XElement INC_01(string elementName, OrganisationContract organisation, ContactPerson contactPerson) { return(Element(elementName, Element("ORGANISATION", Element("OFFICIALNAME", organisation?.Information?.OfficialName), Element("NATIONALID", organisation?.Information?.NationalRegistrationNumber) ), Element("ADDRESS", organisation?.Information?.PostalAddress?.StreetAddress), Element("TOWN", organisation?.Information?.PostalAddress?.Town), Element("POSTAL_CODE", organisation?.Information?.PostalAddress?.PostalCode), ElementWithAttribute("COUNTRY", "VALUE", organisation?.Information?.PostalAddress?.Country), !string.IsNullOrEmpty(contactPerson.Name) ? Element("CONTACT_POINT", contactPerson?.Name) : null, Element("PHONE", contactPerson?.Phone), Element("E_MAILS", Element("E_MAIL", contactPerson?.Email) ) )); }
/// <summary> /// Contracting authority fields /// </summary> /// <param name="elementName">Name of element(ADDRESS_CONTRACTING_BODY or ADDRESS_CONTRACTING_BODY_ADDITIONAL)</param> /// <param name="organisation">Organisation</param> /// <param name="contactPerson">Contact person</param> /// <returns>Xelement</returns> public static XElement ADDRS1(string elementName, OrganisationContract organisation, ContactPerson contactPerson) { if (organisation == null) { return(null); } return(Element(elementName, Element("OFFICIALNAME", organisation.Information?.OfficialName), Element("NATIONALID", organisation.Information?.NationalRegistrationNumber), Element("ADDRESS", organisation.Information?.PostalAddress?.StreetAddress), Element("TOWN", organisation.Information?.PostalAddress?.Town), Element("POSTAL_CODE", organisation.Information?.PostalAddress?.PostalCode), ElementWithAttribute("COUNTRY", "VALUE", organisation.Information?.PostalAddress?.Country), !string.IsNullOrEmpty(contactPerson?.Name) ? Element("CONTACT_POINT", contactPerson?.Name) : null, Element("PHONE", contactPerson?.Phone), Element("E_MAIL", contactPerson?.Email), organisation?.Information?.NutsCodes.ToList().Select(x => new XElement(n2016 + "NUTS", new XAttribute("CODE", x))), Element("URL_GENERAL", organisation.Information?.MainUrl) )); }
/// <summary> /// Update method for the entity. /// </summary> /// <param name="dto">Dto to update the entity from.</param> public void Update(OrganisationContract dto) { if (dto.ContractingAuthorityType == ContractingAuthorityType.OtherType && string.IsNullOrEmpty(dto.OtherContractingAuthorityType)) { throw new HilmaMalformedRequestException($"if ContractingAuthorityType is {ContractingAuthorityType.OtherType} then OtherContractingAuthorityType is required, but null or empty string was provided!"); } if ((dto.MainActivity == MainActivity.OtherActivity || dto.MainActivityUtilities == MainActivityUtilities.OtherActivity) && string.IsNullOrEmpty(dto.OtherMainActivity)) { throw new HilmaMalformedRequestException($"if MainActivity is {MainActivity.OtherActivity} then OtherMainActivity is required, but null or empty string was provided!"); } ValidationState = dto.ValidationState; Information = dto.Information; ContractingAuthorityType = dto.ContractingAuthorityType; OtherContractingAuthorityType = dto.ContractingAuthorityType == ContractingAuthorityType.OtherType ? dto.OtherContractingAuthorityType : null; ContractingType = dto.ContractingType; MainActivity = dto.MainActivity; MainActivityUtilities = dto.MainActivityUtilities; OtherMainActivity = (dto.MainActivity == MainActivity.OtherActivity || dto.MainActivityUtilities == MainActivityUtilities.OtherActivity) ? dto.OtherMainActivity : null; }
/// <summary> /// Constructor from dto. /// </summary> /// <param name="dto">The dto to build the entity from.</param> public Organisation(OrganisationContract dto) { Update(dto); }
/// <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("CONTRACTING_BODY", TedHelpers.ADDRS1("ADDRESS_CONTRACTING_BODY", organisation, contactPerson) )); }