/**
         * saves an appointment note.
         */
        public static void saveAppointmentNote(AppointmentNote note) //similar to all other save functions above
        {
            string       notePath = $"{patientPath}\\{note.appointment.getPatient().getId()}\\Appointments\\{note.appointment.getId()}\\Notes";
            StreamWriter noteFile;

            try
            {
                if (!Directory.Exists(notePath))
                {
                    Directory.CreateDirectory(notePath);
                }

                noteFile = new StreamWriter($"{notePath}\\{GeneralFunctions.generateId(notePath, "Note")}.txt");

                noteFile.WriteLine(note.author.getUsername()); //first line is username
                noteFile.WriteLine(note.date);                 //Second the date.
                noteFile.WriteLine(note.time);                 //third the time.
                noteFile.Write(note.content);                  //and finally, the content.
                noteFile.Close();
            }
            catch (Exception e)
            {
                GeneralFunctions.errorHandler(e);
            }
        }
        public async Task <HttpResponseMessage> AddNote(AppointmentNote appointmentNote)
        {
            var messageData = CreateMessageData($"Booking");

            var result = await _appointmentService.AddNote(appointmentNote);

            if (!result.IsSuccess)
            {
                return(CreateValidationErrorResponse(messageData, new ValidationResult(Validation.ServerError)));
            }
            return(CreateOkResponse(messageData, result.message));
        }
        /**
         * Allows a user to add a note to an appointment.
         */
        private void addNote(Appointment appointment)
        {
            AppointmentNote note;
            string          content = "";

            try
            {
                content = GeneralFunctions.getRequiredInput("Note: ");
                note    = new AppointmentNote(DateTime.Now, appointment, this, content);
                appointment.getNotes().Add(note); //addnote to appointment
                DataIO.saveAppointmentNote(note); //saves the files//saves the files
            }
            catch (Exception e)
            {
                GeneralFunctions.errorHandler(e);
            }
        }
Exemplo n.º 4
0
 public void AddNote(AppointmentNote appointmentNote)
 {
     notes.Add(appointmentNote);
 }