Example #1
0
        private static void SynchronizeContent()
        {
            Entities db = new Entities();
            var doctors = db.Doctors.Include("Hospital").Include("Specialization");
            foreach (var doctor in doctors)
            {
                DoctorSearchResponseInfo searchResponseItem = new DoctorSearchResponseInfo {
                    Name = doctor.NameEN,
                    Specialization = doctor.Specialization.NameEN,
                    Qualification = doctor.Qualification,
                    ContactNumber = doctor.Hospital.ContactNumber,
                    Hospital = doctor.Hospital.NameEN,
                    Fee = doctor.Fee,
                    Image = !string.IsNullOrEmpty(doctor.ImageExt) ? "~/Images/" + doctor.HospitalID + "/" + doctor.ID + doctor.ImageExt : null
                };

                _allDoctors.Add(searchResponseItem);

                int cityLocationId = doctor.Hospital.CityLocationID;
                if (_doctor_CityLocationIDDictionary.ContainsKey(cityLocationId))
                    _doctor_CityLocationIDDictionary[cityLocationId].Add(searchResponseItem);
                else
                    _doctor_CityLocationIDDictionary.Add(cityLocationId, new List<DoctorSearchResponseInfo> { searchResponseItem });
            }

            _lastUpdated = DateTime.UtcNow;
        }
Example #2
0
        // GET: Doctors
        public ActionResult Index()
        {
            //var doctors = db.Doctors.Include(d => d.Hospital).Include(d => d.Specialization);
            //return View(doctors.ToList());
            int? cityId = 0;
            int? cityLocationId = null;
            int? specialityId = null;
            int? checkSumVal = null;
            double? latitude = null;
            double? longitude = null;
            int? hospitalId = null;

            string strCityID = Request.QueryString["cid"] != null ? Request.QueryString["cid"].ToString() : null;
            string strCityLocationId = Request.QueryString["clid"] != null ? Request.QueryString["cid"].ToString() : null;
            string strSpecialityId = Request.QueryString["sid"] != null ? Request.QueryString["sid"].ToString() : null;
            string strCheckSum = Request.QueryString["cs"] != null ? Request.QueryString["cs"].ToString() : null;
            string strLatitude = Request.QueryString["lt"] != null ? Request.QueryString["lt"].ToString() : null;
            string strLongitude = Request.QueryString["lg"] != null ? Request.QueryString["lg"].ToString() : null;
            string strHospitalId = Request.QueryString["hid"] != null ? Request.QueryString["hid"].ToString() : null;

            if (!string.IsNullOrEmpty(strCityID))
                cityId = int.Parse(strCityID);

            if (!string.IsNullOrEmpty(strCityLocationId))
                cityLocationId = int.Parse(strCityLocationId);

            if (!string.IsNullOrEmpty(strSpecialityId))
                specialityId = int.Parse(strSpecialityId);

            if (!string.IsNullOrEmpty(strCheckSum))
                checkSumVal = int.Parse(strCheckSum);

            if (!string.IsNullOrEmpty(strLatitude))
                latitude = double.Parse(strLatitude);

            if (!string.IsNullOrEmpty(strLongitude))
                longitude = double.Parse(strLongitude);

            if (!string.IsNullOrEmpty(strHospitalId))
                hospitalId = int.Parse(strHospitalId);

            Entities dbContext = new Entities();
            List<DoctorSearchResponseInfo> doctorResults = new List<DoctorSearchResponseInfo>();
            if (latitude.HasValue && longitude.HasValue && specialityId != 0)
            {
                var doctors = from d in dbContext.GetAllDoctors(specialityId, latitude, longitude) select d;
                foreach(var item in doctors)
                {
                    doctorResults.Add(new DoctorSearchResponseInfo()
                    {
                        Name = item.NameEN,
                        Qualification = item.Qualification,
                    });
                }
            }
            else if (specialityId != 0 && cityId.HasValue && cityId.Value != 0)
            {
                var doctors = from d in dbContext.GetAllDoctorsByCity(specialityId, cityId) select d;
                foreach (var item in doctors)
                {
                    doctorResults.Add(new DoctorSearchResponseInfo()
                    {
                        Name = item.NameEN,
                        Qualification = item.Qualification,
                        Image = !string.IsNullOrEmpty(item.ImageExt) ?
                                        "~/Images/" + item.HospitalID + "/" + item.ID + item.ImageExt :
                                        "~/Images/no-photo-available-icon.jpg",
                        Hospital = item.HospitalName,
                        Specialization = item.Speciality,
                        ContactNumber = item.ContactNumber,
                        Fee = item.Fee,
                        LikeCount = item.LikeCount,
                        ReviewCount = item.ReviewCount,
                        Location = new string[] { item.Latitude.ToString(), item.Longitude.ToString() },
                        Address = "addresss"
                    });
                }
            }
            else if (hospitalId.HasValue)
            {
                var doctors = from d in dbContext.GetAllDoctorsByHospital(hospitalId, specialityId) select d;
                foreach (var item in doctors)
                {
                    doctorResults.Add(new DoctorSearchResponseInfo()
                    {
                        Name = item.NameEN,
                        Qualification = item.Qualification,
                        Image = !string.IsNullOrEmpty(item.ImageExt) ?
                                        "~/Images/" + item.HospitalID + "/" + item.ID + item.ImageExt :
                                        "~/Images/no-photo-available-icon.jpg" ,
                        Hospital  = item.HospitalName,
                        Specialization = item.Speciality,
                        ContactNumber = item.ContactNumber,
                        Fee = item.Fee,
                        LikeCount = item.LikeCount,
                        ReviewCount = item.ReviewCount,
                        Location = new string[] { item.Latitude.ToString(), item.Longitude.ToString() },
                        Address = "addresss"
                    });
                }
            }
            return View(doctorResults.ToList());
        }
        public ActionResult Index()
        {
            try
            {
                Request.InputStream.Seek(0, SeekOrigin.Begin);
                string jsonData = new StreamReader(Request.InputStream).ReadToEnd();
                NameValueCollection nvc = HttpUtility.ParseQueryString(jsonData);

                int? cityId = 0;
                int? cityLocationId = null;
                int? specialityId = null;
                int? checkSumVal = null;
                double? latitude = null;
                double? longitude = null;

                string strCityID = nvc["cid"] != null ? nvc["cid"].ToString() : null;
                string strCityLocationId = nvc["clid"] != null ? nvc["cid"].ToString() : null;
                string strSpecialityId = nvc["sid"] != null ? nvc["sid"].ToString() : null;
                string strCheckSum = nvc["cs"] != null ? nvc["cs"].ToString() : null;
                string strLatitude = nvc["lt"] != null ? nvc["lt"].ToString() : null;
                string strLongitude = nvc["lg"] != null ? nvc["lg"].ToString() : null;

                if (!string.IsNullOrEmpty(strCityID))
                    cityId = int.Parse(strCityID);

                if (!string.IsNullOrEmpty(strCityLocationId))
                    cityLocationId = int.Parse(strCityLocationId);

                if (!string.IsNullOrEmpty(strSpecialityId))
                    specialityId = int.Parse(strSpecialityId);

                if (!string.IsNullOrEmpty(strCheckSum))
                    checkSumVal = int.Parse(strCheckSum);

                if(!string.IsNullOrEmpty(strLatitude))
                    latitude = double.Parse(strLatitude);

                if(!string.IsNullOrEmpty(strLongitude))
                    longitude = double.Parse(strLongitude);

                if (IsValidCheckSum(cityId, specialityId, checkSumVal))
                {
                    Entities dbContext = new Entities();
                    if(latitude.HasValue && longitude.HasValue && specialityId !=0)
                    {
                        var doctors = from d in dbContext.GetAllDoctors(specialityId, latitude, longitude) select d;
                        return Json(doctors.ToList());
                    }
                    else if(specialityId !=0 && cityId.HasValue)
                    {
                        var doctors = from d in dbContext.GetAllDoctorsByCity(specialityId, cityId) select d;
                        return Json(doctors.ToList());
                    }
                }
            }
            catch
            {
                return null;
            }

            return null;
        }
Example #4
0
        private static void SynchronizeContent()
        {
            Entities db = new Entities();
            foreach (var item in db.GetAllSearchInputs())
            {
                _allSpearchInputs.Add(new SearchInputInfo
                {
                    ID = item.Category + "|"  + item.ID.ToString(),
                    Name = item.Name
                });

            }

            _lastUpdated = DateTime.UtcNow;
        }
Example #5
0
        // GET api/<controller>
        public HttpResponseMessage Get()
        {
            try
            {
                NameValueCollection nvc = HttpContext.Current.Request.QueryString;

                int? cityId = 0;
                int? cityLocationId = null;
                int? specialityId = null;
                int? checkSumVal = null;
                double? latitude = null;
                double? longitude = null;
                int? hospitalId = null;

                string strCityID = nvc["cid"] != null ? nvc["cid"].ToString() : null;
                string strCityLocationId = nvc["clid"] != null ? nvc["cid"].ToString() : null;
                string strSpecialityId = nvc["sid"] != null ? nvc["sid"].ToString() : null;
                string strCheckSum = nvc["cs"] != null ? nvc["cs"].ToString() : null;
                string strLatitude = nvc["lt"] != null ? nvc["lt"].ToString() : null;
                string strLongitude = nvc["lg"] != null ? nvc["lg"].ToString() : null;
                string strHospital = nvc["hid"] != null ? nvc["hid"].ToString() : null;

                if (!string.IsNullOrEmpty(strCityID))
                    cityId = int.Parse(strCityID);

                if (!string.IsNullOrEmpty(strCityLocationId))
                    cityLocationId = int.Parse(strCityLocationId);

                if (!string.IsNullOrEmpty(strSpecialityId))
                    specialityId = int.Parse(strSpecialityId);

                if (!string.IsNullOrEmpty(strCheckSum))
                    checkSumVal = int.Parse(strCheckSum);

                if (!string.IsNullOrEmpty(strLatitude))
                    latitude = double.Parse(strLatitude);

                if (!string.IsNullOrEmpty(strLongitude))
                    longitude = double.Parse(strLongitude);

                if (!string.IsNullOrEmpty(strHospital))
                    hospitalId = int.Parse(strHospital);

                //if (IsValidCheckSum(cityId, specialityId, checkSumVal))
                {
                    Entities dbContext = new Entities();
                    if (latitude.HasValue && longitude.HasValue && specialityId != 0)
                    {
                        var doctors = from d in dbContext.GetAllDoctors(specialityId, latitude, longitude) select d;
                        return Request.CreateResponse(HttpStatusCode.OK, Json(doctors.ToList()));
                    }
                    else if (specialityId != 0 && cityId.HasValue && cityId.Value != 0)
                    {
                        var doctors = from d in dbContext.GetAllDoctorsByCity(specialityId, cityId) select d;
                        return Request.CreateResponse(HttpStatusCode.OK, Json(doctors.ToList()));
                    }
                    else if (hospitalId.HasValue)
                    {
                        var doctors = from d in dbContext.GetAllDoctorsByHospital(hospitalId, specialityId) select
                                      new
                                      {
                                          d.NameEN
                                      };
                        var items = doctors.ToList();
                        return Request.CreateResponse(HttpStatusCode.OK, Json(items));
                    }
                }
            }
            catch
            {
                return null;
            }

            return null;
        }
Example #6
0
        private static void SynchronizeContent()
        {
            Entities db = new Entities();
            foreach(var specialization in db.Specializations)
            {
                _allSpecialities.Add(specialization);
                if (!_allSpecialities.Contains(specialization))
                {
                    _allSpecialities.Add(specialization);
                    _specialization_IDDictionary.Add(specialization.ID, specialization);
                }
            }

            _lastUpdated = DateTime.UtcNow;
        }