Ejemplo n.º 1
0
 public CustomMessage(MessagesTable m)
 {
     if (UtilitiesClass.getPatient(m.MessageTO) != null)
     {
         PatientsTable messageTo   = UtilitiesClass.getPatient(m.MessageTO);
         DoctorsTable  messageFrom = UtilitiesClass.getDoctor(m.MessageFROM);
         this.From = $"{messageFrom.FirstName.Trim()} {messageFrom.LastName.Trim()}";
         this.To   = $"{messageTo.FirstName.Trim()} {messageTo.LastName.Trim()}";
     }
     else
     {
         DoctorsTable  messageTo   = UtilitiesClass.getDoctor(m.MessageTO);
         PatientsTable messageFrom = UtilitiesClass.getPatient(m.MessageFROM);
         this.From = $"{messageFrom.FirstName.Trim()} {messageFrom.LastName.Trim()}";
         this.To   = $"{messageTo.FirstName.Trim()} {messageTo.LastName.Trim()}";
     }
     this.Date           = m.Date;
     this.MessagePreview = Regex.Replace(m.Message.Remove(40), @"\s+", " ");
     //CHECK
     if (m.Message.Length > 40)
     {
         this.MessagePreview += "...";
     }
     this.Read      = Convert.ToInt32(m.IsRead) == 0 ? "Unread" : "";
     this.MessageID = m.MessageID;
 }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // If Patient, do this
            if (Convert.ToInt32(Session["IsDoctor"]) == 0)
            {
                // Doctor's appointments not visible to patient
                ShowDoctorAppointments.Visible = false;
                // Create Patient Object
                myPatient = UtilitiesClass.getPatient(Session["LoginName"].ToString());
                Session["AppointmentPatientID"] = myPatient.PatientID;

                // Create a Doctor object that is paired to the patient
                myDoctor = UtilitiesClass.getPatientsDoctor(myPatient);

                // Adds users appointments to appointments list
                allAppointments = dbcon.AppointmentsTables.ToList();
                foreach (AppointmentsTable appointment in allAppointments)
                {
                    if (appointment.PatientID == myPatient.PatientID)
                    {
                        userAppointments.Add(appointment);
                    }
                }

                // If no appointments are set up, display message
                if (userAppointments.Count == 0)
                {
                    DisplayNoAppointMessage.Text       = "You have no appointments set up yet.";
                    DeletePatientAppointButton.Visible = false;
                }
                else // display patients appointments
                {
                    DisplayNoAppointMessage.Visible    = false;
                    DeletePatientAppointButton.Visible = true;
                }
            }
            else // if Doctor, do this
            {
                AddAppointmentHyperLink.Visible = false;
                ShowDoctorAppointments.Visible  = true;
                ShowPatientAppointments.Visible = false;

                DoctorsTable myDoctor = UtilitiesClass.getDoctor(Session["LoginName"].ToString());

                Session["AppointmentDoctorID"] = myDoctor.DoctorID;

                allAppointments = dbcon.AppointmentsTables.ToList();
                foreach (AppointmentsTable appointment in allAppointments)
                {
                    if (appointment.DoctorID == myDoctor.DoctorID)
                    {
                        userAppointments.Add(appointment);
                    }
                }

                if (userAppointments.Count == 0)
                {
                    DisplayNoAppointMessage.Text      = "You have no appointments set up yet.";
                    DeleteDoctorAppointButton.Visible = false;
                }
                else
                {
                    DisplayNoAppointMessage.Visible   = false;
                    DeleteDoctorAppointButton.Visible = true;
                }
            }
        }