예제 #1
0
        private void Child_Update()
        {
            if (!IsDirty)
            {
                return;
            }

            var dto = new F02_ContinentDto();

            dto.Continent_ID   = Continent_ID;
            dto.Continent_Name = Continent_Name;
            using (var dalManager = DalFactoryParentLoadSoftDelete.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnUpdatePre(args);
                var dal = dalManager.GetProvider <IF02_ContinentDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Update(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnUpdatePost(args);
                // flushes all pending data operations
                FieldManager.UpdateChildren(this);
            }
        }
예제 #2
0
        /// <summary>
        /// Factory method. Loads a <see cref="F02_Continent"/> object from the given F02_ContinentDto.
        /// </summary>
        /// <param name="data">The <see cref="F02_ContinentDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="F02_Continent"/> object.</returns>
        internal static F02_Continent GetF02_Continent(F02_ContinentDto data)
        {
            F02_Continent obj = new F02_Continent();

            obj.Fetch(data);
            obj.LoadProperty(F03_SubContinentObjectsProperty, new F03_SubContinentColl());
            return(obj);
        }
예제 #3
0
        /// <summary>
        /// Loads a <see cref="F02_Continent"/> object from the given <see cref="F02_ContinentDto"/>.
        /// </summary>
        /// <param name="data">The F02_ContinentDto to use.</param>
        private void Fetch(F02_ContinentDto data)
        {
            // Value properties
            LoadProperty(Continent_IDProperty, data.Continent_ID);
            LoadProperty(Continent_NameProperty, data.Continent_Name);
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
예제 #4
0
        private F02_ContinentDto Fetch(SafeDataReader dr)
        {
            var f02_Continent = new F02_ContinentDto();

            // Value properties
            f02_Continent.Continent_ID   = dr.GetInt32("Continent_ID");
            f02_Continent.Continent_Name = dr.GetString("Continent_Name");

            return(f02_Continent);
        }
예제 #5
0
        /// <summary>
        /// Factory method. Loads a <see cref="F02_Continent"/> object from the given F02_ContinentDto.
        /// </summary>
        /// <param name="data">The <see cref="F02_ContinentDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="F02_Continent"/> object.</returns>
        internal static F02_Continent GetF02_Continent(F02_ContinentDto data)
        {
            F02_Continent obj = new F02_Continent();

            // show the framework that this is a child object
            obj.MarkAsChild();
            obj.Fetch(data);
            obj.LoadProperty(F03_SubContinentObjectsProperty, F03_SubContinentColl.NewF03_SubContinentColl());
            obj.MarkOld();
            return(obj);
        }
예제 #6
0
 /// <summary>
 /// Inserts a new F02_Continent object in the database.
 /// </summary>
 /// <param name="f02_Continent">The F02 Continent DTO.</param>
 /// <returns>The new <see cref="F02_ContinentDto"/>.</returns>
 public F02_ContinentDto Insert(F02_ContinentDto f02_Continent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddF02_Continent", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID", f02_Continent.Continent_ID).Direction  = ParameterDirection.Output;
             cmd.Parameters.AddWithValue("@Continent_Name", f02_Continent.Continent_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
             f02_Continent.Continent_ID = (int)cmd.Parameters["@Continent_ID"].Value;
         }
     }
     return(f02_Continent);
 }
예제 #7
0
 /// <summary>
 /// Updates in the database all changes made to the F02_Continent object.
 /// </summary>
 /// <param name="f02_Continent">The F02 Continent DTO.</param>
 /// <returns>The updated <see cref="F02_ContinentDto"/>.</returns>
 public F02_ContinentDto Update(F02_ContinentDto f02_Continent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateF02_Continent", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID", f02_Continent.Continent_ID).DbType     = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Name", f02_Continent.Continent_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("F02_Continent");
             }
         }
     }
     return(f02_Continent);
 }