Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //

            //

            if (!IsPostBack)
            {
                ListItem emptyItem = new ListItem("----Select----", "");
                DoctorList.DataSource = _doctorRepository.GetDoctors();
                DoctorList.DataBind();
                DoctorList.DataTextField  = "DoctorName";
                DoctorList.DataValueField = "DoctorName";
                DoctorList.DataBind();
                DoctorList.Items.Insert(0, emptyItem);

                HospitalList.DataSource = _hospitalRepository.GetHospitals();
                HospitalList.DataBind();
                HospitalList.DataTextField  = "HospitalName";
                HospitalList.DataValueField = "HospitalName";
                HospitalList.DataBind();
                HospitalList.Items.Insert(0, emptyItem);

                SpecialityList.DataSource = _specialityRepository.GetSpecialities();
                SpecialityList.DataBind();
                SpecialityList.DataTextField  = "Speciality";
                SpecialityList.DataValueField = "Speciality";
                SpecialityList.DataBind();
                SpecialityList.Items.Insert(0, emptyItem);

                IDictionary <string, bool?> isActive = new Dictionary <string, bool?>();
                isActive.Add("----Select----", null);
                isActive.Add("Active", true);
                isActive.Add("Not Active", false);

                IsActiveList.DataSource = isActive.ToList();
                IsActiveList.DataBind();
                IsActiveList.DataTextField  = "key";
                IsActiveList.DataValueField = "value";
                IsActiveList.DataBind();

                GenerateReport();
            }
        }
 public List <SpecialtyModel> GetSpecialities()
 {
     return(_specialityRepository.GetSpecialities());
 }
 public void GetSpecialitiesTest()
 {
     var result = _specialityRepository.GetSpecialities();
 }
 public IActionResult Index()
 {
     return(View(_specialityRepository.GetSpecialities()));
 }
Ejemplo n.º 5
0
        public ActionResult Index(string sortOrder, DoctorFilter filter = null, string query = null)
        {
            IEnumerable <Doctor> doctors = doctors = _doctorRepository.GetAllDoctors();

            ViewBag.NameSortParm   = sortOrder == "Name" ? "name_desc" : "Name";
            ViewBag.DegreeSortParm = sortOrder == "Degree" ? "degree_desc" : "Degree";
            ViewBag.IdSortParm     = sortOrder == "Id" ? "id_desc" : "Id";


            if (!String.IsNullOrWhiteSpace(query))
            {
                doctors = doctors.Where(g => g.FullName.Contains(query));
            }

            if (filter.Speciality.HasValue)
            {
                doctors = _doctorRepository.FilterDoctorsBySpeciality(filter.Speciality);
            }

            if (filter.Degree != null)
            {
                doctors = doctors.Where(d => d.Degree == filter.Degree);
            }
            switch (sortOrder)
            {
            case "name_desc":
                doctors = doctors.OrderByDescending(d => d.FullName);
                break;

            case "Name":
                doctors = doctors.OrderBy(d => d.FullName);
                break;

            case "degree_desc":
                doctors = doctors.OrderByDescending(d => d.Degree);
                break;

            case "Degree":
                doctors = doctors.OrderBy(d => d.Degree);;
                break;

            case "id_desc":
                doctors = doctors.OrderByDescending(d => d.DoctorId);
                break;

            case "Id":
                doctors = doctors.OrderBy(d => d.DoctorId);
                break;

            default:
                break;
            }

            var viewModel = new DoctorListViewModel
            {
                Doctors      = doctors,
                Specialities = _specialityRepository.GetSpecialities(),
                Degree       = _doctorRepository.SelectDegrees(),
                SearchTerm   = query
            };

            return(View(viewModel));
        }