コード例 #1
0
        //[Transactional(TransactionalTypes.TransactionScope)]
        protected void DataPortal_Delete(BankTransactionCriteria criteria)
        {
            bool cancel = false;

            OnDeleting(criteria, ref cancel);
            if (cancel)
            {
                return;
            }

            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("[dbo].[spCFM_BankTransaction_Delete]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;

                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));

                    //result: The number of rows changed, inserted, or deleted. -1 for select statements; 0 if no rows were affected, or the statement failed.
                    int result = command.ExecuteNonQuery();
                    if (result == 0)
                    {
                        throw new DBConcurrencyException("The entity is out of date on the client. Please update the entity and try again. This could also be thrown if the sql statement failed to execute.");
                    }
                }
            }

            OnDeleted();
        }
        private BankTransactionList DataPortal_Fetch(BankTransactionCriteria criteria)
        {
            bool cancel = false;

            OnFetching(criteria, ref cancel);
            if (cancel)
            {
                return(null);
            }

            //RaiseListChangedEvents = false;

            // Fetch Child objects.
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("[dbo].[spCFM_BankTransaction_Select]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;

                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    command.Parameters.AddWithValue("@p_BankAccountIDHasValue", criteria.BankAccountIDHasValue);
                    command.Parameters.AddWithValue("@p_NarrativeHasValue", criteria.NarrativeHasValue);
                    command.Parameters.AddWithValue("@p_SerialNumberHasValue", criteria.SerialNumberHasValue);
                    command.Parameters.AddWithValue("@p_SegmentAccountNumberHasValue", criteria.SegmentAccountNumberHasValue);
                    command.Parameters.AddWithValue("@p_PaymentTransactionIDHasValue", criteria.PaymentTransactionIDHasValue);
                    command.Parameters.AddWithValue("@p_InstructionIDHasValue", criteria.InstructionIDHasValue);
                    command.Parameters.AddWithValue("@p_ValueDateHasValue", criteria.ValueDateHasValue);
                    command.Parameters.AddWithValue("@p_TransactionDateTimeUTCHasValue", criteria.TransactionDateTimeUTCHasValue);
                    command.Parameters.AddWithValue("@p_DebtorNameHasValue", criteria.DebtorNameHasValue);
                    command.Parameters.AddWithValue("@p_CreditorNameHasValue", criteria.CreditorNameHasValue);
                    command.Parameters.AddWithValue("@p_EndToEndIDHasValue", criteria.EndToEndIDHasValue);
                    command.Parameters.AddWithValue("@p_RemittanceInformation1HasValue", criteria.RemittanceInformation1HasValue);
                    command.Parameters.AddWithValue("@p_RemittanceInfoformation2HasValue", criteria.RemittanceInfoformation2HasValue);
                    command.Parameters.AddWithValue("@p_PayiDTypeHasValue", criteria.PayiDTypeHasValue);
                    command.Parameters.AddWithValue("@p_PayIDHasValue", criteria.PayIDHasValue);
                    command.Parameters.AddWithValue("@p_ReversalreasonCodeHasValue", criteria.ReversalreasonCodeHasValue);
                    command.Parameters.AddWithValue("@p_OriginalTransactionIDHasValue", criteria.OriginalTransactionIDHasValue);
                    command.Parameters.AddWithValue("@p_UpdatedByHasValue", criteria.UpdatedByHasValue);
                    command.Parameters.AddWithValue("@p_UpdatedOnHasValue", criteria.UpdatedOnHasValue);
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            var rowParser = reader.GetRowParser <CFMData.BankTransaction>();
                            do
                            {
                                this.Add(CFMData.BankTransaction.GetBankTransaction(rowParser, reader));
                            }while(reader.Read());
                        }
                        OnFetched();
                        return(this);
                    }
                }
            }

            //RaiseListChangedEvents = true;
        }
コード例 #3
0
        /// <summary>
        /// Returns a <see cref="BankTransactionList"/> object of the specified criteria.
        /// </summary>
        /// <param name="bankTransactionID">No additional detail available.</param>
        /// <returns>A <see cref="BankTransactionList"/> object of the specified criteria.</returns>
        public static BankTransactionList GetByBankTransactionID(System.Int32 bankTransactionID)
        {
            var criteria = new BankTransactionCriteria {
                BankTransactionID = bankTransactionID
            };


            return(new BankTransactionList().DataPortal_Fetch(criteria));
        }
コード例 #4
0
        /// <summary>
        /// Returns a <see cref="BankTransactionList"/> object of the specified criteria.
        /// </summary>
        /// <param name="createdBy">No additional detail available.</param>
        /// <returns>A <see cref="BankTransactionList"/> object of the specified criteria.</returns>
        public static BankTransactionList GetByCreatedBy(System.Int32 createdBy)
        {
            var criteria = new BankTransactionCriteria {
                CreatedBy = createdBy
            };


            return(new BankTransactionList().DataPortal_Fetch(criteria));
        }
コード例 #5
0
        public static void DeleteBankTransaction(System.Int32 bankTransactionID)
        {
            var criteria = new BankTransactionCriteria {
                BankTransactionID = bankTransactionID
            };


            new BankTransaction().DataPortal_Delete(criteria);
        }
コード例 #6
0
        /// <summary>
        /// CodeSmith generated stub method that is called after the child <see cref="BankTransaction"/> object with the specified criteria has been deleted.
        /// </summary>
        //partial void OnDeleted();
        //partial void OnChildLoading(Csla.Core.IPropertyInfo childProperty, ref bool cancel);

        #endregion


        #region Exists Command

        /// <summary>
        /// Determines if a record exists in the BankTransaction table in the database for the specified criteria.
        /// </summary>
        /// <param name="criteria">The criteria parameter is an <see cref="BankTransaction"/> object.</param>
        /// <returns>A boolean value of true is returned if a record is found.</returns>
        public static BankTransaction Exists(BankTransactionCriteria criteria)
        {
            try
            {
                return(new BankTransaction().DataPortal_Fetch(criteria));
            }
            catch (Exception ex)
            {
            }
            return(null);
        }
コード例 #7
0
        /// <summary>
        /// Returns a <see cref="BankTransactionList"/> object of the specified criteria.
        /// </summary>
        /// <param name="bankAccountID">No additional detail available.</param>
        /// <returns>A <see cref="BankTransactionList"/> object of the specified criteria.</returns>
        public static BankTransactionList GetByBankAccountID(System.Int32?bankAccountID)
        {
            var criteria = new BankTransactionCriteria {
            };

            if (bankAccountID.HasValue)
            {
                criteria.BankAccountID = bankAccountID.Value;
            }

            return(new BankTransactionList().DataPortal_Fetch(criteria));
        }
コード例 #8
0
        /// <summary>
        /// Returns a <see cref="BankTransactionList"/> object of the specified criteria.
        /// </summary>
        /// <param name="updatedBy">No additional detail available.</param>
        /// <returns>A <see cref="BankTransactionList"/> object of the specified criteria.</returns>
        public static BankTransactionList GetByUpdatedBy(System.Int32?updatedBy)
        {
            var criteria = new BankTransactionCriteria {
            };

            if (updatedBy.HasValue)
            {
                criteria.UpdatedBy = updatedBy.Value;
            }

            return(new BankTransactionList().DataPortal_Fetch(criteria));
        }
コード例 #9
0
        private BankTransaction DataPortal_Fetch(BankTransactionCriteria criteria)
        {
            bool cancel = false;

            OnFetching(criteria, ref cancel);
            if (cancel)
            {
                return(null);
            }
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("[dbo].[spCFM_BankTransaction_Select]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    command.Parameters.AddWithValue("@p_BankAccountIDHasValue", criteria.BankAccountIDHasValue);
                    command.Parameters.AddWithValue("@p_NarrativeHasValue", criteria.NarrativeHasValue);
                    command.Parameters.AddWithValue("@p_SerialNumberHasValue", criteria.SerialNumberHasValue);
                    command.Parameters.AddWithValue("@p_SegmentAccountNumberHasValue", criteria.SegmentAccountNumberHasValue);
                    command.Parameters.AddWithValue("@p_PaymentTransactionIDHasValue", criteria.PaymentTransactionIDHasValue);
                    command.Parameters.AddWithValue("@p_InstructionIDHasValue", criteria.InstructionIDHasValue);
                    command.Parameters.AddWithValue("@p_ValueDateHasValue", criteria.ValueDateHasValue);
                    command.Parameters.AddWithValue("@p_TransactionDateTimeUTCHasValue", criteria.TransactionDateTimeUTCHasValue);
                    command.Parameters.AddWithValue("@p_DebtorNameHasValue", criteria.DebtorNameHasValue);
                    command.Parameters.AddWithValue("@p_CreditorNameHasValue", criteria.CreditorNameHasValue);
                    command.Parameters.AddWithValue("@p_EndToEndIDHasValue", criteria.EndToEndIDHasValue);
                    command.Parameters.AddWithValue("@p_RemittanceInformation1HasValue", criteria.RemittanceInformation1HasValue);
                    command.Parameters.AddWithValue("@p_RemittanceInfoformation2HasValue", criteria.RemittanceInfoformation2HasValue);
                    command.Parameters.AddWithValue("@p_PayiDTypeHasValue", criteria.PayiDTypeHasValue);
                    command.Parameters.AddWithValue("@p_PayIDHasValue", criteria.PayIDHasValue);
                    command.Parameters.AddWithValue("@p_ReversalreasonCodeHasValue", criteria.ReversalreasonCodeHasValue);
                    command.Parameters.AddWithValue("@p_OriginalTransactionIDHasValue", criteria.OriginalTransactionIDHasValue);
                    command.Parameters.AddWithValue("@p_UpdatedByHasValue", criteria.UpdatedByHasValue);
                    command.Parameters.AddWithValue("@p_UpdatedOnHasValue", criteria.UpdatedOnHasValue);
                    using (var reader = command.ExecuteReader())
                    {
                        var rowParser = reader.GetRowParser <BankTransaction>();
                        if (reader.Read())
                        {
                            return(GetBankTransaction(rowParser, reader));
                        }
                        else
                        {
                            throw new Exception(String.Format("The record was not found in 'dbo.BankTransaction' using the following criteria: {0}.", criteria));
                        }
                    }
                }
            }
            OnFetched();
        }
コード例 #10
0
 /// <summary>
 /// CodeSmith generated stub method that is called when fetching the child <see cref="BankTransaction"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="BankTransactionCriteria"/> object containing the criteria of the object to fetch.</param>
 /// <param name="cancel">Value returned from the method indicating whether the object fetching should proceed.</param>
 partial void OnFetching(BankTransactionCriteria criteria, ref bool cancel);
コード例 #11
0
        public static BankTransactionList GetByCriteria(BankTransactionCriteria criteria)
        {
            return(new BankTransactionList().DataPortal_Fetch(criteria));
//            return DataPortal.Fetch<BankTransactionList>(criteria);
        }
コード例 #12
0
 /// <summary>
 /// CodeSmith generated stub method that is called when deleting the child <see cref="BankTransaction"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="BankTransactionCriteria"/> object containing the criteria of the object to delete.</param>
 /// <param name="cancel">Value returned from the method indicating whether the object deletion should proceed.</param>
 //partial void OnDeleting(BankTransactionCriteria criteria, ref bool cancel);
 /// <summary>
 /// CodeSmith generated stub method that is called when deleting the child <see cref="BankTransaction"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="BankTransactionCriteria"/> object containing the criteria of the object to delete.</param>
 /// <param name="connection"></param>
 /// <param name="cancel">Value returned from the method indicating whether the object deletion should proceed.</param>
 partial void OnDeleting(BankTransactionCriteria criteria, SqlConnection connection, ref bool cancel);
コード例 #13
0
 /// <summary>
 /// CodeSmith generated stub method that is called when deleting the <see cref="BankTransaction"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="BankTransactionCriteria"/> object containing the criteria of the object to delete.</param>
 /// <param name="cancel">Value returned from the method indicating whether the object deletion should proceed.</param>
 partial void OnDeleting(BankTransactionCriteria criteria, ref bool cancel);