コード例 #1
0
        /// <summary>
        /// Loads a <see cref="H03_Continent_Child"/> object from the given <see cref="H03_Continent_ChildDto"/>.
        /// </summary>
        /// <param name="data">The H03_Continent_ChildDto to use.</param>
        private void Fetch(H03_Continent_ChildDto data)
        {
            // Value properties
            LoadProperty(Continent_Child_NameProperty, data.Continent_Child_Name);
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
コード例 #2
0
        private H03_Continent_ChildDto Fetch(IDataReader data)
        {
            var h03_Continent_Child = new H03_Continent_ChildDto();

            using (var dr = new SafeDataReader(data))
            {
                if (dr.Read())
                {
                    h03_Continent_Child.Continent_Child_Name = dr.GetString("Continent_Child_Name");
                }
            }
            return(h03_Continent_Child);
        }
コード例 #3
0
 /// <summary>
 /// Inserts a new H03_Continent_Child object in the database.
 /// </summary>
 /// <param name="h03_Continent_Child">The H03 Continent Child DTO.</param>
 /// <returns>The new <see cref="H03_Continent_ChildDto"/>.</returns>
 public H03_Continent_ChildDto Insert(H03_Continent_ChildDto h03_Continent_Child)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddH03_Continent_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID1", h03_Continent_Child.Parent_Continent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Child_Name", h03_Continent_Child.Continent_Child_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
         }
     }
     return(h03_Continent_Child);
 }
コード例 #4
0
 /// <summary>
 /// Updates in the database all changes made to the H03_Continent_Child object.
 /// </summary>
 /// <param name="h03_Continent_Child">The H03 Continent Child DTO.</param>
 /// <returns>The updated <see cref="H03_Continent_ChildDto"/>.</returns>
 public H03_Continent_ChildDto Update(H03_Continent_ChildDto h03_Continent_Child)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateH03_Continent_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID1", h03_Continent_Child.Parent_Continent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Child_Name", h03_Continent_Child.Continent_Child_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("H03_Continent_Child");
             }
         }
     }
     return(h03_Continent_Child);
 }
コード例 #5
0
        private void Child_Insert(H02_Continent parent)
        {
            var dto = new H03_Continent_ChildDto();

            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_ChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }