private void But_Guardar_Click(object sender, RoutedEventArgs e){ try { if (tab_control.SelectedIndex == 0) { //Crear DECRETO if (this.Decreto.IsValid()) { if (MessageBox.Show("Seguro que DESEA INSERTAR UN DECRETO NUEVO CON EL NUMERO: " + this.Decreto.Numero + ", SI ES AFIRMATIVO PRESIONE EL BOTON 'SI' DE LO CONTRARIO PRESIONE EL BOTON 'NO'", "DESEA INSERTAR UN DECRETO NUEVO SI/NO", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { try{ if(decretos.Insert(this.Decreto)) { MessageBox.Show("Decreto fue insertado Sactifactoriamente.", "Insertado Sactifactoriamente", MessageBoxButton.OK, MessageBoxImage.Information); this.decretos = Empresa.Docente.Decreto.Recarga(); this.MostrandoUltimoDecreto(); } } catch{ MessageBox.Show("Error el insertar el decreto.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } else { MessageBox.Show(this.Decreto.Error, "Error", MessageBoxButton.OK, MessageBoxImage.Stop); } } else{ //Modificando DECRETO. if (MessageBox.Show("Seguro que DESEA MODIFICAR EL DECRETO CON EL NUMERO: " + this.Decreto.Numero + ", SI ES AFIRMATIVO PRESIONE EL BOTON 'SI' DE LO CONTRARIO PRESIONE EL BOTON 'NO'", "DESEA MODIFICAR EL DECRETO ACTUAL. SI/NO", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { this.decretos.Update((Empresa.Docente.TDecreto)com_decretos.SelectedItem); MessageBox.Show("Decreto fue modificado Sactifactoriamente.", "Modificado Sactifactoriamente", MessageBoxButton.OK, MessageBoxImage.Information); } } } catch{ MessageBox.Show("Error al grabar el documento, verifique que los datos suministrados son validos.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void But_Guardar_Click(object sender, RoutedEventArgs e) { if (this.Decreto.IsValid()) { if (MessageBox.Show("Seguro que DESEA INSERTAR UN DECRETO NUEVO CON EL NUMERO: " + this.Decreto.Numero + ", SI ES AFIRMATIVO PRESIONE EL BOTON 'SI' DE LO CONTRARIO PRESIONE EL BOTON 'NO'", "DESEA INSERTAR UN DECRETO NUEVO SI/NO", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes){ try{ if (decretos.Insert(this.Decreto)){ MessageBox.Show("Decreto fue insertado Sactifactoriamente.", "Insertado Sactifactoriamente", MessageBoxButton.OK, MessageBoxImage.Information); this.decretos = Empresa.Docente.Decreto.Recarga(); this.MostrandoUltimoDecreto(); } } catch{ MessageBox.Show("Error el insertar el decreto.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } else { MessageBox.Show(this.Decreto.Error , "Error", MessageBoxButton.OK, MessageBoxImage.Stop); } }