Exemplo n.º 1
0
        private void Child_Update()
        {
            if (!IsDirty)
            {
                return;
            }

            var dto = new H02_ContinentDto();

            dto.Continent_ID   = Continent_ID;
            dto.Continent_Name = Continent_Name;
            using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnUpdatePre(args);
                var dal = dalManager.GetProvider <IH02_ContinentDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Update(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnUpdatePost(args);
                // flushes all pending data operations
                FieldManager.UpdateChildren(this);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Factory method. Loads a <see cref="H02_Continent"/> object from the given H02_ContinentDto.
        /// </summary>
        /// <param name="data">The <see cref="H02_ContinentDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="H02_Continent"/> object.</returns>
        internal static H02_Continent GetH02_Continent(H02_ContinentDto data)
        {
            H02_Continent obj = new H02_Continent();

            obj.Fetch(data);
            return(obj);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Loads a <see cref="H02_Continent"/> object from the given <see cref="H02_ContinentDto"/>.
        /// </summary>
        /// <param name="data">The H02_ContinentDto to use.</param>
        private void Fetch(H02_ContinentDto data)
        {
            // Value properties
            LoadProperty(Continent_IDProperty, data.Continent_ID);
            LoadProperty(Continent_NameProperty, data.Continent_Name);
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Factory method. Loads a <see cref="H02_Continent"/> object from the given H02_ContinentDto.
        /// </summary>
        /// <param name="data">The <see cref="H02_ContinentDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="H02_Continent"/> object.</returns>
        internal static H02_Continent GetH02_Continent(H02_ContinentDto data)
        {
            H02_Continent obj = new H02_Continent();

            // show the framework that this is a child object
            obj.MarkAsChild();
            obj.Fetch(data);
            obj.MarkOld();
            return(obj);
        }
Exemplo n.º 5
0
        private H02_ContinentDto Fetch(SafeDataReader dr)
        {
            var h02_Continent = new H02_ContinentDto();

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

            return(h02_Continent);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Inserts a new H02_Continent object in the database.
 /// </summary>
 /// <param name="h02_Continent">The H02 Continent DTO.</param>
 /// <returns>The new <see cref="H02_ContinentDto"/>.</returns>
 public H02_ContinentDto Insert(H02_ContinentDto h02_Continent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddH02_Continent", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID", h02_Continent.Continent_ID).Direction  = ParameterDirection.Output;
             cmd.Parameters.AddWithValue("@Continent_Name", h02_Continent.Continent_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
             h02_Continent.Continent_ID = (int)cmd.Parameters["@Continent_ID"].Value;
         }
     }
     return(h02_Continent);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Updates in the database all changes made to the H02_Continent object.
 /// </summary>
 /// <param name="h02_Continent">The H02 Continent DTO.</param>
 /// <returns>The updated <see cref="H02_ContinentDto"/>.</returns>
 public H02_ContinentDto Update(H02_ContinentDto h02_Continent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateH02_Continent", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID", h02_Continent.Continent_ID).DbType     = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Name", h02_Continent.Continent_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("H02_Continent");
             }
         }
     }
     return(h02_Continent);
 }