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

            OnFetchRead(args);
        }
Exemplo n.º 2
0
        private D05_SubContinent_ReChildDto Fetch(IDataReader data)
        {
            var d05_SubContinent_ReChild = new D05_SubContinent_ReChildDto();

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

            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_ReChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }