protected void Page_Load(object sender, EventArgs e) { string ourUser = User.Identity.Name; myDbcon1.PatientsTables.Load(); myDbcon2.DoctorsTables.Load(); PatientsTable myPatient = (from x in myDbcon1.PatientsTables.Local where x.UserLoginName.Trim().Equals(ourUser) select x).First(); int patID = myPatient.PatientsID; int docID = myPatient.DoctorID; DoctorsTable myDoctor = (from x in myDbcon2.DoctorsTables.Local where x.DoctorID == docID select x).First(); Label1.Text = "Name: " + myPatient.FirstName + " " + myPatient.LastName; Label2.Text = "Doctor: " + myDoctor.FirstName + " " + myDoctor.LastName; myDbcon3.TestTables.Load(); TestTable test = (from x in myDbcon3.TestTables.Local where x.PatientID == patID select x).First(); ListBox1.Items.Add(test.TestDate + " " + test.TestResults); }
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; }
public static void Initialize() { Appointments = new AppointmentsTable(); Doctors = new DoctorsTable(); Patients = new PatientsTable(); AppointmentsConflicts = new AppointmentConflictsTable(); AppointmentsOpLog = new AppointmentsOpLogTable(); Patients.Add(new PatientModel() { PatientId = "19860813-XXXX", PatientName = "Henrik Karlsson" }); Patients.Add(new PatientModel() { PatientId = "19750612-XXXX", PatientName = "Erik Henriksson" }); Patients.Add(new PatientModel() { PatientId = "19600519-XXXX", PatientName = "Cecilia Eliasson" }); Doctors.Add(new DoctorModel() { DoctorId = "201012-1425", DoctorName = "Mikael Seström" }); Doctors.Add(new DoctorModel() { DoctorId = "200911-1758", DoctorName = "Carina Axel" }); Doctors.Add(new DoctorModel() { DoctorId = "199005-1875", DoctorName = "Martin Eriksson" }); }
protected void Page_Load(object sender, EventArgs e) { string ourUser = User.Identity.Name; myDbcon1.PatientsTables.Load(); myDbcon2.DoctorsTables.Load(); PatientsTable myPatient = (from x in myDbcon1.PatientsTables.Local where x.UserLoginName.Trim().Equals(ourUser) select x).First(); int patID = myPatient.PatientsID; int docID = myPatient.DoctorID; DoctorsTable myDoctor = (from x in myDbcon2.DoctorsTables.Local where x.DoctorID == docID select x).First(); Label1.Text = "Name: " + myPatient.FirstName + " " + myPatient.LastName; Label2.Text = "Doctor: " + myDoctor.FirstName + " " + myDoctor.LastName; myDbcon3.MessagesTables.Load(); var myMessages = from x in myDbcon3.MessagesTables.Local where x.MessageTO.Trim() == myPatient.UserLoginName.Trim() select x; GridView1.DataSource = myMessages.ToList(); GridView1.DataBind(); }
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; } } }