/// <summary> /// Loads a <see cref="G03_Continent_ReChild"/> object from the given <see cref="G03_Continent_ReChildDto"/>. /// </summary> /// <param name="data">The G03_Continent_ReChildDto to use.</param> private void Fetch(G03_Continent_ReChildDto data) { // Value properties LoadProperty(Continent_Child_NameProperty, data.Continent_Child_Name); var args = new DataPortalHookArgs(data); OnFetchRead(args); }
private G03_Continent_ReChildDto Fetch(IDataReader data) { var g03_Continent_ReChild = new G03_Continent_ReChildDto(); using (var dr = new SafeDataReader(data)) { if (dr.Read()) { g03_Continent_ReChild.Continent_Child_Name = dr.GetString("Continent_Child_Name"); } } return(g03_Continent_ReChild); }
/// <summary> /// Inserts a new G03_Continent_ReChild object in the database. /// </summary> /// <param name="g03_Continent_ReChild">The G03 Continent Re Child DTO.</param> /// <returns>The new <see cref="G03_Continent_ReChildDto"/>.</returns> public G03_Continent_ReChildDto Insert(G03_Continent_ReChildDto g03_Continent_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddG03_Continent_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Continent_ID2", g03_Continent_ReChild.Parent_Continent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Continent_Child_Name", g03_Continent_ReChild.Continent_Child_Name).DbType = DbType.String; cmd.ExecuteNonQuery(); } } return(g03_Continent_ReChild); }
/// <summary> /// Updates in the database all changes made to the G03_Continent_ReChild object. /// </summary> /// <param name="g03_Continent_ReChild">The G03 Continent Re Child DTO.</param> /// <returns>The updated <see cref="G03_Continent_ReChildDto"/>.</returns> public G03_Continent_ReChildDto Update(G03_Continent_ReChildDto g03_Continent_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateG03_Continent_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Continent_ID2", g03_Continent_ReChild.Parent_Continent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Continent_Child_Name", g03_Continent_ReChild.Continent_Child_Name).DbType = DbType.String; var rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DataNotFoundException("G03_Continent_ReChild"); } } } return(g03_Continent_ReChild); }
private void Child_Insert(G02_Continent parent) { var dto = new G03_Continent_ReChildDto(); dto.Parent_Continent_ID = parent.Continent_ID; dto.Continent_Child_Name = Continent_Child_Name; using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <IG03_Continent_ReChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }