// OneToMany
 public void LoadBudgetLines(BudgetLineCategory obj)
 {
     if (obj.BudgetLines != null)
     {
         _budgetLinesProperty = obj.BudgetLines.CurrentDTO;
     }
 }
 public BudgetLineCategory CopyDTO(BudgetLineCategory obj)
 {
     obj.BudgetLineCategoryTypeID = this.BudgetLineCategoryTypeID;
     obj.Name     = this.Name;
     obj.IsActive = this.IsActive;
     return(obj);
 }
 // OneToMany
 public void LoadBudgetClientAdjustments(BudgetLineCategory obj)
 {
     if (obj.BudgetClientAdjustments != null)
     {
         _budgetClientAdjustmentsProperty = obj.BudgetClientAdjustments.CurrentDTO;
     }
 }
 public void LoadUpdatedByApplicationUser(BudgetLineCategory obj)
 {
     if (obj.UpdatedByApplicationUser != null)
     {
         _updatedByApplicationUserProperty = obj.UpdatedByApplicationUser.CurrentDTO;
     }
 }
 public void LoadDataOption(BudgetLineCategory obj)
 {
     if (obj.DataOption != null)
     {
         _dataOptionProperty = obj.DataOption.CurrentDTO;
     }
 }
        public static BudgetLineCategory GetBudgetLineCategory(Func <IDataReader, BudgetLineCategory> rowParser, SqlDataReader reader)
        {
            BudgetLineCategory obj = rowParser(reader);

            obj.InitDTO();
            obj.IsDirty = false;
            obj.IsNew   = false;
            return(obj);
        }
Ejemplo n.º 7
0
        protected void UpdateChildren(BudgetLineCategory parent, SqlConnection connection, SqlTransaction trans)
        {
            if (_budgetClientAdjustmentsPropertyChecked)
            {
                if (_budgetClientAdjustmentsProperty != null)
                {
                    foreach (BudgetClientAdjustment obj in _budgetClientAdjustmentsProperty)
                    {
                        if (obj.IsNew)
                        {
                            obj.Child_Insert(parent, connection, trans);
                        }
                        else
                        {
                            if (obj.IsDirty || obj.IsChildDirty())
                            {
                                obj.Child_Update(parent, connection, trans);
                            }
                        }
                    }
                }
            }


            if (_budgetLinesPropertyChecked)
            {
                if (_budgetLinesProperty != null)
                {
                    foreach (BudgetLine obj in _budgetLinesProperty)
                    {
                        if (obj.IsNew)
                        {
                            obj.Child_Insert(parent, connection, trans);
                        }
                        else
                        {
                            if (obj.IsDirty || obj.IsChildDirty())
                            {
                                obj.Child_Update(parent, connection, trans);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// CodeSmith generated stub method that is called when updating the child <see cref="BudgetLine"/> 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, Budget budget, BudgetLineCategory budgetLineCategory, SqlConnection connection, ref bool cancel, SqlTransaction trans);
Ejemplo n.º 9
0
        public void Child_Update(Budget budget, BudgetLineCategory budgetLineCategory, HomeClient homeClient, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

            OnChildUpdating(budget, budgetLineCategory, homeClient, connection, ref cancel, trans);
            if (cancel)
            {
                return;
            }

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

                command.Parameters.AddWithValue("@p_BudgetClientAdjustmentID", this.BudgetClientAdjustmentID);
                command.Parameters.AddWithValue("@p_BudgetID", budget != null ? budget.BudgetID : this.BudgetID);
                command.Parameters.AddWithValue("@p_CategoryID", budgetLineCategory != null ? budgetLineCategory.BudgetLineCategoryID : this.CategoryID);
                command.Parameters.AddWithValue("@p_HomeClientID", homeClient != null ? homeClient.HomeClientID : this.HomeClientID);
                command.Parameters.AddWithValue("@p_AdjustmentAmount", this.AdjustmentAmount);
                command.Parameters.AddWithValue("@p_StartDate", this.StartDate);
                command.Parameters.AddWithValue("@p_IsActive", this.IsActive);
                command.Parameters.AddWithValue("@p_CreatedBy", this.CreatedBy);
                command.Parameters.AddWithValue("@p_CreatedOn", this.CreatedOn);
                command.Parameters.AddWithValue("@p_UpdatedBy", ADOHelper.NullCheck(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 (budget != null && budget.BudgetID != this.BudgetID)
                {
                    _budgetIDProperty = 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 (budgetLineCategory != null && budgetLineCategory.BudgetLineCategoryID != this.CategoryID)
                {
                    _categoryIDProperty = budgetLineCategory.BudgetLineCategoryID;
                }

                // 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 (homeClient != null && homeClient.HomeClientID != this.HomeClientID)
                {
                    _homeClientIDProperty = homeClient.HomeClientID;
                }
            }

            // 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.º 10
0
 public void Child_Update(BudgetLineCategory budgetLineCategory, SqlConnection connection, SqlTransaction trans)
 {
     Child_Update(null, budgetLineCategory, null, connection, trans);
 }
Ejemplo n.º 11
0
        public void Child_Insert(Budget budget, BudgetLineCategory budgetLineCategory, HomeClient homeClient, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

            OnChildInserting(budget, budgetLineCategory, homeClient, connection, ref cancel, trans);
            if (cancel)
            {
                return;
            }

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

                command.Parameters.AddWithValue("@p_BudgetClientAdjustmentID", this.BudgetClientAdjustmentID);
                command.Parameters["@p_BudgetClientAdjustmentID"].Direction = ParameterDirection.Output;
                command.Parameters.AddWithValue("@p_BudgetID", budget != null ? budget.BudgetID : this.BudgetID);
                command.Parameters.AddWithValue("@p_CategoryID", budgetLineCategory != null ? budgetLineCategory.BudgetLineCategoryID : this.CategoryID);
                command.Parameters.AddWithValue("@p_HomeClientID", homeClient != null ? homeClient.HomeClientID : this.HomeClientID);
                command.Parameters.AddWithValue("@p_AdjustmentAmount", this.AdjustmentAmount);
                command.Parameters.AddWithValue("@p_StartDate", this.StartDate);
                command.Parameters.AddWithValue("@p_IsActive", this.IsActive);
                command.Parameters.AddWithValue("@p_CreatedBy", this.CreatedBy);
                command.Parameters.AddWithValue("@p_CreatedOn", this.CreatedOn);
                command.Parameters.AddWithValue("@p_UpdatedBy", ADOHelper.NullCheck(this.UpdatedBy));
                command.Parameters.AddWithValue("@p_UpdatedOn", ADOHelper.NullCheck(this.UpdatedOn));

                command.ExecuteNonQuery();

                // Update identity primary key value.
                _budgetClientAdjustmentIDProperty = (System.Int32)command.Parameters["@p_BudgetClientAdjustmentID"].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 (budget != null && budget.BudgetID != this.BudgetID)
                {
                    _budgetIDProperty = 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 (budgetLineCategory != null && budgetLineCategory.BudgetLineCategoryID != this.CategoryID)
                {
                    _categoryIDProperty = budgetLineCategory.BudgetLineCategoryID;
                }

                // 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 (homeClient != null && homeClient.HomeClientID != this.HomeClientID)
                {
                    _homeClientIDProperty = homeClient.HomeClientID;
                }
            }

            // 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();
        }
 /// <summary>
 /// CodeSmith generated stub method that is called when updating the child <see cref="BudgetClientAdjustment"/> 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(Budget budget, BudgetLineCategory budgetLineCategory, HomeClient homeClient, SqlConnection connection, ref bool cancel, SqlTransaction trans);
        /// <summary>
        /// Creates a new object of type <see cref="BudgetLineCategory"/>.
        /// </summary>
        /// <returns>Returns a newly instantiated collection of type <see cref="BudgetLineCategory"/>.</returns>
        public static BudgetLineCategory NewBudgetLineCategory()
        {
            BudgetLineCategory obj = new BudgetLineCategory();

            return(obj);
        }
Ejemplo n.º 14
0
 public void Child_Insert(BudgetLineCategory budgetLineCategory, SqlConnection connection, SqlTransaction trans)
 {
     Child_Insert(null, null, budgetLineCategory, connection, trans);
 }