Example #1
0
 public bool Validate(ProcurementProjectContract project, NoticeType type)
 {
     return(ValidateAll(Valid(project != null && project.Id != 0, "ProcurementProjectContract"),
                        Valid(project?.ContractType != ContractType.Undefined, "ProcurementProjectContract.ContractType"),
                        Valid(!string.IsNullOrWhiteSpace(project?.Title), "ProcurementProjectContract.Title"),
                        Validate(project?.Organisation, type, project)));
 }
        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
                    }
                                                   ));
                }
            }
        }
Example #3
0
 public ProcurementProject(ProcurementProjectContract dto, User creator)
 {
     Update(dto);
     Creator       = creator;
     Collaborators = new List <ProjectCollaborators> {
         new ProjectCollaborators {
             User = creator, Project = this
         }
     };
 }
Example #4
0
        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="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)
                                      ));
        }
Example #6
0
        public ProcurementProject Update(ProcurementProjectContract dto, bool ignoreErrors = false)
        {
            if (State == PublishState.Published)
            {
                if (!ignoreErrors && (ProcurementCategory != dto.ProcurementCategory ||
                                      ContractType != dto.ContractType))
                {
                    throw new HilmaException("Updating procurement category, contract type is not allowed for published projects");
                }
            }
            // Creator and  Id cannot be updated with this method.
            ValidationState = dto.ValidationState;
            Title           = dto.Title;
            ReferenceNumber = dto.ReferenceNumber;
            Organisation    = dto.Organisation;

            if (dto.Organisation?.Id != Guid.Empty)
            {
                OwningOrganisationId = dto.Organisation?.Id;
            }
            CoPurchasers        = dto.CoPurchasers;
            CentralPurchasing   = dto.CentralPurchasing;
            ProcurementLaw      = dto.ProcurementLaw;
            JointProcurement    = dto.JointProcurement;
            ContractType        = dto.ContractType;
            ProcurementCategory = dto.ProcurementCategory;
            DefenceCategory     = dto.DefenceCategory;
            DisagreeToPublishNoticeBasedOnDefenceServiceCategory4 = dto.DisagreeToPublishNoticeBasedOnDefenceServiceCategory4;
            DefenceSupplies  = dto.DefenceSupplies;
            DefenceWorks     = dto.DefenceWorks;
            Publish          = dto.Publish;
            AgricultureWorks = dto.AgricultureWorks;
            IsPrivate        = dto.IsPrivate;
            IsConcluded      = dto.IsConcluded;

            return(this);
        }
Example #7
0
 public ProcurementProject(ProcurementProjectContract dto, EtsUser creator)
 {
     Update(dto);
     EtsCreator = creator;
 }