private void altaAsignatura(object sender, RoutedEventArgs e) { // SI EL FORMULARIO SE VALIDA CORRECTAMENTE PROCEDEMOS A REALIZAR EL INSERT if (validarFormulario()) { // COGEMOS EL ID DEL CURSO QUE ESTÁ EN LA POSICIÓN DEL INDEX SELECCIONADO DEL COMBOBOX string idCurso = listaCursos.ElementAt(cbCursoAltaAsignatura.SelectedIndex).id; string nombre = Utils.initCap(txtNombreAltaAsignatura.Text, "no"); string hora1 = txtHora1AltaAsignatura.Text; string hora2 = txtHora2AltaAsignatura.Text; string hora3 = txtHora3AltaAsignatura.Text; string hora4 = txtHora4AltaAsignatura.Text; string hora5 = txtHora5AltaAsignatura.Text; WebService webService = new WebService(); EstadoMensajeResponse response = webService.altaAsignatura(MainWindow.user.id, idCurso, nombre, hora1, hora2, hora3, hora4, hora5); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarAsignaturas(); limpiarCampos(); } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } }
private void registroProfesor(object sender, RoutedEventArgs e) { // SI EL FORMULARIO SE VALIDA CORRECTAMENTE PROCEDEMOS A REALIZAR EL INSERT if (validarFormulario()) { // RECOGEMOS LA INFORMACIÓN DE LOS CAMPOS Y LA PASAMOS A LOWER CASE SALVO LA PASS string user = txtUserRegistro.Text.ToLower(); string pass = txtPassRegistro.Password; string nombre = txtNombreRegistro.Text.ToLower(); string apellidos = txtApellidosRegistro.Text.ToLower(); // INSTANCIAMOS EL WEBSERVICE LLAMANDO AL MÉTODO REGISTRO PROFESOR, ENVÍANDO LOS DATOS Y REALIZANDO EL INSERT EN LA BD WebService webService = new WebService(); EstadoMensajeResponse response = webService.registroProfesor(user, pass, nombre, apellidos); // VALORAMOS EL ESTADO DE LA RESPUESTA RECOGIDA PARA MOSTRAR LA INFORMACIÓN PERTINENTE if (response.estado == 1) { Utils.msgBox("Usuario registrado con éxito", "ok", "info"); limpiarCampos(); } else { Utils.msgBox("El nombre de usuario ya está registrado", "ok", "warning"); } } }
private void altaCurso(object sender, RoutedEventArgs e) { // SI EL FORMULARIO SE VALIDA CORRECTAMENTE PROCEDEMOS A REALIZAR EL INSERT if (validarFormulario()) { string nombre = txtNombreAltaCurso.Text.ToString().ToUpper(); string tipo = cbTipoAltaCurso.Text.ToString(); string grado = txtGradoAltaCurso.Text.ToString(); String nivel = cbNivelAltaCurso.SelectedItem as String; string letra = txtLetraAltaCurso.Text.ToString().ToUpper(); WebService webService = new WebService(); EstadoMensajeResponse response = webService.altaCurso(MainWindow.user.id, nombre, tipo, grado, nivel, letra); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarCursos(); limpiarCampos(); } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } }
private void matricularAlumno(object sender, RoutedEventArgs e) { if (cbAlumnoMatricula.SelectedIndex != -1) { // RECOGEMOS EL ID ALUMNO MEDIANTE LA LISTA DE ALUMNOS y EL ÍNDICE SELECCIONADO string idAlumno = listaAlumnos.ElementAt(cbAlumnoMatricula.SelectedIndex).id; // RECOGEMOS EL ID ASIGNATURA DEL OBJETO ASIGNATURA string idAsignatura = asignatura.id; // HACEMOS EL INSERT A LA BD WebService webService = new WebService(); EstadoMensajeResponse response = webService.matricular(idAlumno, idAsignatura); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarAlumnosClases(); cbAlumnoMatricula.SelectedIndex = -1; } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } else { Utils.msgBox("No ha seleccionado ningún alumno a matricular", "ok", "warning"); } }
private void altaAlumno(object sender, RoutedEventArgs e) { // SI EL FORMULARIO SE VALIDA CORRECTAMENTE PROCEDEMOS A REALIZAR EL INSERT if (validarFormulario()) { // RECOGEMOS LA INFORMACIÓN DE LOS CAMPOS Y LA PASAMOS A LOWER CASE SALVO LA PASS string nombre = Utils.initCap(txtNombreAltaAlumno.Text, "no"); string apellidos = Utils.initCap(txtApellidosAltaAlumno.Text, "mayus"); string direccion = Utils.initCap(txtDireccionAltaAlumno.Text, "no"); string telefono = txtTelefonoAltaAlumno.Text; string email = txtEmailAltaAlumno.Text.ToLower(); // INSTANCIAMOS EL WEBSERVICE LLAMANDO AL MÉTODO REGISTRO PROFESOR, ENVÍANDO LOS DATOS Y REALIZANDO EL INSERT EN LA BD WebService webService = new WebService(); EstadoMensajeResponse response = webService.altaAlumno(MainWindow.user.id, nombre, apellidos, direccion, telefono, email); // VALORAMOS EL ESTADO DE LA RESPUESTA RECOGIDA PARA MOSTRAR LA INFORMACIÓN PERTINENTE if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); // ACTUALIZAMOS LA TABLA DEL MAIN WINDOW ((MainWindow)this.Owner).cargarAlumnos(); // LIMPIAMOS CAMPOS limpiarCampos(); } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } }
private void desmatricular(object sender, RoutedEventArgs e) { Matricula matriculaSeleccionada = dgMatriculasPerfilAlumno.SelectedItem as Matricula; if (matriculaSeleccionada != null) { MessageBoxResult messageBoxResult = Utils.msgBox("¿Desea desmatricular al alumno de la asignatura seleccionada? Se eliminarán también las notas y faltas de la asignatura", "yesno", "question"); if (messageBoxResult == MessageBoxResult.Yes) { WebService webService = new WebService(); EstadoMensajeResponse response = webService.desmatricular(this.idAlumno, matriculaSeleccionada.idAsignatura); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); // RECARGAMOS LAS MATRÍCULAS DEL ALUMNO cargarMatriculas(); cargarCBAsignaturasMatriculadas(); } else { Utils.msgBox(response.mensaje, "ok", "error"); } } } else { Utils.msgBox("Seleccione una asignatura en la tabla superior", "ok", "warning"); } }
private void programarTarea(object sender, RoutedEventArgs e) { if (validarFormulario()) { // COGEMOS EL ID DEL CURSO QUE ESTÁ EN LA POSICIÓN DEL INDEX SELECCIONADO DEL COMBOBOX string nombre = Utils.initCap(txtNombreTarea.Text, "no"); string fecha = dateTimePickerFecha.Text; string valoracion = txtValoracionTarea.Text; string tipo = cbTipoTarea.Text; WebService webService = new WebService(); EstadoMensajeResponse response = webService.altaTarea(this.asignatura.id, nombre, fecha, valoracion, tipo); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarTareasClases(); limpiarCampos(); } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } }
private void editarApunte(object sender, RoutedEventArgs e) { Button boton = sender as Button; if (boton.Content.Equals("MODIFICAR")) { boton.Content = "GUARDAR"; boton.Background = (Brush) new BrushConverter().ConvertFrom("#FF7B9763"); cbTipoApuntes.IsEnabled = true; cbTipoApuntes.IsReadOnly = false; txtNombreApuntes.IsEnabled = true; txtNombreApuntes.IsReadOnly = false; txtEnlaceApuntes.IsEnabled = true; txtEnlaceApuntes.IsReadOnly = false; txtDescripcionAputnes.IsEnabled = true; txtDescripcionAputnes.IsReadOnly = false; } else { // PEDIMOS CONFIRMACIÓN MessageBoxResult messageBoxResult = Utils.msgBox("¿Desea guardar los cambios?", "yesno", "question"); if (messageBoxResult == MessageBoxResult.Yes) { // SI EL FORMULARIO SE VALIDA CORRECTAMENTE PROCEDEMOS A REALIZAR EL INSERT if (validarFormulario()) { string nombre = Utils.initCap(txtNombreApuntes.Text, "no"); string tipo = cbTipoApuntes.Text.ToString(); string enlace = txtEnlaceApuntes.Text; string descripcion = txtDescripcionAputnes.Text; WebService webService = new WebService(); EstadoMensajeResponse response = webService.editarApuntes(this.idApunte, this.asignatura.id, nombre, tipo, enlace, descripcion); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarApuntesClases(); boton.Content = "MODIFICAR"; boton.Background = (Brush) new BrushConverter().ConvertFrom("#FF979563"); cbTipoApuntes.IsEnabled = false; cbTipoApuntes.IsReadOnly = true; txtNombreApuntes.IsEnabled = false; txtNombreApuntes.IsReadOnly = true; txtEnlaceApuntes.IsEnabled = false; txtEnlaceApuntes.IsReadOnly = true; txtDescripcionAputnes.IsEnabled = false; txtDescripcionAputnes.IsReadOnly = true; } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } } } }
private void editarCurso(object sender, RoutedEventArgs e) { Button boton = sender as Button; if (boton.Content.Equals("MODIFICAR")) { boton.Content = "GUARDAR"; boton.Background = (Brush) new BrushConverter().ConvertFrom("#FF7B9763"); cbTipoCurso.IsEnabled = true; cbTipoCurso.IsReadOnly = false; txtLetraFichaCurso.IsEnabled = true; txtLetraFichaCurso.IsReadOnly = false; } else { // PEDIMOS CONFIRMACIÓN MessageBoxResult messageBoxResult = Utils.msgBox("¿Desea guardar los cambios?", "yesno", "question"); if (messageBoxResult == MessageBoxResult.Yes) { // SI EL FORMULARIO SE VALIDA CORRECTAMENTE PROCEDEMOS A REALIZAR EL INSERT if (validarFormulario()) { string nombre = txtNombreCurso.Text.ToString().ToUpper(); string tipo = cbTipoCurso.Text.ToString(); string grado = txtGradoCurso.Text.ToString(); String nivel = cbNivelFichaCurso.SelectedItem as String; string letra = txtLetraFichaCurso.Text.ToString().ToUpper(); WebService webService = new WebService(); EstadoMensajeResponse response = webService.editarCurso(this.idCurso, MainWindow.user.id, nombre, tipo, grado, nivel, letra); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarCursos(); boton.Content = "MODIFICAR"; boton.Background = (Brush) new BrushConverter().ConvertFrom("#FF979563"); txtNombreCurso.IsEnabled = false; txtNombreCurso.IsReadOnly = true; cbTipoCurso.IsEnabled = false; cbTipoCurso.IsReadOnly = true; cbNivelFichaCurso.IsEnabled = false; cbNivelFichaCurso.IsReadOnly = true; txtGradoCurso.IsEnabled = false; txtGradoCurso.IsReadOnly = true; txtLetraFichaCurso.IsEnabled = false; txtLetraFichaCurso.IsReadOnly = true; } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } } } }
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"); } }
private void eliminarApunte(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = Utils.msgBox("¿Desea eliminar los apuntes?", "yesno", "question"); if (messageBoxResult == MessageBoxResult.Yes) { WebService webService = new WebService(); EstadoMensajeResponse response = webService.eliminarApuntes(this.idApunte); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarApuntesClases(); this.Close(); } else { Utils.msgBox(response.mensaje, "ok", "error"); } } }
private void eliminarAlumno(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = Utils.msgBox("¿Desea eliminar el alumno? Se eliminarán también sus matrículas, notas y faltas", "yesno", "question"); if (messageBoxResult == MessageBoxResult.Yes) { WebService webService = new WebService(); EstadoMensajeResponse response = webService.eliminarAlumno(this.idAlumno); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarAlumnos(); this.Close(); } else { Utils.msgBox(response.mensaje, "ok", "error"); } } }
private void eliminarTarea(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = Utils.msgBox("¿Desea eliminar la tarea? Se eliminarán también todas las notas asociadas a ella", "yesno", "question"); if (messageBoxResult == MessageBoxResult.Yes) { WebService webService = new WebService(); EstadoMensajeResponse response = webService.eliminarTarea(this.idTarea); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); // ACTUALIZAMOS LAS ASIGNATURAS DEL MAIN ((MainWindow)this.Owner).cargarTareasClases(); this.Close(); } else { Utils.msgBox(response.mensaje, "ok", "error"); } } }
private void eliminarAsignatura(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = Utils.msgBox("¿Desea eliminar la asignatura? Se eliminarán también las matrículas, tareas y apuntes de la misma", "yesno", "question"); if (messageBoxResult == MessageBoxResult.Yes) { WebService webService = new WebService(); EstadoMensajeResponse response = webService.eliminarAsignatura(this.idAsignatura); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); // ACTUALIZAMOS LAS ASIGNATURAS DEL MAIN ((MainWindow)this.Owner).cargarAsignaturas(); this.Close(); } else if (response.estado == 2) { Utils.msgBox(response.mensaje, "ok", "error"); } } }
private void subirApunte(object sender, RoutedEventArgs e) { if (validarFormulario()) { string nombre = Utils.initCap(txtNombreApuntes.Text, "no"); string tipo = cbTipoApuntes.Text.ToString(); string enlace = txtEnlaceApuntes.Text; string descripcion = txtDescripcionAputnes.Text; WebService webService = new WebService(); EstadoMensajeResponse response = webService.subirApuntes(this.asignatura.id, nombre, tipo, enlace, descripcion); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarApuntesClases(); limpiarCampos(); } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } }
private void editarAlumno(object sender, RoutedEventArgs e) { Button boton = sender as Button; if (boton.Content.Equals("MODIFICAR")) { boton.Content = "GUARDAR"; boton.Background = (Brush) new BrushConverter().ConvertFrom("#FF7B9763"); txtNombrePerfilAlumno.IsEnabled = true; txtNombrePerfilAlumno.IsReadOnly = false; txtApellidosPerfilAlumno.IsEnabled = true; txtApellidosPerfilAlumno.IsReadOnly = false; txtDireccionPerfilAlumno.IsEnabled = true; txtDireccionPerfilAlumno.IsReadOnly = false; txtTelefonoPerfilAlumno.IsEnabled = true; txtTelefonoPerfilAlumno.IsReadOnly = false; txtEmailPerfilAlumno.IsEnabled = true; txtEmailPerfilAlumno.IsReadOnly = false; } else { // PEDIMOS CONFIRMACIÓN MessageBoxResult messageBoxResult = Utils.msgBox("¿Desea guardar los cambios?", "yesno", "question"); if (messageBoxResult == MessageBoxResult.Yes) { // SI EL FORMULARIO SE VALIDA CORRECTAMENTE PROCEDEMOS A REALIZAR EL INSERT if (validarFormulario()) { string nombre = Utils.initCap(txtNombrePerfilAlumno.Text, "no"); string apellidos = Utils.initCap(txtApellidosPerfilAlumno.Text, "mayus"); string direccion = Utils.initCap(txtDireccionPerfilAlumno.Text, "no"); string telefono = txtTelefonoPerfilAlumno.Text; string email = txtEmailPerfilAlumno.Text.ToLower(); WebService webService = new WebService(); EstadoMensajeResponse response = webService.editarAlumno(this.idAlumno, MainWindow.user.id, nombre, apellidos, direccion, telefono, email); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarAlumnos(); boton.Content = "MODIFICAR"; boton.Background = (Brush) new BrushConverter().ConvertFrom("#FF979563"); txtNombrePerfilAlumno.IsEnabled = false; txtNombrePerfilAlumno.IsReadOnly = true; txtApellidosPerfilAlumno.IsEnabled = false; txtApellidosPerfilAlumno.IsReadOnly = true; txtDireccionPerfilAlumno.IsEnabled = false; txtDireccionPerfilAlumno.IsReadOnly = true; txtTelefonoPerfilAlumno.IsEnabled = false; txtTelefonoPerfilAlumno.IsReadOnly = true; txtEmailPerfilAlumno.IsEnabled = false; txtEmailPerfilAlumno.IsReadOnly = true; } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } } } }
private void cargarHorario() { // DECLARAMOS EL VIEWMODEL QUE LE VAMOS A ASIGNAR AL DATAGRID HorarioVM viewModel = new HorarioVM(); // BUCLE QUE RECORRE TODAS LAS HORAS DE CLASE for (int i = 9; i < 22; i++) { // PARA SALTAR LAS 15 HORAS, QUE NO SE IMPARTE CLASE if (i != 15) { // EN CADA HORA VAMOS A RECOGER SI HAY CLASE O NO EN CADA DÍA DE LA SEMANA // OBTENIENDO UN OBJETO DE NOMBRE DE ASIGNATURA EN CADA DIA DE LA SEMANA EN TAL HORA // DEFINIMOS UN STRING HORA A BUSCAR string horaABuscar = ""; // PARA EL CASO DE LAS 9 HAY QUE VALORARLO INDIVIDUALMENTE YA QUE ENTRARÍA EN CONFLICTO CON LAS 19:00 if (i == 9) { horaABuscar = "09:00"; } else { horaABuscar = i + ":00"; } // DECLARAMOS LAS 5 STRING ASIGNATURA Y EL VIEWMODEL string asignaturaLunes = "", asignaturaMartes = "", asignaturaMiercoles = "", asignaturaJueves = "", asignaturaViernes = ""; // A CONTINUACIÓN HACEMOS LAS 5 CONSULTA // LE PASAMOS EL ID DE PROFESOR PARA BUSCAR SUS ASIGNATURAS, LA HORA A BUSCAR Y EL DÍA QUE ESTAMOS BUSCANDO EN FORMA DE INTEGER for (int j = 1; j <= 5; j++) { WebService webService = new WebService(); EstadoMensajeResponse response = webService.getHorario(MainWindow.user.id, horaABuscar, j + ""); if (response.estado == 1) { switch (j) { case 1: asignaturaLunes = response.mensaje; break; case 2: asignaturaMartes = response.mensaje; break; case 3: asignaturaMiercoles = response.mensaje; break; case 4: asignaturaJueves = response.mensaje; break; case 5: asignaturaViernes = response.mensaje; break; } } } // CON EL RESULTADO DE CADA UNA GENERAMOS EL OBJETO HORARIO Y LO AÑADIMOS A LA LISTA DEL HORARIOVM Horario horario = new Horario(horaABuscar, asignaturaLunes, asignaturaMartes, asignaturaMiercoles, asignaturaJueves, asignaturaViernes); viewModel.HorarioAdapterList.Add(horario); } } // FINALMENTE ASIGNAMOS EL VIEWMODEL AL DATASOURCE Y TENEMOS EL HORARIO dgHorario.ItemsSource = viewModel.HorarioAdapterList; }
private void editarAsignatura(object sender, RoutedEventArgs e) { Button boton = sender as Button; if (boton.Content.Equals("MODIFICAR")) { boton.Content = "GUARDAR"; boton.Background = (Brush) new BrushConverter().ConvertFrom("#FF7B9763"); txtNombreFichaAsignatura.IsEnabled = true; txtNombreFichaAsignatura.IsReadOnly = false; cbCursoAsignatura.IsEnabled = true; cbCursoAsignatura.IsReadOnly = false; txtHora1FichaAsignatura.IsEnabled = true; txtHora1FichaAsignatura.IsReadOnly = false; txtHora2FichaAsignatura.IsEnabled = true; txtHora2FichaAsignatura.IsReadOnly = false; txtHora3FichaAsignatura.IsEnabled = true; txtHora3FichaAsignatura.IsReadOnly = false; txtHora4FichaAsignatura.IsEnabled = true; txtHora4FichaAsignatura.IsReadOnly = false; txtHora5FichaAsignatura.IsEnabled = true; txtHora5FichaAsignatura.IsReadOnly = false; } else { // PEDIMOS CONFIRMACIÓN MessageBoxResult messageBoxResult = Utils.msgBox("¿Desea guardar los cambios?", "yesno", "question"); if (messageBoxResult == MessageBoxResult.Yes) { // SI EL FORMULARIO SE VALIDA CORRECTAMENTE PROCEDEMOS A REALIZAR EL INSERT if (validarFormulario()) { // COGEMOS EL ID DEL CURSO QUE ESTÁ EN LA POSICIÓN DEL INDEX SELECCIONADO DEL COMBOBOX string idCurso = listaCursos.ElementAt(cbCursoAsignatura.SelectedIndex).id; string nombre = Utils.initCap(txtNombreFichaAsignatura.Text, "no"); string hora1 = txtHora1FichaAsignatura.Text; string hora2 = txtHora2FichaAsignatura.Text; string hora3 = txtHora3FichaAsignatura.Text; string hora4 = txtHora4FichaAsignatura.Text; string hora5 = txtHora5FichaAsignatura.Text; WebService webService = new WebService(); EstadoMensajeResponse response = webService.editarAsignatura(this.idAsignatura, MainWindow.user.id, idCurso, nombre, hora1, hora2, hora3, hora4, hora5); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarAsignaturas(); boton.Content = "MODIFICAR"; boton.Background = (Brush) new BrushConverter().ConvertFrom("#FF979563"); txtNombreFichaAsignatura.IsEnabled = false; txtNombreFichaAsignatura.IsReadOnly = true; cbCursoAsignatura.IsEnabled = false; cbCursoAsignatura.IsReadOnly = true; txtHora1FichaAsignatura.IsEnabled = false; txtHora1FichaAsignatura.IsReadOnly = true; txtHora2FichaAsignatura.IsEnabled = false; txtHora2FichaAsignatura.IsReadOnly = true; txtHora3FichaAsignatura.IsEnabled = false; txtHora3FichaAsignatura.IsReadOnly = true; txtHora4FichaAsignatura.IsEnabled = false; txtHora4FichaAsignatura.IsReadOnly = true; txtHora5FichaAsignatura.IsEnabled = false; txtHora5FichaAsignatura.IsReadOnly = true; } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } } } }