Пример #1
0
 public User GetUsersByID(int userID)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var objUser = session.Query <User>().Where(x => x.UserID == userID).FirstOrDefault();
             return(objUser);
         }
     }
 }
 public List <PatientMedicine> GetMedicinesByUserID(int userID)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var results = session.Query <PatientMedicine>().Where(x => x.UserID == userID).ToList();
             return(results);
         }
     }
 }
 public PatientMedicine GetMedicinesByAppointmnetID(int appointmentID)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var results = session.Query <PatientMedicine>().Where(x => x.AppointmentID == appointmentID).FirstOrDefault();
             return(results);
         }
     }
 }
 public PatientMedicine GetMedicineByID(int patientMedicineID)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var objMedicine = session.Query <PatientMedicine>().Where(x => x.PatientMedicineID == patientMedicineID).FirstOrDefault();
             return(objMedicine);
         }
     }
 }
Пример #5
0
 public User ValidateUser(string userName, string password)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var objUser = session.Query <User>().Where(x => x.UserName == userName && x.Password == password).FirstOrDefault();
             return(objUser);
         }
     }
 }
Пример #6
0
 public Roles GetRolesByID(int roleID)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var objRole = session.Query <Roles>().Where(x => x.RoleID == roleID).FirstOrDefault();
             return(objRole);
         }
     }
 }
Пример #7
0
 public List <Appointment> GetAppointmentsByDoctorID(int doctorID, DateTime date)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var objAppointment = session.Query <Appointment>().Where(x => x.DoctorID == doctorID && x.AppDate == date).ToList();
             return(objAppointment);
         }
     }
 }
Пример #8
0
 public List <Appointment> GetAppointmentByUserID(int userID)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var objAppointment = session.Query <Appointment>().Where(x => x.UserID == userID).ToList();
             return(objAppointment);
         }
     }
 }
Пример #9
0
 public List <DoctorCalendar> GetDoctorCalendar(int doctorID, DateTime date, int hospitalID)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var results = session.Query <DoctorCalendar>().Where(x => x.DoctorID == doctorID && x.Date == date && x.HospitalID == hospitalID).ToList();
             return(results);
         }
     }
 }
Пример #10
0
 public Appointment GetAppointmentByID(int appointmentID)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var objAppointment = session.Query <Appointment>().Where(x => x.AppointmentID == appointmentID).FirstOrDefault();
             return(objAppointment);
         }
     }
 }
Пример #11
0
 public IEnumerable <T> GetAll()
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var results = session.QueryOver <T>().List();
             return(results);
         }
     }
 }
Пример #12
0
 public DoctorCalendar GetDoctorCalendarByID(int doctorCalendarID)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var objDoctorCalendar = session.Query <DoctorCalendar>().Where(x => x.DoctorCalendarID == doctorCalendarID).FirstOrDefault();
             return(objDoctorCalendar);
         }
     }
 }
Пример #13
0
 public LoginHistory GetLoginHistoryByID(int loginHistoryID)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         using (var session = sessionWrapper.Session)
         {
             var objloginHistory = session.Query <LoginHistory>().Where(x => x.LoginHistoryID == loginHistoryID).FirstOrDefault();
             return(objloginHistory);
         }
     }
 }
Пример #14
0
 public void Delete(T obj)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         sessionWrapper.BeginTransaction();
         using (var session = sessionWrapper.Session)
         {
             session.Delete(obj);
             sessionWrapper.Commit();
         }
     }
 }
Пример #15
0
        public List <Doctor> GetDoctorsBySpecialization(string specialist)
        {
            using (SessionWrapper sessionWrapper = new SessionWrapper())
            {
                using (var session = sessionWrapper.Session)
                {
                    var query = session.Query <Doctor>().Where(x => x.Specialist.Contains(specialist)).ToList();

                    return(query);
                }
            }
        }
Пример #16
0
        public List <Doctor> GetDoctorsByHospitalID(int hospitalID)
        {
            using (SessionWrapper sessionWrapper = new SessionWrapper())
            {
                using (var session = sessionWrapper.Session)
                {
                    var query = "select d.* from doctor d join DoctorCalendar dc on dc.DoctorID = d.DoctorID  inner join Hospital h on h.HospitalID = dc.HospitalID where h.HospitalID =" + hospitalID;

                    var results = session.CreateSQLQuery(query).AddEntity(typeof(Doctor)).List <Doctor>().ToList();
                    return(results);
                }
            }
        }
Пример #17
0
 public T SaveorUpdate(T obj)
 {
     using (SessionWrapper sessionWrapper = new SessionWrapper())
     {
         sessionWrapper.BeginTransaction();
         using (var session = sessionWrapper.Session)
         {
             session.SaveOrUpdate(obj);
             sessionWrapper.Commit();
         }
     }
     return(obj);
 }
Пример #18
0
        public User GetUsersByDoctorID(int doctorID)
        {
            using (SessionWrapper sessionWrapper = new SessionWrapper())
            {
                using (var session = sessionWrapper.Session)
                {
                    var query = "select u.* from UserTable u join Doctor d on u.UserID = d.UserID where d.DoctorID =" + doctorID;

                    var results = session.CreateSQLQuery(query).AddEntity(typeof(User)).List <User>().FirstOrDefault();
                    return(results);
                }
            }
        }
Пример #19
0
        public List <DoctorAppointment> GetAppointments(int doctorID, DateTime date)
        {
            using (SessionWrapper sessionWrapper = new SessionWrapper())
            {
                using (var session = sessionWrapper.Session)
                {
                    var query = "select d.DoctorID,a.UserID,a.AppointmentID,(u.FirstName + ' ' + u.LastName ) as UserName, a.StartTime,a.EndTime,h.Name,dc.Date from Doctor d" +
                                "join Appointment a on d.DoctorID = a.DoctorID" +
                                "join DoctorCalendar dc on dc.DoctorID = a.DoctorID" +
                                "join Hospital h on h.HospitalID = dc.HospitalID" +
                                "join UserTable u on u.UserID = a.UserID" +
                                "where AppointmnetDate =" + date + "and d.doctorId =" + doctorID;

                    var results = session.CreateSQLQuery(query).AddEntity(typeof(DoctorAppointment)).List <DoctorAppointment>().ToList();
                    return(results);
                }
            }
        }