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

            OnFetchRead(args);
        }
コード例 #2
0
        /// <summary>
        /// Factory method. Loads a <see cref="A03_Continent_ReChild"/> object from the given A03_Continent_ReChildDto.
        /// </summary>
        /// <param name="data">The <see cref="A03_Continent_ReChildDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="A03_Continent_ReChild"/> object.</returns>
        internal static A03_Continent_ReChild GetA03_Continent_ReChild(A03_Continent_ReChildDto data)
        {
            A03_Continent_ReChild obj = new A03_Continent_ReChild();

            obj.Fetch(data);
            // check all object rules and property rules
            obj.BusinessRules.CheckRules();
            return(obj);
        }
コード例 #3
0
        /// <summary>
        /// Factory method. Loads a <see cref="A03_Continent_ReChild"/> object from the given A03_Continent_ReChildDto.
        /// </summary>
        /// <param name="data">The <see cref="A03_Continent_ReChildDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="A03_Continent_ReChild"/> object.</returns>
        internal static A03_Continent_ReChild GetA03_Continent_ReChild(A03_Continent_ReChildDto data)
        {
            A03_Continent_ReChild obj = new A03_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);
        }
コード例 #4
0
 /// <summary>
 /// Inserts a new A03_Continent_ReChild object in the database.
 /// </summary>
 /// <param name="a03_Continent_ReChild">The A03 Continent Re Child DTO.</param>
 /// <returns>The new <see cref="A03_Continent_ReChildDto"/>.</returns>
 public A03_Continent_ReChildDto Insert(A03_Continent_ReChildDto a03_Continent_ReChild)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddA03_Continent_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID2", a03_Continent_ReChild.Parent_Continent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Child_Name", a03_Continent_ReChild.Continent_Child_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
         }
     }
     return(a03_Continent_ReChild);
 }
コード例 #5
0
 /// <summary>
 /// Updates in the database all changes made to the A03_Continent_ReChild object.
 /// </summary>
 /// <param name="a03_Continent_ReChild">The A03 Continent Re Child DTO.</param>
 /// <returns>The updated <see cref="A03_Continent_ReChildDto"/>.</returns>
 public A03_Continent_ReChildDto Update(A03_Continent_ReChildDto a03_Continent_ReChild)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateA03_Continent_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID2", a03_Continent_ReChild.Parent_Continent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Child_Name", a03_Continent_ReChild.Continent_Child_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("A03_Continent_ReChild");
             }
         }
     }
     return(a03_Continent_ReChild);
 }
コード例 #6
0
        private void Child_Insert(A02_Continent parent)
        {
            var dto = new A03_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 <IA03_Continent_ReChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }