void Create_Edit_Session_Control_TaskSelect(Task task)
 {
     if (create_Edit_Session_Control.ShowDetailedTaskPreview)
     {
         ShowScheduledSessionControlButtons();
         create_Edit_Session_Control.Visible = false;
         session_Details_Control.Visible     = true;
         _patient.Sessions[_selectedSessionIndex].Clinician = CurrentClinician.NameString;
         _patient.Sessions[_selectedSessionIndex].Task      = task;
         _remote_DataManager.ClientUpdatePatient(_patient, _selectedPatientIndex);
         FillInFields();
         session_Details_Control.Session = _patient.Sessions[_selectedSessionIndex];
         for (int i = 0; i < listViewSessions.Items.Count; i++)
         {
             if (Int32.Parse(listViewSessions.Items[i].SubItems[listViewSessions.Columns.Count].Text) == _selectedSessionIndex)
             {
                 listViewSessions.Items[i].Selected = true;
             }
         }
         ShowScheduledSessionControlButtons();
         session_Details_Control.ReadOnlyNotes = false;
     }
     else
     {
         create_Edit_Session_Control.ShowDetailedTaskPreview = true;
     }
 }
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (CurrentClinician.EditPatients)
            {
                Create_Edit_Patient_Form form = new Create_Edit_Patient_Form();
                _selectedPatientIndex = GetSelectedPatientID();
                form.Patient          = _Remote_Data_Manager.PatientList[_selectedPatientIndex];
                if (form.ShowDialog() == DialogResult.OK)
                {
                    Patient updatedPatient = form.Patient;
                    _Remote_Data_Manager.ClientUpdatePatient(updatedPatient, _selectedPatientIndex);
                    _Remote_Data_Manager.ClientRequestUpdatedPatientList();

                    LoadInPatientData();
                }
                form.Dispose();
            }
            else
            {
                MessageBox.Show(StroMoHab_Client.Properties.Settings.Default.InvalidPermissionsString, "StroMoHab Client", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }