/// <summary>
        /// Canceling a national notice
        /// </summary>
        /// <param name="parentDto">Parent dto</param>
        /// <param name="etsId">Ets identifier</param>
        /// <returns>The notice</returns>
        public static Notice CancelNotice(this EtsNoticeContract parentDto, string etsId)
        {
            var notice = parentDto.CreateNotice(etsId);

            notice.IsCancelled     = true;
            notice.IsCorrigendum   = false;
            notice.CancelledReason = parentDto.CancelledReason;
            notice.TenderingInformation.TendersOrRequestsToParticipateDueDateTime = null;
            notice.TenderingInformation.EstimatedDateOfContractNoticePublication  = null;
            notice.TenderingInformation.EstimatedDateOfInvitations = null;
            return(notice);
        }
Exemplo n.º 2
0
        public static EtsNoticeContract ConvertContract(string formNumber, string noticeType, string formOriginalXml)
        {
            var parser = new NoticeXMLParser();

            var importModel = new NoticeImportContract()
            {
                FormNumber          = formNumber,
                NoticeNumber        = string.Empty, // Assigned by Hilma
                NoticeOjsNumber     = null,
                NoticeType          = noticeType,
                HilmaSubmissionDate = DateTime.Now,
                Notice = formOriginalXml
            };

            var noticeContract = parser.ParseNotice(importModel);
            var etsNotice      = new EtsNoticeContract(noticeContract);

            return(etsNotice);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            if (args.Length < 4)
            {
                Console.WriteLine(@"Instructions: give 4 arguments:
[0] Filename, give xml file as first argument. i.e: ./notice.xml
[1] Form number, i.e: 2 
[2] Notice special type (string), if not known:  0, example: 'PRI_REDUCING_TIME_LIMITS'
[3] Notice OJS Number, if not applicable: null");
                Console.WriteLine(JsonConvert.SerializeObject(args));
                return;
            }

            var filename   = args[0];
            var formNumber = args[1];
            var noticeType = args[2];
            var ojsNumber  = args[3];

            using (var content = File.OpenRead(filename))
                using (var sr = new StreamReader(content, Encoding.UTF8))
                {
                    var parser = new NoticeXMLParser();

                    var importModel = new NoticeImportContract()
                    {
                        FormNumber          = formNumber,
                        NoticeNumber        = string.Empty, // Assigned by Hilma
                        NoticeOjsNumber     = ojsNumber,
                        NoticeType          = noticeType,
                        HilmaSubmissionDate = DateTime.Now,
                        Notice = sr.ReadToEnd(),
                    };

                    var notice    = parser.ParseNotice(importModel);
                    var etsNotice = new EtsNoticeContract(notice);
                    Console.Write(JsonConvert.SerializeObject(etsNotice));
                    Console.ReadLine();
                }
        }
        /// <summary>
        ///     Creates a notice entity from Ets api dto. Sets front-end validation to all valid.
        /// </summary>
        /// <param name="dto">The data from API</param>
        /// <param name="etsId">API user assigned surrogate key</param>
        /// <returns></returns>
        public static Notice CreateNotice(this EtsNoticeContract dto, string etsId)
        {
            // NOTE(JanneF): If you edit this functionality, please also update /common/services/documentation.ts documentation generator!
            var rv = new Notice
            {
                // 1:1
                Type                          = dto.Type,
                LegalBasis                    = dto.LegalBasis,
                EtsIdentifier                 = etsId,
                ComplementaryInformation      = dto.ComplementaryInformation,
                ConditionsInformation         = dto.ConditionsInformation,
                ConditionsInformationDefence  = dto.ConditionsInformationDefence,
                ConditionsInformationNational = dto.ConditionsInformationNational,
                PreviousNoticeOjsNumber       = dto.PreviousNoticeOjsNumber,
                NoticeOjsNumber               = dto.NoticeOjsNumber,
                TenderingInformation          = dto.TenderingInformation,
                RewardsAndJury                = dto.RewardsAndJury,
                ResultsOfContest              = dto.ResultsOfContest,
                ProcedureInformation          = dto.ProcedureInformation,
                CommunicationInformation      = dto.CommunicationInformation,
                ContactPerson                 = dto.ContactPerson,

                LotsInfo           = dto.LotsInfo,
                ObjectDescriptions = dto.ObjectDescriptions ?? new ObjectDescription[0],
                IsCorrigendum      = dto.IsCorrigendum,
                IsCancelled        = dto.IsCancelled,
                CancelledReason    = dto.CancelledReason,
                Annexes            = dto.Annexes,
                CorrigendumAdditionalInformation = dto.CorrigendumAdditionalInformation,
                Language            = dto.Language,
                ProceduresForReview = dto.ProceduresForReview,

                // Flattened stuff
                ProcurementObject = new ProcurementObject
                {
                    ShortDescription = dto.ShortDescription,
                    EstimatedValue   = dto.EstimatedValue,
                    EstimatedValueCalculationMethod = dto.EstimatedValueCalculationMethod,
                    TotalValue  = dto.TotalValue,
                    MainCpvCode = dto.MainCpvCode,
                    Defence     = dto.Defence
                },
                Project = new ProcurementProjectContract
                {
                    Title           = dto.Project?.Title,
                    ContractType    = dto.Project?.ContractType ?? ContractType.Undefined,
                    ReferenceNumber = dto.Project?.ReferenceNumber,
                    State           = PublishState.Draft,
                    CoPurchasers    = dto.Project?.CoPurchasers,
                    Organisation    = new OrganisationContract
                    {
                        Information = dto.Organisation?.Information,
                        ContractingAuthorityType      = dto.Organisation?.ContractingAuthorityType ?? ContractingAuthorityType.Undefined,
                        OtherContractingAuthorityType = dto.Organisation?.OtherContractingAuthorityType,
                        ContractingType       = dto.Organisation?.ContractingType ?? ContractingType.Undefined,
                        MainActivity          = dto.Organisation?.MainActivity ?? MainActivity.Undefined,
                        OtherMainActivity     = dto.Organisation?.OtherMainActivity,
                        MainActivityUtilities = dto.Organisation?.MainActivityUtilities ?? MainActivityUtilities.Undefined
                    },
                    DefenceCategory = dto.Project?.DefenceCategory,
                    DisagreeToPublishNoticeBasedOnDefenceServiceCategory4 = dto.Project?.DisagreeToPublishNoticeBasedOnDefenceServiceCategory4,
                    DefenceSupplies     = dto.Project?.DefenceSupplies ?? Supplies.Undefined,
                    DefenceWorks        = dto.Project?.DefenceWorks ?? Works.Undefined,
                    ProcurementCategory = GetProcurementCategory(dto.LegalBasis, dto.Project?.ProcurementCategory ?? ProcurementCategory.Undefined),
                    ProcurementLaw      = dto.Project?.ProcurementLaw ?? new string[0],
                    CentralPurchasing   = dto.Project?.CentralPurchasing ?? false,
                    JointProcurement    = dto.Project?.JointProcurement ?? false,
                    Publish             = dto.Type.IsNational() ? PublishType.ToHilma : PublishType.ToTed,
                    AgricultureWorks    = dto.Project?.AgricultureWorks ?? AgricultureWorks.Undefined
                },
                AttachmentInformation = new AttachmentInformation()
                {
                    Links = dto.Links ?? new Link[0]
                },
                HasAttachments                 = dto.Links?.Length > 0,
                Modifications                  = dto.Modifications,
                ContractAwardsDefence          = dto.ContractAwardsDefence,
                IsPrivateSmallValueProcurement = dto.IsPrivateSmallValueProcurement,


                // mandatory setup
                State           = PublishState.Draft,
                TedPublishState = TedPublishState.Undefined,
                IsLatest        = true,
            };

            return(rv);
        }