Пример #1
0
 // OneToMany
 public void LoadBudgetClientAdjustments(HomeClient obj)
 {
     if (obj.BudgetClientAdjustments != null)
     {
         _budgetClientAdjustmentsProperty = obj.BudgetClientAdjustments.CurrentDTO;
     }
 }
Пример #2
0
 public void LoadUpdatedByApplicationUser(HomeClient obj)
 {
     if (obj.UpdatedByApplicationUser != null)
     {
         _updatedByApplicationUserProperty = obj.UpdatedByApplicationUser.CurrentDTO;
     }
 }
Пример #3
0
 public void LoadHome(HomeClient obj)
 {
     if (obj.Home != null)
     {
         _homeProperty = obj.Home.CurrentDTO;
     }
 }
Пример #4
0
 public void LoadClient(HomeClient obj)
 {
     if (obj.Client != null)
     {
         _clientProperty = obj.Client.CurrentDTO;
     }
 }
Пример #5
0
        public static HomeClient GetHomeClient(Func <IDataReader, HomeClient> rowParser, SqlDataReader reader)
        {
            HomeClient obj = rowParser(reader);

            obj.InitDTO();
            obj.IsDirty = false;
            obj.IsNew   = false;
            return(obj);
        }
Пример #6
0
 public HomeClient CopyDTO(HomeClient obj)
 {
     obj.HomeID    = this.HomeID;
     obj.ClientID  = this.ClientID;
     obj.EntryDate = this.EntryDate;
     obj.ExitDate  = this.ExitDate;
     obj.IsActive  = this.IsActive;
     return(obj);
 }
 protected void UpdateChildren(HomeClient 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);
                     }
                 }
             }
         }
     }
 }
Пример #8
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();
        }
Пример #9
0
 public void Child_Update(HomeClient homeClient, SqlConnection connection, SqlTransaction trans)
 {
     Child_Update(null, null, homeClient, connection, trans);
 }
Пример #10
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();
        }
Пример #11
0
        /// <summary>
        /// Creates a new object of type <see cref="HomeClient"/>.
        /// </summary>
        /// <returns>Returns a newly instantiated collection of type <see cref="HomeClient"/>.</returns>
        public static HomeClient NewHomeClient()
        {
            HomeClient obj = new HomeClient();

            return(obj);
        }
 /// <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);