Exemplo n.º 1
0
        internal static patient SelectPatientFromPatientId(int patientToEditId)
        {
            stromohabDevEntities db = new stromohabDevEntities();

            return((from p in db.patients
                    where p.idPatient == patientToEditId
                    select p).FirstOrDefault());
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        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();    

         }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
        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;
        }
Exemplo n.º 10
0
        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();
        }
Exemplo n.º 11
0
        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();
        }
Exemplo n.º 12
0
        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();
            }
        }
Exemplo n.º 13
0
        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;
        }
Exemplo n.º 14
0
        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);
        }
Exemplo n.º 15
0
        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();
            }
        }
Exemplo n.º 16
0
        internal static patient SelectPatientFromPatientId(int patientToEditId)
        {
            stromohabDevEntities db = new stromohabDevEntities();

            return ((from p in db.patients
                     where p.idPatient == patientToEditId
                     select p).FirstOrDefault());
        }