/// <summary>
        /// Loads a <see cref="G02_Continent"/> object from the given <see cref="G02_ContinentDto"/>.
        /// </summary>
        /// <param name="data">The G02_ContinentDto to use.</param>
        private void Fetch(G02_ContinentDto data)
        {
            // Value properties
            LoadProperty(Continent_IDProperty, data.Continent_ID);
            LoadProperty(Continent_NameProperty, data.Continent_Name);
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
        private G02_ContinentDto Fetch(IDataReader data)
        {
            var g02_Continent = new G02_ContinentDto();

            using (var dr = new SafeDataReader(data))
            {
                if (dr.Read())
                {
                    g02_Continent.Continent_ID   = dr.GetInt32("Continent_ID");
                    g02_Continent.Continent_Name = dr.GetString("Continent_Name");
                }
            }
            return(g02_Continent);
        }
 /// <summary>
 /// Inserts a new G02_Continent object in the database.
 /// </summary>
 /// <param name="g02_Continent">The G02 Continent DTO.</param>
 /// <returns>The new <see cref="G02_ContinentDto"/>.</returns>
 public G02_ContinentDto Insert(G02_ContinentDto g02_Continent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddG02_Continent", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID", g02_Continent.Continent_ID).Direction  = ParameterDirection.Output;
             cmd.Parameters.AddWithValue("@Continent_Name", g02_Continent.Continent_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
             g02_Continent.Continent_ID = (int)cmd.Parameters["@Continent_ID"].Value;
         }
     }
     return(g02_Continent);
 }
 /// <summary>
 /// Updates in the database all changes made to the G02_Continent object.
 /// </summary>
 /// <param name="g02_Continent">The G02 Continent DTO.</param>
 /// <returns>The updated <see cref="G02_ContinentDto"/>.</returns>
 public G02_ContinentDto Update(G02_ContinentDto g02_Continent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateG02_Continent", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Continent_ID", g02_Continent.Continent_ID).DbType     = DbType.Int32;
             cmd.Parameters.AddWithValue("@Continent_Name", g02_Continent.Continent_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("G02_Continent");
             }
         }
     }
     return(g02_Continent);
 }
Beispiel #5
0
        protected override void DataPortal_Update()
        {
            var dto = new G02_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 <IG02_ContinentDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Update(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnUpdatePost(args);
                // flushes all pending data operations
                FieldManager.UpdateChildren(this);
            }
        }