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

            obj.Fetch(data);
            return(obj);
        }
Beispiel #2
0
        private void Child_Update()
        {
            if (!IsDirty)
            {
                return;
            }

            var dto = new D02_ContinentDto();

            dto.Continent_ID   = Continent_ID;
            dto.Continent_Name = Continent_Name;
            using (var dalManager = DalFactorySelfLoad.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnUpdatePre(args);
                var dal = dalManager.GetProvider <ID02_ContinentDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Update(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnUpdatePost(args);
                // flushes all pending data operations
                FieldManager.UpdateChildren(this);
            }
        }
        /// <summary>
        /// Loads a <see cref="D02_Continent"/> object from the given <see cref="D02_ContinentDto"/>.
        /// </summary>
        /// <param name="data">The D02_ContinentDto to use.</param>
        private void Fetch(D02_ContinentDto data)
        {
            // Value properties
            LoadProperty(Continent_IDProperty, data.Continent_ID);
            LoadProperty(Continent_NameProperty, data.Continent_Name);
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
Beispiel #4
0
        /// <summary>
        /// Factory method. Loads a <see cref="D02_Continent"/> object from the given D02_ContinentDto.
        /// </summary>
        /// <param name="data">The <see cref="D02_ContinentDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="D02_Continent"/> object.</returns>
        internal static D02_Continent GetD02_Continent(D02_ContinentDto data)
        {
            D02_Continent obj = new D02_Continent();

            // show the framework that this is a child object
            obj.MarkAsChild();
            obj.Fetch(data);
            obj.MarkOld();
            return(obj);
        }
        private D02_ContinentDto Fetch(SafeDataReader dr)
        {
            var d02_Continent = new D02_ContinentDto();

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

            return(d02_Continent);
        }
 /// <summary>
 /// Inserts a new D02_Continent object in the database.
 /// </summary>
 /// <param name="d02_Continent">The D02 Continent DTO.</param>
 /// <returns>The new <see cref="D02_ContinentDto"/>.</returns>
 public D02_ContinentDto Insert(D02_ContinentDto d02_Continent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddD02_Continent", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID", d02_Continent.Continent_ID).Direction  = ParameterDirection.Output;
             cmd.Parameters.AddWithValue("@Continent_Name", d02_Continent.Continent_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
             d02_Continent.Continent_ID = (int)cmd.Parameters["@Continent_ID"].Value;
         }
     }
     return(d02_Continent);
 }
 /// <summary>
 /// Updates in the database all changes made to the D02_Continent object.
 /// </summary>
 /// <param name="d02_Continent">The D02 Continent DTO.</param>
 /// <returns>The updated <see cref="D02_ContinentDto"/>.</returns>
 public D02_ContinentDto Update(D02_ContinentDto d02_Continent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateD02_Continent", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID", d02_Continent.Continent_ID).DbType     = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Name", d02_Continent.Continent_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("D02_Continent");
             }
         }
     }
     return(d02_Continent);
 }
Beispiel #8
0
        private void Child_Insert()
        {
            var dto = new D02_ContinentDto();

            dto.Continent_Name = Continent_Name;
            using (var dalManager = DalFactorySelfLoad.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <ID02_ContinentDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    LoadProperty(Continent_IDProperty, resultDto.Continent_ID);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
                // flushes all pending data operations
                FieldManager.UpdateChildren(this);
            }
        }