예제 #1
0
            /*
             * Create a Provider using results from a DataSet
             *
             */
            public Provider CreateProvider(DataRow parent, DataRow[] tx, DataRow[] oth)
            {
                // values
                Provider.NPIType _type = (Provider.NPIType)parent["Type"];
                string           _name;

                // Create a Name field that is either an Individual (i.e. Physician) or a Company/Org
                if (_type == Provider.NPIType.Individual)
                {
                    _name = parent["NamePrefix"] + " "
                            + parent["NameFirst"] + " "
                            + parent["NameLast"] + " "
                            + parent["NameSuffix"];
                    ;
                }
                else
                {
                    _name = parent["OrgName"].ToString();
                }

                // create the Provider using a Builder
                Provider.Builder provbuilder = Provider.CreateBuilder()
                                               .NPI(parent["NPI"].ToString())
                                               .Type(_type)
                                               .Name(_name)
                                               .AddrLine1(parent["AddrLine1"].ToString())
                                               .AddrLine2(parent["AddrLine2"].ToString())
                                               .AddrCity(parent["AddrCity"].ToString())
                                               .AddrState(parent["AddrState"].ToString())
                                               .AddrZip(parent["AddrZip"].ToString());

                // Add the Taxonomy for this Provider
                foreach (DataRow row in tx)
                {
                    provbuilder.AddTx(new Taxonomy()
                    {
                        TxCode         = row["TxCode"].ToString(),
                        Classification = row["Classification"].ToString(),
                        Specialization = row["Specialization"].ToString()
                    }
                                      );
                }

                // Add the Other Provider Relationships
                foreach (DataRow row in oth)
                {
                    provbuilder.AddOth(new OthProvider()
                    {
                        OthId       = row["OthId"].ToString(),
                        OthTypeCode = row["OthTypeCode"].ToString(),
                        OthIssuer   = row["OthIssuer"].ToString(),
                        OthState    = row["OthState"].ToString()
                    }
                                       );
                }

                Provider prov = provbuilder.build();

                return(prov);
            }
예제 #2
0
            /*
             * Create a single Provider using results from a SqlDataReader
             *
             */
            public Provider CreateProvider(SqlDataReader rdr)
            {
                // values
                int _NPI  = rdr.GetOrdinal("NPI");
                int _Type = rdr.GetOrdinal("Type");

                Provider.NPIType _type = (Provider.NPIType)rdr.GetInt32(_Type);
                string           _name;

                // Create a Name field that is either an Individual (i.e. Physician) or a Company/Org
                if (_type == Provider.NPIType.Individual)
                {
                    _name = rdr.GetColString("NamePrefix") + " "
                            + rdr.GetColString("NameFirst") + " "
                            + rdr.GetColString("NameLast") + " "
                            + rdr.GetColString("NameSuffix");
                    ;
                }
                else
                {
                    _name = rdr.GetColString("OrgName");
                }

                // create the Provider using a Builder
                Provider.Builder provbuilder = Provider.CreateBuilder()
                                               .NPI(rdr.GetValue(_NPI).ToString())
                                               .Type(_type)
                                               .Name(_name)
                                               .AddrLine1(rdr.GetColString("AddrLine1"))
                                               .AddrLine2(rdr.GetColString("AddrLine2"))
                                               .AddrCity(rdr.GetColString("AddrCity"))
                                               .AddrState(rdr.GetColString("AddrState"))
                                               .AddrZip(rdr.GetColString("AddrZip"));

                // get Taxonomy
                rdr.NextResult();
                while (rdr.Read())
                {
                    provbuilder.AddTx(new Taxonomy()
                    {
                        TxCode         = rdr.GetColString("TxCode"),
                        Classification = rdr.GetColString("Classification"),
                        Specialization = rdr.GetColString("Specialization")
                    }
                                      );
                }

                // get Other Provider Relationships
                rdr.NextResult();
                while (rdr.Read())
                {
                    provbuilder.AddOth(new OthProvider()
                    {
                        OthId       = rdr.GetColString("OthId"),
                        OthTypeCode = rdr.GetColString("OthTypeCode"),
                        OthIssuer   = rdr.GetColString("OthIssuer"),
                        OthState    = rdr.GetColString("OthState")
                    }
                                       );
                }


                Provider prov = provbuilder.build();

                return(prov);
            }