/// <summary> /// Factory method. Loads a <see cref="E03_Continent_Child"/> object from the given E03_Continent_ChildDto. /// </summary> /// <param name="data">The <see cref="E03_Continent_ChildDto"/>.</param> /// <returns>A reference to the fetched <see cref="E03_Continent_Child"/> object.</returns> internal static E03_Continent_Child GetE03_Continent_Child(E03_Continent_ChildDto data) { E03_Continent_Child obj = new E03_Continent_Child(); obj.Fetch(data); return(obj); }
/// <summary> /// Loads a <see cref="E03_Continent_Child"/> object from the given <see cref="E03_Continent_ChildDto"/>. /// </summary> /// <param name="data">The E03_Continent_ChildDto to use.</param> private void Fetch(E03_Continent_ChildDto data) { // Value properties LoadProperty(Continent_Child_NameProperty, data.Continent_Child_Name); var args = new DataPortalHookArgs(data); OnFetchRead(args); }
/// <summary> /// Factory method. Loads a <see cref="E03_Continent_Child"/> object from the given E03_Continent_ChildDto. /// </summary> /// <param name="data">The <see cref="E03_Continent_ChildDto"/>.</param> /// <returns>A reference to the fetched <see cref="E03_Continent_Child"/> object.</returns> internal static E03_Continent_Child GetE03_Continent_Child(E03_Continent_ChildDto data) { E03_Continent_Child obj = new E03_Continent_Child(); // show the framework that this is a child object obj.MarkAsChild(); obj.Fetch(data); obj.MarkOld(); return(obj); }
/// <summary> /// Inserts a new E03_Continent_Child object in the database. /// </summary> /// <param name="e03_Continent_Child">The E03 Continent Child DTO.</param> /// <returns>The new <see cref="E03_Continent_ChildDto"/>.</returns> public E03_Continent_ChildDto Insert(E03_Continent_ChildDto e03_Continent_Child) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddE03_Continent_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Continent_ID1", e03_Continent_Child.Parent_Continent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Continent_Child_Name", e03_Continent_Child.Continent_Child_Name).DbType = DbType.String; cmd.ExecuteNonQuery(); } } return(e03_Continent_Child); }
/// <summary> /// Updates in the database all changes made to the E03_Continent_Child object. /// </summary> /// <param name="e03_Continent_Child">The E03 Continent Child DTO.</param> /// <returns>The updated <see cref="E03_Continent_ChildDto"/>.</returns> public E03_Continent_ChildDto Update(E03_Continent_ChildDto e03_Continent_Child) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateE03_Continent_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Continent_ID1", e03_Continent_Child.Parent_Continent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Continent_Child_Name", e03_Continent_Child.Continent_Child_Name).DbType = DbType.String; var rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DataNotFoundException("E03_Continent_Child"); } } } return(e03_Continent_Child); }
private void Child_Insert(E02_Continent parent) { var dto = new E03_Continent_ChildDto(); dto.Parent_Continent_ID = parent.Continent_ID; dto.Continent_Child_Name = Continent_Child_Name; using (var dalManager = DalFactoryParentLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <IE03_Continent_ChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }