Esempio n. 1
0
        public static DataView GetTaxonomyChildrenRoot(int taxonomyID)
        {
            Debug.Enter();

            DataSet categories = new DataSet();

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

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Transaction = ConnectionManager.GetTransaction();
            cmd.Parameters.Add(new SqlParameter("@rowCount", SqlDbType.Int)).Direction   = ParameterDirection.ReturnValue;
            cmd.Parameters.Add(new SqlParameter("@taxonomyID", SqlDbType.Int)).Direction = ParameterDirection.Input;

            SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);

            paramacc.SetInt("@taxonomyID", taxonomyID);

            SqlDataAdapter adapter = new SqlDataAdapter(cmd);

            adapter.Fill(categories, "Categories");

            Debug.Leave();

            return(categories.Tables["Categories"].DefaultView);
        }
Esempio n. 2
0
        public void Save()
        {
            Debug.Enter();

            //
            // Save the taxonomy entry.
            //
            SqlCommand cmd = new SqlCommand("net_taxonomy_save", ConnectionManager.GetConnection());

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

            cmd.Parameters.Add(new SqlParameter("@tModelKey", SqlDbType.UniqueIdentifier)).Direction = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@flag", SqlDbType.Int)).Direction       = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@taxonomyID", SqlDbType.Int)).Direction = ParameterDirection.Output;

            SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);

            paramacc.SetGuidFromKey("@tModelKey", tModelKey);
            paramacc.SetInt("@flag", taxonomyFlag);

            cmd.ExecuteNonQuery();

            int taxonomyID = paramacc.GetInt("@taxonomyID");

            foreach (TaxonomyValue tv in TaxonomyValues)
            {
                tv.Save(tModelKey);
            }
        }
Esempio n. 3
0
        public SqlDataReader GetValues(RelationType relation)
        {
            SqlCommand cmd = new SqlCommand("net_taxonomyValue_get", ConnectionManager.GetConnection());

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

            //
            // Add parameters and set values
            //
            SqlParameterAccessor populator = new SqlParameterAccessor(cmd.Parameters);

            cmd.Parameters.Add("@tModelKey", SqlDbType.UniqueIdentifier);
            cmd.Parameters.Add("@keyValue", SqlDbType.NVarChar, UDDI.Constants.Lengths.KeyValue);
            cmd.Parameters.Add("@relation", SqlDbType.Int);

            populator.SetGuidFromKey("@tModelKey", TModelKey);
            populator.SetString("@keyValue", KeyValue);
            populator.SetInt("@relation", (int)relation);

            return(cmd.ExecuteReader());
        }
Esempio n. 4
0
        public static string GetTaxonomyParent(int taxonomyID, string ID)
        {
            Debug.Enter();

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

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Transaction = ConnectionManager.GetTransaction();
            cmd.Parameters.Add(new SqlParameter("@TaxonomyID", SqlDbType.Int)).Direction   = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@ID", SqlDbType.NVarChar, 450)).Direction = ParameterDirection.Input;

            SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);

            paramacc.SetInt("@TaxonomyID", taxonomyID);
            paramacc.SetString("@ID", ID);

            string parent = (string)cmd.ExecuteScalar();

            Debug.Leave();

            return(parent);
        }
Esempio n. 5
0
        internal void Validate()
        {
            Debug.Enter();

            Utility.ValidateLength(ref UseType, "useType", UDDI.Constants.Lengths.UseType);
            Utility.ValidateLength(ref SortCode, "sortCode", UDDI.Constants.Lengths.SortCode);
            Utility.ValidateLength(ref TModelKey, "tModelKey", UDDI.Constants.Lengths.TModelKey);

            //
            // Verify that if the address is adorned with a tModelKey, each
            // of the address lines specifies a key name and value.
            //
            if (null != TModelKey)
            {
                if (Utility.StringEmpty(TModelKey))
                {
                    //
                    // trying to save a business with empty tModelKey attribute
                    // in the address element should return E_invalidKeyPassed
                    //
                    throw new UDDIException(
                              ErrorType.E_invalidKeyPassed,
                              "UDDI_ERROR_INVALIDKEYPASSED_ADDRESS_BLANKTMODELKEY");
                }
                else
                {
                    foreach (AddressLine addressLine in AddressLines)
                    {
                        if (Utility.StringEmpty(addressLine.KeyName) ||
                            Utility.StringEmpty(addressLine.KeyValue))
                        {
                            throw new UDDIException(
                                      ErrorType.E_fatalError,
                                      "UDDI_ERROR_FATALERROR_ADDRESS_MISSINGKEYNAMEKEYVALUE");
                        }
                    }

                    //
                    // call net_key_validate
                    //
                    SqlCommand cmd = new SqlCommand("net_key_validate", ConnectionManager.GetConnection());

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

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

                    SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);

                    //
                    // TODO: Need enumeration for the entityTypeID
                    //
                    paramacc.SetInt("@entityTypeID", 0);
                    paramacc.SetGuidFromKey("@entityKey", TModelKey);

                    cmd.ExecuteNonQuery();
                }
            }

            AddressLines.Validate();

            Debug.Leave();
        }