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