private void Child_Update(E04_SubContinent parent) { if (!IsDirty) { return; } var dto = new E05_SubContinent_ReChildDto(); dto.Parent_SubContinent_ID = parent.SubContinent_ID; dto.SubContinent_Child_Name = SubContinent_Child_Name; dto.RowVersion = _rowVersion; using (var dalManager = DalFactoryParentLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnUpdatePre(args); var dal = dalManager.GetProvider <IE05_SubContinent_ReChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Update(dto); _rowVersion = resultDto.RowVersion; args = new DataPortalHookArgs(resultDto); } OnUpdatePost(args); } }
/// <summary> /// Factory method. Loads a <see cref="E05_SubContinent_ReChild"/> object from the given E05_SubContinent_ReChildDto. /// </summary> /// <param name="data">The <see cref="E05_SubContinent_ReChildDto"/>.</param> /// <returns>A reference to the fetched <see cref="E05_SubContinent_ReChild"/> object.</returns> internal static E05_SubContinent_ReChild GetE05_SubContinent_ReChild(E05_SubContinent_ReChildDto data) { E05_SubContinent_ReChild obj = new E05_SubContinent_ReChild(); obj.Fetch(data); // check all object rules and property rules obj.BusinessRules.CheckRules(); return(obj); }
/// <summary> /// Loads a <see cref="E05_SubContinent_ReChild"/> object from the given <see cref="E05_SubContinent_ReChildDto"/>. /// </summary> /// <param name="data">The E05_SubContinent_ReChildDto to use.</param> private void Fetch(E05_SubContinent_ReChildDto data) { // Value properties LoadProperty(SubContinent_Child_NameProperty, data.SubContinent_Child_Name); _rowVersion = data.RowVersion; // parent properties subContinent_ID2 = data.Parent_SubContinent_ID; var args = new DataPortalHookArgs(data); OnFetchRead(args); }
private E05_SubContinent_ReChildDto FetchE05_SubContinent_ReChild(SafeDataReader dr) { var e05_SubContinent_ReChild = new E05_SubContinent_ReChildDto(); // Value properties e05_SubContinent_ReChild.SubContinent_Child_Name = dr.GetString("SubContinent_Child_Name"); e05_SubContinent_ReChild.RowVersion = dr.GetValue("RowVersion") as byte[]; // parent properties e05_SubContinent_ReChild.Parent_SubContinent_ID = dr.GetInt32("SubContinent_ID2"); return(e05_SubContinent_ReChild); }
/// <summary> /// Factory method. Loads a <see cref="E05_SubContinent_ReChild"/> object from the given E05_SubContinent_ReChildDto. /// </summary> /// <param name="data">The <see cref="E05_SubContinent_ReChildDto"/>.</param> /// <returns>A reference to the fetched <see cref="E05_SubContinent_ReChild"/> object.</returns> internal static E05_SubContinent_ReChild GetE05_SubContinent_ReChild(E05_SubContinent_ReChildDto data) { E05_SubContinent_ReChild obj = new E05_SubContinent_ReChild(); // show the framework that this is a child object obj.MarkAsChild(); obj.Fetch(data); obj.MarkOld(); // check all object rules and property rules obj.BusinessRules.CheckRules(); return(obj); }
/// <summary> /// Inserts a new E05_SubContinent_ReChild object in the database. /// </summary> /// <param name="e05_SubContinent_ReChild">The E05 Sub Continent Re Child DTO.</param> /// <returns>The new <see cref="E05_SubContinent_ReChildDto"/>.</returns> public E05_SubContinent_ReChildDto Insert(E05_SubContinent_ReChildDto e05_SubContinent_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddE05_SubContinent_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SubContinent_ID2", e05_SubContinent_ReChild.Parent_SubContinent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@SubContinent_Child_Name", e05_SubContinent_ReChild.SubContinent_Child_Name).DbType = DbType.String; cmd.Parameters.Add("@NewRowVersion", SqlDbType.Timestamp).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); e05_SubContinent_ReChild.RowVersion = (byte[])cmd.Parameters["@NewRowVersion"].Value; } } return(e05_SubContinent_ReChild); }
/// <summary> /// Updates in the database all changes made to the E05_SubContinent_ReChild object. /// </summary> /// <param name="e05_SubContinent_ReChild">The E05 Sub Continent Re Child DTO.</param> /// <returns>The updated <see cref="E05_SubContinent_ReChildDto"/>.</returns> public E05_SubContinent_ReChildDto Update(E05_SubContinent_ReChildDto e05_SubContinent_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateE05_SubContinent_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SubContinent_ID2", e05_SubContinent_ReChild.Parent_SubContinent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@SubContinent_Child_Name", e05_SubContinent_ReChild.SubContinent_Child_Name).DbType = DbType.String; cmd.Parameters.AddWithValue("@RowVersion", e05_SubContinent_ReChild.RowVersion).DbType = DbType.Binary; cmd.Parameters.Add("@NewRowVersion", SqlDbType.Timestamp).Direction = ParameterDirection.Output; var rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DataNotFoundException("E05_SubContinent_ReChild"); } e05_SubContinent_ReChild.RowVersion = (byte[])cmd.Parameters["@NewRowVersion"].Value; } } return(e05_SubContinent_ReChild); }