public async Task <IHttpActionResult> NewRating() { string root = HttpContext.Current.Server.MapPath("~/Temp"); var provider = new MultipartFormDataStreamProvider(root); long user_id = 0; string rate = "", doctor_id = "", appointment_id = "", review = ""; DateTime dtNow = DateTime.Now; try { await Request.Content.ReadAsMultipartAsync(provider); foreach (var key in provider.FormData.AllKeys) { foreach (var val in provider.FormData.GetValues(key)) { // user_id, patient_id, rate bool bTemp1 = false; switch (key) { case "user_id": IsRequired(key, val, 1); bTemp1 = long.TryParse(val, out user_id); break; case "doctor_id": //IsRequired(key, val, 1); //bTemp = long.TryParse(val, out doctor_id); doctor_id = val; break; case "rate": IsRequired(key, val, 1); //bTemp = int.TryParse(val, out rate); rate = val; break; case "review": IsRequired(key, val, 1); //bTemp = int.TryParse(val, out rate); review = val; break; case "appointment_id": IsRequired(key, val, 1); appointment_id = val; break; default: return(Json(new { message = "Invalid parameter name: " + key, success = false })); } } } IsRequired("user_id", user_id.ToString(), 2); //IsRequired("patient_id", doctor_id.ToString(), 3); IsRequired("rate", rate.ToString(), 3); IsRequired("appointment_id", appointment_id, 3); if (haserror) { return(Json(new { data = new string[] { }, message = errmsg, success = false })); } long appt_id; bool bTemp = long.TryParse(appointment_id, out appt_id); var ext_rating = db.APPOINTMENT_ext.Where(a => a.rel_APPOINTMENT_id == appt_id && a.attr_name == "doctor_rating").FirstOrDefault(); if (ext_rating != null) { db.APPOINTMENT_ext.Remove(ext_rating); db.SaveChanges(); } APPOINTMENT_ext doc_ext = new APPOINTMENT_ext() { rel_APPOINTMENT_id = appt_id, attr_name = "doctor_rating", dname = "Doctor Rating", value = rate.ToString(), rel_ref_datatype_id = 3, create_by__USER_id = user_id, dt_create = dtNow }; db.APPOINTMENT_ext.Add(doc_ext); APPOINTMENT_ext doc_rev = new APPOINTMENT_ext() { rel_APPOINTMENT_id = appt_id, attr_name = "doctor_review", dname = "Doctor Review", value = review.ToString(), rel_ref_datatype_id = 3, create_by__USER_id = user_id, dt_create = dtNow }; db.APPOINTMENT_ext.Add(doc_rev); db.SaveChanges(); return(Json(new { data = new string[] { }, message = "New Doctor rating saved successfully.", success = true })); } catch (Exception ex) { return(Json(new { data = "", message = ex.Message, success = false })); } }
public async Task <IHttpActionResult> putappointmenttype() { string msg = ""; string root = HttpContext.Current.Server.MapPath("~/Temp"); var provider = new MultipartFormDataStreamProvider(root); string appointment_type_id = ""; try { string display_name = ""; string user_id = ""; await Request.Content.ReadAsMultipartAsync(provider); foreach (var key in provider.FormData.AllKeys) { foreach (var val in provider.FormData.GetValues(key)) { switch (key) { case "appointment_type_id": IsRequired(key, val, 1); appointment_type_id = val; break; case "display_name": IsRequired(key, val, 1); display_name = val; break; case "user_id": user_id = val; break; default: msg = "Object reference not set to an instance of an object. Invalid parameter name: " + key; return(Json(new { data = new string[] { }, message = msg, success = false })); } } } IsRequired("display_name", display_name, 1); if (haserror) { return(Json(new { data = new string[] { }, message = errmsg, success = false })); } long nApp_type = 0; bool bApp_type = long.TryParse(appointment_type_id, out nApp_type); var app_type = dbEntity.ref_APPOINTMENT_type.Find(nApp_type); if (app_type != null) { app_type.dname = display_name; dbEntity.Entry(app_type).State = System.Data.Entity.EntityState.Modified; dbEntity.SaveChanges(); } //var ret1 = JsonConvert.SerializeObject(appointment); //var json1 = Newtonsoft.Json.Linq.JArray.Parse(ret1); //msg = appointment.Count() + " Record(s) found."; return(Json(new { data = new string[] { }, message = msg, success = true })); } catch (Exception ex) { return(Json(new { data = new string[] { }, message = ex.Message, success = false })); } }
private IHttpActionResult _saveSupplier(post_supplier m) { phoneValue(m); if (m.organization_npi.Length > 10) { m.organization_npi = m.organization_npi.Substring(0, 10); } SUPPLIER mrk = new SUPPLIER { legal_entity_name = m.legal_entity_name, healthsplash_contact = m.healthsplash_contact, // addr_zip_id addr_address1 = m.address1, addr_address2 = string.IsNullOrEmpty(m.address2) == true ? null: m.address2, addr_zip_id = m.zip_id, federal_tax_number = m.federal_tax_number, primary_phone = m.primary_phone, telemedicine_partner = m.telemedicine_partner, organization_npi = m.organization_npi, preferred_geographic_market = m.preferred_geographic_market, insurance_provider = m.insurance_providers, products_hcpcs = m.products_hcpcs, patient_deductible_threshold = m.patient_deductible_threshold, prim_contact_name_first = m.primary_contact_name_first, prim_contact_name_last = m.primary_contact_name_last, prim_contact_email = m.primary_contact_email, prim_contact_phone = m.primary_contact_phone, oper_contact_name_first = m.operational_name_first, oper_contact_name_last = m.operational_name_last, oper_contact_email = m.operational_email, oper_contact_phone = m.operational_phone, fina_contact_name_first = m.financial_name_first, fina_contact_name_last = m.financial_name_last, fina_contact_email = m.financial_email, fina_contact_phone = m.financial_phone, auth_contact_name_first = m.authorize_signatory_name_first, auth_contact_name_last = m.authorize_signatory_name_last, auth_contact_email = m.authorize_signatory_email, auth_contact_phone = m.authorize_signatory_phone, }; db.SUPPLIERs.Add(mrk); db.SaveChanges(); long user_id = saveSupplier_User(m); //bool saveMarketer_ext(string _attr_name, string _dname, string _value, long market_id = 0, long user_id = 0, int data_type = 0) //mark.fax_number = ""; if (!string.IsNullOrEmpty(m.fax_number)) { bool i = Entry.saveSupplier_ext("fax_number", "fax_number", m.fax_number, mrk.id, 0, 0); } // mark.process_external_transfer if (!string.IsNullOrEmpty(m.process_external_transfer)) { bool i = Entry.saveSupplier_ext("process_external_transfer", "Process External Transfer", m.process_external_transfer, mrk.id, 0, 0); } // mark.marketer_partner if (!string.IsNullOrEmpty(m.marketer_partner)) { bool i = Entry.saveSupplier_ext("marketer_partner", "marketer_partner", m.marketer_partner, mrk.id, 0, 0); } // mark.intake_entity if (!string.IsNullOrEmpty(m.intake_entity)) { bool i = Entry.saveSupplier_ext("intake_entity", "intake_entity", m.intake_entity, mrk.id, 0, 0); } // mark.technology_platform if (!string.IsNullOrEmpty(m.technology_platform)) { bool i = Entry.saveSupplier_ext("technology_platform", "technology_platform", m.technology_platform, mrk.id, 0, 0); } //mark.pharmacy_relationship if (!string.IsNullOrEmpty(m.pharmacy_relationship)) { bool i = Entry.saveSupplier_ext("pharmacy_relationship", "pharmacy_relationship", m.pharmacy_relationship, mrk.id, 0, 0); } //mark.pharmacy_customer_number if (!string.IsNullOrEmpty(m.pharmacy_customer_number)) { bool i = Entry.saveSupplier_ext("pharmacy_customer_number", "pharmacy_customer_number", m.pharmacy_customer_number, mrk.id, 0, 0); } //mark.pharmacy_fax if (!string.IsNullOrEmpty(m.pharmacy_fax)) { bool i = Entry.saveSupplier_ext("pharmacy_fax", "pharmacy_fax", m.pharmacy_fax, mrk.id, 0, 0); } //mark.ptan_number if (!string.IsNullOrEmpty(m.ptan_number)) { bool i = Entry.saveSupplier_ext("ptan_number", "ptan_number", m.ptan_number, mrk.id, 0, 0); } return(Json(new { data = new string[] { }, message = "Successfully saved.", success = true })); }
private IHttpActionResult _savePhysician(post_physician m) { phoneValue(m); if (m.practice_npi.Length > 10) { m.practice_npi = m.practice_npi.Substring(0, 10); } PHYSICIAN mrk = new PHYSICIAN { legal_entity_name = m.legal_entity_name, healthsplash_contact = m.healthsplash_contact, // addr_zip_id addr_address1 = m.address1, addr_address2 = string.IsNullOrEmpty(m.address2) == true ? null : m.address2, addr_zip_id = m.zip_id, federal_tax_number = m.federal_tax_number, primary_phone = m.primary_phone, customer_service_number = m.customer_service_number, number_clinicians = m.number_clinicians, number_exams_per_week = m.number_exams_per_week, practice_npi = m.practice_npi, geographic_market = m.geographic_market, insurance_providers = m.insurance_providers, EMR_software_used = m.EMR_software_used, practice_type = m.practice_type, prim_contact_name_first = m.primary_contact_name_first, prim_contact_name_last = m.primary_contact_name_last, prim_contact_email = m.primary_contact_email, prim_contact_phone = m.primary_phone, oper_contact_name_first = m.operational_name_first, oper_contact_name_last = m.operational_name_last, oper_contact_email = m.operational_email, oper_contact_phone = m.operational_phone, fina_contact_name_first = m.financial_name_first, fina_contact_name_last = m.financial_name_last, fina_contact_email = m.financial_email, fina_contact_phone = m.financial_phone, auth_contact_name_first = m.authorize_signatory_name_first, auth_contact_name_last = m.authorize_signatory_name_last, auth_contact_email = m.authorize_signatory_email, auth_contact_phone = m.authorize_signatory_phone }; db.PHYSICIANs.Add(mrk); db.SaveChanges(); long user_id = savePhysician_User(m); //bool saveMarketer_ext(string _attr_name, string _dname, string _value, long market_id = 0, long user_id = 0, int data_type = 0) //mark.fax_number = ""; if (!string.IsNullOrEmpty(m.fax_number)) { bool i = Entry.savePhysician_ext("fax_number", "fax_number", m.fax_number, mrk.id, 0, 0); } //mark.future_expansion = ""; if (!string.IsNullOrEmpty(m.future_expansion)) { bool i = Entry.savePhysician_ext("future_expansion", "future_expansion", m.future_expansion, mrk.id, 0, 0); } //mark.current_scheduling_solution = ""; if (!string.IsNullOrEmpty(m.current_scheduling_solution)) { bool i = Entry.savePhysician_ext("current_scheduling_solution", "current_scheduling_solution", m.current_scheduling_solution, mrk.id, 0, 0); } return(Json(new { data = new string[] { }, message = "Successfully saved.", success = true })); }
public async Task <IHttpActionResult> postNotification() { string root = HttpContext.Current.Server.MapPath("~/Temp"); var provider = new MultipartFormDataStreamProvider(root); string msg, user_id = null, patient_id = null, text = null, link = null, is_unread = null; try { #region "params" await Request.Content.ReadAsMultipartAsync(provider); foreach (var key in provider.FormData.AllKeys) { foreach (var val in provider.FormData.GetValues(key)) { switch (key) { case "user_id": isRequired(key, val, 1); user_id = val; break; case "patient_id": patient_id = val; break; case "text": text = val; break; case "link": link = val; break; case "is_unread": is_unread = val; break; default: msg = "Object reference not set to an instance of an object. Invalid parameter name: " + key; return(Json(new { data = new string[] { }, message = msg, success = false })); } } } isRequired("user_id", user_id, 1); if (hasError) { return(Json(new { data = new string[] { }, message = errmsg, success = false })); } // check user info long user_id_new = 0; bool isValidUser = long.TryParse(user_id, out user_id_new); if (!isValidUser) { return(Json(new { data = new string[] { }, message = "Invalid user_id value.", success = false })); } var _user = db.USERs.Find(user_id_new); if (_user == null) { return(Json(new { data = new string[] { }, message = "Invalid user_id value.", success = false })); } // check patient info long patient_id_new = 0; bool isValidPatient = long.TryParse(patient_id, out patient_id_new); if (!isValidPatient) { return(Json(new { data = new string[] { }, message = "Invalid patient_id value.", success = false })); } // check is_read value if (!string.IsNullOrEmpty(is_unread)) { if (is_unread.ToLower() != "false" || is_unread.ToLower() != "true") { return(Json(new { data = new string[] { }, message = "Invalid patient_id value.", success = false })); } } else { is_unread = "false"; } #endregion notification noti = new notification { rel_USER_id = user_id_new, SOUL_id = patient_id_new, text = text, link = link, is_unread = is_unread.ToLower() == "true" ? true : false, create_by__USER_id = user_id_new, dt_create = dt }; db.notifications.Add(noti); db.SaveChanges(); return(Json(new { data = new string[] { }, message = "Notification successfully saved.", success = true })); } catch (Exception ex) { return(Json(new { data = new string[] { }, message = ex.Message, success = false })); } }
private IHttpActionResult _savePharmacy(post_pharmacy m) { phoneValue(m); PHARMACY mrk = new PHARMACY { legal_entity_name = m.legal_entity_name, healthsplash_contact = m.healthsplash_contact, // addr_zip_id addr_address1 = m.address1, addr_address2 = string.IsNullOrEmpty(m.address2) == true ? null : m.address2, addr_zip_id = m.zip_id, specialty_service = m.specialty_services, federal_tax_number = m.federal_tax_number, primary_phone = m.primary_phone, customer_service_number = m.customer_service_number, technology_platform_retrieval = m.technology_platform_retrieval, NCPDP_number = m.ncpdp_number, practice_npi_number = m.practice_npi_number, prim_contact_name_first = m.primary_contact_name_first, prim_contact_name_last = m.primary_contact_name_last, prim_contact_email = m.primary_contact_email, prim_contact_phone = m.primary_phone, oper_contact_name_first = m.operational_name_first, oper_contact_name_last = m.operational_name_last, oper_contact_email = m.operational_email, oper_contact_phone = m.operational_phone, fina_contact_name_first = m.financial_name_first, fina_contact_name_last = m.financial_name_last, fina_contact_email = m.financial_email, fina_contact_phone = m.financial_phone, auth_contact_name_first = m.authorize_signatory_name_first, auth_contact_name_last = m.authorize_signatory_name_last, auth_contact_email = m.authorize_signatory_email, auth_contact_phone = m.authorize_signatory_phone, }; db.PHARMACies.Add(mrk); db.SaveChanges(); long user_id = savePhysician_User(m); //bool saveMarketer_ext(string _attr_name, string _dname, string _value, long market_id = 0, long user_id = 0, int data_type = 0) //mark.fax_number = ""; if (!string.IsNullOrEmpty(m.fax_number)) { bool i = Entry.saveMarketer_ext("fax_number", "fax_number", m.fax_number, mrk.id, 0, 0); } //mark.marketer_partner = ""; if (!string.IsNullOrEmpty(m.marketer_partner)) { bool i = Entry.saveMarketer_ext("marketer_partner", "marketer_partner", m.marketer_partner, mrk.id, 0, 0); } //mark.pharmacy_fax_number = ""; if (!string.IsNullOrEmpty(m.marketer_partner)) { bool i = Entry.saveMarketer_ext("pharmacy_fax_number", "pharmacy_fax_number", m.pharmacy_fax_number, mrk.id, 0, 0); } //mark.geographic_market = ""; if (!string.IsNullOrEmpty(m.geographic_market)) { bool i = Entry.saveMarketer_ext("geographic_market", "geographic_market", m.geographic_market, mrk.id, 0, 0); } // mark.insurance_provider if (!string.IsNullOrEmpty(m.insurance_provider)) { bool i = Entry.saveMarketer_ext("insurance_provider", "insurance_provider", m.insurance_provider, mrk.id, 0, 0); } // mark.product_list if (!string.IsNullOrEmpty(m.product_list)) { bool i = Entry.saveMarketer_ext("product_list", "product_list", m.product_list, mrk.id, 0, 0); } return(Json(new { data = new string[] { }, message = "Successfully saved.", success = true })); }