/// <summary> /// Loads a <see cref="H05_SubContinent_ReChild"/> object from the given <see cref="H05_SubContinent_ReChildDto"/>. /// </summary> /// <param name="data">The H05_SubContinent_ReChildDto to use.</param> private void Fetch(H05_SubContinent_ReChildDto data) { // Value properties LoadProperty(SubContinent_Child_NameProperty, data.SubContinent_Child_Name); var args = new DataPortalHookArgs(data); OnFetchRead(args); }
private H05_SubContinent_ReChildDto Fetch(IDataReader data) { var h05_SubContinent_ReChild = new H05_SubContinent_ReChildDto(); using (var dr = new SafeDataReader(data)) { if (dr.Read()) { h05_SubContinent_ReChild.SubContinent_Child_Name = dr.GetString("SubContinent_Child_Name"); } } return(h05_SubContinent_ReChild); }
/// <summary> /// Inserts a new H05_SubContinent_ReChild object in the database. /// </summary> /// <param name="h05_SubContinent_ReChild">The H05 Sub Continent Re Child DTO.</param> /// <returns>The new <see cref="H05_SubContinent_ReChildDto"/>.</returns> public H05_SubContinent_ReChildDto Insert(H05_SubContinent_ReChildDto h05_SubContinent_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddH05_SubContinent_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SubContinent_ID2", h05_SubContinent_ReChild.Parent_SubContinent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@SubContinent_Child_Name", h05_SubContinent_ReChild.SubContinent_Child_Name).DbType = DbType.String; cmd.ExecuteNonQuery(); } } return(h05_SubContinent_ReChild); }
/// <summary> /// Updates in the database all changes made to the H05_SubContinent_ReChild object. /// </summary> /// <param name="h05_SubContinent_ReChild">The H05 Sub Continent Re Child DTO.</param> /// <returns>The updated <see cref="H05_SubContinent_ReChildDto"/>.</returns> public H05_SubContinent_ReChildDto Update(H05_SubContinent_ReChildDto h05_SubContinent_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateH05_SubContinent_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SubContinent_ID2", h05_SubContinent_ReChild.Parent_SubContinent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@SubContinent_Child_Name", h05_SubContinent_ReChild.SubContinent_Child_Name).DbType = DbType.String; var rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DataNotFoundException("H05_SubContinent_ReChild"); } } } return(h05_SubContinent_ReChild); }
private void Child_Insert(H04_SubContinent parent) { var dto = new H05_SubContinent_ReChildDto(); dto.Parent_SubContinent_ID = parent.SubContinent_ID; dto.SubContinent_Child_Name = SubContinent_Child_Name; using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <IH05_SubContinent_ReChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }