예제 #1
0
        public Boolean eliminarTema(Seccion seccion, Tema tema) {

            ArrayList temas;
            temas = seccion.getTemas();
            if (tema.getID().Equals(0) || tema.Equals(null))
            {
                throw new ArgumentNullException("Administrador (Elminar Tema) - Tema invalido.");
            }
            else
            {
                if (seccion.getID().Equals(0) || seccion.Equals(null))
                {
                    throw new ArgumentNullException("Administrador (Eliminar Tema) - Seccion invalida.");
                }
                else
                {
                    for (int i = 0; i < temas.Count; i++)
                    {
                        Tema temaComparar = (Tema)temas[i];
                        if (temaComparar.Equals(tema) && temaComparar.getID().Equals(tema.getID()))
                        {
                            temas.RemoveAt(i);
                            setFechaModificacion(DateTime.Now);
                            return true;
                        }
                    }
                    throw new ArgumentOutOfRangeException("Administrador (Eliminar Tema) - No se encuetra el tema a eliminar en la seccion.");
                }
            }
         }
예제 #2
0
파일: Seccion.cs 프로젝트: Memerto/C.E.J.A.
        public Boolean eliminarTema(Tema tema) {

            ArrayList temas = getTemas();
            if (tema == null || tema.getID() == "0000")
            {
                throw new ArgumentNullException("Seccion (Agregar Tema) - ID invalida.");
            }
            else
            {
                if (temas.Contains(tema))
                {
                    temas.Add(tema);
                    setTemas(temas);
                    setFechaModificacion(DateTime.Now);
                    return true;
                }
                else
                {
                    throw new ArgumentException("Seccion (Agregar Tema) - El tema ya se encuentra en esta seccion.");
                }
            }
        
        }
예제 #3
0
파일: Pagina.cs 프로젝트: Memerto/C.E.J.A.
        public Pagina(int id, String titulo, String informacion, int cantidadAprobacion, int cantidadDesaprobacion, Tema tema) {

            if (id == 0)
            {
                throw new ArgumentNullException("Constructor Pagina - ID invalida.");
            }
            else
            {
                if (titulo == null || titulo == "")
                {
                    throw new ArgumentNullException("Constructor Pagina - Titulo invalido.");
                }
                else
                {
                    if (informacion == null || informacion == "")
                    {
                        throw new ArgumentNullException("Constructor Pagina - Informacion invalida.");
                    }
                    else
                    {
                        if (tema.getID().Equals(0))
                        {
                            throw new ArgumentNullException("Constructor Pagina - Tema invalido.");
                        }
                        else
                        {
                            setID(id);
                            setTitulo(titulo);
                            setInformacion(informacion);
                            setCantidadAprobacion(cantidadAprobacion);
                            setCantidadDesaprobacion(cantidadDesaprobacion);
                            setTema(tema);
                        }
                    }
                }
            }
        }
예제 #4
0
파일: Seccion.cs 프로젝트: Memerto/C.E.J.A.
        public Boolean agregarTema(Tema tema) {

            ArrayList temas = getTemas();
            if (tema == null || tema.getID() == "0000")
            {
                throw new ArgumentNullException("Seccion (Agregar Tema) - ID invalida.");
            }
            else
            {
                Tema temaComparar;
                for (int i = 0; i < temas.Count; i++)
                {
                    temaComparar = (Tema)temas[i];
                    if (temaComparar.Equals(tema))
                    {
                        throw new ArgumentException("Seccion (Agregar Tema) - El tema ya se encuentra en esta seccion.");
                    }
                }
                    temas.Add(tema);
                    setTemas(temas);
                    setFechaModificacion(DateTime.Now);
                    return true;
            }
        }