/// <summary>
        /// Loads a <see cref="D05_SubContinent_Child"/> object from the given <see cref="D05_SubContinent_ChildDto"/>.
        /// </summary>
        /// <param name="data">The D05_SubContinent_ChildDto to use.</param>
        private void Fetch(D05_SubContinent_ChildDto data)
        {
            // Value properties
            LoadProperty(SubContinent_Child_NameProperty, data.SubContinent_Child_Name);
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
예제 #2
0
        private D05_SubContinent_ChildDto Fetch(IDataReader data)
        {
            var d05_SubContinent_Child = new D05_SubContinent_ChildDto();

            using (var dr = new SafeDataReader(data))
            {
                if (dr.Read())
                {
                    d05_SubContinent_Child.SubContinent_Child_Name = dr.GetString("SubContinent_Child_Name");
                }
            }
            return(d05_SubContinent_Child);
        }
예제 #3
0
 /// <summary>
 /// Inserts a new D05_SubContinent_Child object in the database.
 /// </summary>
 /// <param name="d05_SubContinent_Child">The D05 Sub Continent Child DTO.</param>
 /// <returns>The new <see cref="D05_SubContinent_ChildDto"/>.</returns>
 public D05_SubContinent_ChildDto Insert(D05_SubContinent_ChildDto d05_SubContinent_Child)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddD05_SubContinent_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@SubContinent_ID1", d05_SubContinent_Child.Parent_SubContinent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@SubContinent_Child_Name", d05_SubContinent_Child.SubContinent_Child_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
         }
     }
     return(d05_SubContinent_Child);
 }
예제 #4
0
 /// <summary>
 /// Updates in the database all changes made to the D05_SubContinent_Child object.
 /// </summary>
 /// <param name="d05_SubContinent_Child">The D05 Sub Continent Child DTO.</param>
 /// <returns>The updated <see cref="D05_SubContinent_ChildDto"/>.</returns>
 public D05_SubContinent_ChildDto Update(D05_SubContinent_ChildDto d05_SubContinent_Child)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateD05_SubContinent_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@SubContinent_ID1", d05_SubContinent_Child.Parent_SubContinent_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@SubContinent_Child_Name", d05_SubContinent_Child.SubContinent_Child_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("D05_SubContinent_Child");
             }
         }
     }
     return(d05_SubContinent_Child);
 }
예제 #5
0
        private void Child_Insert(D04_SubContinent parent)
        {
            var dto = new D05_SubContinent_ChildDto();

            dto.Parent_SubContinent_ID  = parent.SubContinent_ID;
            dto.SubContinent_Child_Name = SubContinent_Child_Name;
            using (var dalManager = DalFactorySelfLoad.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <ID05_SubContinent_ChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }