/// <summary>
        /// [To be supplied.]
        /// </summary>
        public new tblOrderItem_Record MemberwiseClone()
        {
            tblOrderItem_Record newRecord = new tblOrderItem_Record();

            newRecord.recordWasLoadedFromDB = this.recordWasLoadedFromDB;
            newRecord.recordIsLoaded        = this.recordIsLoaded;
            newRecord.connectionString      = this.connectionString;

            newRecord.col_Oit_GuidID = this.col_Oit_GuidID;


            newRecord.col_Oit_GuidOrderIDWasSet     = this.col_Oit_GuidOrderIDWasSet;
            newRecord.col_Oit_GuidOrderIDWasUpdated = this.col_Oit_GuidOrderIDWasUpdated;
            newRecord.col_Oit_GuidOrderID           = this.col_Oit_GuidOrderID;

            newRecord.col_Oit_GuidOrderID_Record = this.col_Oit_GuidOrderID_Record.MemberwiseClone();

            newRecord.col_Oit_GuidProductIDWasSet     = this.col_Oit_GuidProductIDWasSet;
            newRecord.col_Oit_GuidProductIDWasUpdated = this.col_Oit_GuidProductIDWasUpdated;
            newRecord.col_Oit_GuidProductID           = this.col_Oit_GuidProductID;

            newRecord.col_Oit_GuidProductID_Record = this.col_Oit_GuidProductID_Record.MemberwiseClone();

            newRecord.col_Oit_LngAmountWasSet     = this.col_Oit_LngAmountWasSet;
            newRecord.col_Oit_LngAmountWasUpdated = this.col_Oit_LngAmountWasUpdated;
            newRecord.col_Oit_LngAmount           = this.col_Oit_LngAmount;

            newRecord.displayName = this.displayName;

            return(newRecord);
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        public void Remove(IBusinessComponentRecord record)
        {
            tblOrderItem_Record recordToDelete = record as tblOrderItem_Record;

            if (recordToDelete == null)
            {
                throw new ArgumentException("Invalid record type. Must be 'OlymarsDemo.BusinessComponents.tblOrderItem_Record'.", "record");
            }

            bool alreadyOpened = false;

            Params.spD_tblOrderItem Param = new Params.spD_tblOrderItem(true);
            Param.CommandTimeOut = this.deleteCommandTimeOut;
            switch (this.lastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                Param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                Param.SetUpConnection(this.sqlConnection);
                alreadyOpened = (this.sqlConnection.State == System.Data.ConnectionState.Open);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                Param.SetUpConnection(this.sqlTransaction);
                break;
            }

            Param.Param_Oit_GuidID = recordToDelete.Col_Oit_GuidID;

            SPs.spD_tblOrderItem Sp = new SPs.spD_tblOrderItem(true);

            Sp.Execute(ref Param);
            CloseConnection(Sp.Connection, alreadyOpened);

            if (internalRecords != null)
            {
                internalRecords.Remove(recordToDelete);
            }
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        public void Refresh()
        {
            internalRecords = new System.Collections.ArrayList();

            bool alreadyOpened = false;

            Params.spS_tblOrderItem_Display Param = new Params.spS_tblOrderItem_Display(true);
            Param.CommandTimeOut = this.selectCollectionCommandTimeOut;
            switch (this.lastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                Param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                Param.SetUpConnection(this.sqlConnection);
                alreadyOpened = (this.sqlConnection.State == System.Data.ConnectionState.Open);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                Param.SetUpConnection(this.sqlTransaction);
                break;
            }

            if (!this.col_Oit_GuidOrderID.IsNull)
            {
                Param.Param_Oit_GuidOrderID = this.col_Oit_GuidOrderID;
            }

            if (!this.col_Oit_GuidProductID.IsNull)
            {
                Param.Param_Oit_GuidProductID = this.col_Oit_GuidProductID;
            }

            System.Data.SqlClient.SqlDataReader sqlDataReader = null;
            SPs.spS_tblOrderItem_Display        Sp            = new SPs.spS_tblOrderItem_Display(false);
            if (Sp.Execute(ref Param, out sqlDataReader))
            {
                while (sqlDataReader.Read())
                {
                    tblOrderItem_Record record = null;

                    switch (this.lastKnownConnectionType)
                    {
                    case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                        record = new tblOrderItem_Record(this.connectionString, sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_ID1.ColumnIndex));
                        break;

                    case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                        record = new tblOrderItem_Record(this.sqlConnection, sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_ID1.ColumnIndex));
                        break;

                    case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                        record = new tblOrderItem_Record(this.sqlTransaction, sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_ID1.ColumnIndex));
                        break;
                    }


                    record.UpdateCommandTimeOut = this.updateCommandTimeOut;
                    record.SelectCommandTimeOut = this.selectCommandTimeOut;

                    if (sqlDataReader.GetFieldType(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex) == typeof(string))
                    {
                        record.displayName = sqlDataReader.GetString(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex);
                    }
                    else
                    {
                        record.displayName = sqlDataReader.GetValue(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex).ToString();
                    }

                    internalRecords.Add(record);
                }

                if (sqlDataReader != null && !sqlDataReader.IsClosed)
                {
                    sqlDataReader.Close();
                }

                CloseConnection(Sp.Connection, alreadyOpened);

                this.recordsAreLoaded = true;
            }
            else
            {
                if (sqlDataReader != null && !sqlDataReader.IsClosed)
                {
                    sqlDataReader.Close();
                }

                CloseConnection(Sp.Connection, alreadyOpened);

                this.recordsAreLoaded = false;
                throw new OlymarsDemo.DataClasses.CustomException(Param, "OlymarsDemo.BusinessComponents.tblOrderItem_Collection", "Refresh");
            }
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        /// <returns>[To be supplied.]</returns>
        public IBusinessComponentRecord Add(IBusinessComponentRecord record)
        {
            tblOrderItem_Record recordToAdd = record as tblOrderItem_Record;

            if (recordToAdd == null)
            {
                throw new ArgumentException("Invalid record type. Must be 'OlymarsDemo.BusinessComponents.tblOrderItem_Record'.", "record");
            }

            switch (this.parentType)
            {
            case tblOrderItem_CollectionParentType.Col_Oit_GuidOrderID:
                recordToAdd.Col_Oit_GuidOrderID = ((tblOrder_Record)this.parent).Col_Ord_GuidID;
                break;

            case tblOrderItem_CollectionParentType.Col_Oit_GuidProductID:
                recordToAdd.Col_Oit_GuidProductID = ((Product)this.parent).Col_Pro_GuidID;
                break;
            }

            bool alreadyOpened = false;

            Params.spI_tblOrderItem Param = new Params.spI_tblOrderItem(true);
            Param.CommandTimeOut = this.insertCommandTimeOut;
            switch (this.lastKnownConnectionType)
            {
            case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                Param.SetUpConnection(this.connectionString);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                Param.SetUpConnection(this.sqlConnection);
                alreadyOpened = (this.sqlConnection.State == System.Data.ConnectionState.Open);
                break;

            case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                Param.SetUpConnection(this.sqlTransaction);
                break;
            }

            Param.Param_Oit_GuidID        = recordToAdd.Col_Oit_GuidID;
            Param.Param_Oit_GuidOrderID   = recordToAdd.Col_Oit_GuidOrderID;
            Param.Param_Oit_GuidProductID = recordToAdd.Col_Oit_GuidProductID;
            Param.Param_Oit_LngAmount     = recordToAdd.Col_Oit_LngAmount;

            SPs.spI_tblOrderItem Sp = new SPs.spI_tblOrderItem(false);
            if (Sp.Execute(ref Param))
            {
                tblOrderItem_Record newRecord = null;

                switch (this.lastKnownConnectionType)
                {
                case OlymarsDemo.DataClasses.ConnectionType.ConnectionString:
                    newRecord = new tblOrderItem_Record(this.connectionString, Param.Param_Oit_GuidID);
                    break;

                case OlymarsDemo.DataClasses.ConnectionType.SqlConnection:
                    newRecord = new tblOrderItem_Record(this.sqlConnection, Param.Param_Oit_GuidID);
                    break;

                case OlymarsDemo.DataClasses.ConnectionType.SqlTransaction:
                    newRecord = new tblOrderItem_Record(this.sqlTransaction, Param.Param_Oit_GuidID);
                    break;
                }

                CloseConnection(Sp.Connection, alreadyOpened);

                if (internalRecords != null)
                {
                    internalRecords.Add(newRecord);
                }

                if (this.addedRecords == null)
                {
                    this.addedRecords = new System.Collections.ArrayList();
                }
                this.addedRecords.Add(newRecord);

                return(newRecord);
            }
            else
            {
                throw new OlymarsDemo.DataClasses.CustomException(Param, "OlymarsDemo.BusinessComponents.tblOrderItem_Collection", "Add");
            }
        }