AJH.CMS.Core.Data.CombinationProductDataMapper.AddCombinationAttribute C# (CSharp) Method

AddCombinationAttribute() static private method

static private AddCombinationAttribute ( int combinationId, int attributeId ) : void
combinationId int
attributeId int
return void
        internal static void AddCombinationAttribute(int combinationId, int attributeId)
        {
            using (SqlConnection sqlConnection = new SqlConnection(CMSCoreBase.CMSCoreConnectionString))
            {
                SqlCommand sqlCommand = new SqlCommand(SN_COMBINATION_ATTRIBUTE_ADD, sqlConnection);
                sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;

                SqlParameter sqlParameter = null;

                sqlParameter = new SqlParameter(PN_COMBINATION_ID, System.Data.SqlDbType.Int);
                sqlParameter.Direction = System.Data.ParameterDirection.Input;
                sqlParameter.Value = combinationId;
                sqlCommand.Parameters.Add(sqlParameter);

                sqlParameter = new SqlParameter(AttributeDataMapper.PN_ATTRIBUTE_ID, System.Data.SqlDbType.Int);
                sqlParameter.Direction = System.Data.ParameterDirection.Input;
                sqlParameter.Value = attributeId;
                sqlCommand.Parameters.Add(sqlParameter);

                try
                {
                    sqlCommand.Connection.Open();
                    sqlCommand.ExecuteNonQuery();
                    sqlCommand.Connection.Close();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }