/// <summary> /// Loads a <see cref="H07_Country_ReChild"/> object from the given <see cref="H07_Country_ReChildDto"/>. /// </summary> /// <param name="data">The H07_Country_ReChildDto to use.</param> private void Fetch(H07_Country_ReChildDto data) { // Value properties LoadProperty(Country_Child_NameProperty, data.Country_Child_Name); var args = new DataPortalHookArgs(data); OnFetchRead(args); }
private H07_Country_ReChildDto Fetch(IDataReader data) { var h07_Country_ReChild = new H07_Country_ReChildDto(); using (var dr = new SafeDataReader(data)) { if (dr.Read()) { h07_Country_ReChild.Country_Child_Name = dr.GetString("Country_Child_Name"); } } return(h07_Country_ReChild); }
/// <summary> /// Inserts a new H07_Country_ReChild object in the database. /// </summary> /// <param name="h07_Country_ReChild">The H07 Country Re Child DTO.</param> /// <returns>The new <see cref="H07_Country_ReChildDto"/>.</returns> public H07_Country_ReChildDto Insert(H07_Country_ReChildDto h07_Country_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddH07_Country_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Country_ID2", h07_Country_ReChild.Parent_Country_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Country_Child_Name", h07_Country_ReChild.Country_Child_Name).DbType = DbType.String; cmd.ExecuteNonQuery(); } } return(h07_Country_ReChild); }
/// <summary> /// Updates in the database all changes made to the H07_Country_ReChild object. /// </summary> /// <param name="h07_Country_ReChild">The H07 Country Re Child DTO.</param> /// <returns>The updated <see cref="H07_Country_ReChildDto"/>.</returns> public H07_Country_ReChildDto Update(H07_Country_ReChildDto h07_Country_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateH07_Country_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Country_ID2", h07_Country_ReChild.Parent_Country_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Country_Child_Name", h07_Country_ReChild.Country_Child_Name).DbType = DbType.String; var rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DataNotFoundException("H07_Country_ReChild"); } } } return(h07_Country_ReChild); }
private void Child_Insert(H06_Country parent) { var dto = new H07_Country_ReChildDto(); dto.Parent_Country_ID = parent.Country_ID; dto.Country_Child_Name = Country_Child_Name; using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <IH07_Country_ReChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }