public WasteRecoveryViewModel(ProvidedBy? providedBy)
 {
     if (providedBy.HasValue)
     {
         ProvidedBy = providedBy;
     }
 }
        private static PluginService ParsePluginService(Type remoteType, FieldInfo field)
        {
            var attribute      = field.CustomAttributes.First(c => c.AttributeType.Name == typeof(Prise.Plugin.PluginServiceAttribute).Name);
            var serviceTypeArg = attribute.NamedArguments.FirstOrDefault(a => a.MemberName == "ServiceType");

            if (serviceTypeArg == null)
            {
                throw new PluginActivationException($"The ServiceType {remoteType.Name} argument is required for the {nameof(PluginServiceAttribute)}.");
            }

            var serviceType = serviceTypeArg.TypedValue.Value as Type;

            ProvidedBy providedBy    = default(ProvidedBy);
            var        providedByArg = attribute.NamedArguments.FirstOrDefault(a => a.MemberName == "ProvidedBy");

            if (providedByArg != null)
            {
                var providedByArgValue = providedByArg.TypedValue.Value;
                if (providedByArgValue != null)
                {
                    providedBy = (ProvidedBy)(int)providedByArgValue;
                }
            }

            Type proxyType = GetProxyTypeFromAttribute(attribute);

            return(new PluginService
            {
                ProvidedBy = providedBy,
                ServiceType = serviceType,
                FieldName = field.Name,
                ProxyType = proxyType
            });
        }
Пример #3
0
        public async Task ReturnsCorrectProviderWhenSet(ProvidedBy providedBy)
        {
            notification.WasteRecoveryInformationProvidedByImporter = providedBy == ProvidedBy.Importer;

            var result = await handler.HandleAsync(new GetWasteRecoveryProvider(NotificationId));

            Assert.Equal(providedBy, result);
        }
        public async Task ReturnsCorrectProviderWhenSet(ProvidedBy providedBy)
        {
            notification.WasteRecoveryInformationProvidedByImporter = providedBy == ProvidedBy.Importer;

            var result = await handler.HandleAsync(new GetWasteRecoveryProvider(NotificationId));

            Assert.Equal(providedBy, result);
        }
Пример #5
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Status?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DateOccured?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ProvidedBy?.GetHashCode() ?? 0);
            return(hashCode);
        }
        private static PluginService ParsePluginService(FieldInfo field)
        {
            var attribute      = field.CustomAttributes.First(c => c.AttributeType.Name == typeof(Prise.Plugin.PluginServiceAttribute).Name);
            var serviceTypeArg = attribute.NamedArguments.FirstOrDefault(a => a.MemberName == "ServiceType");

            if (serviceTypeArg == null)
            {
                throw new PrisePluginException($"The ServiceType {typeof(T).Name} argument is required for the PluginServiceAttribute.");
            }

            var serviceType = serviceTypeArg.TypedValue.Value as Type;

            ProvidedBy providedBy    = default(ProvidedBy);
            var        providedByArg = attribute.NamedArguments.FirstOrDefault(a => a.MemberName == "ProvidedBy");

            if (providedByArg != null)
            {
                var providedByArgValue = providedByArg.TypedValue.Value;
                if (providedByArgValue != null)
                {
                    providedBy = (ProvidedBy)(int)providedByArgValue;
                }
            }

            Type bridgeType    = null;
            var  bridgeTypeArg = attribute.NamedArguments.FirstOrDefault(a => a.MemberName == "BridgeType");

            if (bridgeTypeArg != null)
            {
                var bridgeTypeArgValue = bridgeTypeArg.TypedValue.Value;
                if (bridgeTypeArgValue != null)
                {
                    bridgeType = bridgeTypeArgValue as Type;
                }
            }

            return(new PluginService
            {
                ProvidedBy = providedBy,
                ServiceType = serviceType,
                FieldName = field.Name,
                BridgeType = bridgeType
            });
        }
        public void SetWasteRecoveryInformationProvider(ProvidedBy providedBy)
        {
            this.WasteRecoveryInformationProvidedByImporter = providedBy == ProvidedBy.Importer;

            RaiseEvent(new ProviderChangedEvent(this.Id, providedBy));
        }
Пример #8
0
        public void SetWasteRecoveryInformationProvider(ProvidedBy providedBy)
        {
            this.WasteRecoveryInformationProvidedByImporter = providedBy == ProvidedBy.Importer;

            RaiseEvent(new ProviderChangedEvent(this.Id, providedBy));
        }
 public ProviderChangedEvent(Guid notificationId, ProvidedBy newProvider)
 {
     NotificationId = notificationId;
     NewProvider = newProvider;
 }
Пример #10
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if ((Identifier != null) && (Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Active != null)
            {
                writer.WriteBoolean("active", (bool)Active !);
            }

            if (ProvidedBy != null)
            {
                writer.WritePropertyName("providedBy");
                ProvidedBy.SerializeJson(writer, options);
            }

            if ((Category != null) && (Category.Count != 0))
            {
                writer.WritePropertyName("category");
                writer.WriteStartArray();

                foreach (CodeableConcept valCategory in Category)
                {
                    valCategory.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Type != null) && (Type.Count != 0))
            {
                writer.WritePropertyName("type");
                writer.WriteStartArray();

                foreach (CodeableConcept valType in Type)
                {
                    valType.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Specialty != null) && (Specialty.Count != 0))
            {
                writer.WritePropertyName("specialty");
                writer.WriteStartArray();

                foreach (CodeableConcept valSpecialty in Specialty)
                {
                    valSpecialty.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Location != null) && (Location.Count != 0))
            {
                writer.WritePropertyName("location");
                writer.WriteStartArray();

                foreach (Reference valLocation in Location)
                {
                    valLocation.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Name))
            {
                writer.WriteString("name", (string)Name !);
            }

            if (_Name != null)
            {
                writer.WritePropertyName("_name");
                _Name.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Comment))
            {
                writer.WriteString("comment", (string)Comment !);
            }

            if (_Comment != null)
            {
                writer.WritePropertyName("_comment");
                _Comment.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ExtraDetails))
            {
                writer.WriteString("extraDetails", (string)ExtraDetails !);
            }

            if (_ExtraDetails != null)
            {
                writer.WritePropertyName("_extraDetails");
                _ExtraDetails.SerializeJson(writer, options);
            }

            if (Photo != null)
            {
                writer.WritePropertyName("photo");
                Photo.SerializeJson(writer, options);
            }

            if ((Telecom != null) && (Telecom.Count != 0))
            {
                writer.WritePropertyName("telecom");
                writer.WriteStartArray();

                foreach (ContactPoint valTelecom in Telecom)
                {
                    valTelecom.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((CoverageArea != null) && (CoverageArea.Count != 0))
            {
                writer.WritePropertyName("coverageArea");
                writer.WriteStartArray();

                foreach (Reference valCoverageArea in CoverageArea)
                {
                    valCoverageArea.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((ServiceProvisionCode != null) && (ServiceProvisionCode.Count != 0))
            {
                writer.WritePropertyName("serviceProvisionCode");
                writer.WriteStartArray();

                foreach (CodeableConcept valServiceProvisionCode in ServiceProvisionCode)
                {
                    valServiceProvisionCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Eligibility != null) && (Eligibility.Count != 0))
            {
                writer.WritePropertyName("eligibility");
                writer.WriteStartArray();

                foreach (HealthcareServiceEligibility valEligibility in Eligibility)
                {
                    valEligibility.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Program != null) && (Program.Count != 0))
            {
                writer.WritePropertyName("program");
                writer.WriteStartArray();

                foreach (CodeableConcept valProgram in Program)
                {
                    valProgram.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Characteristic != null) && (Characteristic.Count != 0))
            {
                writer.WritePropertyName("characteristic");
                writer.WriteStartArray();

                foreach (CodeableConcept valCharacteristic in Characteristic)
                {
                    valCharacteristic.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Communication != null) && (Communication.Count != 0))
            {
                writer.WritePropertyName("communication");
                writer.WriteStartArray();

                foreach (CodeableConcept valCommunication in Communication)
                {
                    valCommunication.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((ReferralMethod != null) && (ReferralMethod.Count != 0))
            {
                writer.WritePropertyName("referralMethod");
                writer.WriteStartArray();

                foreach (CodeableConcept valReferralMethod in ReferralMethod)
                {
                    valReferralMethod.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (AppointmentRequired != null)
            {
                writer.WriteBoolean("appointmentRequired", (bool)AppointmentRequired !);
            }

            if ((AvailableTime != null) && (AvailableTime.Count != 0))
            {
                writer.WritePropertyName("availableTime");
                writer.WriteStartArray();

                foreach (HealthcareServiceAvailableTime valAvailableTime in AvailableTime)
                {
                    valAvailableTime.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((NotAvailable != null) && (NotAvailable.Count != 0))
            {
                writer.WritePropertyName("notAvailable");
                writer.WriteStartArray();

                foreach (HealthcareServiceNotAvailable valNotAvailable in NotAvailable)
                {
                    valNotAvailable.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(AvailabilityExceptions))
            {
                writer.WriteString("availabilityExceptions", (string)AvailabilityExceptions !);
            }

            if (_AvailabilityExceptions != null)
            {
                writer.WritePropertyName("_availabilityExceptions");
                _AvailabilityExceptions.SerializeJson(writer, options);
            }

            if ((Endpoint != null) && (Endpoint.Count != 0))
            {
                writer.WritePropertyName("endpoint");
                writer.WriteStartArray();

                foreach (Reference valEndpoint in Endpoint)
                {
                    valEndpoint.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Пример #11
0
 public ProviderChangedEvent(Guid notificationId, ProvidedBy newProvider)
 {
     NotificationId = notificationId;
     NewProvider    = newProvider;
 }
Пример #12
0
 public SetWasteRecoveryProvider(ProvidedBy providedBy, Guid notificationId)
 {
     ProvidedBy     = providedBy;
     NotificationId = notificationId;
 }