Example #1
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="TitleId">[To be supplied.]</param>
        public void Remove(System.Data.SqlTypes.SqlInt32 TitleId)
        {
            bool alreadyOpened = false;

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

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

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

            Param.Param_TitleId = TitleId;

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

            Sp.Execute(ref Param);

            CloseConnection(Sp.Connection, alreadyOpened);
        }
Example #2
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        public void Remove(IBusinessComponentRecord record)
        {
            Title recordToDelete = record as Title;

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

            bool alreadyOpened = false;

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

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

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

            Param.Param_TitleId = recordToDelete.TitleId;

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

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

            if (internalRecords != null)
            {
                internalRecords.Remove(recordToDelete);
            }
        }