コード例 #1
0
        /// <summary>
        /// Loads a <see cref="G07_Country_Child"/> object from the given <see cref="G07_Country_ChildDto"/>.
        /// </summary>
        /// <param name="data">The G07_Country_ChildDto to use.</param>
        private void Fetch(G07_Country_ChildDto data)
        {
            // Value properties
            LoadProperty(Country_Child_NameProperty, data.Country_Child_Name);
            var args = new DataPortalHookArgs(data);

            OnFetchRead(args);
        }
コード例 #2
0
        private G07_Country_ChildDto Fetch(IDataReader data)
        {
            var g07_Country_Child = new G07_Country_ChildDto();

            using (var dr = new SafeDataReader(data))
            {
                if (dr.Read())
                {
                    g07_Country_Child.Country_Child_Name = dr.GetString("Country_Child_Name");
                }
            }
            return(g07_Country_Child);
        }
コード例 #3
0
 /// <summary>
 /// Inserts a new G07_Country_Child object in the database.
 /// </summary>
 /// <param name="g07_Country_Child">The G07 Country Child DTO.</param>
 /// <returns>The new <see cref="G07_Country_ChildDto"/>.</returns>
 public G07_Country_ChildDto Insert(G07_Country_ChildDto g07_Country_Child)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddG07_Country_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Country_ID1", g07_Country_Child.Parent_Country_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Country_Child_Name", g07_Country_Child.Country_Child_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
         }
     }
     return(g07_Country_Child);
 }
コード例 #4
0
 /// <summary>
 /// Updates in the database all changes made to the G07_Country_Child object.
 /// </summary>
 /// <param name="g07_Country_Child">The G07 Country Child DTO.</param>
 /// <returns>The updated <see cref="G07_Country_ChildDto"/>.</returns>
 public G07_Country_ChildDto Update(G07_Country_ChildDto g07_Country_Child)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateG07_Country_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Country_ID1", g07_Country_Child.Parent_Country_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@Country_Child_Name", g07_Country_Child.Country_Child_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("G07_Country_Child");
             }
         }
     }
     return(g07_Country_Child);
 }
コード例 #5
0
        private void Child_Insert(G06_Country parent)
        {
            var dto = new G07_Country_ChildDto();

            dto.Parent_Country_ID  = parent.Country_ID;
            dto.Country_Child_Name = Country_Child_Name;
            using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <IG07_Country_ChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }