public BankTransaction CopyDTO(BankTransaction obj)
 {
     obj.BankAccountID            = this.BankAccountID;
     obj.TransactionDate          = this.TransactionDate;
     obj.AccountNumber            = this.AccountNumber;
     obj.AccountName              = this.AccountName;
     obj.CurrencyCode             = this.CurrencyCode;
     obj.ClosingBalanace          = this.ClosingBalanace;
     obj.TransactionAmount        = this.TransactionAmount;
     obj.TransactionCode          = this.TransactionCode;
     obj.Narrative                = this.Narrative;
     obj.SerialNumber             = this.SerialNumber;
     obj.SegmentAccountNumber     = this.SegmentAccountNumber;
     obj.PaymentTransactionID     = this.PaymentTransactionID;
     obj.InstructionID            = this.InstructionID;
     obj.ValueDate                = this.ValueDate;
     obj.TransactionDateTimeUTC   = this.TransactionDateTimeUTC;
     obj.DebtorName               = this.DebtorName;
     obj.CreditorName             = this.CreditorName;
     obj.EndToEndID               = this.EndToEndID;
     obj.RemittanceInformation1   = this.RemittanceInformation1;
     obj.RemittanceInfoformation2 = this.RemittanceInfoformation2;
     obj.PayiDType                = this.PayiDType;
     obj.PayID = this.PayID;
     obj.ReversalreasonCode    = this.ReversalreasonCode;
     obj.OriginalTransactionID = this.OriginalTransactionID;
     obj.IsActive = this.IsActive;
     return(obj);
 }
 public void LoadUpdatedByApplicationUser(BankTransaction obj)
 {
     if (obj.UpdatedByApplicationUser != null)
     {
         _updatedByApplicationUserProperty = obj.UpdatedByApplicationUser.CurrentDTO;
     }
 }
 public void LoadBankAccount(BankTransaction obj)
 {
     if (obj.BankAccount != null)
     {
         _bankAccountProperty = obj.BankAccount.CurrentDTO;
     }
 }
 // ZeroOrOneToMany
 public void LoadGls(BankTransaction obj)
 {
     if (obj.Gls != null)
     {
         _glsProperty = obj.Gls.CurrentDTO;
     }
 }
        public static BankTransaction GetBankTransaction(Func <IDataReader, BankTransaction> rowParser, SqlDataReader reader)
        {
            BankTransaction obj = rowParser(reader);

            obj.InitDTO();
            obj.IsDirty = false;
            obj.IsNew   = false;
            return(obj);
        }
 protected void UpdateChildren(BankTransaction parent, SqlConnection connection, SqlTransaction trans)
 {
     if (_glsPropertyChecked)
     {
         if (_glsProperty != null)
         {
             foreach (Gl obj in _glsProperty)
             {
                 if (obj.IsNew)
                 {
                     obj.Child_Insert(parent, connection, trans);
                 }
                 else
                 {
                     if (obj.IsDirty || obj.IsChildDirty())
                     {
                         obj.Child_Update(parent, connection, trans);
                     }
                 }
             }
         }
     }
 }
        public void Child_Update(ApplicationUser applicationUser, BankTransaction bankTransaction, Budget budget, GLEntity gLEntity, TransactionType transactionType, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

            OnChildUpdating(applicationUser, bankTransaction, budget, gLEntity, transactionType, connection, ref cancel, trans);
            if (cancel)
            {
                return;
            }

            if (connection.State != ConnectionState.Open)
            {
                connection.Open();
            }
            using (var command = new SqlCommand("[dbo].[spCFM_Gl_Update]", connection, trans))
            {
                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.AddWithValue("@p_GLID", this.Glid);
                command.Parameters.AddWithValue("@p_JournalDate", this.JournalDate);
                command.Parameters.AddWithValue("@p_PostingDate", ADOHelper.NullCheck(this.PostingDate));
                command.Parameters.AddWithValue("@p_GLAccountID", this.GLAccountID);
                command.Parameters.AddWithValue("@p_TransactionTypeID", transactionType != null ? transactionType.TransactionTypeID : this.TransactionTypeID);
                command.Parameters.AddWithValue("@p_GLCostCentreEntityID", ADOHelper.NullCheck(gLEntity != null ? gLEntity.GLEntityID : this.GLCostCentreEntityID));
                command.Parameters.AddWithValue("@p_BankTransactionID", ADOHelper.NullCheck(bankTransaction != null ? bankTransaction.BankTransactionID : this.BankTransactionID));
                command.Parameters.AddWithValue("@p_CategoryID", ADOHelper.NullCheck(this.CategoryID));
                command.Parameters.AddWithValue("@p_JournalNumber", this.JournalNumber);
                command.Parameters.AddWithValue("@p_Narration", this.Narration);
                command.Parameters.AddWithValue("@p_DocRef", this.DocRef);
                command.Parameters.AddWithValue("@p_CurrencyCode", this.CurrencyCode);
                command.Parameters.AddWithValue("@p_ExGstAMount", ADOHelper.NullCheck(this.ExGstAMount));
                command.Parameters.AddWithValue("@p_GSTAmount", ADOHelper.NullCheck(this.GSTAmount));
                command.Parameters.AddWithValue("@p_DRAmount", ADOHelper.NullCheck(this.DRAmount));
                command.Parameters.AddWithValue("@p_CRAmount", ADOHelper.NullCheck(this.CRAmount));
                command.Parameters.AddWithValue("@p_HouseBudgetID", ADOHelper.NullCheck(budget != null ? budget.BudgetID : this.HouseBudgetID));
                command.Parameters.AddWithValue("@p_ClientBudgetID", ADOHelper.NullCheck(budget != null ? budget.BudgetID : this.ClientBudgetID));
                command.Parameters.AddWithValue("@p_IsActive", this.IsActive);
                command.Parameters.AddWithValue("@p_CreatedBy", applicationUser != null ? applicationUser.ApplicationUserID : this.CreatedBy);
                command.Parameters.AddWithValue("@p_CreatedOn", this.CreatedOn);
                command.Parameters.AddWithValue("@p_UpdatedBy", ADOHelper.NullCheck(applicationUser != null ? applicationUser.ApplicationUserID : this.UpdatedBy));
                command.Parameters.AddWithValue("@p_UpdatedOn", ADOHelper.NullCheck(this.UpdatedOn));

                //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.");
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (transactionType != null && transactionType.TransactionTypeID != this.TransactionTypeID)
                {
                    _transactionTypeIDProperty = transactionType.TransactionTypeID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (gLEntity != null && gLEntity.GLEntityID != this.GLCostCentreEntityID)
                {
                    _gLCostCentreEntityIDProperty = gLEntity.GLEntityID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (bankTransaction != null && bankTransaction.BankTransactionID != this.BankTransactionID)
                {
                    _bankTransactionIDProperty = bankTransaction.BankTransactionID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (budget != null && budget.BudgetID != this.HouseBudgetID)
                {
                    _houseBudgetIDProperty = budget.BudgetID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (budget != null && budget.BudgetID != this.ClientBudgetID)
                {
                    _clientBudgetIDProperty = budget.BudgetID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (applicationUser != null && applicationUser.ApplicationUserID != this.CreatedBy)
                {
                    _createdByProperty = applicationUser.ApplicationUserID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (applicationUser != null && applicationUser.ApplicationUserID != this.UpdatedBy)
                {
                    _updatedByProperty = applicationUser.ApplicationUserID;
                }
            }

            // A child relationship exists on this Business Object but its type is not a child type (E.G. EditableChild).
            // TODO: Please override OnChildUpdated() and update this child manually.
            // UpdateChildren(this, connection);

            OnChildUpdated();
        }
 public void Child_Update(BankTransaction bankTransaction, SqlConnection connection, SqlTransaction trans)
 {
     Child_Update(null, bankTransaction, null, null, null, connection, trans);
 }
        public void Child_Insert(ApplicationUser applicationUser, BankTransaction bankTransaction, Budget budget, GLEntity gLEntity, TransactionType transactionType, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

            OnChildInserting(applicationUser, bankTransaction, budget, gLEntity, transactionType, connection, ref cancel, trans);
            if (cancel)
            {
                return;
            }

            if (connection.State != ConnectionState.Open)
            {
                connection.Open();
            }
            using (var command = new SqlCommand("[dbo].[spCFM_Gl_Insert]", connection, trans))
            {
                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.AddWithValue("@p_GLID", this.Glid);
                command.Parameters["@p_GLID"].Direction = ParameterDirection.Output;
                command.Parameters.AddWithValue("@p_JournalDate", this.JournalDate);
                command.Parameters.AddWithValue("@p_PostingDate", ADOHelper.NullCheck(this.PostingDate));
                command.Parameters.AddWithValue("@p_GLAccountID", this.GLAccountID);
                command.Parameters.AddWithValue("@p_TransactionTypeID", transactionType != null ? transactionType.TransactionTypeID : this.TransactionTypeID);
                command.Parameters.AddWithValue("@p_GLCostCentreEntityID", ADOHelper.NullCheck(gLEntity != null ? gLEntity.GLEntityID : this.GLCostCentreEntityID));
                command.Parameters.AddWithValue("@p_BankTransactionID", ADOHelper.NullCheck(bankTransaction != null ? bankTransaction.BankTransactionID : this.BankTransactionID));
                command.Parameters.AddWithValue("@p_CategoryID", ADOHelper.NullCheck(this.CategoryID));
                command.Parameters.AddWithValue("@p_JournalNumber", this.JournalNumber);
                command.Parameters.AddWithValue("@p_Narration", this.Narration);
                command.Parameters.AddWithValue("@p_DocRef", this.DocRef);
                command.Parameters.AddWithValue("@p_CurrencyCode", this.CurrencyCode);
                command.Parameters.AddWithValue("@p_ExGstAMount", ADOHelper.NullCheck(this.ExGstAMount));
                command.Parameters.AddWithValue("@p_GSTAmount", ADOHelper.NullCheck(this.GSTAmount));
                command.Parameters.AddWithValue("@p_DRAmount", ADOHelper.NullCheck(this.DRAmount));
                command.Parameters.AddWithValue("@p_CRAmount", ADOHelper.NullCheck(this.CRAmount));
                command.Parameters.AddWithValue("@p_HouseBudgetID", ADOHelper.NullCheck(budget != null ? budget.BudgetID : this.HouseBudgetID));
                command.Parameters.AddWithValue("@p_ClientBudgetID", ADOHelper.NullCheck(budget != null ? budget.BudgetID : this.ClientBudgetID));
                command.Parameters.AddWithValue("@p_IsActive", this.IsActive);
                command.Parameters.AddWithValue("@p_CreatedBy", applicationUser != null ? applicationUser.ApplicationUserID : this.CreatedBy);
                command.Parameters.AddWithValue("@p_CreatedOn", this.CreatedOn);
                command.Parameters.AddWithValue("@p_UpdatedBy", ADOHelper.NullCheck(applicationUser != null ? applicationUser.ApplicationUserID : this.UpdatedBy));
                command.Parameters.AddWithValue("@p_UpdatedOn", ADOHelper.NullCheck(this.UpdatedOn));

                command.ExecuteNonQuery();

                // Update identity primary key value.
                _glidProperty = (System.Int32)command.Parameters["@p_GLID"].Value;

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (transactionType != null && transactionType.TransactionTypeID != this.TransactionTypeID)
                {
                    _transactionTypeIDProperty = transactionType.TransactionTypeID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (gLEntity != null && gLEntity.GLEntityID != this.GLCostCentreEntityID)
                {
                    _gLCostCentreEntityIDProperty = gLEntity.GLEntityID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (bankTransaction != null && bankTransaction.BankTransactionID != this.BankTransactionID)
                {
                    _bankTransactionIDProperty = bankTransaction.BankTransactionID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (budget != null && budget.BudgetID != this.HouseBudgetID)
                {
                    _houseBudgetIDProperty = budget.BudgetID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (budget != null && budget.BudgetID != this.ClientBudgetID)
                {
                    _clientBudgetIDProperty = budget.BudgetID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (applicationUser != null && applicationUser.ApplicationUserID != this.CreatedBy)
                {
                    _createdByProperty = applicationUser.ApplicationUserID;
                }

                // Update foreign keys values. This code will update the values passed in from the parent only if no errors occurred after executing the query.
                if (applicationUser != null && applicationUser.ApplicationUserID != this.UpdatedBy)
                {
                    _updatedByProperty = applicationUser.ApplicationUserID;
                }
            }

            // A child relationship exists on this Business Object but its type is not a child type (E.G. EditableChild).
            // TODO: Please override OnChildInserted() and insert this child manually.
            // UpdateChildren(this, connection);

            OnChildInserted();
        }
 public void Child_Insert(BankTransaction bankTransaction, SqlConnection connection, SqlTransaction trans)
 {
     Child_Insert(null, bankTransaction, null, null, null, connection, trans);
 }
 /// <summary>
 /// CodeSmith generated stub method that is called when updating the child <see cref="Gl"/> object.
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="cancel">Value returned from the method indicating whether the object insertion should proceed.</param>
 partial void OnChildUpdating(ApplicationUser applicationUser, BankTransaction bankTransaction, Budget budget, GLEntity gLEntity, TransactionType transactionType, SqlConnection connection, ref bool cancel, SqlTransaction trans);
        /// <summary>
        /// Creates a new object of type <see cref="BankTransaction"/>.
        /// </summary>
        /// <returns>Returns a newly instantiated collection of type <see cref="BankTransaction"/>.</returns>
        public static BankTransaction NewBankTransaction()
        {
            BankTransaction obj = new BankTransaction();

            return(obj);
        }