private void Child_Update(G04_SubContinent parent) { if (!IsDirty) { return; } var dto = new G05_SubContinent_ChildDto(); dto.Parent_SubContinent_ID = parent.SubContinent_ID; dto.SubContinent_Child_Name = SubContinent_Child_Name; dto.RowVersion = _rowVersion; using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnUpdatePre(args); var dal = dalManager.GetProvider <IG05_SubContinent_ChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Update(dto); _rowVersion = resultDto.RowVersion; args = new DataPortalHookArgs(resultDto); } OnUpdatePost(args); } }
/// <summary> /// Loads a <see cref="G05_SubContinent_Child"/> object from the given <see cref="G05_SubContinent_ChildDto"/>. /// </summary> /// <param name="data">The G05_SubContinent_ChildDto to use.</param> private void Fetch(G05_SubContinent_ChildDto data) { // Value properties LoadProperty(SubContinent_Child_NameProperty, data.SubContinent_Child_Name); _rowVersion = data.RowVersion; var args = new DataPortalHookArgs(data); OnFetchRead(args); }
private G05_SubContinent_ChildDto Fetch(IDataReader data) { var g05_SubContinent_Child = new G05_SubContinent_ChildDto(); using (var dr = new SafeDataReader(data)) { if (dr.Read()) { g05_SubContinent_Child.SubContinent_Child_Name = dr.GetString("SubContinent_Child_Name"); g05_SubContinent_Child.RowVersion = dr.GetValue("RowVersion") as byte[]; } } return(g05_SubContinent_Child); }
/// <summary> /// Inserts a new G05_SubContinent_Child object in the database. /// </summary> /// <param name="g05_SubContinent_Child">The G05 Sub Continent Child DTO.</param> /// <returns>The new <see cref="G05_SubContinent_ChildDto"/>.</returns> public G05_SubContinent_ChildDto Insert(G05_SubContinent_ChildDto g05_SubContinent_Child) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddG05_SubContinent_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SubContinent_ID1", g05_SubContinent_Child.Parent_SubContinent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@SubContinent_Child_Name", g05_SubContinent_Child.SubContinent_Child_Name).DbType = DbType.String; cmd.Parameters.Add("@NewRowVersion", SqlDbType.Timestamp).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); g05_SubContinent_Child.RowVersion = (byte[])cmd.Parameters["@NewRowVersion"].Value; } } return(g05_SubContinent_Child); }
/// <summary> /// Updates in the database all changes made to the G05_SubContinent_Child object. /// </summary> /// <param name="g05_SubContinent_Child">The G05 Sub Continent Child DTO.</param> /// <returns>The updated <see cref="G05_SubContinent_ChildDto"/>.</returns> public G05_SubContinent_ChildDto Update(G05_SubContinent_ChildDto g05_SubContinent_Child) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateG05_SubContinent_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SubContinent_ID1", g05_SubContinent_Child.Parent_SubContinent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@SubContinent_Child_Name", g05_SubContinent_Child.SubContinent_Child_Name).DbType = DbType.String; cmd.Parameters.AddWithValue("@RowVersion", g05_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("G05_SubContinent_Child"); } g05_SubContinent_Child.RowVersion = (byte[])cmd.Parameters["@NewRowVersion"].Value; } } return(g05_SubContinent_Child); }