Beispiel #1
0
        public static string TModelName(string tModelKey)
        {
            Debug.Enter();

            SqlCommand cmd = new SqlCommand("net_tModel_get", 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("@operatorName", SqlDbType.NVarChar, UDDI.Constants.Lengths.OperatorName)).Direction     = ParameterDirection.Output;
            cmd.Parameters.Add(new SqlParameter("@authorizedName", SqlDbType.NVarChar, UDDI.Constants.Lengths.AuthorizedName)).Direction = ParameterDirection.Output;
            cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar, UDDI.Constants.Lengths.Name)).Direction = ParameterDirection.Output;
            cmd.Parameters.Add(new SqlParameter("@overviewURL", SqlDbType.NVarChar, UDDI.Constants.Lengths.OverviewURL)).Direction = ParameterDirection.Output;

            SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);

            paramacc.SetGuidFromKey("@tModelKey", tModelKey);

            cmd.ExecuteNonQuery();

            Debug.Leave();

            return(paramacc.GetString("@name"));
        }
Beispiel #2
0
        public void Save(string tModelKey)
        {
            Debug.Enter();

            SqlCommand cmd = new SqlCommand("net_taxonomyValue_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("@keyValue", SqlDbType.NVarChar, 128)).Direction       = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@parentKeyValue", SqlDbType.NVarChar, 128)).Direction = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@keyName", SqlDbType.NVarChar, 128)).Direction        = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@valid", SqlDbType.Bit)).Direction = ParameterDirection.Input;

            SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);

            paramacc.SetGuidFromKey("@tModelKey", tModelKey);
            paramacc.SetString("@keyValue", KeyValue);
            paramacc.SetString("@keyName", KeyNames[0].Name);
            cmd.Parameters["@valid"].Value = ValidForClassification;

            if (Utility.StringEmpty(ParentKeyValue))
            {
                paramacc.SetString("@parentKeyValue", KeyValue);
            }
            else
            {
                paramacc.SetString("@parentKeyValue", ParentKeyValue);
            }

            cmd.ExecuteNonQuery();
        }
Beispiel #3
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);
            }
        }
        internal void Validate()
        {
            SqlCommand cmd = new SqlCommand("net_categoryBag_validate", ConnectionManager.GetConnection());

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

            cmd.Parameters.Add(new SqlParameter("@keyValue", SqlDbType.NVarChar, UDDI.Constants.Lengths.KeyValue)).Direction = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@tModelKey", SqlDbType.UniqueIdentifier)).Direction = ParameterDirection.Input;

            SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);

            paramacc.SetString("@keyValue", KeyValue);
            paramacc.SetGuidFromKey("@tModelKey", TModelKey);

            cmd.ExecuteNonQuery();
        }
        public void Delete()
        {
            Debug.Enter();

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

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

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

            SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);

            paramacc.SetGuidFromKey("@tModelKey", tModelKey);

            cmd.ExecuteNonQuery();

            Debug.Leave();
        }
        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());
        }
Beispiel #7
0
        internal void Validate(string parentKey, KeyedReferenceType keyedReferenceType)
        {
            Debug.Enter();

            //
            // IN69: 4. When a keyedReference is saved within a categoryBag without specifying
            // a tModelKey (that is no tModelKey attribute at all) the UDDI server MUST
            // assume the urn:uddi-org:general_keywords tModelKey.  The resulting response
            // MUST add to the keyedReference the attribute
            // tModelKey=”uuid:A035A07C-F362-44dd-8F95-E2B134BF43B4” (case does not matter).
            //
            if (KeyedReferenceType.CategoryBag == keyedReferenceType && Utility.StringEmpty(TModelKey))
            {
                TModelKey = Config.GetString("TModelKey.GeneralKeywords");
            }

            //
            // IN69: 3. A UDDI server MUST reject a save_xxx request with a keyedReferences
            // in an identifierBag where no tModelKey attribute is specified.
            //
            if (KeyedReferenceType.IdentifierBag == keyedReferenceType && Utility.StringEmpty(TModelKey))
            {
                throw new UDDIException(
                          ErrorType.E_fatalError,
                          "UDDI_ERROR_FATALERROR_IDBAG_MISSINGTMODELKEY");
            }

            //
            // IN69: 1. A UDDI server MUST reject a save_xxx request with a keyedReference
            // with no keyName when the urn:uddi-org:general_keywords is involved
            //
            // #1718, make sure the comparison is not case sensitive.
            //
            if (Config.GetString("TModelKey.GeneralKeywords").ToLower().Equals(TModelKey) && null == keyname)
            {
                throw new UDDIException(
                          ErrorType.E_fatalError,
                          "UDDI_ERROR_FATALERROR_GENERALKEYWORDS_BLANKNAME");
            }

            //
            // IN69: 2. A UDDI server MUST reject a save_xxx request with a
            // keyedReference where only the keyValue is specified
            //
            if (Utility.StringEmpty(tmodelkey) && Utility.StringEmpty(keyname))
            {
                throw new UDDIException(
                          ErrorType.E_fatalError,
                          "UDDI_ERROR_FATALERROR_ASSERTION_MISSINGTMODELKEYORNAME");
            }

            //
            // Validate TModelKey, KeyName, and KeyValue length.
            //
            if (KeyedReferenceType.Assertion == keyedReferenceType)
            {
                if (Utility.StringEmpty(tmodelkey) ||
                    null == keyname ||
                    null == keyvalue)
                {
                    throw new UDDIException(
                              ErrorType.E_fatalError,
                              "UDDI_ERROR_FATALERROR_ASSERTION_MISSINGKEYNAMEORVALUE");
                }
            }

            Utility.ValidateLength(ref tmodelkey, "tModelKey", UDDI.Constants.Lengths.TModelKey);
            Utility.ValidateLength(ref keyname, "keyName", UDDI.Constants.Lengths.KeyName);
            Utility.ValidateLength(ref keyvalue, "keyValue", UDDI.Constants.Lengths.KeyValue);

            Debug.VerifyKey(tmodelkey);

            //
            // TODO: We are skipping validation of this keyedreference here if the parent entity key is
            // the same as the tModelKey for the identifer bag or category bag. Why???
            //
            // Please insert a comment to describe why this is necessary
            //
            if (parentKey != TModelKey)
            {
                //
                // call net_keyedReference_validate
                //
                SqlCommand cmd = new SqlCommand("net_keyedReference_validate", ConnectionManager.GetConnection());

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

                cmd.Parameters.Add(new SqlParameter("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID)).Direction = ParameterDirection.Input;
                cmd.Parameters.Add(new SqlParameter("@keyedRefType", SqlDbType.TinyInt)).Direction = ParameterDirection.Input;
                cmd.Parameters.Add(new SqlParameter("@keyValue", SqlDbType.NVarChar, UDDI.Constants.Lengths.KeyValue)).Direction = ParameterDirection.Input;
                cmd.Parameters.Add(new SqlParameter("@tModelKey", SqlDbType.UniqueIdentifier)).Direction = ParameterDirection.Input;

                SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);

                paramacc.SetString("@PUID", Context.User.ID);
                paramacc.SetShort("@keyedRefType", (short)keyedReferenceType);
                paramacc.SetString("@keyValue", KeyValue);
                paramacc.SetGuidFromKey("@tModelKey", TModelKey);

                cmd.ExecuteNonQuery();
            }

            Debug.Leave();
        }
        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();
        }