예제 #1
0
        /// <summary>Inserts a Currency record.</summary>
        /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
        /// <param name="rowVersion">The version number of the row.</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>
        /// <param name="externalId2">The value for the ExternalId2 column.</param>
        /// <param name="externalId3">The value for the ExternalId3 column.</param>
        /// <param name="externalId4">The value for the ExternalId4 column.</param>
        /// <param name="externalId5">The value for the ExternalId5 column.</param>
        /// <param name="externalId6">The value for the ExternalId6 column.</param>
        /// <param name="externalId7">The value for the ExternalId7 column.</param>
        /// <param name="groupPermission">The value for the GroupPermission column.</param>
        /// <param name="hidden">The value for the Hidden column.</param>
        /// <param name="name">The value for the Name column.</param>
        /// <param name="owner">The value for the Owner column.</param>
        /// <param name="ownerPermission">The value for the OwnerPermission column.</param>
        /// <param name="readOnly">The value for the ReadOnly column.</param>
        /// <param name="worldPermission">The value for the WorldPermission column.</param>
        /// <param name="countryId">The value for the CountryId column.</param>
        /// <param name="typeCode">The value for the TypeCode column.</param>
        /// <param name="symbol">The value for the Symbol column.</param>
        /// <param name="securityTypeCode">The value for the SecurityTypeCode column.</param>
        /// <param name="priceFactor">The value for the PriceFactor column.</param>
        /// <param name="quantityFactor">The value for the QuantityFactor column.</param>
        public static int Insert(
            AdoTransaction adoTransaction,
            SqlTransaction sqlTransaction,
            ref long rowVersion,
            object description,
            object externalId0,
            object externalId1,
            object externalId2,
            object externalId3,
            object externalId4,
            object externalId5,
            object externalId6,
            object externalId7,
            object groupPermission,
            object hidden,
            string name,
            object owner,
            object ownerPermission,
            object readOnly,
            object worldPermission,
            int countryId,
            object typeCode,
            object symbol,
            object securityTypeCode,
            object priceFactor,
            object quantityFactor)
        {
            // Accessor for the Currency Table.
            ServerDataModel.CurrencyDataTable currencyTable = ServerDataModel.Currency;
            // Apply Defaults
            if ((securityTypeCode == null))
            {
                securityTypeCode = 0;
            }
            if ((priceFactor == null))
            {
                priceFactor = 1.0m;
            }
            if ((quantityFactor == null))
            {
                quantityFactor = 1.0m;
            }
            // Insert the base members using the base class.
            int currencyId = Security.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, countryId, typeCode, ((int)(securityTypeCode)), ((decimal)(quantityFactor)), ((decimal)(priceFactor)), symbol);

            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Insert the record into the ADO database.
            ServerDataModel.CurrencyRow currencyRow = currencyTable.NewCurrencyRow();
            currencyRow[currencyTable.RowVersionColumn] = rowVersion;
            currencyRow[currencyTable.CurrencyIdColumn] = currencyId;
            currencyTable.AddCurrencyRow(currencyRow);
            adoTransaction.DataRows.Add(currencyRow);
            // Insert the record into the SQL database.
            SqlCommand sqlCommand = new SqlCommand("insert \"Currency\" (\"rowVersion\",CurrencyId) values (@rowVersion,@currencyId)");

            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("@currencyId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, currencyId));
            sqlCommand.ExecuteNonQuery();
            // Return Statements
            return(currencyRow.CurrencyId);
        }