示例#1
0
 // ZeroOrOneToMany
 public void LoadCountryAddresses(DataOption obj)
 {
     if (obj.CountryAddresses != null)
     {
         _countryAddressesProperty = obj.CountryAddresses.CurrentDTO;
     }
 }
示例#2
0
 // OneToMany
 public void LoadHomes(DataOption obj)
 {
     if (obj.Homes != null)
     {
         _homesProperty = obj.Homes.CurrentDTO;
     }
 }
示例#3
0
 // OneToMany
 public void LoadClients(DataOption obj)
 {
     if (obj.Clients != null)
     {
         _clientsProperty = obj.Clients.CurrentDTO;
     }
 }
示例#4
0
 public void LoadUpdatedByApplicationUser(DataOption obj)
 {
     if (obj.UpdatedByApplicationUser != null)
     {
         _updatedByApplicationUserProperty = obj.UpdatedByApplicationUser.CurrentDTO;
     }
 }
示例#5
0
 public void LoadDataOptionType(DataOption obj)
 {
     if (obj.DataOptionType != null)
     {
         _dataOptionTypeProperty = obj.DataOptionType.CurrentDTO;
     }
 }
示例#6
0
 // ZeroOrOneToMany
 public void LoadStateAddresses(DataOption obj)
 {
     if (obj.StateAddresses != null)
     {
         _stateAddressesProperty = obj.StateAddresses.CurrentDTO;
     }
 }
示例#7
0
 // ZeroOrOneToMany
 public void LoadApplicationUsers(DataOption obj)
 {
     if (obj.ApplicationUsers != null)
     {
         _applicationUsersProperty = obj.ApplicationUsers.CurrentDTO;
     }
 }
示例#8
0
 // OneToMany
 public void LoadBudgetLineCategories(DataOption obj)
 {
     if (obj.BudgetLineCategories != null)
     {
         _budgetLineCategoriesProperty = obj.BudgetLineCategories.CurrentDTO;
     }
 }
示例#9
0
        public void Child_Update(ApplicationUser applicationUser, DataOption dataOption, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

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

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

                command.Parameters.AddWithValue("@p_BudgetLineCategoryID", this.BudgetLineCategoryID);
                command.Parameters.AddWithValue("@p_BudgetLineCategoryTypeID", dataOption != null ? dataOption.DataOptionID : this.BudgetLineCategoryTypeID);
                command.Parameters.AddWithValue("@p_Name", this.Name);
                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 (dataOption != null && dataOption.DataOptionID != this.BudgetLineCategoryTypeID)
                {
                    _budgetLineCategoryTypeIDProperty = 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, null, null, null, connection);

            OnChildUpdated();
        }
示例#10
0
        public void Child_Insert(ApplicationUser applicationUser, DataOption dataOption, SqlConnection connection, SqlTransaction trans)
        {
            bool cancel = false;

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

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

                command.Parameters.AddWithValue("@p_BudgetLineCategoryID", this.BudgetLineCategoryID);
                command.Parameters["@p_BudgetLineCategoryID"].Direction = ParameterDirection.Output;
                command.Parameters.AddWithValue("@p_BudgetLineCategoryTypeID", dataOption != null ? dataOption.DataOptionID : this.BudgetLineCategoryTypeID);
                command.Parameters.AddWithValue("@p_Name", this.Name);
                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.
                _budgetLineCategoryIDProperty = (System.Int32)command.Parameters["@p_BudgetLineCategoryID"].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 (dataOption != null && dataOption.DataOptionID != this.BudgetLineCategoryTypeID)
                {
                    _budgetLineCategoryTypeIDProperty = 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();
        }
        public static DataOption GetDataOption(Func <IDataReader, DataOption> rowParser, SqlDataReader reader)
        {
            DataOption obj = rowParser(reader);

            obj.InitDTO();
            obj.IsDirty = false;
            obj.IsNew   = false;
            return(obj);
        }
示例#12
0
 public DataOption CopyDTO(DataOption obj)
 {
     obj.DataOptionTypeID     = this.DataOptionTypeID;
     obj.Code                 = this.Code;
     obj.DisplayValue         = this.DisplayValue;
     obj.ParentID             = this.ParentID;
     obj.SortID               = this.SortID;
     obj.IsSystem             = this.IsSystem;
     obj.AdditionalConfigData = this.AdditionalConfigData;
     obj.ActiveFrom           = this.ActiveFrom;
     obj.ActiveTo             = this.ActiveTo;
     return(obj);
 }
 /// <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);
        /// <summary>
        /// Creates a new object of type <see cref="DataOption"/>.
        /// </summary>
        /// <returns>Returns a newly instantiated collection of type <see cref="DataOption"/>.</returns>
        public static DataOption NewDataOption()
        {
            DataOption obj = new DataOption();

            return(obj);
        }
 public void Child_Update(DataOption dataOption, SqlConnection connection, SqlTransaction trans)
 {
     Child_Update(null, null, dataOption, null, connection, 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();
        }
        protected void UpdateChildren(DataOption parent, SqlConnection connection, SqlTransaction trans)
        {
            if (_stateAddressesPropertyChecked)
            {
                if (_stateAddressesProperty != null)
                {
                    foreach (Address obj in _stateAddressesProperty)
                    {
                        if (obj.IsNew)
                        {
                            obj.Child_Insert(parent, connection, trans);
                        }
                        else
                        {
                            if (obj.IsDirty || obj.IsChildDirty())
                            {
                                obj.Child_Update(parent, connection, trans);
                            }
                        }
                    }
                }
            }


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


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


            if (_budgetLineCategoriesPropertyChecked)
            {
                if (_budgetLineCategoriesProperty != null)
                {
                    foreach (BudgetLineCategory obj in _budgetLineCategoriesProperty)
                    {
                        if (obj.IsNew)
                        {
                            obj.Child_Insert(parent, connection, trans);
                        }
                        else
                        {
                            if (obj.IsDirty || obj.IsChildDirty())
                            {
                                obj.Child_Update(parent, connection, 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 (_dataOptionTypesPropertyChecked)
            {
                if (_dataOptionTypesProperty != null)
                {
                    foreach (DataOptionType obj in _dataOptionTypesProperty)
                    {
                        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);
                            }
                        }
                    }
                }
            }
        }
 /// <summary>
 /// CodeSmith generated stub method that is called when inserting the child <see cref="DataOptionType"/> object.
 /// </summary>
 partial void OnChildInserting(ApplicationUser applicationUser, DataOption dataOption, DataOptionTypeSort dataOptionTypeSort, SqlConnection connection, ref bool cancel, SqlTransaction trans);
 /// <summary>
 /// CodeSmith generated stub method that is called when updating the child <see cref="BudgetLineCategory"/> 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, DataOption dataOption, SqlConnection connection, ref bool cancel, SqlTransaction trans);
示例#20
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();
        }
示例#21
0
 public void Child_Insert(DataOption dataOption, SqlConnection connection, SqlTransaction trans)
 {
     Child_Insert(null, dataOption, connection, trans);
 }
示例#22
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);