public void LoadGLEntity(FinAdministrator obj)
 {
     if (obj.GLEntity != null)
     {
         _gLEntityProperty = obj.GLEntity.CurrentDTO;
     }
 }
 // OneToMany
 public void LoadFinAdministratorAppUsers(FinAdministrator obj)
 {
     if (obj.FinAdministratorAppUsers != null)
     {
         _finAdministratorAppUsersProperty = obj.FinAdministratorAppUsers.CurrentDTO;
     }
 }
 public void LoadUpdatedByApplicationUser(FinAdministrator obj)
 {
     if (obj.UpdatedByApplicationUser != null)
     {
         _updatedByApplicationUserProperty = obj.UpdatedByApplicationUser.CurrentDTO;
     }
 }
 public void LoadAddress(FinAdministrator obj)
 {
     if (obj.Address != null)
     {
         _addressProperty = obj.Address.CurrentDTO;
     }
 }
 public void LoadBankAccount(FinAdministrator obj)
 {
     if (obj.BankAccount != null)
     {
         _bankAccountProperty = obj.BankAccount.CurrentDTO;
     }
 }
Beispiel #6
0
        public static FinAdministrator GetFinAdministrator(Func <IDataReader, FinAdministrator> rowParser, SqlDataReader reader)
        {
            FinAdministrator obj = rowParser(reader);

            obj.InitDTO();
            obj.IsDirty = false;
            obj.IsNew   = false;
            return(obj);
        }
 public FinAdministrator CopyDTO(FinAdministrator obj)
 {
     obj.GLEntityID     = this.GLEntityID;
     obj.Name           = this.Name;
     obj.IsOrganisation = this.IsOrganisation;
     obj.Email          = this.Email;
     obj.AddressID      = this.AddressID;
     obj.HasDirectDebit = this.HasDirectDebit;
     obj.BankAccountID  = this.BankAccountID;
     obj.IsActive       = this.IsActive;
     return(obj);
 }
 protected void UpdateChildren(FinAdministrator parent, SqlConnection connection, SqlTransaction trans)
 {
     if (_finAdministratorAppUsersPropertyChecked)
     {
         if (_finAdministratorAppUsersProperty != null)
         {
             foreach (FinAdministratorAppUser obj in _finAdministratorAppUsersProperty)
             {
                 if (obj.IsNew)
                 {
                     obj.Child_Insert(parent, connection, trans);
                 }
                 else
                 {
                     if (obj.IsDirty || obj.IsChildDirty())
                     {
                         obj.Child_Update(parent, connection, trans);
                     }
                 }
             }
         }
     }
 }
Beispiel #9
0
        public void Child_Update(ApplicationUser applicationUser, FinAdministrator finAdministrator, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

            OnChildUpdating(applicationUser, finAdministrator, connection, ref cancel, trans);
            if (cancel)
            {
                return;
            }

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

                command.Parameters.AddWithValue("@p_FinAdministratorAppUserID", this.FinAdministratorAppUserID);
                command.Parameters.AddWithValue("@p_FinAdministratorID", finAdministrator != null ? finAdministrator.FinAdministratorID : this.FinAdministratorID);
                command.Parameters.AddWithValue("@p_ApplicationUserId", applicationUser != null ? applicationUser.ApplicationUserID : this.ApplicationUserId);
                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 (finAdministrator != null && finAdministrator.FinAdministratorID != this.FinAdministratorID)
                {
                    _finAdministratorIDProperty = finAdministrator.FinAdministratorID;
                }

                // 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.ApplicationUserId)
                {
                    _applicationUserIdProperty = 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.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();
        }
Beispiel #10
0
 public void Child_Update(FinAdministrator finAdministrator, SqlConnection connection, SqlTransaction trans)
 {
     Child_Update(null, finAdministrator, connection, trans);
 }
Beispiel #11
0
        public void Child_Insert(ApplicationUser applicationUser, FinAdministrator finAdministrator, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

            OnChildInserting(applicationUser, finAdministrator, connection, ref cancel, trans);
            if (cancel)
            {
                return;
            }

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

                command.Parameters.AddWithValue("@p_FinAdministratorAppUserID", this.FinAdministratorAppUserID);
                command.Parameters["@p_FinAdministratorAppUserID"].Direction = ParameterDirection.Output;
                command.Parameters.AddWithValue("@p_FinAdministratorID", finAdministrator != null ? finAdministrator.FinAdministratorID : this.FinAdministratorID);
                command.Parameters.AddWithValue("@p_ApplicationUserId", applicationUser != null ? applicationUser.ApplicationUserID : this.ApplicationUserId);
                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.
                _finAdministratorAppUserIDProperty = (System.Int32)command.Parameters["@p_FinAdministratorAppUserID"].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 (finAdministrator != null && finAdministrator.FinAdministratorID != this.FinAdministratorID)
                {
                    _finAdministratorIDProperty = finAdministrator.FinAdministratorID;
                }

                // 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.ApplicationUserId)
                {
                    _applicationUserIdProperty = 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.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();
        }
Beispiel #12
0
 /// <summary>
 /// CodeSmith generated stub method that is called when updating the child <see cref="FinAdministratorAppUser"/> 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, FinAdministrator finAdministrator, SqlConnection connection, ref bool cancel, SqlTransaction trans);
Beispiel #13
0
        /// <summary>
        /// Creates a new object of type <see cref="FinAdministrator"/>.
        /// </summary>
        /// <returns>Returns a newly instantiated collection of type <see cref="FinAdministrator"/>.</returns>
        public static FinAdministrator NewFinAdministrator()
        {
            FinAdministrator obj = new FinAdministrator();

            return(obj);
        }