/// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="Col_Sup_GuidID">[To be supplied.]</param>
        public void Remove(System.Data.SqlTypes.SqlGuid Col_Sup_GuidID)
        {
            bool alreadyOpened = false;

            Params.spD_tblSupplier Param = new Params.spD_tblSupplier(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_Sup_GuidID = Col_Sup_GuidID;

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

            Sp.Execute(ref Param);

            CloseConnection(Sp.Connection, alreadyOpened);
        }
Example #2
0
        public void Delete_Supplier(Guid id)
        {
            Params.spD_tblSupplier param = new Params.spD_tblSupplier(true);

            param.SetUpConnection(string.Empty);

            param.Param_Sup_GuidID = id;

            using (SPs.spD_tblSupplier sp = new SPs.spD_tblSupplier(true)) {
                sp.Execute(ref param);
                param.Dispose();
            }
        }
Example #3
0
        public void Execute(WSGuid Sup_GuidID)
        {
            Params.spD_tblSupplier param = new Params.spD_tblSupplier(true);
            param.SetUpConnection(string.Empty);

            if (Sup_GuidID == null || Sup_GuidID.UseNull)
            {
                param.Param_Sup_GuidID = SqlGuid.Null;
            }
            else if (!Sup_GuidID.UseDefault)
            {
                param.Param_Sup_GuidID = Sup_GuidID.Value;
            }

            using (SPs.spD_tblSupplier sp = new SPs.spD_tblSupplier(true)) {
                sp.Execute(ref param);
                param.Dispose();
            }
        }
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        public void Remove(IBusinessComponentRecord record)
        {
            Supplier recordToDelete = record as Supplier;

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

            bool alreadyOpened = false;

            Params.spD_tblSupplier Param = new Params.spD_tblSupplier(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_Sup_GuidID = recordToDelete.Col_Sup_GuidID;

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

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

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

            Param = new Params.spD_tblSupplier();

            Param.SetUpConnection(ConnectionString);

            Param.Param_Sup_GuidID = CurrentID;

            SP = new SPs.spD_tblSupplier();

            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;
                }
            }
        }