Ejemplo n.º 1
0
 // OneToMany
 public void LoadClients(GLEntity obj)
 {
     if (obj.Clients != null)
     {
         _clientsProperty = obj.Clients.CurrentDTO;
     }
 }
Ejemplo n.º 2
0
 // ZeroOrOneToMany
 public void LoadGls(GLEntity obj)
 {
     if (obj.Gls != null)
     {
         _glsProperty = obj.Gls.CurrentDTO;
     }
 }
Ejemplo n.º 3
0
 // OneToMany
 public void LoadFinAdministrators(GLEntity obj)
 {
     if (obj.FinAdministrators != null)
     {
         _finAdministratorsProperty = obj.FinAdministrators.CurrentDTO;
     }
 }
Ejemplo n.º 4
0
 public void LoadUpdatedByApplicationUser(GLEntity obj)
 {
     if (obj.UpdatedByApplicationUser != null)
     {
         _updatedByApplicationUserProperty = obj.UpdatedByApplicationUser.CurrentDTO;
     }
 }
Ejemplo n.º 5
0
 // OneToMany
 public void LoadGLAccounts(GLEntity obj)
 {
     if (obj.GLAccounts != null)
     {
         _gLAccountsProperty = obj.GLAccounts.CurrentDTO;
     }
 }
Ejemplo n.º 6
0
 // OneToMany
 public void LoadHomes(GLEntity obj)
 {
     if (obj.Homes != null)
     {
         _homesProperty = obj.Homes.CurrentDTO;
     }
 }
Ejemplo n.º 7
0
 public void LoadGLEntityType(GLEntity obj)
 {
     if (obj.GLEntityType != null)
     {
         _gLEntityTypeProperty = obj.GLEntityType.CurrentDTO;
     }
 }
        public static GLEntity GetGLEntity(Func <IDataReader, GLEntity> rowParser, SqlDataReader reader)
        {
            GLEntity obj = rowParser(reader);

            obj.InitDTO();
            obj.IsDirty = false;
            obj.IsNew   = false;
            return(obj);
        }
        /// <summary>
        /// Creates a new object of type <see cref="GLEntity"/>.
        /// </summary>
        /// <returns>Returns a newly instantiated collection of type <see cref="GLEntity"/>.</returns>
        public static GLEntity NewGLEntity()
        {
            GLEntity obj = new GLEntity();

            return(obj);
        }
        public void Child_Update(ApplicationUser applicationUser, BusinessArea businessArea, DataOption dataOption, GLEntity gLEntity, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

            OnChildUpdating(applicationUser, businessArea, dataOption, gLEntity, connection, ref cancel, trans);
            if (cancel)
            {
                return;
            }

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

                command.Parameters.AddWithValue("@p_HomeID", this.HomeID);
                command.Parameters.AddWithValue("@p_GLEntityID", gLEntity != null ? gLEntity.GLEntityID : this.GLEntityID);
                command.Parameters.AddWithValue("@p_BusinessAreaID", businessArea != null ? businessArea.BusinessAreaID : this.BusinessAreaID);
                command.Parameters.AddWithValue("@p_HomeCostCentreCode", this.HomeCostCentreCode);
                command.Parameters.AddWithValue("@p_HomeName", this.HomeName);
                command.Parameters.AddWithValue("@p_Parcel", this.Parcel);
                command.Parameters.AddWithValue("@p_SILTarget", this.SILTarget);
                command.Parameters.AddWithValue("@p_NoofBeds", this.NoofBeds);
                command.Parameters.AddWithValue("@p_AccommodationTypeId", dataOption != null ? dataOption.DataOptionID : this.AccommodationTypeId);
                command.Parameters.AddWithValue("@p_isGST", this.IsGST);
                command.Parameters.AddWithValue("@p_AddressID", ADOHelper.NullCheck(this.AddressID));
                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 (gLEntity != null && gLEntity.GLEntityID != this.GLEntityID)
                {
                    _gLEntityIDProperty = 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 (businessArea != null && businessArea.BusinessAreaID != this.BusinessAreaID)
                {
                    _businessAreaIDProperty = businessArea.BusinessAreaID;
                }

                // 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 (dataOption != null && dataOption.DataOptionID != this.AccommodationTypeId)
                {
                    _accommodationTypeIdProperty = dataOption.DataOptionID;
                }

                // 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, null, connection);

            OnChildUpdated();
        }
 public void Child_Update(GLEntity gLEntity, SqlConnection connection, SqlTransaction trans)
 {
     Child_Update(null, null, null, gLEntity, connection, trans);
 }
        public void Child_Update(Address address, ApplicationUser applicationUser, BankAccount bankAccount, GLEntity gLEntity, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

            OnChildUpdating(address, applicationUser, bankAccount, gLEntity, connection, ref cancel, trans);
            if (cancel)
            {
                return;
            }

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

                command.Parameters.AddWithValue("@p_FinAdministratorID", this.FinAdministratorID);
                command.Parameters.AddWithValue("@p_GLEntityID", gLEntity != null ? gLEntity.GLEntityID : this.GLEntityID);
                command.Parameters.AddWithValue("@p_Name", ADOHelper.NullCheck(this.Name));
                command.Parameters.AddWithValue("@p_isOrganisation", this.IsOrganisation);
                command.Parameters.AddWithValue("@p_Email", ADOHelper.NullCheck(this.Email));
                command.Parameters.AddWithValue("@p_AddressID", ADOHelper.NullCheck(address != null ? address.AddressID : this.AddressID));
                command.Parameters.AddWithValue("@p_HasDirectDebit", this.HasDirectDebit);
                command.Parameters.AddWithValue("@p_BankAccountID", ADOHelper.NullCheck(bankAccount != null ? bankAccount.BankAccountID : this.BankAccountID));
                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 (gLEntity != null && gLEntity.GLEntityID != this.GLEntityID)
                {
                    _gLEntityIDProperty = 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 (address != null && address.AddressID != this.AddressID)
                {
                    _addressIDProperty = address.AddressID;
                }

                // 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 (bankAccount != null && bankAccount.BankAccountID != this.BankAccountID)
                {
                    _bankAccountIDProperty = bankAccount.BankAccountID;
                }

                // 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, null, connection);

            OnChildUpdated();
        }
Ejemplo n.º 13
0
 public GLEntity CopyDTO(GLEntity obj)
 {
     obj.EntityTypeID = this.EntityTypeID;
     obj.IsActive     = this.IsActive;
     return(obj);
 }
        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(GLEntity gLEntity, SqlConnection connection, SqlTransaction trans)
 {
     Child_Insert(null, null, null, gLEntity, null, connection, trans);
 }
        protected void UpdateChildren(GLEntity parent, SqlConnection connection, SqlTransaction trans)
        {
            if (_clientsPropertyChecked)
            {
                if (_clientsProperty != null)
                {
                    foreach (Client obj in _clientsProperty)
                    {
                        if (obj.IsNew)
                        {
                            obj.Child_Insert(parent, connection, trans);
                        }
                        else
                        {
                            if (obj.IsDirty || obj.IsChildDirty())
                            {
                                obj.Child_Update(parent, connection, trans);
                            }
                        }
                    }
                }
            }


            if (_finAdministratorsPropertyChecked)
            {
                if (_finAdministratorsProperty != null)
                {
                    foreach (FinAdministrator obj in _finAdministratorsProperty)
                    {
                        if (obj.IsNew)
                        {
                            obj.Child_Insert(parent, connection, trans);
                        }
                        else
                        {
                            if (obj.IsDirty || obj.IsChildDirty())
                            {
                                obj.Child_Update(parent, connection, 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);
                            }
                        }
                    }
                }
            }


            if (_gLAccountsPropertyChecked)
            {
                if (_gLAccountsProperty != null)
                {
                    foreach (GLAccount obj in _gLAccountsProperty)
                    {
                        if (obj.IsNew)
                        {
                            obj.Child_Insert(parent, connection, trans);
                        }
                        else
                        {
                            if (obj.IsDirty || obj.IsChildDirty())
                            {
                                obj.Child_Update(parent, connection, trans);
                            }
                        }
                    }
                }
            }


            if (_homesPropertyChecked)
            {
                if (_homesProperty != null)
                {
                    foreach (Home obj in _homesProperty)
                    {
                        if (obj.IsNew)
                        {
                            obj.Child_Insert(parent, connection, trans);
                        }
                        else
                        {
                            if (obj.IsDirty || obj.IsChildDirty())
                            {
                                obj.Child_Update(parent, connection, trans);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 17
0
        public void Child_Insert(Address address, ApplicationUser applicationUser, DataOption dataOption, GLEntity gLEntity, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

            OnChildInserting(address, applicationUser, dataOption, gLEntity, connection, ref cancel, trans);
            if (cancel)
            {
                return;
            }

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

                command.Parameters.AddWithValue("@p_ClientID", this.ClientID);
                command.Parameters["@p_ClientID"].Direction = ParameterDirection.Output;
                command.Parameters.AddWithValue("@p_GLEntityID", gLEntity != null ? gLEntity.GLEntityID : this.GLEntityID);
                command.Parameters.AddWithValue("@p_RefCode", this.RefCode);
                command.Parameters.AddWithValue("@p_NDISNumber", ADOHelper.NullCheck(this.NDISNumber));
                command.Parameters.AddWithValue("@p_FirstName", this.FirstName);
                command.Parameters.AddWithValue("@p_LastName", this.LastName);
                command.Parameters.AddWithValue("@p_DOB", this.Dob);
                command.Parameters.AddWithValue("@p_Email", ADOHelper.NullCheck(this.Email));
                command.Parameters.AddWithValue("@p_AddressID", ADOHelper.NullCheck(address != null ? address.AddressID : this.AddressID));
                command.Parameters.AddWithValue("@p_IsHomeAddress", this.IsHomeAddress);
                command.Parameters.AddWithValue("@p_StatementDelOptID", dataOption != null ? dataOption.DataOptionID : this.StatementDelOptID);
                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.
                _clientIDProperty = (System.Int32)command.Parameters["@p_ClientID"].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 (gLEntity != null && gLEntity.GLEntityID != this.GLEntityID)
                {
                    _gLEntityIDProperty = 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 (address != null && address.AddressID != this.AddressID)
                {
                    _addressIDProperty = address.AddressID;
                }

                // 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 (dataOption != null && dataOption.DataOptionID != this.StatementDelOptID)
                {
                    _statementDelOptIDProperty = dataOption.DataOptionID;
                }

                // 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, null, null, null, null, connection);

            OnChildInserted();
        }
 /// <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);
Ejemplo n.º 19
0
 partial void OnChildInserting(ApplicationUser applicationUser, BankAccount bankAccount, GLAccountType gLAccountType, GLEntity gLEntity, SqlConnection connection, ref bool cancel, SqlTransaction trans)
 {
     InsertUpdateBankAccount(connection, trans);
 }
 partial void OnChildInserting(Address address, ApplicationUser applicationUser, BankAccount bankAccount, GLEntity gLEntity, SqlConnection connection, ref bool cancel, SqlTransaction trans)
 {
     InsertUpdateAddress(connection, trans);
 }
        public void Child_Insert(Address address, ApplicationUser applicationUser, BankAccount bankAccount, GLEntity gLEntity, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

            OnChildInserting(address, applicationUser, bankAccount, gLEntity, connection, ref cancel, trans);
            if (cancel)
            {
                return;
            }

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

                command.Parameters.AddWithValue("@p_FinAdministratorID", this.FinAdministratorID);
                command.Parameters["@p_FinAdministratorID"].Direction = ParameterDirection.Output;
                command.Parameters.AddWithValue("@p_GLEntityID", gLEntity != null ? gLEntity.GLEntityID : this.GLEntityID);
                command.Parameters.AddWithValue("@p_Name", ADOHelper.NullCheck(this.Name));
                command.Parameters.AddWithValue("@p_isOrganisation", this.IsOrganisation);
                command.Parameters.AddWithValue("@p_Email", ADOHelper.NullCheck(this.Email));
                command.Parameters.AddWithValue("@p_AddressID", ADOHelper.NullCheck(address != null ? address.AddressID : this.AddressID));
                command.Parameters.AddWithValue("@p_HasDirectDebit", this.HasDirectDebit);
                command.Parameters.AddWithValue("@p_BankAccountID", ADOHelper.NullCheck(bankAccount != null ? bankAccount.BankAccountID : this.BankAccountID));
                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.
                _finAdministratorIDProperty = (System.Int32)command.Parameters["@p_FinAdministratorID"].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 (gLEntity != null && gLEntity.GLEntityID != this.GLEntityID)
                {
                    _gLEntityIDProperty = 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 (address != null && address.AddressID != this.AddressID)
                {
                    _addressIDProperty = address.AddressID;
                }

                // 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 (bankAccount != null && bankAccount.BankAccountID != this.BankAccountID)
                {
                    _bankAccountIDProperty = bankAccount.BankAccountID;
                }

                // 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, null, connection);

            OnChildInserted();
        }
        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();
        }
Ejemplo n.º 23
0
 /// <summary>
 /// CodeSmith generated stub method that is called when updating the child <see cref="Client"/> 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(Address address, ApplicationUser applicationUser, DataOption dataOption, GLEntity gLEntity, SqlConnection connection, ref bool cancel, SqlTransaction trans);
        public void Child_Insert(ApplicationUser applicationUser, BusinessArea businessArea, DataOption dataOption, GLEntity gLEntity, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

            OnChildInserting(applicationUser, businessArea, dataOption, gLEntity, connection, ref cancel, trans);
            if (cancel)
            {
                return;
            }

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

                command.Parameters.AddWithValue("@p_HomeID", this.HomeID);
                command.Parameters["@p_HomeID"].Direction = ParameterDirection.Output;
                command.Parameters.AddWithValue("@p_GLEntityID", gLEntity != null ? gLEntity.GLEntityID : this.GLEntityID);
                command.Parameters.AddWithValue("@p_BusinessAreaID", businessArea != null ? businessArea.BusinessAreaID : this.BusinessAreaID);
                command.Parameters.AddWithValue("@p_HomeCostCentreCode", this.HomeCostCentreCode);
                command.Parameters.AddWithValue("@p_HomeName", this.HomeName);
                command.Parameters.AddWithValue("@p_Parcel", this.Parcel);
                command.Parameters.AddWithValue("@p_SILTarget", this.SILTarget);
                command.Parameters.AddWithValue("@p_NoofBeds", this.NoofBeds);
                command.Parameters.AddWithValue("@p_AccommodationTypeId", dataOption != null ? dataOption.DataOptionID : this.AccommodationTypeId);
                command.Parameters.AddWithValue("@p_isGST", this.IsGST);
                command.Parameters.AddWithValue("@p_AddressID", ADOHelper.NullCheck(this.AddressID));
                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.
                _homeIDProperty = (System.Int32)command.Parameters["@p_HomeID"].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 (gLEntity != null && gLEntity.GLEntityID != this.GLEntityID)
                {
                    _gLEntityIDProperty = 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 (businessArea != null && businessArea.BusinessAreaID != this.BusinessAreaID)
                {
                    _businessAreaIDProperty = businessArea.BusinessAreaID;
                }

                // 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 (dataOption != null && dataOption.DataOptionID != this.AccommodationTypeId)
                {
                    _accommodationTypeIdProperty = dataOption.DataOptionID;
                }

                // 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, null, connection);

            OnChildInserted();
        }
 /// <summary>
 /// CodeSmith generated stub method that is called when updating the child <see cref="Home"/> 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, BusinessArea businessArea, DataOption dataOption, GLEntity gLEntity, SqlConnection connection, ref bool cancel, SqlTransaction trans);