Beispiel #1
0
        /// <summary>
        /// Factory method. Loads a <see cref="F05_SubContinent_Child"/> object from the given F05_SubContinent_ChildDto.
        /// </summary>
        /// <param name="data">The <see cref="F05_SubContinent_ChildDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="F05_SubContinent_Child"/> object.</returns>
        internal static F05_SubContinent_Child GetF05_SubContinent_Child(F05_SubContinent_ChildDto data)
        {
            F05_SubContinent_Child obj = new F05_SubContinent_Child();

            obj.Fetch(data);
            return(obj);
        }
Beispiel #2
0
        /// <summary>
        /// Factory method. Loads a <see cref="F05_SubContinent_Child"/> object from the given F05_SubContinent_ChildDto.
        /// </summary>
        /// <param name="data">The <see cref="F05_SubContinent_ChildDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="F05_SubContinent_Child"/> object.</returns>
        internal static F05_SubContinent_Child GetF05_SubContinent_Child(F05_SubContinent_ChildDto data)
        {
            F05_SubContinent_Child obj = new F05_SubContinent_Child();

            // show the framework that this is a child object
            obj.MarkAsChild();
            obj.Fetch(data);
            obj.MarkOld();
            return(obj);
        }
Beispiel #3
0
        /// <summary>
        /// Loads a <see cref="F05_SubContinent_Child"/> object from the given <see cref="F05_SubContinent_ChildDto"/>.
        /// </summary>
        /// <param name="data">The F05_SubContinent_ChildDto to use.</param>
        private void Fetch(F05_SubContinent_ChildDto data)
        {
            // Value properties
            LoadProperty(SubContinent_Child_NameProperty, data.SubContinent_Child_Name);
            // parent properties
            subContinent_ID1 = data.Parent_SubContinent_ID;
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
Beispiel #4
0
        private F05_SubContinent_ChildDto FetchF05_SubContinent_Child(SafeDataReader dr)
        {
            var f05_SubContinent_Child = new F05_SubContinent_ChildDto();

            // Value properties
            f05_SubContinent_Child.SubContinent_Child_Name = dr.GetString("SubContinent_Child_Name");
            // parent properties
            f05_SubContinent_Child.Parent_SubContinent_ID = dr.GetInt32("SubContinent_ID1");

            return(f05_SubContinent_Child);
        }
 /// <summary>
 /// Inserts a new F05_SubContinent_Child object in the database.
 /// </summary>
 /// <param name="f05_SubContinent_Child">The F05 Sub Continent Child DTO.</param>
 /// <returns>The new <see cref="F05_SubContinent_ChildDto"/>.</returns>
 public F05_SubContinent_ChildDto Insert(F05_SubContinent_ChildDto f05_SubContinent_Child)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddF05_SubContinent_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@SubContinent_ID1", f05_SubContinent_Child.Parent_SubContinent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@SubContinent_Child_Name", f05_SubContinent_Child.SubContinent_Child_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
         }
     }
     return(f05_SubContinent_Child);
 }
 /// <summary>
 /// Updates in the database all changes made to the F05_SubContinent_Child object.
 /// </summary>
 /// <param name="f05_SubContinent_Child">The F05 Sub Continent Child DTO.</param>
 /// <returns>The updated <see cref="F05_SubContinent_ChildDto"/>.</returns>
 public F05_SubContinent_ChildDto Update(F05_SubContinent_ChildDto f05_SubContinent_Child)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateF05_SubContinent_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@SubContinent_ID1", f05_SubContinent_Child.Parent_SubContinent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@SubContinent_Child_Name", f05_SubContinent_Child.SubContinent_Child_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("F05_SubContinent_Child");
             }
         }
     }
     return(f05_SubContinent_Child);
 }
Beispiel #7
0
        private void Child_Insert(F04_SubContinent parent)
        {
            var dto = new F05_SubContinent_ChildDto();

            dto.Parent_SubContinent_ID  = parent.SubContinent_ID;
            dto.SubContinent_Child_Name = SubContinent_Child_Name;
            using (var dalManager = DalFactoryParentLoadSoftDelete.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <IF05_SubContinent_ChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }