/// <summary> /// Deletes a clinician /// </summary> /// <param name="clinician"></param> static void Clinician_Remote_DateManager_DeleteClinicianRequestedByClient(Clinician clinician) { _clinicians = OpenClinciansFile(); // reload clincians int i = 0; foreach (Clinician c in _clinicians) { if (c.LoginName == clinician.LoginName) { _clinicians.RemoveAt(i); SaveClinciansFile(_clinicians); return; } i++; } }
/// <summary> /// Generates the default clinician /// </summary> /// <returns></returns> private static Clinician GenderateDefaultClinician() { Clinician newClinician = new Clinician(); newClinician.LoginName = "admin"; newClinician.FirstName = "Clinician"; newClinician.LastName = "Manager"; newClinician.EditClinicians = true; newClinician.EditPatients = false; newClinician.EditSessions = false; newClinician.EditTasks = false; newClinician.RunSessions = false; newClinician.ScheduleSessions = false; newClinician.CanEditDetails = false; // block changing details newClinician.SetPassword("stromohab"); return newClinician; }
/// <summary> /// Responds to a login request /// </summary> /// <param name="clinician">A valid clicnian or Null if login failed</param> private static void RespondToLoginRequest(Clinician clinician) { _remote_DataManager.ServerRespondToLoginRequest(clinician); }
/// <summary> /// Generates a list view item for the given clinician /// </summary> /// <param name="clinician"></param> /// <param name="index"></param> /// <returns></returns> private ListViewItem GenerateListViewClinicianItem(Clinician clinician, int index) { if (clinician.EditClinicians) { return new ListViewItem(new string[] { clinician.LoginName, clinician.NameString, clinician.EditClinicians.ToString(), clinician.EditPatients.ToString(), clinician.EditSessions.ToString(), clinician.EditTasks.ToString(), clinician.ScheduleSessions.ToString(), clinician.RunSessions.ToString(), index.ToString(), }, listViewGroup_Special); } else { return new ListViewItem(new string[] { clinician.LoginName, clinician.NameString, clinician.EditClinicians.ToString(), clinician.EditPatients.ToString(), clinician.EditSessions.ToString(), clinician.EditTasks.ToString(), clinician.ScheduleSessions.ToString(), clinician.RunSessions.ToString(), index.ToString(), }, listViewGroup_Clinicians); } }
/// <summary> /// Saves a new clinician (will fail if one with the same login already exists) /// </summary> /// <param name="clinician"></param> static void Clinician_Remote_DateManager_NewClinicianSaveRequestedByClient(Clinician clinician) { _clinicians = OpenClinciansFile(); // reload clincians foreach (Clinician c in _clinicians) { if (c.LoginName == clinician.LoginName) // already exists so fail as can't have two { return; } } _clinicians.Add(clinician); SaveClinciansFile(_clinicians); }
void Clinician_Login_Screen_Login() { _clinician = clinican_Login_Screen.CurrentClinician; if (_clinician.EditClinicians) //if they can edit clinicians { if (clinician_Records_Screen == null) { clinician_Records_Screen = new Clinician_Records_Screen(); clinician_Records_Screen.Dock = DockStyle.Fill; this.Controls.Add(clinician_Records_Screen); } clinician_Records_Screen.UpdateClinicians(); clinican_Login_Screen.Visible = false; clinician_Records_Screen.Visible = true; } else { if (patient_Records_Screen == null) { SetStatusLabelValue("Loading Patients From Server..."); patient_Records_Screen = new Patient_Records_Screen(); patient_Records_Screen.Dock = DockStyle.Fill; this.Controls.Add(patient_Records_Screen); } patient_Records_Screen.CurrentClinician = _clinician; clinican_Login_Screen.Visible = false; patient_Records_Screen.Visible = true; if (patient_Screen != null) { patient_Screen.CurrentClinician = _clinician; patient_Screen.Visible = false; } } }
/// <summary> /// Respond to login request by passing the validated clinician or null /// </summary> /// <param name="clinician"></param> public void ServerRespondToLoginRequest(Clinician clinician) { _clinician = clinician; }
/// <summary> /// Saves a new clinician /// </summary> /// <param name="clinician"></param> public void ClientSaveNewClinician(Clinician clinician) { if (NewClinicianSaveRequestedByClient != null) NewClinicianSaveRequestedByClient(clinician); }
/// <summary> /// Deletes a clinician /// </summary> /// <param name="clinician"></param> public void ClientDeleteClinician(Clinician clinician) { if (DeleteClinicianRequestedByClient != null) DeleteClinicianRequestedByClient(clinician); }
/// <summary> /// Updates a clinician /// </summary> /// <param name="clinician"></param> public void ClientUpdateClinician(Clinician clinician) { if (UpdateClinicianRequestedByClient != null) UpdateClinicianRequestedByClient(clinician); }