Exemple #1
0
        private void ponerNota(object sender, RoutedEventArgs e)
        {
            if (cbAsignaturasMatriculadas.SelectedIndex != -1 && cbTareasAsignaturasMatriculadas.SelectedIndex != -1)
            {
                double datoSalida;
                // SI SE PUEDE PASEAR A DOUBLE Y ESTÁ ENTRE 0 y 10 LA SUBIMOS
                if (double.TryParse(txtNotaPerfilAlumno.Text, out datoSalida))
                {
                    if (double.Parse(txtNotaPerfilAlumno.Text) >= 0 && double.Parse(txtNotaPerfilAlumno.Text) <= 10)
                    {
                        string     idTarea    = listaTareasAsignatura.ElementAt(cbTareasAsignaturasMatriculadas.SelectedIndex).id;
                        string     puntuacion = txtNotaPerfilAlumno.Text.ToString();
                        WebService webService = new WebService();

                        EstadoMensajeResponse response = webService.altaNota(this.idAlumno, idTarea, puntuacion);

                        if (response.estado == 1)
                        {
                            Utils.msgBox(response.mensaje, "ok", "info");
                            // RECARGAMOS LAS MATRÍCULAS DEL ALUMNO
                            cargarMatriculas();
                            cargarCBAsignaturasMatriculadas();
                        }
                        else if (response.estado == 2)
                        {
                            Utils.msgBox(response.mensaje, "ok", "info");
                        }
                        else
                        {
                            Utils.msgBox(response.mensaje, "ok", "error");
                        }
                    }
                    else
                    {
                        Utils.msgBox("La nota debe estar comprendida entre 0 y 10", "ok", "warning");
                    }
                }
                else
                {
                    Utils.msgBox("La puntuación no tiene un formato adecuado, tiene que ser un número, admite decimales", "ok", "warning");
                }
            }
            else
            {
                Utils.msgBox("Debe seleccionar una asignatura en la que esté matriculado el alumno y una tarea para editar la nota", "ok", "warning");
            }
        }