Example #1
0
 /// <summary>Inserts a Equity 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="issuerId">The value for the IssuerId column.</param>
 /// <param name="exchangeId">The value for the ExchangeId column.</param>
 /// <param name="settlementId">The value for the SettlementId column.</param>
 /// <param name="securityTypeCode">The value for the SecurityTypeCode column.</param>
 /// <param name="equityTypeCode">The value for the EquityTypeCode column.</param>
 /// <param name="priceFactor">The value for the PriceFactor column.</param>
 /// <param name="quantityFactor">The value for the QuantityFactor column.</param>
 /// <param name="sharesOutstanding">The value for the SharesOutstanding 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 issuerId, 
             object exchangeId, 
             int settlementId, 
             object securityTypeCode, 
             int equityTypeCode, 
             object priceFactor, 
             object quantityFactor, 
             object sharesOutstanding)
 {
     // Accessor for the Equity Table.
     ServerDataModel.EquityDataTable equityTable = ServerDataModel.Equity;
     // Apply Defaults
     if ((issuerId == null))
     {
         issuerId = System.DBNull.Value;
     }
     if ((exchangeId == null))
     {
         exchangeId = System.DBNull.Value;
     }
     if ((securityTypeCode == null))
     {
         securityTypeCode = 1;
     }
     if ((priceFactor == null))
     {
         priceFactor = 1.0m;
     }
     if ((quantityFactor == null))
     {
         quantityFactor = 1.0m;
     }
     if ((sharesOutstanding == null))
     {
         sharesOutstanding = System.DBNull.Value;
     }
     // Insert the base members using the base class.
     int equityId = 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.EquityRow equityRow = equityTable.NewEquityRow();
     equityRow[equityTable.RowVersionColumn] = rowVersion;
     equityRow[equityTable.EquityIdColumn] = equityId;
     equityRow[equityTable.IssuerIdColumn] = issuerId;
     equityRow[equityTable.ExchangeIdColumn] = exchangeId;
     equityRow[equityTable.SettlementIdColumn] = settlementId;
     equityRow[equityTable.EquityTypeCodeColumn] = equityTypeCode;
     equityRow[equityTable.SharesOutstandingColumn] = sharesOutstanding;
     equityTable.AddEquityRow(equityRow);
     adoTransaction.DataRows.Add(equityRow);
     // Insert the record into the SQL database.
     SqlCommand sqlCommand = new SqlCommand("insert \"Equity\" (\"rowVersion\",EquityId,IssuerId,ExchangeId,SettlementId,EquityTyp" +
             "eCode,SharesOutstanding) values (@rowVersion,@equityId,@issuerId,@exchangeId,@se" +
             "ttlementId,@equityTypeCode,@sharesOutstanding)");
     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("@equityId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, equityId));
     sqlCommand.Parameters.Add(new SqlParameter("@issuerId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, issuerId));
     sqlCommand.Parameters.Add(new SqlParameter("@exchangeId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, exchangeId));
     sqlCommand.Parameters.Add(new SqlParameter("@settlementId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, settlementId));
     sqlCommand.Parameters.Add(new SqlParameter("@equityTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, equityTypeCode));
     sqlCommand.Parameters.Add(new SqlParameter("@sharesOutstanding", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, sharesOutstanding));
     sqlCommand.ExecuteNonQuery();
     // Return Statements
     return equityRow.EquityId;
 }