public getDoctor_rating _get_averagerating_doc1(long doctor_id) { try { //balkon rating = dr.average_rating, //balkon favorite = dr.fave, //balkon patient_review = dr.review, SV_db1Entities dbEntity = new SV_db1Entities(); // var appt = dbEntity.APPOINTMENTs.Where(a => a.doctor_id == doctor_id); var appt = from ap in dbEntity.APPOINTMENTs where ap.doctor_id == doctor_id select ap; // having Where clause slows down the response. // we shud consider the status of the Appointment, only those that were Closed not canceled getDoctor_rating ave = new getDoctor_rating(); List <p_ratings_review> rating_review = new List <p_ratings_review>(); foreach (var a in appt) { // long id = a.doctor_id.Value; // ave.average_rating= a.doctor_rating.Value; // review = a.doctor_review; double rating = a.doctor_rating == null ? 0 : a.doctor_rating.Value; string review = a.doctor_review; rating_review.Add(new p_ratings_review { rating = rating, remark = review }); // ave.review.Add{ rating_review}; } ave.review = rating_review; return(ave); } catch (Exception ex) { return(null); } }
public List <doc_search_profile2> getMobileDoctor(dynamic doc_items) { try { // balkon List <doc_search_profile2> dc = new List <doc_search_profile2>(); List <long> doc_id = new List <long>(); foreach (var doc in doc_items) { List <zip_search_address> home_addr = _getDoctor_homeaddress_doc1(doc); List <zip_search_address> pract_addr = _getDoctor_practiceaddress_doc1(doc); // bozal var_getDoctor_ext d_ext = _getDoctor_ext_doc1(doc.ext); //01/11/2018 List<doc_specialty2> spec = _getDoctor_specialty_doc1(doc.con_spec); List <doc_specialty_01112018> spec = _getDoctor_specialty_doc1(doc.con_spec); List <doc_language> lang = _getLanguage_doc1(doc.con_lang); List <insurance> ins = _getInsurance_doc1(doc.con_ins); getDoctor_rating dr = _get_averagerating_doc1(doc.id); var prof = new Models.doc_search_profile2 { id = doc.id, npi = doc.NPI == null ? "" : doc.NPI, first_name = doc.name_first == null ? "" : doc.name_first, last_name = doc.name_last == null ? "" : doc.name_last, middle_name = doc.name_middle == null ? "" : doc.name_middle, email = doc.email == null ? "" : doc.email, gender = doc.gender == null ? "" : doc.gender.Trim().ToUpper(), title = doc.title == null ? "" : doc.title, phone = doc.phone == null ? "" : doc.phone, license = doc.license_no == null ? "" : doc.license_no, organization_name = doc.organization_name == null ? "" : doc.organization_name, image_url = doc.image_url == null ? "" : doc.image_url, DOB = doc.dob == null ? "" : doc.dob, bio = doc.bio, pecos_certificate = doc.pecos_certification, //balkon favorite = dr.fave, //balkon rating = dr.average_rating, //balkon patient_review = dr.review, doctor_fee = d_ext.doc_fee, time_slot = d_ext.time_slot, education = d_ext.education, experience = d_ext.experience, appointment_type = d_ext.appt_type, network_insurance = ins, // d_ext.insurance == null ? new List<insurance>() { } : d_ext.insurance, language_spoken = lang, // d_ext.language == null ? new List<doc_language>() { } : d_ext.language, specialties = spec, // d_ext.spec == null ? new List<doc_specialty2>() { } : d_ext.spec, home_address = home_addr == null ? new List <zip_search_address>() { } : home_addr, practice_address = pract_addr == null ? new List <zip_search_address>() { } : pract_addr }; dc.Add(prof); //} } return(dc); } catch (Exception ex) { return(null); } }