/// <summary> /// Factory method. Loads a <see cref="B05_SubContinent_ReChild"/> object from the given B05_SubContinent_ReChildDto. /// </summary> /// <param name="data">The <see cref="B05_SubContinent_ReChildDto"/>.</param> /// <returns>A reference to the fetched <see cref="B05_SubContinent_ReChild"/> object.</returns> internal static B05_SubContinent_ReChild GetB05_SubContinent_ReChild(B05_SubContinent_ReChildDto data) { B05_SubContinent_ReChild obj = new B05_SubContinent_ReChild(); obj.Fetch(data); // check all object rules and property rules obj.BusinessRules.CheckRules(); return(obj); }
/// <summary> /// Loads a <see cref="B05_SubContinent_ReChild"/> object from the given <see cref="B05_SubContinent_ReChildDto"/>. /// </summary> /// <param name="data">The B05_SubContinent_ReChildDto to use.</param> private void Fetch(B05_SubContinent_ReChildDto data) { // Value properties LoadProperty(SubContinent_Child_NameProperty, data.SubContinent_Child_Name); // parent properties subContinent_ID2 = data.Parent_SubContinent_ID; var args = new DataPortalHookArgs(data); OnFetchRead(args); }
private B05_SubContinent_ReChildDto FetchB05_SubContinent_ReChild(SafeDataReader dr) { var b05_SubContinent_ReChild = new B05_SubContinent_ReChildDto(); // Value properties b05_SubContinent_ReChild.SubContinent_Child_Name = dr.GetString("SubContinent_Child_Name"); // parent properties b05_SubContinent_ReChild.Parent_SubContinent_ID = dr.GetInt32("SubContinent_ID2"); return(b05_SubContinent_ReChild); }
/// <summary> /// Factory method. Loads a <see cref="B05_SubContinent_ReChild"/> object from the given B05_SubContinent_ReChildDto. /// </summary> /// <param name="data">The <see cref="B05_SubContinent_ReChildDto"/>.</param> /// <returns>A reference to the fetched <see cref="B05_SubContinent_ReChild"/> object.</returns> internal static B05_SubContinent_ReChild GetB05_SubContinent_ReChild(B05_SubContinent_ReChildDto data) { B05_SubContinent_ReChild obj = new B05_SubContinent_ReChild(); // show the framework that this is a child object obj.MarkAsChild(); obj.Fetch(data); obj.MarkOld(); // check all object rules and property rules obj.BusinessRules.CheckRules(); return(obj); }
/// <summary> /// Inserts a new B05_SubContinent_ReChild object in the database. /// </summary> /// <param name="b05_SubContinent_ReChild">The B05 Sub Continent Re Child DTO.</param> /// <returns>The new <see cref="B05_SubContinent_ReChildDto"/>.</returns> public B05_SubContinent_ReChildDto Insert(B05_SubContinent_ReChildDto b05_SubContinent_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddB05_SubContinent_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SubContinent_ID2", b05_SubContinent_ReChild.Parent_SubContinent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@SubContinent_Child_Name", b05_SubContinent_ReChild.SubContinent_Child_Name).DbType = DbType.String; cmd.ExecuteNonQuery(); } } return(b05_SubContinent_ReChild); }
/// <summary> /// Updates in the database all changes made to the B05_SubContinent_ReChild object. /// </summary> /// <param name="b05_SubContinent_ReChild">The B05 Sub Continent Re Child DTO.</param> /// <returns>The updated <see cref="B05_SubContinent_ReChildDto"/>.</returns> public B05_SubContinent_ReChildDto Update(B05_SubContinent_ReChildDto b05_SubContinent_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateB05_SubContinent_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SubContinent_ID2", b05_SubContinent_ReChild.Parent_SubContinent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@SubContinent_Child_Name", b05_SubContinent_ReChild.SubContinent_Child_Name).DbType = DbType.String; var rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DataNotFoundException("B05_SubContinent_ReChild"); } } } return(b05_SubContinent_ReChild); }
private void Child_Insert(B04_SubContinent parent) { var dto = new B05_SubContinent_ReChildDto(); dto.Parent_SubContinent_ID = parent.SubContinent_ID; dto.SubContinent_Child_Name = SubContinent_Child_Name; using (var dalManager = DalFactoryParentLoad.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <IB05_SubContinent_ReChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }