private void Child_Update(C04_SubContinent parent)
        {
            if (!IsDirty)
            {
                return;
            }

            var dto = new C05_SubContinent_ReChildDto();

            dto.Parent_SubContinent_ID  = parent.SubContinent_ID;
            dto.SubContinent_Child_Name = SubContinent_Child_Name;
            dto.RowVersion = _rowVersion;
            using (var dalManager = DalFactorySelfLoad.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnUpdatePre(args);
                var dal = dalManager.GetProvider <IC05_SubContinent_ReChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Update(dto);
                    _rowVersion = resultDto.RowVersion;
                    args        = new DataPortalHookArgs(resultDto);
                }
                OnUpdatePost(args);
            }
        }
        /// <summary>
        /// Loads a <see cref="C05_SubContinent_ReChild"/> object from the given <see cref="C05_SubContinent_ReChildDto"/>.
        /// </summary>
        /// <param name="data">The C05_SubContinent_ReChildDto to use.</param>
        private void Fetch(C05_SubContinent_ReChildDto data)
        {
            // Value properties
            LoadProperty(SubContinent_Child_NameProperty, data.SubContinent_Child_Name);
            _rowVersion = data.RowVersion;
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
        private C05_SubContinent_ReChildDto Fetch(IDataReader data)
        {
            var c05_SubContinent_ReChild = new C05_SubContinent_ReChildDto();

            using (var dr = new SafeDataReader(data))
            {
                if (dr.Read())
                {
                    c05_SubContinent_ReChild.SubContinent_Child_Name = dr.GetString("SubContinent_Child_Name");
                    c05_SubContinent_ReChild.RowVersion = dr.GetValue("RowVersion") as byte[];
                }
            }
            return(c05_SubContinent_ReChild);
        }
 /// <summary>
 /// Inserts a new C05_SubContinent_ReChild object in the database.
 /// </summary>
 /// <param name="c05_SubContinent_ReChild">The C05 Sub Continent Re Child DTO.</param>
 /// <returns>The new <see cref="C05_SubContinent_ReChildDto"/>.</returns>
 public C05_SubContinent_ReChildDto Insert(C05_SubContinent_ReChildDto c05_SubContinent_ReChild)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddC05_SubContinent_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@SubContinent_ID2", c05_SubContinent_ReChild.Parent_SubContinent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@SubContinent_Child_Name", c05_SubContinent_ReChild.SubContinent_Child_Name).DbType = DbType.String;
             cmd.Parameters.Add("@NewRowVersion", SqlDbType.Timestamp).Direction = ParameterDirection.Output;
             cmd.ExecuteNonQuery();
             c05_SubContinent_ReChild.RowVersion = (byte[])cmd.Parameters["@NewRowVersion"].Value;
         }
     }
     return(c05_SubContinent_ReChild);
 }
        /// <summary>
        /// Updates in the database all changes made to the C05_SubContinent_ReChild object.
        /// </summary>
        /// <param name="c05_SubContinent_ReChild">The C05 Sub Continent Re Child DTO.</param>
        /// <returns>The updated <see cref="C05_SubContinent_ReChildDto"/>.</returns>
        public C05_SubContinent_ReChildDto Update(C05_SubContinent_ReChildDto c05_SubContinent_ReChild)
        {
            using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
            {
                using (var cmd = new SqlCommand("UpdateC05_SubContinent_ReChild", ctx.Connection))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@SubContinent_ID2", c05_SubContinent_ReChild.Parent_SubContinent_ID).DbType         = DbType.Int32;
                    cmd.Parameters.AddWithValue("@SubContinent_Child_Name", c05_SubContinent_ReChild.SubContinent_Child_Name).DbType = DbType.String;
                    cmd.Parameters.AddWithValue("@RowVersion", c05_SubContinent_ReChild.RowVersion).DbType = DbType.Binary;
                    cmd.Parameters.Add("@NewRowVersion", SqlDbType.Timestamp).Direction = ParameterDirection.Output;
                    var rowsAffected = cmd.ExecuteNonQuery();
                    if (rowsAffected == 0)
                    {
                        throw new DataNotFoundException("C05_SubContinent_ReChild");
                    }

                    c05_SubContinent_ReChild.RowVersion = (byte[])cmd.Parameters["@NewRowVersion"].Value;
                }
            }
            return(c05_SubContinent_ReChild);
        }