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

            OnFetchRead(args);
        }
示例#2
0
        private G07_Country_ReChildDto Fetch(IDataReader data)
        {
            var g07_Country_ReChild = new G07_Country_ReChildDto();

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

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