// Displays the patients details
        private void Patient_Clicked(object sender, System.EventArgs e)
        {
            Task.Run(async() =>
            {
                // Get selected person id
                Patient selectedItem = this.patientList.SelectedItem as Patient;
                int pPatientID       = selectedItem.PatientID;
                int wardID           = selectedItem.WardID;
                try
                {
                    // run the query
                    MediClipClient client = new MediClipClient();
                    Patient result        = await client.PatientByID(wardID, pPatientID);

                    Device.BeginInvokeOnMainThread(() =>
                    {
                        Navigation.PushAsync(new PatientPage(result));
                    });
                }
                catch
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert("Error", "Error retreiving patient list", "Okay");
                    });
                }
            });
        }
Example #2
0
        //Event Handler when note button is clicked to see patients notes.
        private void Notes_Clicked(object sender, System.EventArgs e)
        {
            ObservableCollection <Note> patientNotes = new ObservableCollection <Note>();

            Task.Run(async() =>
            {
                try
                {
                    // run the query
                    MediClipClient client = new MediClipClient();
                    List <Note> result    = await client.PatientByID(patientID);

                    Device.BeginInvokeOnMainThread(() =>
                    {
                        foreach (Note notes in result)
                        {
                            patientNotes.Add(notes);
                        }
                        Navigation.PushAsync(new NoteListPage(patientNotes, patientID));
                    });
                }
                catch
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert("Error", "Error retreiving patient list", "Okay");
                    });
                }
            });
        }
Example #3
0
        private void Ward_Clicked(object sender, System.EventArgs e)
        {
            ObservableCollection <Patient> patientList = new ObservableCollection <Patient>();

            Task.Run(async() =>
            {
                // Get selected ward id
                Ward selectedItem = this.wardList.SelectedItem as Ward;
                int wWardID       = selectedItem.WardID;
                try
                {
                    // run the query
                    MediClipClient client = new MediClipClient();
                    List <Patient> result = await client.ListPatient(wWardID);

                    Device.BeginInvokeOnMainThread(() =>
                    {
                        // create patientlist page
                        foreach (Patient patient in result)
                        {
                            patientList.Add(patient);
                        }
                        Navigation.PushAsync(new PatientListPage(patientList));
                    });
                }
                catch // If the query fails display an error message
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert("Error", "Error retreiving patient list", "Okay");
                    });
                }
            });
        }
Example #4
0
        //=============================================
        //End reference A1
        //=============================================

        //=============================================
        //End reference A2
        //=============================================



        //Saving all information to the data base
        private void Submit_Clicked(object sender, System.EventArgs e)
        {
            String theText  = this.entryField.Text;
            String theTitle = this.title.Text;
            String theImage = pictureName;
            //Creating a Note to pass to the NotePage once created.
            Note tempNote = new Note();

            tempNote.PatientID = pPatientID;
            tempNote.Text      = theText;
            tempNote.Picture   = pictureName;
            tempNote.Title     = theTitle;

            try
            {
                // run the query
                MediClipClient client = new MediClipClient();
                //bool result =
                client.PostNote(pPatientID, theTitle, theText, theImage);

                Device.BeginInvokeOnMainThread(() =>
                {
                    Navigation.PushAsync(new NotePage(tempNote));
                });
            }
            catch
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    DisplayAlert("Error", "Error uploading patient note", "Okay");
                });
            }
        }
Example #5
0
        //Event Handler when a note from the list is clicked to view selected note
        private void Note_Clicked(object sender, System.EventArgs e)
        {
            Task.Run(async() =>
            {
                // Get selected person id and note Id to get a Note
                Note selectedItem = this.listOfNotes.SelectedItem as Note;
                int pPatientID    = selectedItem.PatientID;
                int noteID        = selectedItem.NoteID;
                try
                {
                    // run the query
                    MediClipClient client = new MediClipClient();
                    Note result           = await client.GetNote(noteID, pPatientID);

                    Device.BeginInvokeOnMainThread(() =>
                    {
                        Navigation.PushAsync(new NotePage(result));
                    });
                }
                catch
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert("Error", "Error retreiving patient note", "Okay");
                    });
                }
            });
        }
Example #6
0
        public WardViewModel()
        {
            // The ObservableCollection that contains the wards returned by the client
            wards = new ObservableCollection <Ward>();

            // Runs the task in the background (as it may take a long time)
            Task.Run(async() =>
            {
                // Create a new client
                MediClipClient client = new MediClipClient();

                // Create a list of all the wards returned by the client
                List <Ward> result = await client.ListWard();

                // Add all the wards to the wards ObservableCollection
                foreach (Ward wWard in result)
                {
                    wards.Add(wWard);
                }
            });
        }
Example #7
0
        //Event Handler to handle Login submission
        private void LogIn_Clicked(object sender, System.EventArgs e)
        {
            Task.Run(async() =>
            {
                // convert entered text to strings
                String sNurseUserName = this.UserName.Text;
                String sNursePassword = this.Password.Text;
                try
                {
                    // Find the nurse by username
                    MediClipClient client = new MediClipClient();
                    Nurse currentNurse    = await client.GetNurse(sNurseUserName);

                    //If password is correct send to homescreen else display login failed message
                    if (sNursePassword.Equals(currentNurse.Password))
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            Navigation.PushAsync(new HomePage());
                        });
                    }
                    else
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            DisplayAlert("Login Failed", "Username or Password is incorrect", "Okay");
                        });
                    }
                }
                catch
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        DisplayAlert("Error", "Error retrieving login details", "Okay");
                    });
                }
            });
        }