private void phoneValue(post_supplier 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 saveSupplier_User(post_supplier 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 = 11 }; db.USERs.Add(u); db.SaveChanges(); return(u.id); }
public IHttpActionResult postSupplier([FromBody] post_supplier supp) { try { #region //legal_entity_name: sdfdfddddd // healthsplash_contact:dsdfsdf // address1:dsfsfdsdfsdfsf // address2:sdfsfdd // city:Cayey // state:Puerto Rico //zip: 00736 //federal_tax_number: adfasd // primary_phone:asdfs // partner_supplier:asdf // partner_telemedicine:asdfsad // primary_contact_name_first:afsdf // primary_contact_name_last:asdfd // primary_contacty_phone:asdfsd // primary_contact_email:asfsd // operational_name_first:asfdf // operational_name_first:asdfsd // operational_name_last:sfsdd // operational_phone:sdd // operational_email:ddss // financial_name_first:lllkkd // financial_name_last:dsddfd // financial_phone:seeed // financial_email:dsdgge // authorize_signatory_name_first:sddggd // authorize_signatory_name_last:dsdfdsfd // authorize_signatory_phone:sdfdfd // authorize_signatory_email:sdfdsfd // fax_number:sdfs // process_external_transfer: asdfsdf // intake_entity:safsdf // technology_platform:sdfsdfdfd // pharmacy_relationship:sdddf // unique_customer_number:sdfsdfds // pharmacy_fax:ddsdbggg // preferred_geographic_market:sdfsfdsfd #endregion Is_Required("legal_entity_name", supp.legal_entity_name, 1); Is_Required("healthsplash_contact", supp.healthsplash_contact, 1); Is_Required("address1", supp.address1, 1); Is_Required("city", supp.city, 1); Is_Required("state", supp.state, 1); Is_Required("zip", supp.zip, 1); Is_Required("federal_tax_number", supp.federal_tax_number, 1); Is_Required("primary_phone", supp.primary_phone, 1); //Is_Required("supplier_partner", mark.partner_supplier, 1); Is_Required("telemedicine_partner", supp.telemedicine_partner, 1); Is_Required("organization_npi", supp.organization_npi, 1); Is_Required("preferred_geographic_market", supp.preferred_geographic_market, 1); Is_Required("insurance_providers", supp.insurance_providers, 1); Is_Required("products_hcpcs", supp.products_hcpcs, 1); Is_Required("patient_deductible_threshold", supp.patient_deductible_threshold, 1); Is_Required("primary_contact_name_first", supp.primary_contact_name_first, 1); Is_Required("primary_contact_name_last", supp.primary_contact_name_last, 1); Is_Required("primary_contacty_phone", supp.primary_contact_phone, 1); Is_Required("primary_contact_email", supp.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", supp.financial_name_first, 1); Is_Required("financial_name_last", supp.financial_name_last, 1); Is_Required("financial_phone", supp.financial_phone, 1); Is_Required("financial_email", supp.financial_email, 1); Is_Required("authorize_signatory_name_first", supp.authorize_signatory_name_first, 1); Is_Required("authorize_signatory_name_last", supp.authorize_signatory_name_last, 1); Is_Required("authorize_signatory_phone", supp.authorize_signatory_phone, 1); Is_Required("authorize_signatory_email", supp.authorize_signatory_email, 1); if (HAS_ERROR) { return(Json(new { data = new string[] { }, message = ERR_MSG, success = false })); } long a = validateZip(supp); 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 == supp.authorize_signatory_email.ToLower()); if (u_search.Count() > 0) { return(Json(new { data = new string[] { }, message = "Authorized email already exist.", success = false })); } return(_saveSupplier(supp)); //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 })); } }
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 })); }