Exemplo n.º 1
0
        private BSBBankDetail DataPortal_Fetch(BSBBankDetailCriteria 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_BSBBankDetail_Select]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    command.Parameters.AddWithValue("@p_BankCodeHasValue", criteria.BankCodeHasValue);
                    command.Parameters.AddWithValue("@p_BankNameHasValue", criteria.BankNameHasValue);
                    using (var reader = command.ExecuteReader())
                    {
                        var rowParser = reader.GetRowParser <BSBBankDetail>();
                        if (reader.Read())
                        {
                            return(GetBSBBankDetail(rowParser, reader));
                        }
                        else
                        {
                            throw new Exception(String.Format("The record was not found in 'dbo.BSBBankDetail' using the following criteria: {0}.", criteria));
                        }
                    }
                }
            }
            OnFetched();
        }
Exemplo n.º 2
0
        //[Transactional(TransactionalTypes.TransactionScope)]
        protected void DataPortal_Delete(BSBBankDetailCriteria 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_BSBBankDetail_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();
        }
        /// <summary>
        /// Returns a <see cref="BSBBankDetailList"/> object of the specified criteria.
        /// </summary>
        /// <param name="bSBBankDetailID">No additional detail available.</param>
        /// <returns>A <see cref="BSBBankDetailList"/> object of the specified criteria.</returns>
        public static BSBBankDetailList GetByBSBBankDetailID(System.Int32 bSBBankDetailID)
        {
            var criteria = new BSBBankDetailCriteria {
                BSBBankDetailID = bSBBankDetailID
            };


            return(new BSBBankDetailList().DataPortal_Fetch(criteria));
        }
Exemplo n.º 4
0
        public static void DeleteBSBBankDetail(System.Int32 bSBBankDetailID)
        {
            var criteria = new BSBBankDetailCriteria {
                BSBBankDetailID = bSBBankDetailID
            };


            new BSBBankDetail().DataPortal_Delete(criteria);
        }
Exemplo n.º 5
0
 public static BSBBankDetail GetByCriteria(BSBBankDetailCriteria criteria)
 {
     try
     {
         return(new BSBBankDetail().DataPortal_Fetch(criteria));
     }
     catch (Exception ex)
     {
     }
     return(null);
 }
Exemplo n.º 6
0
        private BSBBankDetailList DataPortal_Fetch(BSBBankDetailCriteria 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_BSBBankDetail_Select]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;

                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    command.Parameters.AddWithValue("@p_BankCodeHasValue", criteria.BankCodeHasValue);
                    command.Parameters.AddWithValue("@p_BankNameHasValue", criteria.BankNameHasValue);
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            var rowParser = reader.GetRowParser <CFMData.BSBBankDetail>();
                            do
                            {
                                this.Add(CFMData.BSBBankDetail.GetBSBBankDetail(rowParser, reader));
                            }while(reader.Read());
                        }
                        OnFetched();
                        return(this);
                    }
                }
            }

            //RaiseListChangedEvents = true;
        }
        public static BSBBankDetailList GetByCriteria(BSBBankDetailCriteria criteria)
        {
            return(new BSBBankDetailList().DataPortal_Fetch(criteria));
//            return DataPortal.Fetch<BSBBankDetailList>(criteria);
        }
 /// <summary>
 /// CodeSmith generated stub method that is called when fetching the child <see cref="BSBBankDetail"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="BSBBankDetailCriteria"/> 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(BSBBankDetailCriteria criteria, ref bool cancel);
Exemplo n.º 9
0
 /// <summary>
 /// CodeSmith generated stub method that is called when deleting the child <see cref="BSBBankDetail"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="BSBBankDetailCriteria"/> 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(BSBBankDetailCriteria criteria, ref bool cancel);
 /// <summary>
 /// CodeSmith generated stub method that is called when deleting the child <see cref="BSBBankDetail"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="BSBBankDetailCriteria"/> 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(BSBBankDetailCriteria criteria, SqlConnection connection, ref bool cancel);
Exemplo n.º 10
0
 /// <summary>
 /// CodeSmith generated stub method that is called when deleting the <see cref="BSBBankDetail"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="BSBBankDetailCriteria"/> 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(BSBBankDetailCriteria criteria, ref bool cancel);