コード例 #1
0
        public static void EditarNota()
        {
            if (Logica.Nota.ListarTodas().Count == 0)
            {
                MetodosComunes.MensajeColor(mensaje: "\nLa lista de Notas esta vacia.", color: ConsoleColor.Red);
                MetodosComunes.Continuar();
            }
            else
            {
                int             cantidad = MetodosComunes.ValidacionNumericaInt(mensajeIngreso: $"\nCuantas notas quiere editar (1-50):", mensajeError: "Valor no comprendido entre 1 y 50", minimoValorInput: 1, maximoValorInput: 50);
                int             ID;
                string          devolucionEditar;
                Entidades.Notas nota;
                for (int i = 0; i < cantidad; i++)
                {
                    do
                    {
                        MetodosInformar.InformarTodasNotas();
                        ID   = MetodosComunes.ValidacionNumericaInt(mensajeIngreso: "\nElija el ID de la nota de la cual desea editar:", minimoValorInput: 1, mensajeError: "\nEl valor debe ser 1 o mayor.", borrarInformacion: false);
                        nota = Logica.Nota.ListarUna(notasID: ID);
                        if (nota == null)
                        {
                            MetodosComunes.MensajeColor(mensaje: "\nLa nota seleccionada no existe.", color: ConsoleColor.Red);
                        }
                    } while (nota == null);
                    MetodosComunes.MensajeColor(mensaje: $"\nAnterior nota del Primer Parcial: {(nota.PrimerParcial == null ? "NULL" : nota.PrimerParcial.ToString())}");
                    nota.PrimerParcial = MetodosComunes.ValidacionNumericaFloat(mensajeIngreso: "\nNueva nota del primer parcial (1-10/null) Ej: 5,5:", minimoValorInput: 0, maximoValorInput: 10, mensajeError: "\nEl valor debe estar comprendido entre 1 a 10 o ser null.", borrarInformacion: false);

                    MetodosComunes.MensajeColor(mensaje: $"\nAnterior nota del Primer recuperatorio: {(nota.PrimerRecuperatorio == null ? "NULL" : nota.PrimerRecuperatorio.ToString())}");
                    nota.PrimerRecuperatorio = MetodosComunes.ValidacionNumericaFloat(mensajeIngreso: "\nNueva nota del primer recuperatorio (1-10/null) Ej: 5,5:", minimoValorInput: 0, maximoValorInput: 10, mensajeError: "\nEl valor debe estar comprendido entre 1 a 10 o ser null.", borrarInformacion: false);

                    MetodosComunes.MensajeColor(mensaje: $"\nAnterior nota del Segundo Parcial: {(nota.SegundoParcial == null ? "NULL" : nota.SegundoParcial.ToString())}");
                    nota.SegundoParcial = MetodosComunes.ValidacionNumericaFloat(mensajeIngreso: "\nNueva nota del segundo parcial (1-10/null) Ej: 5,5:", minimoValorInput: 0, maximoValorInput: 10, mensajeError: "\nEl valor debe estar comprendido entre 1 a 10 o ser null.", borrarInformacion: false);

                    MetodosComunes.MensajeColor(mensaje: $"\nAnterior nota del Segundo recuperatorio: {(nota.SegundoRecuperatorio == null ? "NULL" : nota.SegundoRecuperatorio.ToString())}");
                    nota.SegundoRecuperatorio = MetodosComunes.ValidacionNumericaFloat(mensajeIngreso: "\nNueva nota del segundo recuperatorio (1-10/null) Ej: 5,5:", minimoValorInput: 0, maximoValorInput: 10, mensajeError: "\nEl valor debe estar comprendido entre 1 a 10 o ser null.", borrarInformacion: false);

                    MetodosComunes.MensajeColor(mensaje: $"\nAnterior nota del Final: {(nota.Final == null ? "NULL" : nota.Final.ToString())}");
                    nota.Final       = MetodosComunes.ValidacionNumericaFloat(mensajeIngreso: "\nNueva nota del final (1-10/null) Ej: 5,5:", minimoValorInput: 0, maximoValorInput: 10, mensajeError: "\nEl valor debe estar comprendido entre 1 a 10 o ser null.", borrarInformacion: false);
                    devolucionEditar = Logica.Nota.Editar(nota);
                    if (devolucionEditar.Contains("correctamente"))
                    {
                        MetodosComunes.MensajeColor(mensaje: $"\nLa nota con ID: {nota.NotasId} de la asignatura con ID: {nota.AsignaturaId} ha sido editada correctamente.");
                    }
                    else
                    {
                        MetodosComunes.MensajeColor(mensaje: $"\n{devolucionEditar}", color: ConsoleColor.Red);
                    }
                }
            }
        }
コード例 #2
0
 public static Notas AgregarDatosNota(Notas pNota)
 {
     Entidades.Asignaturas asignatura;
     do
     {
         MetodosInformar.InformarTodasAsignaturas();
         pNota.AsignaturaId = MetodosComunes.ValidacionNumericaInt(mensajeIngreso: "\nIngrese el ID de la asignatura de la cual desea agregar la nota:", minimoValorInput: 1, mensajeError: "\nEl valor debe ser 1 o mayor.", borrarInformacion: false);
         asignatura         = Logica.Asignatura.ListarUna(pNota.AsignaturaId);
         if (asignatura == null)
         {
             MetodosComunes.MensajeColor(mensaje: "\nLa nota seleccionada no existe.", color: ConsoleColor.Red);
         }
     } while (asignatura == null);
     pNota.PrimerParcial        = MetodosComunes.ValidacionNumericaFloat(mensajeIngreso: "\nIngrese la nota del primer parcial (1-10/null) Ej: 5,5:", minimoValorInput: 0, maximoValorInput: 10, mensajeError: "\nEl valor debe estar comprendido entre 1 a 10 o ser null.", borrarInformacion: false);
     pNota.PrimerRecuperatorio  = MetodosComunes.ValidacionNumericaFloat(mensajeIngreso: "\nIngrese la nota del primer recuperatorio (1-10/null) Ej: 5,5:", minimoValorInput: 0, maximoValorInput: 10, mensajeError: "\nEl valor debe estar comprendido entre 1 a 10 o ser null.", borrarInformacion: false);
     pNota.SegundoParcial       = MetodosComunes.ValidacionNumericaFloat(mensajeIngreso: "\nIngrese la nota del segundo parcial (1-10/null) Ej: 5,5:", minimoValorInput: 0, maximoValorInput: 10, mensajeError: "\nEl valor debe estar comprendido entre 1 a 10 o ser null.", borrarInformacion: false);
     pNota.SegundoRecuperatorio = MetodosComunes.ValidacionNumericaFloat(mensajeIngreso: "\nIngrese la nota del segundo recuperatorio (1-10/null) Ej: 5,5:", minimoValorInput: 0, maximoValorInput: 10, mensajeError: "\nEl valor debe estar comprendido entre 1 a 10 o ser null.", borrarInformacion: false);
     pNota.Final = MetodosComunes.ValidacionNumericaFloat(mensajeIngreso: "\nIngrese la nota del final (1-10/null) Ej: 5,5:", minimoValorInput: 0, maximoValorInput: 10, mensajeError: "\nEl valor debe estar comprendido entre 1 a 10 o ser null.", borrarInformacion: false);
     return(pNota);
 }