Beispiel #1
0
        /// <summary>
        /// Loads a <see cref="D09_Region_Child"/> object from the given <see cref="D09_Region_ChildDto"/>.
        /// </summary>
        /// <param name="data">The D09_Region_ChildDto to use.</param>
        private void Fetch(D09_Region_ChildDto data)
        {
            // Value properties
            LoadProperty(Region_Child_NameProperty, data.Region_Child_Name);
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
Beispiel #2
0
        private D09_Region_ChildDto Fetch(IDataReader data)
        {
            var d09_Region_Child = new D09_Region_ChildDto();

            using (var dr = new SafeDataReader(data))
            {
                if (dr.Read())
                {
                    d09_Region_Child.Region_Child_Name = dr.GetString("Region_Child_Name");
                }
            }
            return(d09_Region_Child);
        }
Beispiel #3
0
 /// <summary>
 /// Inserts a new D09_Region_Child object in the database.
 /// </summary>
 /// <param name="d09_Region_Child">The D09 Region Child DTO.</param>
 /// <returns>The new <see cref="D09_Region_ChildDto"/>.</returns>
 public D09_Region_ChildDto Insert(D09_Region_ChildDto d09_Region_Child)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddD09_Region_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Region_ID1", d09_Region_Child.Parent_Region_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Region_Child_Name", d09_Region_Child.Region_Child_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
         }
     }
     return(d09_Region_Child);
 }
Beispiel #4
0
 /// <summary>
 /// Updates in the database all changes made to the D09_Region_Child object.
 /// </summary>
 /// <param name="d09_Region_Child">The D09 Region Child DTO.</param>
 /// <returns>The updated <see cref="D09_Region_ChildDto"/>.</returns>
 public D09_Region_ChildDto Update(D09_Region_ChildDto d09_Region_Child)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateD09_Region_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Region_ID1", d09_Region_Child.Parent_Region_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Region_Child_Name", d09_Region_Child.Region_Child_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("D09_Region_Child");
             }
         }
     }
     return(d09_Region_Child);
 }
Beispiel #5
0
        private void Child_Insert(D08_Region parent)
        {
            var dto = new D09_Region_ChildDto();

            dto.Parent_Region_ID  = parent.Region_ID;
            dto.Region_Child_Name = Region_Child_Name;
            using (var dalManager = DalFactorySelfLoad.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <ID09_Region_ChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }