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

            Params.spD_tblCustomer Param = new Params.spD_tblCustomer(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_Cus_LngID = Col_Cus_LngID;

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

            Sp.Execute(ref Param);

            CloseConnection(Sp.Connection, alreadyOpened);
        }
Ejemplo n.º 2
0
        public void Delete_tblCustomer_Record(Int32 id)
        {
            Params.spD_tblCustomer param = new Params.spD_tblCustomer(true);

            param.SetUpConnection(string.Empty);

            param.Param_Cus_LngID = id;

            using (SPs.spD_tblCustomer sp = new SPs.spD_tblCustomer(true)) {
                sp.Execute(ref param);
                param.Dispose();
            }
        }
        public void Execute(WSInt32 Cus_LngID)
        {
            Params.spD_tblCustomer param = new Params.spD_tblCustomer(true);
            param.SetUpConnection(string.Empty);

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

            using (SPs.spD_tblCustomer sp = new SPs.spD_tblCustomer(true)) {
                sp.Execute(ref param);
                param.Dispose();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// [To be supplied.]
        /// </summary>
        /// <param name="record">[To be supplied.]</param>
        public void Remove(IBusinessComponentRecord record)
        {
            tblCustomer_Record recordToDelete = record as tblCustomer_Record;

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

            bool alreadyOpened = false;

            Params.spD_tblCustomer Param = new Params.spD_tblCustomer(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_Cus_LngID = recordToDelete.Col_Cus_LngID;

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

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

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

            Param = new Params.spD_tblCustomer();

            Param.SetUpConnection(ConnectionString);

            Param.Param_Cus_LngID = CurrentID;

            SP = new SPs.spD_tblCustomer();

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