Ejemplo n.º 1
0
        /// <summary>
        /// Loads a <see cref="H03_Continent_ReChild"/> object from the given <see cref="H03_Continent_ReChildDto"/>.
        /// </summary>
        /// <param name="data">The H03_Continent_ReChildDto to use.</param>
        private void Fetch(H03_Continent_ReChildDto data)
        {
            // Value properties
            LoadProperty(Continent_Child_NameProperty, data.Continent_Child_Name);
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
        private H03_Continent_ReChildDto Fetch(IDataReader data)
        {
            var h03_Continent_ReChild = new H03_Continent_ReChildDto();

            using (var dr = new SafeDataReader(data))
            {
                if (dr.Read())
                {
                    h03_Continent_ReChild.Continent_Child_Name = dr.GetString("Continent_Child_Name");
                }
            }
            return(h03_Continent_ReChild);
        }
 /// <summary>
 /// Inserts a new H03_Continent_ReChild object in the database.
 /// </summary>
 /// <param name="h03_Continent_ReChild">The H03 Continent Re Child DTO.</param>
 /// <returns>The new <see cref="H03_Continent_ReChildDto"/>.</returns>
 public H03_Continent_ReChildDto Insert(H03_Continent_ReChildDto h03_Continent_ReChild)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddH03_Continent_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID2", h03_Continent_ReChild.Parent_Continent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Child_Name", h03_Continent_ReChild.Continent_Child_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
         }
     }
     return(h03_Continent_ReChild);
 }
 /// <summary>
 /// Updates in the database all changes made to the H03_Continent_ReChild object.
 /// </summary>
 /// <param name="h03_Continent_ReChild">The H03 Continent Re Child DTO.</param>
 /// <returns>The updated <see cref="H03_Continent_ReChildDto"/>.</returns>
 public H03_Continent_ReChildDto Update(H03_Continent_ReChildDto h03_Continent_ReChild)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateH03_Continent_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID2", h03_Continent_ReChild.Parent_Continent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Child_Name", h03_Continent_ReChild.Continent_Child_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("H03_Continent_ReChild");
             }
         }
     }
     return(h03_Continent_ReChild);
 }
        private void Child_Insert(H02_Continent parent)
        {
            var dto = new H03_Continent_ReChildDto();

            dto.Parent_Continent_ID  = parent.Continent_ID;
            dto.Continent_Child_Name = Continent_Child_Name;
            using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <IH03_Continent_ReChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }