/// <summary> /// Get appointment type per Doctor. /// </summary> /// <param name="value"></param> /// <returns></returns> public appt_type _getDoctor_appointmenttype(long value) { SV_db1Entities dbEntity = new SV_db1Entities(); appt_type appt_type = new appt_type(); // long vappt_id = 0; // bool isAppt = long.TryParse(value, out vappt_id); var n1 = dbEntity.ref_APPOINTMENT_type.Find(value); string vappt_name = n1.dname; long vappt_id = n1.id; //appt_type.Add(new appt_type //{ // id = vappt_id, // type = vappt_name //}); appt_type.id = vappt_id; appt_type.type = vappt_name; return(appt_type); }
public var_getDoctor_ext _getDoctor_ext_doc1(dynamic doc_ext) { try { //SV_db1Entities dbEntity = new SV_db1Entities(); //var doc_ext = dbEntity.hs_DOCTOR_ext.Where(a => a.rel_DOCTOR_id == doc.id); var_getDoctor_ext dx = new var_getDoctor_ext(); List <appt_type> m_app_type = new List <appt_type>(); List <string> m_time_slot = new List <string>() { }; List <string> m_education = new List <string>() { }; List <string> m_experience = new List <string>() { }; // referenced by: /doctor/search foreach (var n in doc_ext) { string e = n.ext_attr_name; string v = n.ext_value; switch (e) { case "language_spoken": // removed from doctor_ext break; case "fee": double d_fee; bool bTemp = double.TryParse(v, out d_fee); dx.doc_fee = d_fee; break; case "specialty_id": // removed from doctor_ext break; case "home_zip": //dx.home_address = _getDoctor_homeaddress(n.value); break; case "practice_zip": //dx.practice_address = _getDoctor_practiceaddress(doctor_id, n.value); break; case "drappttype": // dx.appt_type = _getDoctor_appointmenttype(n.value); long vappt_id = 0; bool isAppt = long.TryParse(v, out vappt_id); if (isAppt) { appt_type appt_ = new appt_type(); appt_ = _getDoctor_appointmenttype(vappt_id); //dx.appt_type.Add(new appt_type { id = appt_.id, type = appt_.type }); m_app_type.Add(new appt_type { id = appt_.id, type = appt_.type }); } break; case "time_slot": m_time_slot.Add(v); break; case "education": m_education.Add(v); break; case "experience": m_experience.Add(v); break; case "dea": dx.dea = v; break; } //public List<string> time_slot { get; set; } //public List<string> education { get; set; } //public List<string> experience { get; set; } } // it wud yield an error, if class variable is assigned inside switch() dx.education = m_education; dx.time_slot = m_time_slot; dx.appt_type = m_app_type; dx.experience = m_experience; //if (m_education.Count() > 0) { } //if (m_time_slot.Count() > 0) { } //if (m_app_type.Count() > 0) { } return(dx); } catch (Exception ex) { return(null); } }