/// <summary> /// Loads a <see cref="H09_Region_ReChild"/> object from the given <see cref="H09_Region_ReChildDto"/>. /// </summary> /// <param name="data">The H09_Region_ReChildDto to use.</param> private void Fetch(H09_Region_ReChildDto data) { // Value properties LoadProperty(Region_Child_NameProperty, data.Region_Child_Name); var args = new DataPortalHookArgs(data); OnFetchRead(args); }
private H09_Region_ReChildDto Fetch(IDataReader data) { var h09_Region_ReChild = new H09_Region_ReChildDto(); using (var dr = new SafeDataReader(data)) { if (dr.Read()) { h09_Region_ReChild.Region_Child_Name = dr.GetString("Region_Child_Name"); } } return(h09_Region_ReChild); }
/// <summary> /// Inserts a new H09_Region_ReChild object in the database. /// </summary> /// <param name="h09_Region_ReChild">The H09 Region Re Child DTO.</param> /// <returns>The new <see cref="H09_Region_ReChildDto"/>.</returns> public H09_Region_ReChildDto Insert(H09_Region_ReChildDto h09_Region_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddH09_Region_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Region_ID2", h09_Region_ReChild.Parent_Region_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Region_Child_Name", h09_Region_ReChild.Region_Child_Name).DbType = DbType.String; cmd.ExecuteNonQuery(); } } return(h09_Region_ReChild); }
/// <summary> /// Updates in the database all changes made to the H09_Region_ReChild object. /// </summary> /// <param name="h09_Region_ReChild">The H09 Region Re Child DTO.</param> /// <returns>The updated <see cref="H09_Region_ReChildDto"/>.</returns> public H09_Region_ReChildDto Update(H09_Region_ReChildDto h09_Region_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateH09_Region_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Region_ID2", h09_Region_ReChild.Parent_Region_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Region_Child_Name", h09_Region_ReChild.Region_Child_Name).DbType = DbType.String; var rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DataNotFoundException("H09_Region_ReChild"); } } } return(h09_Region_ReChild); }
private void Child_Insert(H08_Region parent) { var dto = new H09_Region_ReChildDto(); dto.Parent_Region_ID = parent.Region_ID; dto.Region_Child_Name = Region_Child_Name; using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <IH09_Region_ReChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }