Esempio n. 1
0
        public static string BusinessName(string businessKey)
        {
            string name = null;

            Debug.Enter();

            SqlCommand cmd = new SqlCommand("net_businessEntity_names_get", ConnectionManager.GetConnection());

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Transaction = ConnectionManager.GetTransaction();

            cmd.Parameters.Add(new SqlParameter("@businessKey", SqlDbType.UniqueIdentifier)).Direction = ParameterDirection.Input;

            SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);

            paramacc.SetGuidFromString("@businessKey", businessKey);

            SqlDataReaderAccessor reader = new SqlDataReaderAccessor(cmd.ExecuteReader());

            try
            {
                if (reader.Read())
                {
                    name = reader.GetString("name");
                }
            }
            finally
            {
                reader.Close();
            }

            Debug.Leave();

            return(name);
        }
        public void Save(string businessKey)
        {
            //
            // Create a command object to invoke the stored procedure
            //
            SqlCommand cmd = new SqlCommand("net_businessEntity_discoveryUrl_save", ConnectionManager.GetConnection());

            cmd.Transaction = ConnectionManager.GetTransaction();
            cmd.CommandType = CommandType.StoredProcedure;

            //
            // Input parameters
            //
            cmd.Parameters.Add(new SqlParameter("@businessKey", SqlDbType.UniqueIdentifier));
            cmd.Parameters.Add(new SqlParameter("@useType", SqlDbType.NVarChar, UDDI.Constants.Lengths.UseType));
            cmd.Parameters.Add(new SqlParameter("@discoveryUrl", SqlDbType.NVarChar, UDDI.Constants.Lengths.DiscoveryURL));

            //
            // Set parameters
            //
            SqlParameterAccessor parmacc = new SqlParameterAccessor(cmd.Parameters);

            parmacc.SetGuidFromString("@businessKey", businessKey);
            parmacc.SetString("@useType", UseType);
            parmacc.SetString("@discoveryUrl", Value);

            //
            // Execute save
            //
            cmd.ExecuteNonQuery();
        }
Esempio n. 3
0
        public void Save(string businessKey)
        {
            //
            // Create a command object to invoke the stored procedure
            //
            SqlCommand cmd = new SqlCommand("net_businessEntity_contact_save", ConnectionManager.GetConnection());

            cmd.Transaction = ConnectionManager.GetTransaction();
            cmd.CommandType = CommandType.StoredProcedure;

            //
            // Parameters
            //
            cmd.Parameters.Add(new SqlParameter("@businessKey", SqlDbType.UniqueIdentifier)).Direction = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@useType", SqlDbType.NVarChar, UDDI.Constants.Lengths.UseType)).Direction       = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@personName", SqlDbType.NVarChar, UDDI.Constants.Lengths.PersonName)).Direction = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@contactID", SqlDbType.BigInt)).Direction = ParameterDirection.Output;

            //
            // Set parameter values and execute query
            //
            SqlParameterAccessor parmacc = new SqlParameterAccessor(cmd.Parameters);

            parmacc.SetGuidFromString("@businessKey", businessKey);
            parmacc.SetString("@personName", PersonName);
            parmacc.SetString("@useType", UseType);

            cmd.ExecuteScalar();

            //
            // Move out parameters into local variables
            //
            long ContactID = parmacc.GetLong("@contactID");

            //
            // Save sub-objects
            //
            Descriptions.Save(ContactID, EntityType.Contact);
            Phones.Save(ContactID);
            Emails.Save(ContactID);
            Addresses.Save(ContactID);
        }
        public void Get(string businessKey)
        {
            //
            // This procedure add the discoveryURLs that were persisted to the database
            // this does not include the default discoveryURL, it is added by the the businessEntity.Get()
            // method since it has the visibility of the operator name who owns the entity.
            //

            //
            // Create a command object to invoke the stored procedure
            //
            SqlStoredProcedureAccessor cmd = new SqlStoredProcedureAccessor("net_businessEntity_discoveryURLs_get");

            //
            // Add parameters
            //
            cmd.Parameters.Add("@businessKey", SqlDbType.UniqueIdentifier);
            cmd.Parameters.SetGuidFromString("@businessKey", businessKey);

            //
            // Execute query
            //
            SqlDataReaderAccessor reader = cmd.ExecuteReader();

            try
            {
                Read(reader);
            }
            finally
            {
                reader.Close();
            }

#if never
            //
            // This procedure add the discoveryURLs that were persisted to the database
            // this does not include the default discoveryURL, it is added by the the businessEntity.Get()
            // method since it has the visibility of the operator name who owns the entity.
            //
            const int UseTypeIndex = 0;
            const int UrlIndex     = 1;

            //
            // Create a command object to invoke the stored procedure
            //
            SqlCommand cmd = new SqlCommand("net_businessEntity_discoveryURLs_get", ConnectionManager.GetConnection());

            cmd.Transaction = ConnectionManager.GetTransaction();
            cmd.CommandType = CommandType.StoredProcedure;

            //
            // Add parameters
            //
            cmd.Parameters.Add(new SqlParameter("@businessKey", SqlDbType.UniqueIdentifier));
            SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);
            paramacc.SetGuidFromString("@businessKey", businessKey);

            //
            // Execute query
            //
            SqlDataReader rdr = cmd.ExecuteReader();
            try
            {
                SqlDataReaderAccessor rdracc = new SqlDataReaderAccessor(rdr);

                //
                // The discoveryUrls will be contained in the result set
                //
                while (rdr.Read())
                {
                    string useType = rdracc.GetString(UseTypeIndex);

                    if (null == useType)
                    {
                        useType = "";
                    }

                    Add(rdracc.GetString(UrlIndex), useType);
                }
            }
            finally
            {
                rdr.Close();
            }
#endif
        }
Esempio n. 5
0
        public void Get(string businessKey)
        {
            //
            // Create a command object to invoke the stored procedure net_get_contacts
            //
            SqlStoredProcedureAccessor cmd = new SqlStoredProcedureAccessor("net_businessEntity_contacts_get");

            //
            // Input parameters
            //
            cmd.Parameters.Add("@businessKey", SqlDbType.UniqueIdentifier, ParameterDirection.Input);
            cmd.Parameters.SetGuidFromString("@businessKey", businessKey);

            //
            // Run the stored procedure
            //
            SqlDataReaderAccessor reader     = cmd.ExecuteReader();
            ArrayList             contactIds = null;

            try
            {
                contactIds = Read(reader);
            }
            finally
            {
                reader.Close();
            }

            Populate(contactIds);
#if never
            const int ContactIdIndex  = 0;
            const int UseTypeIndex    = 1;
            const int PersonNameIndex = 2;
            ArrayList contactIds      = new ArrayList();

            //
            // Create a command object to invoke the stored procedure net_get_contacts
            //
            SqlCommand cmd = new SqlCommand("net_businessEntity_contacts_get", ConnectionManager.GetConnection());

            cmd.Transaction = ConnectionManager.GetTransaction();
            cmd.CommandType = CommandType.StoredProcedure;

            //
            // Input parameters
            //
            cmd.Parameters.Add(new SqlParameter("@businessKey", SqlDbType.UniqueIdentifier)).Direction = ParameterDirection.Input;

            //
            // Set parameter values
            //
            SqlParameterAccessor populator = new SqlParameterAccessor(cmd.Parameters);
            populator.SetGuidFromString("@businessKey", businessKey);

            //
            // Run the stored procedure
            //
            SqlDataReader rdr = cmd.ExecuteReader();
            try
            {
                SqlDataReaderAccessor dracc = new SqlDataReaderAccessor(rdr);

                //
                // The contacts will be contained in the result set
                //
                while (rdr.Read())
                {
                    //
                    // construct a new contact from the data in this row, fully populate contact and add to collection
                    //
                    Add(new Contact(dracc.GetString(PersonNameIndex), dracc.GetString(UseTypeIndex)));
                    contactIds.Add(dracc.GetInt(ContactIdIndex));
                }
            }
            finally
            {
                rdr.Close();
            }

            int i = 0;
            foreach (Contact contact in this)
            {
                contact.Get((int)contactIds[i++]);
            }
#endif
        }