/// <summary> /// Inserts a new C03_Continent_Child object in the database. /// </summary> /// <param name="c03_Continent_Child">The C03 Continent Child DTO.</param> /// <returns>The new <see cref="C03_Continent_ChildDto"/>.</returns> public C03_Continent_ChildDto Insert(C03_Continent_ChildDto c03_Continent_Child) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddC03_Continent_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Continent_ID1", c03_Continent_Child.Parent_Continent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Continent_Child_Name", c03_Continent_Child.Continent_Child_Name).DbType = DbType.String; cmd.ExecuteNonQuery(); } } return(c03_Continent_Child); }
/// <summary> /// Updates in the database all changes made to the C03_Continent_Child object. /// </summary> /// <param name="c03_Continent_Child">The C03 Continent Child DTO.</param> /// <returns>The updated <see cref="C03_Continent_ChildDto"/>.</returns> public C03_Continent_ChildDto Update(C03_Continent_ChildDto c03_Continent_Child) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateC03_Continent_Child", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Continent_ID1", c03_Continent_Child.Parent_Continent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Continent_Child_Name", c03_Continent_Child.Continent_Child_Name).DbType = DbType.String; var rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DataNotFoundException("C03_Continent_Child"); } } } return(c03_Continent_Child); }
private void Child_Insert(C02_Continent parent) { var dto = new C03_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 <IC03_Continent_ChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }