// ZeroOrOneToMany public void LoadApplicationPermissions(BusinessArea obj) { if (obj.ApplicationPermissions != null) { _applicationPermissionsProperty = obj.ApplicationPermissions.CurrentDTO; } }
// OneToMany public void LoadHomes(BusinessArea obj) { if (obj.Homes != null) { _homesProperty = obj.Homes.CurrentDTO; } }
public void LoadBusinessDivision(BusinessArea obj) { if (obj.BusinessDivision != null) { _businessDivisionProperty = obj.BusinessDivision.CurrentDTO; } }
public BusinessArea CopyDTO(BusinessArea obj) { obj.Code = this.Code; obj.Name = this.Name; obj.BusinessDivisionID = this.BusinessDivisionID; return(obj); }
public static BusinessArea GetBusinessArea(Func <IDataReader, BusinessArea> rowParser, SqlDataReader reader) { BusinessArea obj = rowParser(reader); obj.InitDTO(); obj.IsDirty = false; obj.IsNew = false; return(obj); }
protected void UpdateChildren(BusinessArea parent, SqlConnection connection, SqlTransaction trans) { if (_applicationPermissionsPropertyChecked) { if (_applicationPermissionsProperty != null) { foreach (ApplicationPermission obj in _applicationPermissionsProperty) { 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> /// Creates a new object of type <see cref="BusinessArea"/>. /// </summary> /// <returns>Returns a newly instantiated collection of type <see cref="BusinessArea"/>.</returns> public static BusinessArea NewBusinessArea() { BusinessArea obj = new BusinessArea(); 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(BusinessArea businessArea, SqlConnection connection, SqlTransaction trans) { Child_Update(null, businessArea, null, 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(); }
public void Child_Update(ApplicationUser applicationUser, BusinessArea businessArea, BusinessDivision businessDivision, BusinessEntity businessEntity, Client client, Home home, SqlConnection connection, SqlTransaction trans) { bool cancel = false; OnChildUpdating(applicationUser, businessArea, businessDivision, businessEntity, client, home, connection, ref cancel, trans); if (cancel) { return; } if (connection.State != ConnectionState.Open) { connection.Open(); } using (var command = new SqlCommand("[dbo].[spCFM_ApplicationPermission_Update]", connection, trans)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@p_ApplicationPermissionID", this.ApplicationPermissionID); command.Parameters.AddWithValue("@p_ApplicationRoleID", ADOHelper.NullCheck(this.ApplicationRoleID)); command.Parameters.AddWithValue("@p_ApplicationUserID", ADOHelper.NullCheck(this.ApplicationUserID)); command.Parameters.AddWithValue("@p_BusinessAreaID", ADOHelper.NullCheck(businessArea != null ? businessArea.BusinessAreaID : this.BusinessAreaID)); command.Parameters.AddWithValue("@p_BusinessDivisionID", ADOHelper.NullCheck(businessDivision != null ? businessDivision.BusinessDivisionID : this.BusinessDivisionID)); command.Parameters.AddWithValue("@p_BusinessEntityID", ADOHelper.NullCheck(businessEntity != null ? businessEntity.BusinessEntityID : this.BusinessEntityID)); command.Parameters.AddWithValue("@p_HomeID", ADOHelper.NullCheck(home != null ? home.HomeID : this.HomeID)); command.Parameters.AddWithValue("@p_ClientID", ADOHelper.NullCheck(client != null ? client.ClientID : this.ClientID)); 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 (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 (businessDivision != null && businessDivision.BusinessDivisionID != this.BusinessDivisionID) { _businessDivisionIDProperty = businessDivision.BusinessDivisionID; } // 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 (businessEntity != null && businessEntity.BusinessEntityID != this.BusinessEntityID) { _businessEntityIDProperty = businessEntity.BusinessEntityID; } // 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 (home != null && home.HomeID != this.HomeID) { _homeIDProperty = home.HomeID; } // 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 (client != null && client.ClientID != this.ClientID) { _clientIDProperty = client.ClientID; } // 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(); }
public void Child_Insert(ApplicationUser applicationUser, BusinessArea businessArea, BusinessDivision businessDivision, BusinessEntity businessEntity, Client client, Home home, SqlConnection connection, SqlTransaction trans) { bool cancel = false; OnChildInserting(applicationUser, businessArea, businessDivision, businessEntity, client, home, connection, ref cancel, trans); if (cancel) { return; } if (connection.State != ConnectionState.Open) { connection.Open(); } using (var command = new SqlCommand("[dbo].[spCFM_ApplicationPermission_Insert]", connection, trans)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@p_ApplicationPermissionID", this.ApplicationPermissionID); command.Parameters["@p_ApplicationPermissionID"].Direction = ParameterDirection.Output; command.Parameters.AddWithValue("@p_ApplicationRoleID", ADOHelper.NullCheck(this.ApplicationRoleID)); command.Parameters.AddWithValue("@p_ApplicationUserID", ADOHelper.NullCheck(this.ApplicationUserID)); command.Parameters.AddWithValue("@p_BusinessAreaID", ADOHelper.NullCheck(businessArea != null ? businessArea.BusinessAreaID : this.BusinessAreaID)); command.Parameters.AddWithValue("@p_BusinessDivisionID", ADOHelper.NullCheck(businessDivision != null ? businessDivision.BusinessDivisionID : this.BusinessDivisionID)); command.Parameters.AddWithValue("@p_BusinessEntityID", ADOHelper.NullCheck(businessEntity != null ? businessEntity.BusinessEntityID : this.BusinessEntityID)); command.Parameters.AddWithValue("@p_HomeID", ADOHelper.NullCheck(home != null ? home.HomeID : this.HomeID)); command.Parameters.AddWithValue("@p_ClientID", ADOHelper.NullCheck(client != null ? client.ClientID : this.ClientID)); 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. _applicationPermissionIDProperty = (System.Int32)command.Parameters["@p_ApplicationPermissionID"].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 (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 (businessDivision != null && businessDivision.BusinessDivisionID != this.BusinessDivisionID) { _businessDivisionIDProperty = businessDivision.BusinessDivisionID; } // 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 (businessEntity != null && businessEntity.BusinessEntityID != this.BusinessEntityID) { _businessEntityIDProperty = businessEntity.BusinessEntityID; } // 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 (home != null && home.HomeID != this.HomeID) { _homeIDProperty = home.HomeID; } // 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 (client != null && client.ClientID != this.ClientID) { _clientIDProperty = client.ClientID; } // 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(); }
/// <summary> /// CodeSmith generated stub method that is called when updating the child <see cref="ApplicationPermission"/> 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, BusinessDivision businessDivision, BusinessEntity businessEntity, Client client, Home home, SqlConnection connection, ref bool cancel, SqlTransaction trans);
/// <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);