예제 #1
0
        public bool Post([FromBody] WorkPackaged workPackaged)
        {
            if ((workPackaged == null) ||
                (string.IsNullOrWhiteSpace(workPackaged.WorkPackagedThingName)) ||
                (workPackaged.ProcedureId == 0) ||
                ((workPackaged.WorkPackagedKind == WorkPackagedType.Treaty) &&
                 (workPackaged.NonTreatySeriesMembership == null)))
            {
                return(false);
            }
            string tripleStoreId                       = GetTripleStoreId();
            string workPackageTripleStoreId            = GetTripleStoreId();
            string seriesMembershipTripleStoreId       = null;
            string seriesMembershipTreatyTripleStoreId = null;

            if (workPackaged.WorkPackagedKind == WorkPackagedType.Treaty)
            {
                seriesMembershipTripleStoreId       = GetTripleStoreId();
                seriesMembershipTreatyTripleStoreId = GetTripleStoreId();
                if ((string.IsNullOrWhiteSpace(seriesMembershipTripleStoreId)) ||
                    (string.IsNullOrWhiteSpace(seriesMembershipTreatyTripleStoreId)))
                {
                    return(false);
                }
            }
            if ((string.IsNullOrWhiteSpace(tripleStoreId)) ||
                (string.IsNullOrWhiteSpace(workPackageTripleStoreId)))
            {
                return(false);
            }
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("@TripleStoreId", tripleStoreId);
            parameters.Add("@WebLink", workPackaged.WebLink);
            parameters.Add("@ProcedureWorkPackageTripleStoreId", workPackageTripleStoreId);
            parameters.Add("@ProcedureId", workPackaged.ProcedureId);
            parameters.Add("@WorkPackagedKind", (int)workPackaged.WorkPackagedKind);
            parameters.Add("@WorkPackagedThingName", workPackaged.WorkPackagedThingName);
            parameters.Add("@StatutoryInstrumentNumber", workPackaged.StatutoryInstrumentNumber);
            parameters.Add("@StatutoryInstrumentNumberPrefix", workPackaged.StatutoryInstrumentNumberPrefix);
            parameters.Add("@StatutoryInstrumentNumberYear", workPackaged.StatutoryInstrumentNumberYear);
            parameters.Add("@ComingIntoForceNote", workPackaged.ComingIntoForceNote);
            parameters.Add("@ComingIntoForceDate", workPackaged.ComingIntoForceDate);
            parameters.Add("@MadeDate", workPackaged.MadeDate);
            parameters.Add("@LeadGovernmentOrganisationTripleStoreId", workPackaged.LeadGovernmentOrganisationTripleStoreId);
            parameters.Add("@SeriesCitation", workPackaged.NonTreatySeriesMembership?.Citation);
            parameters.Add("@SeriesTreatyCitation", workPackaged?.TreatySeriesMembership?.Citation);
            parameters.Add("@SeriesMembershipTripleStoreId", seriesMembershipTripleStoreId);
            parameters.Add("@SeriesMembershipTreatyTripleStoreId", seriesMembershipTreatyTripleStoreId);
            parameters.Add("@IsCountrySeriesMembership", workPackaged.NonTreatySeriesMembership?.SeriesMembershipKind == SeriesMembershipType.Country);
            parameters.Add("@IsEuropeanUnionSeriesMembership", workPackaged.NonTreatySeriesMembership?.SeriesMembershipKind == SeriesMembershipType.EuropeanUnion);
            parameters.Add("@IsMiscellaneousSeriesMembership", workPackaged.NonTreatySeriesMembership?.SeriesMembershipKind == SeriesMembershipType.Miscellaneous);
            parameters.Add("@IsTreatySeriesMembership", workPackaged.TreatySeriesMembership != null);
            parameters.Add("@ModifiedBy", EMail);
            CommandDefinition command = new CommandDefinition("CreateWorkPackaged",
                                                              parameters,
                                                              commandType: System.Data.CommandType.StoredProcedure);

            return(Execute(command));
        }
        public bool PostStatutoryInstrument(int id, [FromBody] WorkPackaged workPackaged)
        {
            if ((workPackaged == null) ||
                (string.IsNullOrWhiteSpace(workPackaged.WorkPackagedThingName)) ||
                (workPackaged.ProcedureId == 0))
            {
                return(false);
            }
            string tripleStoreId            = GetTripleStoreId();
            string workPackageTripleStoreId = GetTripleStoreId();

            if ((string.IsNullOrWhiteSpace(tripleStoreId)) ||
                (string.IsNullOrWhiteSpace(workPackageTripleStoreId)))
            {
                return(false);
            }
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("@TripleStoreId", tripleStoreId);
            parameters.Add("@WebLink", workPackaged.WebLink);
            parameters.Add("@ProcedureWorkPackageTripleStoreId", workPackageTripleStoreId);
            parameters.Add("@ProcedureId", workPackaged.ProcedureId);
            parameters.Add("@WorkPackagedKind", (int)workPackaged.WorkPackagedKind);
            parameters.Add("@WorkPackagedThingName", workPackaged.WorkPackagedThingName);
            parameters.Add("@StatutoryInstrumentNumber", workPackaged.StatutoryInstrumentNumber);
            parameters.Add("@StatutoryInstrumentNumberPrefix", workPackaged.StatutoryInstrumentNumberPrefix);
            parameters.Add("@StatutoryInstrumentNumberYear", workPackaged.StatutoryInstrumentNumberYear);
            parameters.Add("@ComingIntoForceNote", workPackaged.ComingIntoForceNote);
            parameters.Add("@ComingIntoForceDate", workPackaged.ComingIntoForceDate);
            parameters.Add("@MadeDate", workPackaged.MadeDate);
            parameters.Add("@SolarFeedId", id);
            parameters.Add("@ModifiedBy", EMail);
            CommandDefinition command = new CommandDefinition("CreateWorkPackaged",
                                                              parameters,
                                                              commandType: System.Data.CommandType.StoredProcedure);

            return(Execute(command));
        }