示例#1
0
        public MiembroCO crearMiembroTotal(MiembroCO miembroCO)
        {
            try
            {
                TransactionalPlainAction action = null;
                switch (miembroCO.GetType().Name)
                {
                case "JugadorCO": action = new CrearJugadorAction((JugadorCO)miembroCO);
                    break;

                case "EntrenadorCO": action = new CrearEntrenadorAction((EntrenadorCO)miembroCO);
                    break;

                case "DirectivoCO": action = new CrearDirectivoAction((DirectivoCO)miembroCO);
                    break;

                default: action = new CrearJugadorAction((JugadorCO)miembroCO);
                    break;
                }



                return((MiembroCO)PlainActionProcessor.process(dbFactory, action));
            }
            catch (InternalErrorException e) { throw e; }
            catch (Exception e) { throw new InternalErrorException(e); }
        }
示例#2
0
        public object execute(DbConnection connection, DbTransaction transaction)
        {
            IntegranteDAO    integranteDAO    = new IntegranteDAO();
            HcoIntegranteDAO hcoIntegranteDAO = new HcoIntegranteDAO();
            JugadorDAO       jugadorDAO       = new JugadorDAO();
            EntrenadorDAO    entrenadorDAO    = new EntrenadorDAO();
            DirectivoDAO     directivoDAO     = new DirectivoDAO();

            if (info.Integrante != null)
            {
                integranteDAO.updateIntegrante(connection, transaction, info.Integrante);
            }
            var hcoIntegranteActual = info.ListaHcoIntegrantes[info.ListaHcoIntegrantes.Count - 1];

            hcoIntegranteDAO.updateHcoIntegrante(connection, transaction, hcoIntegranteActual);

            if (info.GetType().Name.Equals("JugadorCO"))
            {
                if ((info as JugadorCO).Jugador != null)
                {
                    jugadorDAO.updateJugador(connection, transaction, (info as JugadorCO).Jugador);
                }
            }
            else
            if (info.GetType().Name.Equals("EntrenadorCO"))
            {
                if ((info as EntrenadorCO).Entrenador != null)
                {
                    entrenadorDAO.updateEntrenador(connection, transaction, (info as EntrenadorCO).Entrenador);
                }
            }
            else
            {
                if ((info as DirectivoCO).Directivo != null)
                {
                    directivoDAO.updateDirectivo(connection, transaction, (info as DirectivoCO).Directivo);
                }
            }

            return(info);
        }