Example #1
0
        //Currently not in use due to inability to data share with dashboard.
        public async Task OpenAddView()
        {
            PatientModel selectedPatient = new PatientModel
            {
                ID        = PatientDetailBox.First().ID,
                FirstName = PatientDetailBox.First().FirstName,
                LastName  = PatientDetailBox.First().LastName
            };


            await _events.PublishOnUIThreadAsync(new OpenAddPrescriptionEvent());
        }
Example #2
0
        /*  public bool _editModeActive = false;
         * public bool EditModeActive
         * {
         *    get
         *    {
         *        return _editModeActive;
         *
         *     }
         *    set
         *    {
         *        EditModeActive = value;
         *        NotifyOfPropertyChange(() => EditModeActive);
         *    }
         *
         * } */

        /*  public void EditPatient()
         * {
         *    EditModeActive = true;
         *
         *    NotifyOfPropertyChange(() => PatientDetailBox);
         * }*/

        /*   public void CancelEditPatient()
         * {
         *     EditModeActive = false;
         *
         *     NotifyOfPropertyChange(() => PatientDetailBox);
         *
         * }*/

        public async Task EditPatientDetails()
        {
            var formattedPhoneNumber = FormatPhoneNumberHelper.FormatPhoneNumber(PatientDetailBox.First().PhoneNumber);
            var patient = new PatientModel
            {
                ID          = PatientDetailBox.First().ID,
                FirstName   = PatientDetailBox.First().FirstName,
                LastName    = PatientDetailBox.First().LastName,
                Email       = PatientDetailBox.First().Email,
                PhoneNumber = formattedPhoneNumber
            };

            await _patientEndpoint.EditPatient(patient);

            await LoadPatients();
        }
Example #3
0
        public async Task ViewDetails(int patientId = 0)
        {
            PatientModel patientDetails;

            if (patientId != 0)
            {
                patientDetails = await _patientEndpoint.GetPatientDetails(patientId);
            }
            else
            {
                patientDetails = await _patientEndpoint.GetPatientDetails(SelectedPatient.Id);
            }

            PatientDetailBox.Clear();
            PrescriptionDetailBox.Clear();



            PatientModel patient = new PatientModel
            {
                ID            = patientDetails.ID,
                FirstName     = patientDetails.FirstName,
                LastName      = patientDetails.LastName,
                DOB           = patientDetails.DOB,
                Email         = patientDetails.Email,
                PhoneNumber   = patientDetails.PhoneNumber,
                Prescriptions = patientDetails.Prescriptions
            };

            foreach (var item in patient.Prescriptions)
            {
                PrescriptionDetailBox.Add(item);
            }
            PatientDetailBox.Add(patient);
            selectedPatient = patient;

            ResetPrescription();
        }
Example #4
0
        public async Task AddPrescription()
        {
            //ErrorMessage = "";

            if (PrescriptionId != 0 && DrugName != SelectedPrescription.DrugName)
            {
                dynamic settings = new ExpandoObject();
                settings.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                settings.ResizeMode            = ResizeMode.NoResize;
                settings.Title = "System Error";

                _status.UpdateMessage("Unauthorized", "Changing medication name is not allowed. Please create a new prescription");
                await _window.ShowDialog(_status, null, settings);

                DrugName = selectedPrescription.DrugName;
            }
            else
            {
                var prescription = new PrescriptionModel
                {
                    ID           = PrescriptionId,
                    PatientID    = PatientDetailBox.First().ID,
                    DrugName     = DrugName,
                    Dosage       = Dosage,
                    PrescriberId = PrescriberId,
                    RenewalDate  = RenewalDate
                };


                await _prescriptionEndpoint.AddPrescription(prescription);

                ResetPrescription();

                await ViewDetails(prescription.PatientID);
            }
        }