Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        public void Save(long contactID)
        {
            //
            // Create a command object to invoke the stored procedure
            //
            SqlCommand cmd = new SqlCommand("net_contact_email_save", ConnectionManager.GetConnection());

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

            //
            // Input parameters
            //
            cmd.Parameters.Add(new SqlParameter("@contactID", SqlDbType.BigInt)).Direction = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar, UDDI.Constants.Lengths.Email)).Direction     = ParameterDirection.Input;
            cmd.Parameters.Add(new SqlParameter("@useType", SqlDbType.NVarChar, UDDI.Constants.Lengths.UseType)).Direction = ParameterDirection.Input;

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

            parmacc.SetLong("@contactID", contactID);
            parmacc.SetString("@email", Value);
            parmacc.SetString("@useType", UseType);

            cmd.ExecuteNonQuery();
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
        public DispositionReport DiscardAuthToken(DiscardAuthToken dat)
        {
            Debug.Enter();
            DispositionReport dr = new DispositionReport();

            try
            {
                if ((Config.GetInt("Security.AuthenticationMode") == (int)AuthenticationMode.Passport))
                {
                    PassportAuthenticator authenticator = new PassportAuthenticator();
                    authenticator.Authenticate(dat.AuthInfo, Config.GetInt("Security.TimeOut"));

                    //
                    // Call to the database to update the user status to logged off.
                    //
                    SqlCommand cmd = new SqlCommand("ADM_setPublisherStatus", ConnectionManager.GetConnection());

                    cmd.Transaction = ConnectionManager.GetTransaction();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID)).Direction = ParameterDirection.Input;
                    cmd.Parameters.Add(new SqlParameter("@publisherStatus", SqlDbType.NVarChar, UDDI.Constants.Lengths.PublisherStatus)).Direction = ParameterDirection.Input;

                    SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);
                    paramacc.SetString("@PUID", Context.User.ID);
                    paramacc.SetString("@publisherStatus", "loggedOut");
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(dr);
        }
Exemplo n.º 5
0
        public static DataView GetTaxonomyChildrenNode(int taxonomyID, string node)
        {
            Debug.Enter();

            DataSet categories = new DataSet();

            SqlCommand cmd = new SqlCommand("UI_getTaxonomyChildrenNode", 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;
            cmd.Parameters.Add(new SqlParameter("@node", SqlDbType.NVarChar, 450)).Direction = ParameterDirection.Input;

            SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);

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

            SqlDataAdapter adapter = new SqlDataAdapter(cmd);

            adapter.Fill(categories, "categories");

            Debug.Leave();

            return(categories.Tables["categories"].DefaultView);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
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());
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
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();
        }