private void phoneValue(post_pharmacy mark) { if (!string.IsNullOrEmpty(mark.primary_phone) & mark.primary_phone.Length > 10) { mark.primary_phone = mark.primary_phone.Substring(0, 10); } if (!string.IsNullOrEmpty(mark.financial_phone) & mark.financial_phone.Length > 10) { mark.financial_phone = mark.financial_phone.Substring(0, 10); } if (!string.IsNullOrEmpty(mark.operational_phone) & mark.operational_phone.Length > 10) { mark.operational_phone = mark.operational_phone.Substring(0, 10); } if (!string.IsNullOrEmpty(mark.primary_contact_phone) & mark.primary_contact_phone.Length > 10) { mark.primary_contact_phone = mark.primary_contact_phone.Substring(0, 10); } if (!string.IsNullOrEmpty(mark.authorize_signatory_phone) & mark.authorize_signatory_phone.Length > 10) { mark.authorize_signatory_phone = mark.authorize_signatory_phone.Substring(0, 10); //return Json(new { data = new string[] { }, message = "Phone numbe", success = false }); } //return Json(new { data = new string[] { }, message = "Phone numbe", success = false }); }
private long savePhysician_User(post_pharmacy m) { var u_find = db.USERs.Where(a => a.username == m.authorize_signatory_email.ToLower()); USER u = new USER { name_first = m.authorize_signatory_name_first, name_last = m.authorize_signatory_name_last, username = m.authorize_signatory_email, dt_create = dt, create_by__USER_id = 0, rel_ref_USER_type_id = 13 }; db.USERs.Add(u); db.SaveChanges(); return(u.id); }
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 })); }
public IHttpActionResult postPharmacy([FromBody] post_pharmacy pharma) { try { Is_Required("legal_entity_name", pharma.legal_entity_name, 1); Is_Required("healthsplash_contact", pharma.healthsplash_contact, 1); Is_Required("address1", pharma.address1, 1); Is_Required("city", pharma.city, 1); Is_Required("state", pharma.state, 1); Is_Required("zip", pharma.zip, 1); Is_Required("federal_tax_number", pharma.federal_tax_number, 1); Is_Required("primary_phone", pharma.primary_phone, 1); Is_Required("specialty_services", pharma.specialty_services, 1); Is_Required("customer_service_number", pharma.customer_service_number, 1); Is_Required("technology_platform_retrieval", pharma.technology_platform_retrieval, 1); Is_Required("ncpdp_number", pharma.ncpdp_number, 1); Is_Required("practice_npi_number", pharma.practice_npi_number, 1); Is_Required("primary_contact_name_first", pharma.primary_contact_name_first, 1); Is_Required("primary_contact_name_last", pharma.primary_contact_name_last, 1); Is_Required("primary_contacty_phone", pharma.primary_contact_phone, 1); Is_Required("primary_contact_email", pharma.primary_contact_email, 1); //Is_Required("operational_name_first", mark.operational_name_first, 1); //Is_Required("operational_name_last", mark.operational_name_last, 1); //Is_Required("operational_phone", mark.operational_phone, 1); //Is_Required("operational_email", mark.operational_email, 1); Is_Required("financial_name_first", pharma.financial_name_first, 1); Is_Required("financial_name_last", pharma.financial_name_last, 1); Is_Required("financial_phone", pharma.financial_phone, 1); Is_Required("financial_email", pharma.financial_email, 1); Is_Required("authorize_signatory_name_first", pharma.authorize_signatory_name_first, 1); Is_Required("authorize_signatory_name_last", pharma.authorize_signatory_name_last, 1); Is_Required("authorize_signatory_phone", pharma.authorize_signatory_phone, 1); Is_Required("authorize_signatory_email", pharma.authorize_signatory_email, 1); if (HAS_ERROR) { return(Json(new { data = new string[] { }, message = ERR_MSG, success = false })); } long a = validateZip(pharma); if (a == 1) { return(Json(new { data = new string[] { }, message = "Invalid zip value.", success = false })); } else if (a == 2) { return(Json(new { data = new string[] { }, message = "Invalid city value.", success = false })); } else if (a == 3) { return(Json(new { data = new string[] { }, message = "Invalid state value.", success = false })); } var u_search = db.USERs.Where(b => b.username == pharma.authorize_signatory_email.ToLower()); if (u_search.Count() > 0) { return(Json(new { data = new string[] { }, message = "Authorized email already exist.", success = false })); } return(_savePharmacy(pharma)); //mark.fax_number = ""; // mark.process_external_transfer // mark.intake_entity // mark.technology_platform //mark.pharmacy_relationship //mark.unique_customer_number //mark.pharmacy_fax //mark.preferred_geographic_market } catch (Exception ex) { return(Json(new { data = new string[] { }, message = ex.Message, success = false })); } }