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

            Params.spD_tblCategory Param = new Params.spD_tblCategory(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_Cat_LngID = Col_Cat_LngID;

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

            Sp.Execute(ref Param);

            CloseConnection(Sp.Connection, alreadyOpened);
        }
示例#2
0
        public void Delete_Category(Int32 id)
        {
            Params.spD_tblCategory param = new Params.spD_tblCategory(true);

            param.SetUpConnection(string.Empty);

            param.Param_Cat_LngID = id;

            using (SPs.spD_tblCategory sp = new SPs.spD_tblCategory(true)) {
                sp.Execute(ref param);
                param.Dispose();
            }
        }
示例#3
0
        public void Execute(WSInt32 Cat_LngID)
        {
            Params.spD_tblCategory param = new Params.spD_tblCategory(true);
            param.SetUpConnection(string.Empty);

            if (Cat_LngID == null || Cat_LngID.UseNull)
            {
                param.Param_Cat_LngID = SqlInt32.Null;
            }
            else if (!Cat_LngID.UseDefault)
            {
                param.Param_Cat_LngID = Cat_LngID.Value;
            }

            using (SPs.spD_tblCategory sp = new SPs.spD_tblCategory(true)) {
                sp.Execute(ref param);
                param.Dispose();
            }
        }
示例#4
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        public void Remove(IBusinessComponentRecord record)
        {
            Category recordToDelete = record as Category;

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

            bool alreadyOpened = false;

            Params.spD_tblCategory Param = new Params.spD_tblCategory(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_Cat_LngID = recordToDelete.Col_Cat_LngID;

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

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

            if (internalRecords != null)
            {
                internalRecords.Remove(recordToDelete);
            }
        }
示例#5
0
        private void cmdDelete_Click(object sender, System.EventArgs e)
        {
            Params.spD_tblCategory Param = null;
            SPs.spD_tblCategory    SP    = null;

            Param = new Params.spD_tblCategory();

            Param.SetUpConnection(ConnectionString);

            Param.Param_Cat_LngID = CurrentID;

            SP = new SPs.spD_tblCategory();

            if (SP.Execute(ref Param))
            {
                Param.Dispose();
                SP.Dispose();

                MainDisplay.Visible  = false;
                ErrorDisplay.Visible = true;
                lab_Error.Text       = String.Format("Record with ID: {0} was successfully deleted!", CurrentID.ToString());

                return;
            }
            else
            {
                if (Param.SqlException != null)
                {
                    throw Param.SqlException;
                }

                if (Param.OtherException != null)
                {
                    throw Param.OtherException;
                }
            }
        }