private void Child_Update(E04_SubContinent parent) { if (!IsDirty) { return; } var dto = new E05_SubContinent_ChildDto(); 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_ChildDal>(); 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_Child"/> object from the given E05_SubContinent_ChildDto. /// </summary> /// <param name="data">The <see cref="E05_SubContinent_ChildDto"/>.</param> /// <returns>A reference to the fetched <see cref="E05_SubContinent_Child"/> object.</returns> internal static E05_SubContinent_Child GetE05_SubContinent_Child(E05_SubContinent_ChildDto data) { E05_SubContinent_Child obj = new E05_SubContinent_Child(); obj.Fetch(data); return(obj); }
/// <summary> /// Factory method. Loads a <see cref="E05_SubContinent_Child"/> object from the given E05_SubContinent_ChildDto. /// </summary> /// <param name="data">The <see cref="E05_SubContinent_ChildDto"/>.</param> /// <returns>A reference to the fetched <see cref="E05_SubContinent_Child"/> object.</returns> internal static E05_SubContinent_Child GetE05_SubContinent_Child(E05_SubContinent_ChildDto data) { E05_SubContinent_Child obj = new E05_SubContinent_Child(); // show the framework that this is a child object obj.MarkAsChild(); obj.Fetch(data); obj.MarkOld(); return(obj); }
/// <summary> /// Loads a <see cref="E05_SubContinent_Child"/> object from the given <see cref="E05_SubContinent_ChildDto"/>. /// </summary> /// <param name="data">The E05_SubContinent_ChildDto to use.</param> private void Fetch(E05_SubContinent_ChildDto data) { // Value properties LoadProperty(SubContinent_Child_NameProperty, data.SubContinent_Child_Name); _rowVersion = data.RowVersion; // parent properties subContinent_ID1 = data.Parent_SubContinent_ID; var args = new DataPortalHookArgs(data); OnFetchRead(args); }
private E05_SubContinent_ChildDto FetchE05_SubContinent_Child(SafeDataReader dr) { var e05_SubContinent_Child = new E05_SubContinent_ChildDto(); // Value properties e05_SubContinent_Child.SubContinent_Child_Name = dr.GetString("SubContinent_Child_Name"); e05_SubContinent_Child.RowVersion = dr.GetValue("RowVersion") as byte[]; // parent properties e05_SubContinent_Child.Parent_SubContinent_ID = dr.GetInt32("SubContinent_ID1"); return(e05_SubContinent_Child); }
/// <summary> /// Inserts a new E05_SubContinent_Child object in the database. /// </summary> /// <param name="e05_SubContinent_Child">The E05 Sub Continent Child DTO.</param> /// <returns>The new <see cref="E05_SubContinent_ChildDto"/>.</returns> public E05_SubContinent_ChildDto Insert(E05_SubContinent_ChildDto e05_SubContinent_Child) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddE05_SubContinent_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SubContinent_ID1", e05_SubContinent_Child.Parent_SubContinent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@SubContinent_Child_Name", e05_SubContinent_Child.SubContinent_Child_Name).DbType = DbType.String; cmd.Parameters.Add("@NewRowVersion", SqlDbType.Timestamp).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); e05_SubContinent_Child.RowVersion = (byte[])cmd.Parameters["@NewRowVersion"].Value; } } return(e05_SubContinent_Child); }
/// <summary> /// Updates in the database all changes made to the E05_SubContinent_Child object. /// </summary> /// <param name="e05_SubContinent_Child">The E05 Sub Continent Child DTO.</param> /// <returns>The updated <see cref="E05_SubContinent_ChildDto"/>.</returns> public E05_SubContinent_ChildDto Update(E05_SubContinent_ChildDto e05_SubContinent_Child) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateE05_SubContinent_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SubContinent_ID1", e05_SubContinent_Child.Parent_SubContinent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@SubContinent_Child_Name", e05_SubContinent_Child.SubContinent_Child_Name).DbType = DbType.String; cmd.Parameters.AddWithValue("@RowVersion", e05_SubContinent_Child.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_Child"); } e05_SubContinent_Child.RowVersion = (byte[])cmd.Parameters["@NewRowVersion"].Value; } } return(e05_SubContinent_Child); }