/// <summary> /// Loads a <see cref="H11_City_ReChild"/> object from the given <see cref="H11_City_ReChildDto"/>. /// </summary> /// <param name="data">The H11_City_ReChildDto to use.</param> private void Fetch(H11_City_ReChildDto data) { // Value properties City_Child_Name = data.City_Child_Name; var args = new DataPortalHookArgs(data); OnFetchRead(args); }
private H11_City_ReChildDto Fetch(IDataReader data) { var h11_City_ReChild = new H11_City_ReChildDto(); using (var dr = new SafeDataReader(data)) { if (dr.Read()) { h11_City_ReChild.City_Child_Name = dr.GetString("City_Child_Name"); } } return(h11_City_ReChild); }
/// <summary> /// Inserts a new H11_City_ReChild object in the database. /// </summary> /// <param name="h11_City_ReChild">The H11 City Re Child DTO.</param> /// <returns>The new <see cref="H11_City_ReChildDto"/>.</returns> public H11_City_ReChildDto Insert(H11_City_ReChildDto h11_City_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddH11_City_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@City_ID2", h11_City_ReChild.Parent_City_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@City_Child_Name", h11_City_ReChild.City_Child_Name).DbType = DbType.String; cmd.ExecuteNonQuery(); } } return(h11_City_ReChild); }
/// <summary> /// Updates in the database all changes made to the H11_City_ReChild object. /// </summary> /// <param name="h11_City_ReChild">The H11 City Re Child DTO.</param> /// <returns>The updated <see cref="H11_City_ReChildDto"/>.</returns> public H11_City_ReChildDto Update(H11_City_ReChildDto h11_City_ReChild) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateH11_City_ReChild", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@City_ID2", h11_City_ReChild.Parent_City_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@City_Child_Name", h11_City_ReChild.City_Child_Name).DbType = DbType.String; var rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DataNotFoundException("H11_City_ReChild"); } } } return(h11_City_ReChild); }
private void Child_Insert(H10_City parent) { var dto = new H11_City_ReChildDto(); dto.Parent_City_ID = parent.City_ID; dto.City_Child_Name = City_Child_Name; using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnInsertPre(args); var dal = dalManager.GetProvider <IH11_City_ReChildDal>(); using (BypassPropertyChecks) { var resultDto = dal.Insert(dto); args = new DataPortalHookArgs(resultDto); } OnInsertPost(args); } }