Exemplo n.º 1
0
        public string CheckAvailableServices(ExtendedAddress extendedAddress)
        {
            if (extendedAddress == null)
            {
                return(null);
            }

            var    zipCode         = extendedAddress.BasicAddress.ZipCode;
            string selectedZipCode = string.Empty;

            if (!String.IsNullOrEmpty(zipCode))
            {
                var serviceAvailables = Shared.APIs.IServices.GetAvailableServices(zipCode);
                if (serviceAvailables == null || serviceAvailables.Count == 0)
                {
                    selectedZipCode = string.Empty;
                    extendedAddress.BasicAddress.ZipCode = string.Empty;
                }
                else
                {
                    selectedZipCode = zipCode;
                }
            }
            return(selectedZipCode);
        }
Exemplo n.º 2
0
 public static void AddPreviouslyUsedAddress(ExtendedAddress value)
 {
     try
     {
         if (value != null)
         {
             var previouslyUsedAddresses = Shared.PreviouslyUsedAddresses;
             var firstOrDefault          = previouslyUsedAddresses.FirstOrDefault(t => t.BasicAddress.ToAddressLine() == value.BasicAddress.ToAddressLine());
             if (firstOrDefault == null)
             {
                 previouslyUsedAddresses.Insert(0, value);
             }
             else
             {
                 previouslyUsedAddresses.Remove(firstOrDefault);
                 previouslyUsedAddresses.Insert(0, value);
             }
             Shared.PreviouslyUsedAddresses = previouslyUsedAddresses.Take(10).ToList();
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Catch(e);
     }
 }
Exemplo n.º 3
0
        /// <inheritdoc/>
        public void FromDelimitedString(string delimitedString, Separators separators)
        {
            Separators seps = separators ?? new Separators().UsingConfigurationValues();

            string[] segments = delimitedString == null
                ? Array.Empty <string>()
                : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None);

            if (segments.Length > 0)
            {
                if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0)
                {
                    throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString));
                }
            }

            RequestedGiveCode                      = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[1], false, seps) : null;
            RequestedGiveAmountMinimum             = segments.Length > 2 && segments[2].Length > 0 ? segments[2].ToNullableDecimal() : null;
            RequestedGiveAmountMaximum             = segments.Length > 3 && segments[3].Length > 0 ? segments[3].ToNullableDecimal() : null;
            RequestedGiveUnits                     = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[4], false, seps) : null;
            RequestedDosageForm                    = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[5], false, seps) : null;
            ProvidersPharmacyTreatmentInstructions = segments.Length > 6 && segments[6].Length > 0 ? segments[6].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null;
            ProvidersAdministrationInstructions    = segments.Length > 7 && segments[7].Length > 0 ? segments[7].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null;
            DeliverToLocation                      = segments.Length > 8 && segments[8].Length > 0 ? TypeSerializer.Deserialize <LocationWithAddressVariationOne>(segments[8], false, seps) : null;
            AllowSubstitutions                     = segments.Length > 9 && segments[9].Length > 0 ? segments[9] : null;
            RequestedDispenseCode                  = segments.Length > 10 && segments[10].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[10], false, seps) : null;
            RequestedDispenseAmount                = segments.Length > 11 && segments[11].Length > 0 ? segments[11].ToNullableDecimal() : null;
            RequestedDispenseUnits                 = segments.Length > 12 && segments[12].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[12], false, seps) : null;
            NumberOfRefills                        = segments.Length > 13 && segments[13].Length > 0 ? segments[13].ToNullableDecimal() : null;
            OrderingProvidersDeaNumber             = segments.Length > 14 && segments[14].Length > 0 ? segments[14].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedCompositeIdNumberAndNameForPersons>(x, false, seps)) : null;
            PharmacistTreatmentSuppliersVerifierId = segments.Length > 15 && segments[15].Length > 0 ? segments[15].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedCompositeIdNumberAndNameForPersons>(x, false, seps)) : null;
            NeedsHumanReview                       = segments.Length > 16 && segments[16].Length > 0 ? segments[16] : null;
            RequestedGivePerTimeUnit               = segments.Length > 17 && segments[17].Length > 0 ? segments[17] : null;
            RequestedGiveStrength                  = segments.Length > 18 && segments[18].Length > 0 ? segments[18].ToNullableDecimal() : null;
            RequestedGiveStrengthUnits             = segments.Length > 19 && segments[19].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[19], false, seps) : null;
            Indication = segments.Length > 20 && segments[20].Length > 0 ? segments[20].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null;
            RequestedGiveRateAmount          = segments.Length > 21 && segments[21].Length > 0 ? segments[21] : null;
            RequestedGiveRateUnits           = segments.Length > 22 && segments[22].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[22], false, seps) : null;
            TotalDailyDose                   = segments.Length > 23 && segments[23].Length > 0 ? TypeSerializer.Deserialize <CompositeQuantityWithUnits>(segments[23], false, seps) : null;
            SupplementaryCode                = segments.Length > 24 && segments[24].Length > 0 ? segments[24].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null;
            RequestedDrugStrengthVolume      = segments.Length > 25 && segments[25].Length > 0 ? segments[25].ToNullableDecimal() : null;
            RequestedDrugStrengthVolumeUnits = segments.Length > 26 && segments[26].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[26], false, seps) : null;
            PharmacyOrderType                = segments.Length > 27 && segments[27].Length > 0 ? segments[27] : null;
            DispensingInterval               = segments.Length > 28 && segments[28].Length > 0 ? segments[28].ToNullableDecimal() : null;
            MedicationInstanceIdentifier     = segments.Length > 29 && segments[29].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[29], false, seps) : null;
            SegmentInstanceIdentifier        = segments.Length > 30 && segments[30].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[30], false, seps) : null;
            MoodCode                  = segments.Length > 31 && segments[31].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[31], false, seps) : null;
            DispensingPharmacy        = segments.Length > 32 && segments[32].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[32], false, seps) : null;
            DispensingPharmacyAddress = segments.Length > 33 && segments[33].Length > 0 ? TypeSerializer.Deserialize <ExtendedAddress>(segments[33], false, seps) : null;
            DeliverToPatientLocation  = segments.Length > 34 && segments[34].Length > 0 ? TypeSerializer.Deserialize <PersonLocation>(segments[34], false, seps) : null;
            DeliverToAddress          = segments.Length > 35 && segments[35].Length > 0 ? TypeSerializer.Deserialize <ExtendedAddress>(segments[35], false, seps) : null;
        }
Exemplo n.º 4
0
        internal ExtendedAddress GetExtendedAddress(int fieldIndex)
        {
            ExtendedAddress address = new ExtendedAddress();

            string fieldValue = GetField(fieldIndex);

            address.Address1 = GetComponent(fieldValue, 0);
            address.Address2 = GetComponent(fieldValue, 1);
            address.City     = GetComponent(fieldValue, 2);
            address.State    = GetComponent(fieldValue, 3);
            address.ZipCode  = GetComponent(fieldValue, 4);

            return(address);
        }
Exemplo n.º 5
0
        /// <inheritdoc/>
        public void FromDelimitedString(string delimitedString, Separators separators)
        {
            Separators seps = separators ?? new Separators().UsingConfigurationValues();

            string[] segments = delimitedString == null
                ? Array.Empty <string>()
                : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None);

            if (segments.Length > 0)
            {
                if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0)
                {
                    throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString));
                }
            }

            GiveSubIdCounter     = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableDecimal() : null;
            DispenseSubIdCounter = segments.Length > 2 && segments[2].Length > 0 ? segments[2].ToNullableDecimal() : null;
            QuantityTiming       = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <TimingQuantity>(segments[3], false, seps) : null;
            GiveCode             = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[4], false, seps) : null;
            GiveAmountMinimum    = segments.Length > 5 && segments[5].Length > 0 ? segments[5].ToNullableDecimal() : null;
            GiveAmountMaximum    = segments.Length > 6 && segments[6].Length > 0 ? segments[6].ToNullableDecimal() : null;
            GiveUnits            = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[7], false, seps) : null;
            GiveDosageForm       = segments.Length > 8 && segments[8].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[8], false, seps) : null;
            AdministrationNotes  = segments.Length > 9 && segments[9].Length > 0 ? segments[9].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null;
            SubstitutionStatus   = segments.Length > 10 && segments[10].Length > 0 ? segments[10] : null;
            DispenseToLocation   = segments.Length > 11 && segments[11].Length > 0 ? TypeSerializer.Deserialize <LocationWithAddressVariationTwo>(segments[11], false, seps) : null;
            NeedsHumanReview     = segments.Length > 12 && segments[12].Length > 0 ? segments[12] : null;
            SpecialAdministrationInstructions = segments.Length > 13 && segments[13].Length > 0 ? segments[13].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null;
            GivePerTimeUnit           = segments.Length > 14 && segments[14].Length > 0 ? segments[14] : null;
            GiveRateAmount            = segments.Length > 15 && segments[15].Length > 0 ? segments[15] : null;
            GiveRateUnits             = segments.Length > 16 && segments[16].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[16], false, seps) : null;
            GiveStrength              = segments.Length > 17 && segments[17].Length > 0 ? segments[17].ToNullableDecimal() : null;
            GiveStrengthUnits         = segments.Length > 18 && segments[18].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[18], false, seps) : null;
            SubstanceLotNumber        = segments.Length > 19 && segments[19].Length > 0 ? segments[19].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null;
            SubstanceExpirationDate   = segments.Length > 20 && segments[20].Length > 0 ? segments[20].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => x.ToDateTime()) : null;
            SubstanceManufacturerName = segments.Length > 21 && segments[21].Length > 0 ? segments[21].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null;
            Indication                  = segments.Length > 22 && segments[22].Length > 0 ? segments[22].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null;
            GiveDrugStrengthVolume      = segments.Length > 23 && segments[23].Length > 0 ? segments[23].ToNullableDecimal() : null;
            GiveDrugStrengthVolumeUnits = segments.Length > 24 && segments[24].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[24], false, seps) : null;
            GiveBarcodeIdentifier       = segments.Length > 25 && segments[25].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[25], false, seps) : null;
            PharmacyOrderType           = segments.Length > 26 && segments[26].Length > 0 ? segments[26] : null;
            DispenseToPharmacy          = segments.Length > 27 && segments[27].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[27], false, seps) : null;
            DispenseToPharmacyAddress   = segments.Length > 28 && segments[28].Length > 0 ? TypeSerializer.Deserialize <ExtendedAddress>(segments[28], false, seps) : null;
            DeliverToPatientLocation    = segments.Length > 29 && segments[29].Length > 0 ? TypeSerializer.Deserialize <PersonLocation>(segments[29], false, seps) : null;
            DeliverToAddress            = segments.Length > 30 && segments[30].Length > 0 ? TypeSerializer.Deserialize <ExtendedAddress>(segments[30], false, seps) : null;
        }
Exemplo n.º 6
0
        public List <Service> GetAvailableServices(ExtendedAddress extendedAddress)
        {
            if (extendedAddress == null)
            {
                return(null);
            }
            var zipCode = extendedAddress.BasicAddress.ZipCode;

            if (!String.IsNullOrEmpty(zipCode))
            {
                var serviceAvailables = Shared.APIs.IServices.GetAvailableServices(zipCode);
                return(serviceAvailables);
            }
            else
            {
                return(new List <Service>());
            }
        }
Exemplo n.º 7
0
        public void SetSubcomponentFlags_WithoutSubcomponent_ReturnsObjectWithNoFlagSet()
        {
            PidSegment segment = new()
            {
                PatientAddress = new ExtendedAddress[]
                {
                    new ExtendedAddress
                    {
                        Addressee = "123 Main Street"
                    }
                }
            };

            SegmentHelper helper = new();

            helper.SetSubcomponentFlags(segment);

            Assert.False(segment.PatientAddress.FirstOrDefault().IsSubcomponent);
        }
    }
Exemplo n.º 8
0
        public ServiceNotAvailablePage(ExtendedAddress extendedAddress, string fullName = "", string email = "")
        {
            InitializeComponent();

            mAppServices = DependencyService.Get <IAppServices>();
            if (!string.IsNullOrEmpty(fullName))
            {
                EntryFullName.Text = fullName;
            }

            if (!string.IsNullOrEmpty(email))
            {
                EntryEmail.Text = email;
            }
            if (!string.IsNullOrEmpty(extendedAddress.BasicAddress.ZipCode))
            {
                LabelServicesAreNotCurrentlyAvailable.Text = AppResources.ServicesAreNotCurrentlyAvailableZipCode + " " + extendedAddress.BasicAddress.ZipCode + ".";
            }
            else
            {
                LabelServicesAreNotCurrentlyAvailable.Text = AppResources.ServicesAreNotCurrentlyAvailable;
            }

            GreenButtonNotifyMe.Clicked += (sender, e) =>
            {
                this.IsBusy = true;
                var fullname = EntryFullName.Text;
                var id       = EntryFullName.Text;
                Task.Run(() =>
                {
                }).ContinueWith((arg) =>
                {
                    Utils.ShowSuccessMessage(AppResources.LeadsGenerationMessage, 4);
                    Navigation.PopAsync();
                    this.IsBusy = false;
                }, TaskScheduler.FromCurrentSynchronizationContext());
            };
        }
Exemplo n.º 9
0
        public void SetSubcomponentFlags_WithSubcomponent_ReturnsObjectWithFlagSet()
        {
            PidSegment segment = new()
            {
                PatientAddress = new ExtendedAddress[]
                {
                    new ExtendedAddress
                    {
                        StreetAddress = new StreetAddress
                        {
                            StreetOrMailingAddress = "123 Main Street",
                            DwellingNumber         = "Suite 321"
                        }
                    }
                }
            };

            SegmentHelper helper = new();

            helper.SetSubcomponentFlags(segment);

            Assert.True(segment.PatientAddress.FirstOrDefault().StreetAddress.IsSubcomponent);
        }