コード例 #1
0
        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            var addedItem = new Prescription()
            {
                Medicine = cb_medicine.SelectedItem as MedicineInventory,
                Amount   = it_amount.Value,
                AddedBy  = App.LoggedUser.Username,
                AddedOn  = DateTime.Now
            };

            addedItem.Schedule = ConvertFromDateTimeOffset(cdp_startDate.Date.Value.Add(tp_startTime.Time));

            int            uploadMode = pv_options.SelectedIndex;
            ImsDataService imsSvc     = new ImsDataService(App.ApiSettings);

            ContentDialogButtonClickDeferral def = args.GetDeferral();

            if (uploadMode == 0)
            {
                var item = await imsSvc.AddNewPrescriptionAsync(Patient.ID, addedItem);

                AddedItem = item;
            }
            else
            {
                var items = await imsSvc.SetRecurringPrescriptionsAsync(Patient.ID, addedItem, it_times.Value, it_days.Value);

                AddedItems  = items;
                IsRecurring = true;
            }
            def.Complete();
        }
コード例 #2
0
        /// <summary>
        /// Prepares the data when the page is navigated to.
        ///
        /// This is an implementation of the INavigable interface.
        /// </summary>
        /// <param name="parameter">Optional passed parameter</param>
        public virtual async void Activate(object parameter)
        {
            PropertyChanged += OnPropertyChanged;

            imsSvc = new ImsDataService(ApiSettings);
            await GetAdmittedPatientsAsync();
        }
コード例 #3
0
        private async void OnDialogLoaded(object sender, RoutedEventArgs e)
        {
            ImsDataService imsSvc    = new ImsDataService(App.ApiSettings);
            var            inventory = await imsSvc.GetMedicineInventoryListAsync();

            SuggestedMedicines = new ObservableCollection <MedicineInventory>(inventory);
        }
コード例 #4
0
        /// <summary>
        /// Gets all of the prescriptions from the IMS API and groups them into their schedules.
        /// </summary>
        /// <param name="imsId">ID of admitted patient at the IMS.</param>
        /// <returns>An observable collection of grouped prescriptions.</returns>
        protected async Task <ObservableCollection <PrescriptionGroup> > GetPrescriptionsAsync(int imsId, PatientAdministrationStatus?status = null)
        {
            imsSvc = new ImsDataService(ApiSettings);

            List <Prescription> medicines = await imsSvc.GetPrescriptionsAsync(imsId);

            var grpedMedicines = from meds in medicines
                                 group meds by meds.Schedule into grp
                                 orderby grp.Key
                                 select new { TimeStamp = grp.Key, Items = grp };

            var prescriptionsGrouped = new ObservableCollection <PrescriptionGroup>();

            foreach (var groups in grpedMedicines)
            {
                PrescriptionGroup grp = new PrescriptionGroup();

                grp.TimeStamp = groups.TimeStamp;

                ObservableCollection <Prescription> sortedMedicines = new ObservableCollection <Prescription>();
                foreach (var meds in groups.Items)
                {
                    sortedMedicines.Add(meds);
                }
                grp.Prescriptions = sortedMedicines;

                prescriptionsGrouped.Add(grp);
            }

            if (status.HasValue)
            {
                switch (status.Value)
                {
                case PatientAdministrationStatus.MedicineSelected:
                    var isSelected = prescriptionsGrouped.Where(grp => grp.IsSelected).ToList();
                    return(new ObservableCollection <PrescriptionGroup>(isSelected));

                case PatientAdministrationStatus.MedicineLoaded:
                    var isLoaded = prescriptionsGrouped.Where(grp => grp.IsLoaded).ToList();
                    return(new ObservableCollection <PrescriptionGroup>(isLoaded));

                case PatientAdministrationStatus.MedicineAdministered:
                    var isAdministered = prescriptionsGrouped.Where(grp => grp.IsAdministered).ToList();
                    return(new ObservableCollection <PrescriptionGroup>(isAdministered));

                default:
                    return(prescriptionsGrouped);
                }
            }
            else
            {
                return(prescriptionsGrouped);
            }
        }
コード例 #5
0
        private async Task <MedicineInventory> AddMedicineViaDataServiceAsync(MedicineInventory newItem)
        {
            try
            {
                ImsDataService imsSvc = new ImsDataService(App.ApiSettings);
                var            result = await imsSvc.AddNewMedicineInventoryAsync(newItem);

                return(result);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #6
0
        private async void OnSubmitButtonClick(object sender, RoutedEventArgs e)
        {
            if (await ValidateEntriesAsync(tbx_ipAdd.Text.Trim(), tbx_devName.Text.Trim()))
            {
                IPAddress ipa;
                IPAddress.TryParse(tbx_ipAdd.Text.Trim(), out ipa);

                var imsSvc = new ImsDataService(App.ApiSettings);
                MobileMedAdminSystem system = await imsSvc.RegisterMmasDeviceAsync(tbx_devName.Text, ipa);

                var serializedData = JsonConvert.SerializeObject(system);
                SettingsHelper.SetLocalSetting("ims_pairedDevice", serializedData);

                Frame.Navigate(typeof(PatientsPage), system);
            }
        }
コード例 #7
0
 public void Activate(object parameter)
 {
     //LoadSampleData();
     imsSvc = new ImsDataService(ApiSettings);
     GetMedicinesAsync();
 }