public ActionResult GetVisitsByFilter(DataTablesRequest dataTablesRequest, VisitFilter visitFilter)
        {
            Service serv = new Service();
            int totalRecordsNumber;
            var visitList = serv.GetVisitsByFilter(dataTablesRequest, visitFilter, out totalRecordsNumber);

            return new DataTablesResult(dataTablesRequest.sEcho, totalRecordsNumber, totalRecordsNumber, visitList);
        }
        public ActionResult GetPatientListByFilter(DataTablesRequest dataTablesRequest, PatientFilter patient)
        {
            Service serv = new Service();
            int totalRecordsNumber;
            var model = serv.FindPatiets(dataTablesRequest, patient, out totalRecordsNumber);

            return new DataTablesResult(dataTablesRequest.sEcho, totalRecordsNumber, totalRecordsNumber, model);
        }
示例#3
0
        public IEnumerable<PatientTableView> FindPatiets(DataTablesRequest dataTablesRequest, PatientFilter patient, out int totalRecordsNumber)
        {
            IQueryable<Patient> query = db.Patients.AsQueryable<Patient>();
            if (!String.IsNullOrEmpty(patient.FirstName))
            {
                query = query.Where(x => x.FirstName.Contains(patient.FirstName));
            }
            if (!String.IsNullOrEmpty(patient.LastName))
            {
                query = query.Where(x => x.LastName.Contains(patient.LastName));
            }
            if (patient.Pesel.HasValue)
            {
                query = query.Where(x => x.Pesel == patient.Pesel);
            }

            totalRecordsNumber = query.Count();

            query = query.OrderBy(x => x.Id).Skip(dataTablesRequest.iDisplayStart).Take(dataTablesRequest.iDisplayLength);

            var patientDBList = query.ToList<Patient>();
            var patientTableList = new List<PatientTableView>();
            foreach (var pat in patientDBList)
            {
                PatientTableView p = new PatientTableView()
                {
                    City = pat.City.CityName,
                    FirstName = pat.FirstName,
                    Id = pat.Id,
                    LastName = pat.LastName,
                    Pesel = pat.Pesel.ToString()
                };
                patientTableList.Add(p);
            }

            return patientTableList;
        }
示例#4
0
        public IEnumerable<VisitViewModel> GetVisitsByFilter(DataTablesRequest dataTablesRequest, VisitFilter visitFilter, out int totalRecordsNumber)
        {
            IQueryable<Visite> query = db.Visites.AsQueryable<Visite>();
            if (!String.IsNullOrEmpty(visitFilter.VisitDate))
            {
                DateTime date = DateTime.Parse(visitFilter.VisitDate);
                query = query.Where(x => x.VisiteDate.Year == date.Year).Where(x => x.VisiteDate.Month == date.Month).Where(x => x.VisiteDate.Day == date.Day);

            }
            if (visitFilter.DoctorName!="-1")
            {
                query = query.Where(x => (x.Doctor.FirstName+" "+x.Doctor.LastName == visitFilter.DoctorName));
            }
            totalRecordsNumber = query.Count();

            query = query.OrderBy(x => x.DoctorId).Skip(dataTablesRequest.iDisplayStart).Take(dataTablesRequest.iDisplayLength);

            var visistTableList = query.ToList<Visite>().Select(v => new VisitViewModel()
            {
                Description = v.Description,
                City = v.Patient.City.CityName,
                DoctorName = v.Doctor.FirstName + " " + v.Doctor.LastName,
                DoctorSpecialization = v.Doctor.MedicalSpecialization.Specialization,
                PatientName = v.Patient.FirstName + " " + v.Patient.LastName,
                VisitDate = v.VisiteDate.ToString()
            });
            return visistTableList;
        }
 public DataTablesResult(DataTablesRequest dataTable)
     : this(dataTable.sEcho, 0, 0, null)
 {
 }
 public DataTablesResult(DataTablesRequest dataTable, int iTotalRecords, int iTotalDisplayRecords, IEnumerable<object> aaData)
     : this(dataTable.sEcho, iTotalRecords, iTotalDisplayRecords, aaData)
 {
 }
示例#7
0
 public DataTablesResult(DataTablesRequest dataTable)
     : this(dataTable.sEcho, 0, 0, null)
 {
 }
示例#8
0
 public DataTablesResult(DataTablesRequest dataTable, int iTotalRecords, int iTotalDisplayRecords, IEnumerable <object> aaData)
     : this(dataTable.sEcho, iTotalRecords, iTotalDisplayRecords, aaData)
 {
 }