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

            obj.Fetch(data);
            // check all object rules and property rules
            obj.BusinessRules.CheckRules();
            return(obj);
        }
Beispiel #2
0
        /// <summary>
        /// Loads a <see cref="A09_Region_ReChild"/> object from the given <see cref="A09_Region_ReChildDto"/>.
        /// </summary>
        /// <param name="data">The A09_Region_ReChildDto to use.</param>
        private void Fetch(A09_Region_ReChildDto data)
        {
            // Value properties
            LoadProperty(Region_Child_NameProperty, data.Region_Child_Name);
            // parent properties
            region_ID2 = data.Parent_Region_ID;
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
Beispiel #3
0
        private A09_Region_ReChildDto FetchA09_Region_ReChild(SafeDataReader dr)
        {
            var a09_Region_ReChild = new A09_Region_ReChildDto();

            // Value properties
            a09_Region_ReChild.Region_Child_Name = dr.GetString("Region_Child_Name");
            // parent properties
            a09_Region_ReChild.Parent_Region_ID = dr.GetInt32("Region_ID2");

            return(a09_Region_ReChild);
        }
Beispiel #4
0
        /// <summary>
        /// Factory method. Loads a <see cref="A09_Region_ReChild"/> object from the given A09_Region_ReChildDto.
        /// </summary>
        /// <param name="data">The <see cref="A09_Region_ReChildDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="A09_Region_ReChild"/> object.</returns>
        internal static A09_Region_ReChild GetA09_Region_ReChild(A09_Region_ReChildDto data)
        {
            A09_Region_ReChild obj = new A09_Region_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 A09_Region_ReChild object in the database.
 /// </summary>
 /// <param name="a09_Region_ReChild">The A09 Region Re Child DTO.</param>
 /// <returns>The new <see cref="A09_Region_ReChildDto"/>.</returns>
 public A09_Region_ReChildDto Insert(A09_Region_ReChildDto a09_Region_ReChild)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddA09_Region_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Region_ID2", a09_Region_ReChild.Parent_Region_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Region_Child_Name", a09_Region_ReChild.Region_Child_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
         }
     }
     return(a09_Region_ReChild);
 }
 /// <summary>
 /// Updates in the database all changes made to the A09_Region_ReChild object.
 /// </summary>
 /// <param name="a09_Region_ReChild">The A09 Region Re Child DTO.</param>
 /// <returns>The updated <see cref="A09_Region_ReChildDto"/>.</returns>
 public A09_Region_ReChildDto Update(A09_Region_ReChildDto a09_Region_ReChild)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateA09_Region_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Region_ID2", a09_Region_ReChild.Parent_Region_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Region_Child_Name", a09_Region_ReChild.Region_Child_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("A09_Region_ReChild");
             }
         }
     }
     return(a09_Region_ReChild);
 }
Beispiel #7
0
        private void Child_Insert(A08_Region parent)
        {
            var dto = new A09_Region_ReChildDto();

            dto.Parent_Region_ID  = parent.Region_ID;
            dto.Region_Child_Name = Region_Child_Name;
            using (var dalManager = DalFactoryParentLoad.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <IA09_Region_ReChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }