private static void SendAllReportsInMailForThread(Therapist therapist) { try { MailMessage mail = new MailMessage(); mail.From = new MailAddress(SystemEmail); mail.To.Add(therapist.Email); mail.Subject = therapist.FirstName + " " + therapist.LastName + ": All Patients Reports"; mail.Body = "All patients reports are attached as requested.\nIf the file is not displaying correctly, please open it via Google Docs or Notpad."; string[] patientsFiles = Directory.GetFiles(PinchConstants.PatientsDirectoryPath); foreach (string file in patientsFiles) { Patient patient = QuestFileManager.GetPatientFromFile(file); Attachment attachment = new Attachment(ReportsManager.GetPatientReport(patient), patient.Id + ReportExtention); mail.Attachments.Add(attachment); } SmtpServer.Send(mail); } catch (Exception e) { PrintToLog(e.ToString(), LogType.Error); } }
public void OnSearchClicked() { int id; try { m_statusText.text = ""; if (m_idField.text == string.Empty) { m_statusText.text = "Please enter patient ID"; return; } if (!int.TryParse(m_idField.text, out id)) { m_statusText.text = "Please enter only numbers on ID field"; return; } Patient patient = QuestFileManager.GetPatientFromFile(FilePath); //Patient patient = new Patient() { Id = m_idField.text, FullName = "Bar Attaly", Gender = "Female", Height = "172", Weight = "70" }; if (patient == null) { m_statusText.text = "Patient doesn't exists."; return; } m_mainController.SetCurrentPatient(patient); m_mainController.ShowScreen(ScreensIndex.PatientScreen); ClearScreen(); } catch (Exception e) { PrintToLog(e.ToString(), MainController.LogType.Error); } }
public void OnConfirmClicked() { int id; try { m_statusText.text = string.Empty; if (m_fullNameField.text == string.Empty || m_heightField.text == string.Empty || m_weightField.text == string.Empty) { m_statusText.text = "Please fill all data"; return; } if (!m_fullNameField.text.All(char.IsLetter) && !m_fullNameField.text.Contains(" ")) { m_statusText.text = "Please enter only letters on full name field"; return; } if (!int.TryParse(m_heightField.text, out id)) { m_statusText.text = "Please enter only numbers on height field"; return; } if (!int.TryParse(m_weightField.text, out id)) { m_statusText.text = "Please enter only numbers on weight field"; return; } if (QuestFileManager.GetPatientFromFile(FilePath) == null) { m_statusText.text = "Patient doesn't exists"; return; } Patient patient = GetUserFromGui(); m_mainController.CurrentPatient.FullName = patient.FullName; m_mainController.CurrentPatient.Gender = patient.Gender; m_mainController.CurrentPatient.Height = patient.Height; m_mainController.CurrentPatient.Weight = patient.Weight; m_mainController.CurrentPatient.Hand = patient.Hand; QuestFileManager.UpdatePatientOnFile(m_mainController.CurrentPatient, FilePath); m_mainController.ShowPopup(MessageController.MessageType.Succsess, "Patient details has been updated!", OnPopupAnswerFromConfirm); m_statusText.text = string.Empty; PrintToLog("Patient's details update: " + m_mainController.CurrentPatient.FullName + " " + ", id: " + m_mainController.CurrentPatient.Id + ". Updated by the therapist: " + m_mainController.LoggedInTherapist.FirstName + " " + m_mainController.LoggedInTherapist.LastName + ", id: " + m_mainController.LoggedInTherapist.Username + ".", MainController.LogType.Information); } catch (Exception e) { PrintToLog(e.ToString(), MainController.LogType.Error); } }