/// <summary> /// Loads a <see cref="G03_Continent_Child"/> object from the given <see cref="G03_Continent_ChildDto"/>. /// </summary> /// <param name="data">The G03_Continent_ChildDto to use.</param> private void Fetch(G03_Continent_ChildDto data) { // Value properties LoadProperty(Continent_Child_NameProperty, data.Continent_Child_Name); var args = new DataPortalHookArgs(data); OnFetchRead(args); }
private G03_Continent_ChildDto Fetch(IDataReader data) { var g03_Continent_Child = new G03_Continent_ChildDto(); using (var dr = new SafeDataReader(data)) { if (dr.Read()) { g03_Continent_Child.Continent_Child_Name = dr.GetString("Continent_Child_Name"); } } return(g03_Continent_Child); }
/// <summary> /// Inserts a new G03_Continent_Child object in the database. /// </summary> /// <param name="g03_Continent_Child">The G03 Continent Child DTO.</param> /// <returns>The new <see cref="G03_Continent_ChildDto"/>.</returns> public G03_Continent_ChildDto Insert(G03_Continent_ChildDto g03_Continent_Child) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddG03_Continent_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Continent_ID1", g03_Continent_Child.Parent_Continent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Continent_Child_Name", g03_Continent_Child.Continent_Child_Name).DbType = DbType.String; cmd.ExecuteNonQuery(); } } return(g03_Continent_Child); }
/// <summary> /// Updates in the database all changes made to the G03_Continent_Child object. /// </summary> /// <param name="g03_Continent_Child">The G03 Continent Child DTO.</param> /// <returns>The updated <see cref="G03_Continent_ChildDto"/>.</returns> public G03_Continent_ChildDto Update(G03_Continent_ChildDto g03_Continent_Child) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateG03_Continent_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Continent_ID1", g03_Continent_Child.Parent_Continent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Continent_Child_Name", g03_Continent_Child.Continent_Child_Name).DbType = DbType.String; var rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DataNotFoundException("G03_Continent_Child"); } } } return(g03_Continent_Child); }
private void Child_Insert(G02_Continent parent) { var dto = new G03_Continent_ChildDto(); 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_ChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }