/// <summary>
        /// Factory method. Loads a <see cref="B03_Continent_ReChild"/> object from the given B03_Continent_ReChildDto.
        /// </summary>
        /// <param name="data">The <see cref="B03_Continent_ReChildDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="B03_Continent_ReChild"/> object.</returns>
        internal static B03_Continent_ReChild GetB03_Continent_ReChild(B03_Continent_ReChildDto data)
        {
            B03_Continent_ReChild obj = new B03_Continent_ReChild();

            obj.Fetch(data);
            // check all object rules and property rules
            obj.BusinessRules.CheckRules();
            return(obj);
        }
        /// <summary>
        /// Loads a <see cref="B03_Continent_ReChild"/> object from the given <see cref="B03_Continent_ReChildDto"/>.
        /// </summary>
        /// <param name="data">The B03_Continent_ReChildDto to use.</param>
        private void Fetch(B03_Continent_ReChildDto data)
        {
            // Value properties
            LoadProperty(Continent_Child_NameProperty, data.Continent_Child_Name);
            // parent properties
            continent_ID2 = data.Parent_Continent_ID;
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
Esempio n. 3
0
        private B03_Continent_ReChildDto FetchB03_Continent_ReChild(SafeDataReader dr)
        {
            var b03_Continent_ReChild = new B03_Continent_ReChildDto();

            // Value properties
            b03_Continent_ReChild.Continent_Child_Name = dr.GetString("Continent_Child_Name");
            // parent properties
            b03_Continent_ReChild.Parent_Continent_ID = dr.GetInt32("Continent_ID2");

            return(b03_Continent_ReChild);
        }
        /// <summary>
        /// Factory method. Loads a <see cref="B03_Continent_ReChild"/> object from the given B03_Continent_ReChildDto.
        /// </summary>
        /// <param name="data">The <see cref="B03_Continent_ReChildDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="B03_Continent_ReChild"/> object.</returns>
        internal static B03_Continent_ReChild GetB03_Continent_ReChild(B03_Continent_ReChildDto data)
        {
            B03_Continent_ReChild obj = new B03_Continent_ReChild();

            // show the framework that this is a child object
            obj.MarkAsChild();
            obj.Fetch(data);
            obj.MarkOld();
            // check all object rules and property rules
            obj.BusinessRules.CheckRules();
            return(obj);
        }
 /// <summary>
 /// Inserts a new B03_Continent_ReChild object in the database.
 /// </summary>
 /// <param name="b03_Continent_ReChild">The B03 Continent Re Child DTO.</param>
 /// <returns>The new <see cref="B03_Continent_ReChildDto"/>.</returns>
 public B03_Continent_ReChildDto Insert(B03_Continent_ReChildDto b03_Continent_ReChild)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddB03_Continent_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID2", b03_Continent_ReChild.Parent_Continent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Child_Name", b03_Continent_ReChild.Continent_Child_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
         }
     }
     return(b03_Continent_ReChild);
 }
 /// <summary>
 /// Updates in the database all changes made to the B03_Continent_ReChild object.
 /// </summary>
 /// <param name="b03_Continent_ReChild">The B03 Continent Re Child DTO.</param>
 /// <returns>The updated <see cref="B03_Continent_ReChildDto"/>.</returns>
 public B03_Continent_ReChildDto Update(B03_Continent_ReChildDto b03_Continent_ReChild)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateB03_Continent_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID2", b03_Continent_ReChild.Parent_Continent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Child_Name", b03_Continent_ReChild.Continent_Child_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("B03_Continent_ReChild");
             }
         }
     }
     return(b03_Continent_ReChild);
 }
        private void Child_Insert(B02_Continent parent)
        {
            var dto = new B03_Continent_ReChildDto();

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