Пример #1
0
        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));
        }
Пример #2
0
        public ActionResult SearchVisit()
        {
            Service serv = new Service();

            ViewBag.DoctorNames = serv.GetDoctors();

            var visits = new VisitFilter();

            return(PartialView(visits));
        }
Пример #3
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);
        }