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

            OnFetchRead(args);
        }
Пример #2
0
        private C02_ContinentDto Fetch(IDataReader data)
        {
            var c02_Continent = new C02_ContinentDto();

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