Exemplo n.º 1
0
        /// <summary>Inserts a AccountBase record using Metadata Parameters.</summary>
        /// <param name="parameters">Contains the metadata parameters.</param>
        public new static void Update(ParameterList parameters)
        {
            // Extract the parameters from the command batch.
            AdoTransaction adoTransaction  = parameters["adoTransaction"];
            SqlTransaction sqlTransaction  = parameters["sqlTransaction"];
            long           rowVersion      = parameters["rowVersion"];
            object         description     = parameters["description"].Value;
            object         externalId0     = parameters["externalId0"].Value;
            object         externalId1     = parameters["externalId1"].Value;
            object         externalId2     = parameters["externalId2"].Value;
            object         externalId3     = parameters["externalId3"].Value;
            object         externalId4     = parameters["externalId4"].Value;
            object         externalId5     = parameters["externalId5"].Value;
            object         externalId6     = parameters["externalId6"].Value;
            object         externalId7     = parameters["externalId7"].Value;
            object         groupPermission = parameters["groupPermission"].Value;
            object         hidden          = parameters["hidden"].Value;
            object         name            = parameters["name"].Value;
            object         owner           = parameters["owner"].Value;
            object         ownerPermission = parameters["ownerPermission"].Value;
            object         readOnly        = parameters["readOnly"].Value;
            object         worldPermission = parameters["worldPermission"].Value;
            int            accountBaseId   = parameters["accountBaseId"];
            object         address0        = parameters["address0"].Value;
            object         address1        = parameters["address1"].Value;
            object         address2        = parameters["address2"].Value;
            object         city            = parameters["city"].Value;
            object         countryId       = parameters["countryId"].Value;
            object         currencyId      = parameters["currencyId"].Value;
            object         mnemonic        = parameters["mnemonic"].Value;
            object         postalCode      = parameters["postalCode"].Value;
            object         provinceId      = parameters["provinceId"].Value;
            object         typeCode        = parameters["typeCode"].Value;
            object         userId          = parameters["userId"].Value;
            object         userData0       = parameters["userData0"].Value;
            object         userData1       = parameters["userData1"].Value;
            object         userData2       = parameters["userData2"].Value;
            object         userData3       = parameters["userData3"].Value;
            object         userData4       = parameters["userData4"].Value;
            object         userData5       = parameters["userData5"].Value;
            object         userData6       = parameters["userData6"].Value;
            object         userData7       = parameters["userData7"].Value;

            // Call the internal method to complete the operation.
            AccountBase.Update(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, accountBaseId, address0, address1, address2, city, countryId, currencyId, mnemonic, postalCode, provinceId, typeCode, userId, userData0, userData1, userData2, userData3, userData4, userData5, userData6, userData7);
            // Return values.
            parameters["rowVersion"] = rowVersion;
        }
Exemplo n.º 2
0
 /// <summary>Collects the table lock request(s) for an Update operation</summary>
 /// <param name="adoTransaction">A list of locks required for this operation.</param>
 public new static void Update(AdoTransaction adoTransaction)
 {
     // Lock the tables at the base level of the object hierarchy.
     AccountBase.Update(adoTransaction);
 }
Exemplo n.º 3
0
        /// <summary>Updates a AccountGroup 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="address0">The value for the Address0 column.</param>
        /// <param name="address1">The value for the Address1 column.</param>
        /// <param name="address2">The value for the Address2 column.</param>
        /// <param name="city">The value for the City column.</param>
        /// <param name="countryId">The value for the CountryId column.</param>
        /// <param name="currencyId">The value for the CurrencyId column.</param>
        /// <param name="mnemonic">The value for the Mnemonic column.</param>
        /// <param name="postalCode">The value for the PostalCode column.</param>
        /// <param name="provinceId">The value for the ProvinceId column.</param>
        /// <param name="userId">The value for the UserId column.</param>
        /// <param name="userData0">The value for the UserData0 column.</param>
        /// <param name="userData1">The value for the UserData1 column.</param>
        /// <param name="userData2">The value for the UserData2 column.</param>
        /// <param name="userData3">The value for the UserData3 column.</param>
        /// <param name="userData4">The value for the UserData4 column.</param>
        /// <param name="userData5">The value for the UserData5 column.</param>
        /// <param name="userData6">The value for the UserData6 column.</param>
        /// <param name="userData7">The value for the UserData7 column.</param>
        /// <param name="accountGroupId">The value for the AccountGroupId column.</param>
        /// <param name="typeCode">The value for the TypeCode column.</param>
        public static void Update(
            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,
            object name,
            object owner,
            object ownerPermission,
            object readOnly,
            object worldPermission,
            object address0,
            object address1,
            object address2,
            object city,
            object countryId,
            object currencyId,
            object mnemonic,
            object postalCode,
            object provinceId,
            object userId,
            object userData0,
            object userData1,
            object userData2,
            object userData3,
            object userData4,
            object userData5,
            object userData6,
            object userData7,
            int accountGroupId,
            object typeCode)
        {
            // Accessor for the AccountGroup Table.
            ServerMarketData.AccountGroupDataTable accountGroupTable = ServerMarketData.AccountGroup;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.AccountGroupRow accountGroupRow = accountGroupTable.FindByAccountGroupId(accountGroupId);
            if ((accountGroupRow == null))
            {
                throw new Exception(string.Format("The AccountGroup table does not have an element identified by {0}", accountGroupId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((accountGroupRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Apply Defaults
            // Insert the base members using the base class.  Note that optimistic concurrency is only used
            // by the top level type in the hierarchy, it is bypassed after you pass the first test.
            long baseRowVersion = accountGroupRow.AccountBaseRow.RowVersion;

            AccountBase.Update(adoTransaction, sqlTransaction, ref baseRowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, accountGroupId, address0, address1, address2, city, countryId, currencyId, mnemonic, postalCode, provinceId, typeCode, userId, userData0, userData1, userData2, userData3, userData4, userData5, userData6, userData7);
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Update the record in the ADO database.
            accountGroupRow[accountGroupTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(accountGroupRow);
            // Update the record in the SQL database.
        }
Exemplo n.º 4
0
        /// <summary>Updates a Account 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="address0">The value for the Address0 column.</param>
        /// <param name="address1">The value for the Address1 column.</param>
        /// <param name="address2">The value for the Address2 column.</param>
        /// <param name="city">The value for the City column.</param>
        /// <param name="countryId">The value for the CountryId column.</param>
        /// <param name="currencyId">The value for the CurrencyId column.</param>
        /// <param name="mnemonic">The value for the Mnemonic column.</param>
        /// <param name="postalCode">The value for the PostalCode column.</param>
        /// <param name="provinceId">The value for the ProvinceId column.</param>
        /// <param name="userId">The value for the UserId column.</param>
        /// <param name="userData0">The value for the UserData0 column.</param>
        /// <param name="userData1">The value for the UserData1 column.</param>
        /// <param name="userData2">The value for the UserData2 column.</param>
        /// <param name="userData3">The value for the UserData3 column.</param>
        /// <param name="userData4">The value for the UserData4 column.</param>
        /// <param name="userData5">The value for the UserData5 column.</param>
        /// <param name="userData6">The value for the UserData6 column.</param>
        /// <param name="userData7">The value for the UserData7 column.</param>
        /// <param name="accountId">The value for the AccountId column.</param>
        /// <param name="lotHandlingCode">The value for the LotHandlingCode column.</param>
        /// <param name="typeCode">The value for the TypeCode column.</param>
        public static void Update(
            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,
            object name,
            object owner,
            object ownerPermission,
            object readOnly,
            object worldPermission,
            object address0,
            object address1,
            object address2,
            object city,
            object countryId,
            object currencyId,
            object mnemonic,
            object postalCode,
            object provinceId,
            object userId,
            object userData0,
            object userData1,
            object userData2,
            object userData3,
            object userData4,
            object userData5,
            object userData6,
            object userData7,
            int accountId,
            object lotHandlingCode,
            object typeCode)
        {
            // Accessor for the Account Table.
            ServerMarketData.AccountDataTable accountTable = ServerMarketData.Account;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.AccountRow accountRow = accountTable.FindByAccountId(accountId);
            if ((accountRow == null))
            {
                throw new Exception(string.Format("The Account table does not have an element identified by {0}", accountId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((accountRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Apply Defaults
            if ((lotHandlingCode == null))
            {
                lotHandlingCode = accountRow[accountTable.LotHandlingCodeColumn];
            }
            // Insert the base members using the base class.  Note that optimistic concurrency is only used
            // by the top level type in the hierarchy, it is bypassed after you pass the first test.
            long baseRowVersion = accountRow.AccountBaseRow.RowVersion;

            AccountBase.Update(adoTransaction, sqlTransaction, ref baseRowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, accountId, address0, address1, address2, city, countryId, currencyId, mnemonic, postalCode, provinceId, typeCode, userId, userData0, userData1, userData2, userData3, userData4, userData5, userData6, userData7);
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Update the record in the ADO database.
            accountRow[accountTable.RowVersionColumn]      = rowVersion;
            accountRow[accountTable.LotHandlingCodeColumn] = lotHandlingCode;
            adoTransaction.DataRows.Add(accountRow);
            // Update the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Account\" set \"RowVersion\"=@rowVersion,\"LotHandlingCode\"=@lotHandlingCode " +
                                                   "where \"AccountId\"=@accountId");

            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("@accountId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, accountId));
            sqlCommand.Parameters.Add(new SqlParameter("@lotHandlingCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, lotHandlingCode));
            // Update the record in the SQL database.
            sqlCommand.ExecuteNonQuery();
        }