Beispiel #1
0
        /// <summary>Inserts a AlgorithmType record.</summary>
        /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
        /// <param name="algorithmTypeCode">The value for the AlgorithmTypeCode column.</param>
        /// <param name="name">The value for the Name column.</param>
        /// <param name="description">The value for the Description column.</param>
        /// <param name="externalId0">The value for the ExternalId0 column.</param>
        /// <param name="externalId1">The value for the ExternalId1 column.</param>
        public static void Insert(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, ref long rowVersion, int algorithmTypeCode, object name, object description, object externalId0, object externalId1)
        {
            // Accessor for the AlgorithmType Table.
            ServerDataModel.AlgorithmTypeDataTable algorithmTypeTable = ServerDataModel.AlgorithmType;
            // Apply Defaults
            if ((name == null))
            {
                name = System.DBNull.Value;
            }
            if ((description == null))
            {
                description = System.DBNull.Value;
            }
            if ((externalId0 == null))
            {
                externalId0 = System.DBNull.Value;
            }
            if ((externalId1 == null))
            {
                externalId1 = System.DBNull.Value;
            }
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Insert the record into the ADO database.
            ServerDataModel.AlgorithmTypeRow algorithmTypeRow = algorithmTypeTable.NewAlgorithmTypeRow();
            algorithmTypeRow[algorithmTypeTable.RowVersionColumn]        = rowVersion;
            algorithmTypeRow[algorithmTypeTable.AlgorithmTypeCodeColumn] = algorithmTypeCode;
            algorithmTypeRow[algorithmTypeTable.NameColumn]        = name;
            algorithmTypeRow[algorithmTypeTable.DescriptionColumn] = description;
            algorithmTypeRow[algorithmTypeTable.ExternalId0Column] = externalId0;
            algorithmTypeRow[algorithmTypeTable.ExternalId1Column] = externalId1;
            algorithmTypeTable.AddAlgorithmTypeRow(algorithmTypeRow);
            adoTransaction.DataRows.Add(algorithmTypeRow);
            // Insert the record into the SQL database.
            SqlCommand sqlCommand = new SqlCommand("insert \"AlgorithmType\" (\"rowVersion\",\"AlgorithmTypeCode\",\"Name\",\"Description\",\"Ex" +
                                                   "ternalId0\",\"ExternalId1\") values (@rowVersion,@algorithmTypeCode,@name,@descript" +
                                                   "ion,@externalId0,@externalId1)");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@rowVersion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, rowVersion));
            sqlCommand.Parameters.Add(new SqlParameter("@algorithmTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, algorithmTypeCode));
            sqlCommand.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, name));
            sqlCommand.Parameters.Add(new SqlParameter("@description", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, description));
            sqlCommand.Parameters.Add(new SqlParameter("@externalId0", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, externalId0));
            sqlCommand.Parameters.Add(new SqlParameter("@externalId1", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, externalId1));
            sqlCommand.ExecuteNonQuery();
        }