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

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

            using (var dr = new SafeDataReader(data))
            {
                if (dr.Read())
                {
                    g11_City_ReChild.City_Child_Name = dr.GetString("City_Child_Name");
                }
            }
            return(g11_City_ReChild);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Inserts a new G11_City_ReChild object in the database.
 /// </summary>
 /// <param name="g11_City_ReChild">The G11 City Re Child DTO.</param>
 /// <returns>The new <see cref="G11_City_ReChildDto"/>.</returns>
 public G11_City_ReChildDto Insert(G11_City_ReChildDto g11_City_ReChild)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddG11_City_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@City_ID2", g11_City_ReChild.Parent_City_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@City_Child_Name", g11_City_ReChild.City_Child_Name).DbType = DbType.String;
             cmd.ExecuteNonQuery();
         }
     }
     return(g11_City_ReChild);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Updates in the database all changes made to the G11_City_ReChild object.
 /// </summary>
 /// <param name="g11_City_ReChild">The G11 City Re Child DTO.</param>
 /// <returns>The updated <see cref="G11_City_ReChildDto"/>.</returns>
 public G11_City_ReChildDto Update(G11_City_ReChildDto g11_City_ReChild)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("UpdateG11_City_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@City_ID2", g11_City_ReChild.Parent_City_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@City_Child_Name", g11_City_ReChild.City_Child_Name).DbType = DbType.String;
             var rowsAffected = cmd.ExecuteNonQuery();
             if (rowsAffected == 0)
             {
                 throw new DataNotFoundException("G11_City_ReChild");
             }
         }
     }
     return(g11_City_ReChild);
 }
        private void Child_Insert(G10_City parent)
        {
            var dto = new G11_City_ReChildDto();

            dto.Parent_City_ID  = parent.City_ID;
            dto.City_Child_Name = City_Child_Name;
            using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <IG11_City_ReChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }