예제 #1
0
        private void phoneValue(post_market 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 });
        }
예제 #2
0
        private long saveMarketer_User(post_market 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 = 10
            };

            db.USERs.Add(u);
            db.SaveChanges();

            return(u.id);
        }
예제 #3
0
        public IHttpActionResult postMarketing([FromBody] post_market mark)
        {
            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", mark.legal_entity_name, 1);
                Is_Required("healthsplash_contact", mark.healthsplash_contact, 1);
                Is_Required("address1", mark.address1, 1);
                //IsRequired("address_2", mark.address2, 1);
                Is_Required("city", mark.city, 1);
                Is_Required("state", mark.state, 1);
                Is_Required("zip", mark.zip, 1);

                Is_Required("federal_tax_number", mark.federal_tax_number, 1);
                Is_Required("primary_phone", mark.primary_phone, 1);

                Is_Required("supplier_partner", mark.supplier_partner, 1);
                Is_Required("telemedicine_partner", mark.telemedicine_partner, 1);

                Is_Required("primary_contact_name_first", mark.primary_contact_name_first, 1);
                Is_Required("primary_contact_name_last", mark.primary_contact_name_last, 1);
                Is_Required("primary_contact_phone", mark.primary_contact_phone, 1);
                Is_Required("primary_contact_email", mark.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", mark.financial_name_first, 1);
                Is_Required("financial_name_last", mark.financial_name_last, 1);
                Is_Required("financial_phone", mark.financial_phone, 1);
                Is_Required("financial_email", mark.financial_email, 1);

                Is_Required("authorize_signatory_name_first", mark.authorize_signatory_name_first, 1);
                Is_Required("authorize_signatory_name_last", mark.authorize_signatory_name_last, 1);
                Is_Required("authorize_signatory_phone", mark.authorize_signatory_phone, 1);
                Is_Required("authorize_signatory_email", mark.authorize_signatory_email, 1);

                if (HAS_ERROR)
                {
                    return(Json(new { data = new string[] { }, message = ERR_MSG, success = false }));
                }

                long a = validateZip(mark);
                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 == mark.authorize_signatory_email.ToLower());
                if (u_search.Count() > 0)
                {
                    return(Json(new { data = new string[] { }, message = "Authorized email already exist.", success = false }));
                }

                return(_saveMarketer(mark));
            }
            catch (Exception ex)
            {
                return(Json(new { data = new string[] { }, message = ex.Message, success = false }));
            }
        }
예제 #4
0
        private IHttpActionResult _saveMarketer(post_market m)
        {
            phoneValue(m);

            MARKETER mrk = new MARKETER
            {
                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,
                supplier_partner        = m.supplier_partner,
                telemedicine_partner    = m.telemedicine_partner,
                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 == null ? null:  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.MARKETERs.Add(mrk);
            db.SaveChanges();

            long user_id = saveMarketer_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.process_external_transfer
            if (!string.IsNullOrEmpty(m.process_external_transfer))
            {
                bool i = Entry.saveMarketer_ext("process_external_transfer", "Process External Transfer", m.process_external_transfer, mrk.id, 0, 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.intake_entity
            if (!string.IsNullOrEmpty(m.intake_entity))
            {
                bool i = Entry.saveMarketer_ext("intake_entity", "intake_entity", m.intake_entity, mrk.id, 0, 0);
            }
            // mark.technology_platform
            if (!string.IsNullOrEmpty(m.technology_platform))
            {
                bool i = Entry.saveMarketer_ext("technology_platform", "technology_platform", m.technology_platform, mrk.id, 0, 0);
            }
            //mark.pharmacy_relationship
            if (!string.IsNullOrEmpty(m.pharmacy_relationship))
            {
                bool i = Entry.saveMarketer_ext("pharmacy_relationship", "pharmacy_relationship", m.pharmacy_relationship, mrk.id, 0, 0);
            }
            //mark.unique_customer_number
            if (!string.IsNullOrEmpty(m.pharmacy_customer_number))
            {
                bool i = Entry.saveMarketer_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.saveMarketer_ext("pharmacy_fax", "pharmacy_fax", m.pharmacy_fax, mrk.id, 0, 0);
            }
            //mark.preferred_geographic_market
            if (!string.IsNullOrEmpty(m.preferred_geographic_market))
            {
                bool i = Entry.saveMarketer_ext("preferred_geographic_market", "preferred_geographic_market", m.preferred_geographic_market, mrk.id, 0, 0);
            }

            return(Json(new { data = new string[] { }, message = "Successfully saved.", success = true }));
        }