internal static patient SelectPatientFromPatientId(int patientToEditId) { stromohabDevEntities db = new stromohabDevEntities(); return((from p in db.patients where p.idPatient == patientToEditId select p).FirstOrDefault()); }
internal static IQueryable SessionDatasetForCliniciansPatient(int patientId, string userName) { stromohabDevEntities db = new stromohabDevEntities(); var patientSessions = from p in db.sessions where p.Patients_idPatient == patientId && p.Patients_Clinicians_cUserName == userName select p; return(patientSessions); }
internal static IQueryable SessionDatasetForCliniciansPatient(int patientId, string userName) { stromohabDevEntities db = new stromohabDevEntities(); var patientSessions = from p in db.sessions where p.Patients_idPatient == patientId && p.Patients_Clinicians_cUserName == userName select p; return patientSessions; }
internal static void DeletePatientByID(int patientId) { stromohabDevEntities db = new stromohabDevEntities(); var patientToEdit = (from p in db.patients where p.idPatient == patientId select p).FirstOrDefault(); db.DeleteObject(patientToEdit); db.SaveChanges(); }
internal static void AddTask(string taskName, byte[] taskData) { stromohabDevEntities db = new stromohabDevEntities(); task taskToAdd = new task(); taskToAdd.tName = taskName; taskToAdd.tData = taskData; db.tasks.AddObject(taskToAdd); db.SaveChanges(); }
public static bool AuthenticateUser(string userName, string password) { Contract.Requires(password != null); Contract.Requires(userName != null); string hashedPassword = Md5Hash(password); stromohabDevEntities db = new stromohabDevEntities(); var authenticatedClinicians = from p in db.clinicians where p.cUserName == userName && p.cPassword == hashedPassword select p.cUserName; return(authenticatedClinicians.Count() == 1); }
public static bool AuthenticateUser(string userName, string password) { Contract.Requires(password!=null); Contract.Requires(userName!=null); string hashedPassword = Md5Hash(password); stromohabDevEntities db = new stromohabDevEntities(); var authenticatedClinicians = from p in db.clinicians where p.cUserName == userName && p.cPassword == hashedPassword select p.cUserName; return authenticatedClinicians.Count() == 1; }
internal static void AddPatient(string firstNames, string lastName, DateTime dateOfBirth, string gender, string contactNumber, string clinicianUserName) { stromohabDevEntities db = new stromohabDevEntities(); clinician patientsClinician = db.clinicians.Single(c => c.cUserName == clinicianUserName); patientsClinician.patients.Add(new patient { pFirstName = firstNames, pLastName = lastName, pDateOfBirth = dateOfBirth, pGender = gender, pContactNumber = contactNumber, Clinicians_cUserName = clinicianUserName }); db.SaveChanges(); }
internal static void UpdatePatient(patient patientToUpdate) { stromohabDevEntities db = new stromohabDevEntities(); var dbPatientInfo = db.patients .Where(w => w.idPatient == patientToUpdate.idPatient) .SingleOrDefault(); if (dbPatientInfo != null) { dbPatientInfo.idPatient = patientToUpdate.idPatient; dbPatientInfo.pContactNumber = patientToUpdate.pContactNumber; dbPatientInfo.pDateOfBirth = patientToUpdate.pDateOfBirth; dbPatientInfo.pFirstName = patientToUpdate.pFirstName; dbPatientInfo.pGender = patientToUpdate.pGender; dbPatientInfo.pLastName = patientToUpdate.pLastName; db.SaveChanges(); } }
internal static IQueryable PatientDataSetForClinician(string userName) { stromohabDevEntities db = new stromohabDevEntities(); var clinicansPatients = from p in db.patients where p.Clinicians_cUserName == userName select new { p.idPatient, p.pFirstName, p.pLastName, p.pDateOfBirth, p.pGender, p.pContactNumber }; return clinicansPatients; }
internal static IQueryable PatientDataSetForClinician(string userName) { stromohabDevEntities db = new stromohabDevEntities(); var clinicansPatients = from p in db.patients where p.Clinicians_cUserName == userName select new { p.idPatient, p.pFirstName, p.pLastName, p.pDateOfBirth, p.pGender, p.pContactNumber }; return(clinicansPatients); }
internal static patient SelectPatientFromPatientId(int patientToEditId) { stromohabDevEntities db = new stromohabDevEntities(); return ((from p in db.patients where p.idPatient == patientToEditId select p).FirstOrDefault()); }