private get_response_physician _getPhysician_ext(long m_id) { var mx = db.PHYSICIAN_ext.Where(a => a.rel_PHYSICIAN_id == m_id); get_response_physician resp = new get_response_physician(); foreach (var n in mx) { switch (n.attr_name) { case "fax_number": resp.fax_number = n.value; break; case "future_expansion": resp.future_expansion = n.value; break; case "current_scheduling_solution": resp.current_scheduling_solution = n.value; break; } } return(resp); }
public IHttpActionResult GetPhysician([FromUri] get_physician physician) { try { var m = db.PHYSICIANs.Find(physician.id); List <get_response_physician> resp = new List <get_response_physician>(); if (m != null) { var ref_zip = db.ref_zip.Find(m.addr_zip_id); get_response_physician ext = _getPhysician_ext(m.id); List <zip_search_address2> addr = new List <zip_search_address2>(); if (ref_zip != null) { addr.Add(new zip_search_address2 { address1 = m.addr_address1, address2 = m.addr_address2 == null ? "" : m.addr_address2, city = ref_zip == null ? "" : ref_zip.city_name, state = ref_zip == null ? "" : ref_zip.city_state, state_long = ref_zip == null ? "" : ref_zip.city_state_long, zip = ref_zip == null ? "" : ref_zip.zip }); } resp.Add(new get_response_physician { legal_entity_name = m.legal_entity_name, healthsplash_contact = m.healthsplash_contact, address = addr == null ? new List <zip_search_address2>() { } : addr, federal_tax_number = m.federal_tax_number, primary_phone = m.primary_phone, geographic_market = m.geographic_market, insurance_providers = m.insurance_providers, practice_npi = m.practice_npi, practice_type = m.practice_type, customer_service_number = m.customer_service_number, number_clinicians = m.number_clinicians.Value, number_exams_per_week = m.number_exams_per_week.Value, EMR_software_used = m.EMR_software_used, fax_number = ext.fax_number == null ? "" : ext.fax_number, current_scheduling_solution = ext.current_scheduling_solution == null ? "" : ext.current_scheduling_solution, future_expansion = ext.future_expansion == null ? "" : ext.future_expansion, primary_contact_name_first = m.prim_contact_name_first, primary_contact_name_last = m.prim_contact_name_last, primary_contacty_phone = m.prim_contact_phone, primary_contact_email = m.prim_contact_email, operational_name_first = m.oper_contact_name_first, operational_name_last = m.oper_contact_name_last, operational_phone = m.oper_contact_phone, operational_email = m.oper_contact_email, financial_name_first = m.fina_contact_name_first, financial_name_last = m.fina_contact_name_last, financial_phone = m.fina_contact_phone, financial_email = m.fina_contact_email, authorize_signatory_name_first = m.auth_contact_name_first, authorize_signatory_name_last = m.auth_contact_name_last, authorize_signatory_phone = m.auth_contact_phone, authorize_signatory_email = m.auth_contact_email }); var ret1 = JsonConvert.SerializeObject(resp); var json1 = Newtonsoft.Json.Linq.JArray.Parse(ret1); string msg = resp.Count() + " Record found."; return(Json(new { data = json1, message = msg, success = true })); } } catch (Exception ex) { return(Json(new { data = new string[] { }, message = ex.Message, success = false })); } return(Json(new { data = new string[] { }, message = "", success = false })); }