private void btnOmitir_Click(object sender, RoutedEventArgs e) { Paciente pa = new Paciente(bandera_offline_online); bool inserto = pa.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.paciente.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica, alias); if (inserto) { //pa = new Paciente(!bandera_offline_online); // pa.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.paciente.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); if (admin != null) { admin.Main.Content = new Page6(alias); //System.Windows.Forms.MessageBox.Show("Se Ingreso el Paciente", "Se Ingreso", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (recep != null) { recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias); //System.Windows.Forms.MessageBox.Show("Se Ingreso el Paciente", "Se Ingreso", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (socio != null) { socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); //System.Windows.Forms.MessageBox.Show("Se Ingreso el Paciente", "Se Ingreso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { // System.Windows.Forms.MessageBox.Show("No se pudo Ingresar el Paciente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnFinalizar_Click(object sender, RoutedEventArgs e) { string descripcion = txtAntecedentes.Text; paciente.antecedente = descripcion; Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); if (admin != null) { admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden; admin.Main.Content = new Page8_IngresarFoto(paciente, this.lista, this.alias); } else if (recep != null) { recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden; recep.Main3.Content = new Page8_IngresarFoto(paciente, this.lista, this.alias); } else if (socio != null) { socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden; socio.Main4.Content = new Page8_IngresarFoto(paciente, this.lista, this.alias); } }
private void btnFinalizar_Click(object sender, RoutedEventArgs e) { // MessageBox.Show("la foto es :" + paciente.foto); PacienteModel paciente_nuevo = new PacienteModel(); ClinicaModel clinica = new ClinicaModel(); paciente_nuevo.id_paciente = this.paciente.id_paciente; paciente_nuevo.nombre = this.paciente.nombre; paciente_nuevo.apellidos = this.paciente.apellidos; paciente_nuevo.direccion = this.paciente.direccion; paciente_nuevo.telefono = this.paciente.telefono; paciente_nuevo.foto = this.paciente.foto; paciente_nuevo.imagen = null; paciente_nuevo.antecedente = txtAntecedentes.Text; paciente_nuevo.email = this.paciente.email; paciente_nuevo.marketing = this.paciente.marketing; clinica.id_clinica = this.paciente.clinica.id_clinica; clinica.nombre_sucursal = this.paciente.clinica.nombre_sucursal; clinica.color = this.paciente.clinica.color; paciente_nuevo.clinica = clinica; this.foto = this.paciente.foto; Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); if (admin != null) { admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden; admin.Main.Content = new Page8_ActualizarFoto(paciente_nuevo, null, alias); } else if (recep != null) { recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden; recep.Main3.Content = new Page8_ActualizarFoto(paciente_nuevo, null, alias); } else if (socio != null) { socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden; socio.Main4.Content = new Page8_ActualizarFoto(paciente_nuevo, this.lista, this.alias); } }
private void button1_Click(object sender, EventArgs e) { ColorDialog MyDialog = new ColorDialog(); if (MyDialog.ShowDialog() == DialogResult.OK) { } System.Drawing.Color color = MyDialog.Color; System.Windows.Media.Color mediaColor = System.Windows.Media.Color.FromRgb(color.R, color.G, color.B); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); Clin clin = System.Windows.Application.Current.Windows.OfType <Clin>().FirstOrDefault(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); if (admin != null) { admin.paleta_colores.Background = new SolidColorBrush(mediaColor); } else if (clin != null) { clin.paleta_colores.Background = new SolidColorBrush(mediaColor); this.Hide(); } else if (recep != null) { recep.paleta_colores.Background = new SolidColorBrush(mediaColor); this.Hide(); } else if (socio != null) { socio.paleta_colores.Background = new SolidColorBrush(mediaColor); this.Hide(); } }
private void btn_Omitir_Click(object sender, RoutedEventArgs e) { if (MiWebCam != null && MiWebCam.IsRunning) { CerrarWebCam(); } Servicios.Paciente paciente = new Servicios.Paciente(bandera_offline_online); bool inserto = paciente.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, "", this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica, alias); if (inserto) { //paciente = new Servicios.Paciente(!bandera_offline_online); //bool inserto_2 = paciente.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, "", this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); if (admin != null) { admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; admin.Main.Content = new Page6(alias); } else if (recep != null) { recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias); } else if (socio != null) { socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); } } }
private void Button_Click_1(object sender, RoutedEventArgs e) { string identificador = new Seguridad().SHA1(DateTime.Now + ""); string foto = this.paciente.nombre + "_" + this.paciente.apellidos + "_" + identificador + ".jpg"; foto = foto.Replace(" ", "_"); if (MiWebCam != null && MiWebCam.IsRunning) { /*CerrarWebCam(); * string filePath = ruta +foto; * var encoder = new JpegBitmapEncoder(); * encoder.Frames.Add(BitmapFrame.Create((BitmapSource)img1.Source)); * using (FileStream stream = new FileStream(filePath, FileMode.Create)) * encoder.Save(stream);*/ System.Windows.Forms.MessageBox.Show("La camara sigue encendida no ha tomado la foto ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string filePath = filePath = ruta + foto; var encoder = new JpegBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create((BitmapSource)img1.Source)); using (FileStream stream = new FileStream(filePath, FileMode.Create)) encoder.Save(stream); } Servicios.Paciente paciente = new Servicios.Paciente(bandera_offline_online); bool inserto = paciente.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica, alias); if (inserto) { string destFile = System.IO.Path.Combine(ruta_offline, foto); string destFile2 = System.IO.Path.Combine(@configuracion.carpetas.ruta_imagenes_carpeta + "\\", foto); System.IO.File.Copy(ruta + foto, destFile, true); System.IO.File.Copy(ruta + foto, destFile2, true); if (File.Exists(ruta + foto)) { File.Delete(ruta + foto); } //System.Windows.Forms.MessageBox.Show("Se subio correctamente la foto", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); if (admin != null) { admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; admin.Main.Content = new Page6(alias); } else if (recep != null) { recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias); } else if (socio != null) { socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); } //paciente = new Servicios.Paciente(!bandera_offline_online); //bool inserto_2 = paciente.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica); //if(inserto_2) //{ // System.Windows.Forms.MessageBox.Show("Tardaran unos minutos al subir la foto", "Espera", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // bool subir = SubirFicheroStockFTP(foto, @configuracion.carpetas.ruta_imagenes_carpeta + "\\"); // if (subir) // { // System.Windows.Forms.MessageBox.Show("Se subio correctamente la foto", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information); // Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault(); // Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault(); // Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault(); // if (admin != null) // { // admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // admin.Main.Content = new Page6(); // } // else // if (recep != null) // { // recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica); // } // else // if (socio != null) // { // socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // socio.Main4.Content = new Pacientes_socio(this.lista,this.alias); // } // } // else // { // System.Windows.Forms.MessageBox.Show("No se pudo subir la foto", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault(); // Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault(); // Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault(); // if (admin != null) // { // admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // admin.Main.Content = new Page6(); // } // else // if (recep != null) // { // recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica); // } // else // if (socio != null) // { // socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); // } // } //} //else //{ // Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault(); // Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault(); // Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault(); // if (admin != null) // { // admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // admin.Main.Content = new Page6(); // } // else // if (recep != null) // { // recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica); // } // else // if (socio != null) // { // socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); // } } else { // System.Windows.Forms.MessageBox.Show("No se pudo registrar el paciente ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } //bool insertarPaciente = paciente.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica); //if (insertarPaciente) //{ // System.Windows.Forms.MessageBox.Show("Se registro correctamente el Paciente", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information); // Test_Internet ti = new Test_Internet(); // if (ti.Test()) // { // System.Windows.Forms.MessageBox.Show("Tardaran unos minutos al subir la foto", "Espera", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // bool subir = SubirFicheroStockFTP(foto, ruta); // if (subir) // { // //bool descargo = downloadFile("ftp://jjdeveloperswdm.com/", "*****@*****.**", "bonita_smile", foto, // // @"\\DESKTOP-ED8E774\bs\" + foto, 10); // string destFile = System.IO.Path.Combine(@"\\DESKTOP-ED8E774\bs\", foto); // //MessageBox.Show("el valor de result es " + result); // System.IO.File.Copy(ruta+foto, destFile, true); // //File.Delete(ruta + foto); // System.Windows.Forms.MessageBox.Show("Se subio correctamente la foto", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information); // // } // else // { // System.Windows.Forms.MessageBox.Show("No se pudo subir la foto", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // } // } // else // { // System.Windows.Forms.MessageBox.Show("No se pudo subir la foto por el internet ", "Error por falta de internet", MessageBoxButtons.OK, MessageBoxIcon.Error); // string destFile = System.IO.Path.Combine(ruta_offline, foto); // string destFile2 = System.IO.Path.Combine(@"\\DESKTOP-ED8E774\bs\", foto); // //MessageBox.Show("el valor de result es " + result); // System.IO.File.Copy(ruta + foto, destFile, true); // System.IO.File.Copy(ruta + foto, destFile2, true); // File.Delete(ruta + foto); // System.Windows.Forms.MessageBox.Show("Se subira la foto cuando tengas internet y des click en sincronizar ", "Se guardara la foto", MessageBoxButtons.OK, MessageBoxIcon.Information); // Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault(); // Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault(); // if (admin != null) // { // admin.Main.Content = new Page6(); // } // else // if (recep != null) // { // recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica); // } // } //} // }
private void btnFinalizar_Click(object sender, RoutedEventArgs e) { if (txtNombre.Text.Equals("") || txtApellido.Text.Equals("") || txtAlias.Text.Equals("") || pwbPassword.Password.Equals("")) { System.Windows.Forms.MessageBox.Show("Falta llenar Campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { //Ventana_Usuario vu = new Ventana_Usuario(); UsuarioModel usu = new UsuarioModel(); RolModel rolModel = new RolModel(); string nombre = txtNombre.Text; string apellidos = txtApellido.Text; string alias = txtAlias.Text; string password = pwbPassword.Password; //System.Windows.MessageBox.Show(id_usu.ToString() + " " + nombre + " " + apellidos + " " + alias + " " + password + "" + " " + id_rol); Usuarios user = new Usuarios(bandera_online_offline); string pass_tabla = obtener_password(id_usu); bool inserto = false; if (password.Equals(pass_tabla)) { inserto = user.actualizarUsuario(id_usu, alias, nombre, apellidos, password, id_rol, alias_user); if (inserto) { //System.Windows.Forms.MessageBox.Show("Se actualizo el Usuario", "Se Actualizo", MessageBoxButtons.OK, MessageBoxIcon.Information); //user = new Usuarios(!bandera_online_offline); //user.actualizarUsuario(id_usu, alias, nombre, apellidos, password, id_rol); usu.alias = alias; usu.apellidos = apellidos; usu.id_usuario = id_usu; usu.nombre = nombre; usu.password = password; //rolModel.id_rol = id_rol; rolModel.descripcion = valor; usu.rol = rolModel; Clin clinica = System.Windows.Application.Current.Windows.OfType <Clin>().FirstOrDefault(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); if (recep != null) { recep.Main3.Content = new Recepcionista_Principal(id, alias + "_" + usu.id_usuario); } else if (clinica != null) { clinica.Main2.Content = new Pagina_Clinica(id, nombre + apellidos, alias + "_" + usu.id_usuario); } //System.Windows.MessageBox.Show("imprimo " + usuario.rol.descripcion); } else { // System.Windows.Forms.MessageBox.Show("No se pudo Actualizar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { Seguridad secure = new Seguridad(); string new_pass = secure.Encriptar(password); inserto = user.actualizarUsuario(id_usu, alias, nombre, apellidos, new_pass, id_rol, alias_user); if (inserto) { //user = new Usuarios(!bandera_online_offline); //user.actualizarUsuario(id_usu, alias, nombre, apellidos, new_pass, id_rol); usu.alias = alias; usu.apellidos = apellidos; usu.id_usuario = id_usu; usu.nombre = nombre; usu.password = password; //rolModel.id_rol = id_rol; rolModel.descripcion = valor; usu.rol = rolModel; //System.Windows.Forms.MessageBox.Show("Se actualizo el Usuario", "Se Actualizo", MessageBoxButtons.OK, MessageBoxIcon.Information); //vu.refrescar_listview(this.usu, usu, lv_aux); Clin clinica = System.Windows.Application.Current.Windows.OfType <Clin>().FirstOrDefault(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); if (recep != null) { recep.Main3.Content = new Recepcionista_Principal(id, alias + "_" + usu.id_usuario); } else if (clinica != null) { clinica.Main2.Content = new Pagina_Clinica(id, nombre + apellidos, alias + "_" + usu.id_usuario); } } else { // System.Windows.Forms.MessageBox.Show("No se pudo Actualizar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("No selecciono Nada en el combobox", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); if (txtNombre.Text.Equals("") || txtApellido.Text.Equals("") || txtAlias.Text.Equals("") || pwbPassword.Password.Equals("")) { System.Windows.Forms.MessageBox.Show("Falta llenar Campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
//this.paciente.clinica.id_clinica-> esto va en recepcionista en la ventana wpf private void btnOmitir_Click(object sender, RoutedEventArgs e) { bool eliminarArchivo = true; string rutaArchivoEliminar = @"\\DESKTOP-ED8E774\backup_bs\eliminar_imagen_temporal.txt"; Paciente pa = new Paciente(bandera_online_offline); bool email_correcto = new Seguridad().email_bien_escrito(this.paciente.email); if (email_correcto || this.paciente.email.Equals("")) { string viejo = this.nombre_viejo; string nuevo = this.paciente.nombre + "_" + this.paciente.apellidos; if (viejo.Equals(nuevo)) { if (this.foto.Equals("")) { bool inserto = pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica, alias); if (inserto) { // System.Windows.Forms.MessageBox.Show("Se actualizo el Paciente", "Se Actualizo", MessageBoxButtons.OK, MessageBoxIcon.Information); // pa = new Paciente(!bandera_online_offline); //pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); if (admin != null) { admin.Main.Content = new Page6(alias); } else if (recep != null) { recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias); } else if (socio != null) { socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); } } } else { bool inserto = pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica, alias); if (inserto) { //System.Windows.Forms.MessageBox.Show("Se actualizo el Paciente", "Se Actualizo", MessageBoxButtons.OK, MessageBoxIcon.Information); // pa = new Paciente(!bandera_online_offline); //pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); if (admin != null) { admin.Main.Content = new Page6(alias); } else if (recep != null) { recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias); } else if (socio != null) { socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); } } } } else { if (foto.Equals("")) { bool inserto = pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica, alias); { //System.Windows.Forms.MessageBox.Show("Se actualizo el Paciente", "Se Actualizo", MessageBoxButtons.OK, MessageBoxIcon.Information); // pa = new Paciente(!bandera_online_offline); //pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); if (admin != null) { admin.Main.Content = new Page6(alias); } else if (recep != null) { recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias); } else if (socio != null) { socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); } } } else { Seguridad s = new Seguridad(); string nombre_nuevo_foto = this.paciente.nombre + "_" + this.paciente.apellidos + "_" + this.paciente.id_paciente + ".jpg"; nombre_nuevo_foto = nombre_nuevo_foto.Replace(" ", "_"); nombre_nuevo_foto = s.quitar_acentos(nombre_nuevo_foto); bool inserto = pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, nombre_nuevo_foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica, alias); if (inserto) { renombrar(this.paciente.foto, nombre_nuevo_foto); if (File.Exists(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + this.paciente.foto)) { File.Delete(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + this.paciente.foto); } string destFile2 = System.IO.Path.Combine(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\", nombre_nuevo_foto); System.IO.File.Copy(@configuracion.carpetas.ruta_imagenes_carpeta + "\\" + nombre_nuevo_foto, destFile2, true); Escribir_Archivo ea = new Escribir_Archivo(); ea.escribir_imagen_eliminar(this.paciente.foto, @configuracion.carpetas.ruta_eliminar_carpeta + "\\eliminar_imagen_temporal_" + alias + ".txt"); // System.Windows.Forms.MessageBox.Show("Se actualizo el Paciente", "Se Actualizo", MessageBoxButtons.OK, MessageBoxIcon.Information); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); if (admin != null) { admin.Main.Content = new Page6(alias); } else if (recep != null) { recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias); } else if (socio != null) { socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); } //pa = new Paciente(!bandera_online_offline); //bool actualizo = pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, nombre_nuevo_foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica); // if (actualizo) // { // var datos = ea.leer(rutaArchivoEliminar); // foreach (string imagen in datos) // { // Uri siteUri = new Uri("ftp://jjdeveloperswdm.com/" + imagen); // bool verdad = DeleteFileOnServer(siteUri, "*****@*****.**", "bonita_smile"); // if (!verdad) // eliminarArchivo = false; // } // if (eliminarArchivo) // { // System.Windows.MessageBox.Show("elimino Archivo"); // ea.SetFileReadAccess(rutaArchivoEliminar, false); // File.Delete(@"\\DESKTOP-ED8E774\backup_bs\eliminar_imagen_temporal.txt"); // bool subir = SubirFicheroStockFTP(nombre_nuevo_foto, @"\\DESKTOP-ED8E774\bs\"); // Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault(); // Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault(); // Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault(); // if (admin != null) // { // admin.Main.Content = new Page6(); // } // else // if (recep != null) // { // recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica); // } // else // if (socio != null) // { // socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); // } // } //} } } } } else { System.Windows.Forms.MessageBox.Show("Correo no válido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Metodo que realiza a validação de Usuario e senha public void PesquisaUsuario(string p_Cpf) { //Variáveis string Alu, Prof, Recep, Admin; //Busca no Banco Alu = Controller.AlunoController.Busca(p_Cpf); Prof = Controller.ProfessorController.Busca(p_Cpf); Recep = Controller.RecepcionistaController.Busca(p_Cpf); Admin = Controller.AdminController.Busca(p_Cpf); //Realiza as Condicionais verificando if (Alu == null) { if (Prof == null) { if (Recep == null) { if (Admin == null) { MessageBox.Show("Usuário ou Senha Incorretos!!", "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPassword.Clear(); txtUser.Clear(); txtUser.Focus(); } else { if (Admin.Equals(txtPassword.Text)) { Controller.PessoaLogController.UltimoLog(4, txtUser.Text); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Usuário ou Senha Incorretos!!", "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPassword.Clear(); txtUser.Clear(); txtUser.Focus(); } } } else { if (Recep.Equals(txtPassword.Text)) { Controller.PessoaLogController.UltimoLog(3, txtUser.Text); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Usuário ou Senha Incorretos!!", "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPassword.Clear(); txtUser.Clear(); txtUser.Focus(); } } } else { if (Prof.Equals(txtPassword.Text)) { Controller.PessoaLogController.UltimoLog(2, txtUser.Text); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Usuário ou Senha Incorretos!!", "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPassword.Clear(); txtUser.Clear(); txtUser.Focus(); } } } else { if (Alu.Equals(txtPassword.Text)) { Controller.PessoaLogController.UltimoLog(1, txtUser.Text); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Usuário ou Senha Incorretos!!", "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPassword.Clear(); txtUser.Clear(); txtUser.Focus(); } } }
private void btnAceptar_Click(object sender, EventArgs e) { string id_membresia = ""; if (!txtPrecio.Text.Equals("") && !txt_efectivo.Text.Equals("")) { if (new Seguridad().validar_numero(txtPrecio.Text) && new Seguridad().validar_numero(txt_efectivo.Text)) { double abono = Convert.ToDouble(txtPrecio.Text, culture); double efectivo = Convert.ToDouble(txt_efectivo.Text, culture); if (efectivo > 0) { try { //MessageBox.Show(paciente.nombre); bool inserto = new Membresia(bandera_online_offline).InsertarMembresia(paciente.id_paciente, datetimepicker1.Value.ToString("yyyy/MM/dd"), paciente.clinica.id_clinica, abono.ToString(culture), alias); if (inserto) { List <MembresiaModel> lista = new Membresia(bandera_online_offline).MostrarMembresias(paciente.id_paciente, paciente.clinica.id_clinica); foreach (var membresia in lista) { id_membresia = membresia.id_membresia; } bool inserto2 = new Abonos_Membresia(bandera_online_offline).InsertarAbonoMembresia(DateTime.Now.ToString("yyyy/MM/dd"), efectivo.ToString(culture), "Primer pago para tener la membresia", id_membresia, paciente.id_paciente, paciente.clinica.id_clinica, alias); if (inserto2) { //System.Windows.Forms.MessageBox.Show("El paciente " + paciente.nombre + " " + paciente.apellidos + " es ahora miembro", "Se ingreso correctamente", MessageBoxButtons.OK, MessageBoxIcon.Information); imprimir_recibo(); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); if (admin != null) { //MessageBox.Show(abono.ToString()); admin.Main.Content = new Abonos_Mem(paciente, id_membresia, abono, alias); } else if (recep != null) { recep.Main3.Content = new Abonos_Mem(paciente, id_membresia, abono, alias); } else if (socio != null) { socio.Main4.Content = new Abonos_Mem(paciente, id_membresia, abono, alias); } } // -----------------------------------------------/ //inserto = new Paciente(!bandera_online_offline).actualizarMembresia(paciente); } else { // System.Windows.Forms.MessageBox.Show("No se pudo Ingresar la membresia", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Se ha producido un error ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.OK; } this.DialogResult = DialogResult.OK; } else { System.Windows.Forms.MessageBox.Show("Abono mayor que efectivo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { System.Windows.Forms.MessageBox.Show("Cantidad no valida", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { System.Windows.Forms.MessageBox.Show("LLene todos los campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { bool eliminarArchivo = true; string rutaArchivoEliminar = @configuracion.carpetas.ruta_respaldo_carpeta + "\\eliminar_imagen_temporal_" + alias + ".txt"; Seguridad s = new Seguridad(); string foto = this.paciente.nombre + "_" + this.paciente.apellidos + "_" + this.paciente.id_paciente + ".jpg"; foto = foto.Replace(" ", "_"); foto = s.quitar_acentos(foto); if (MiWebCam != null && MiWebCam.IsRunning) { /*CerrarWebCam(); * string filePath = ruta +foto; * var encoder = new JpegBitmapEncoder(); * encoder.Frames.Add(BitmapFrame.Create((BitmapSource)img1.Source)); * using (FileStream stream = new FileStream(filePath, FileMode.Create)) * encoder.Save(stream);*/ System.Windows.Forms.MessageBox.Show("No apagó la cámara ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string filePath = ""; Test_Internet test_i = new Test_Internet(); filePath = ruta2 + foto; var encoder = new JpegBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create((BitmapSource)img1.Source)); using (FileStream stream = new FileStream(filePath, FileMode.Create)) encoder.Save(stream); Paciente paciente = new Paciente(bandera_online_offline); bool actualizo = paciente.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica, alias); if (actualizo) { if (this.foto_vieja.Equals("")) { string destfile_bs = @configuracion.carpetas.ruta_imagenes_carpeta + "\\" + foto; System.IO.File.Copy(ruta2 + foto, destfile_bs, true); string destfile_fotos = @configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + foto; System.IO.File.Copy(destfile_bs, destfile_fotos, true); File.Delete(ruta2 + foto); //paciente = new Paciente(!bandera_online_offline); //bool actualizo_again = paciente.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica); //if (actualizo_again) //{ // System.Windows.Forms.MessageBox.Show("Tardaran unos minutos al subir la foto", "Espera", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // bool subir = SubirFicheroStockFTP(foto, @configuracion.carpetas.ruta_imagenes_carpeta+"\\"); // System.Windows.Forms.MessageBox.Show("Se subio correctamente la foto", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information); // Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault(); // Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault(); // Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault(); // if (admin != null) // { // admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // admin.Main.Content = new Page6(); // } // else // if (recep != null) // { // recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica); // } // else // if (socio != null) // { // socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; // socio.Main4.Content = new Pacientes_socio(this.lista,this.alias); // } //} //else //{ //System.Windows.Forms.MessageBox.Show("Offline", "Offline", MessageBoxButtons.OK, MessageBoxIcon.Error); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); if (admin != null) { admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; admin.Main.Content = new Page6(alias); } else if (recep != null) { recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias); } else if (socio != null) { socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); } } else { if (File.Exists(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + foto_vieja)) { File.Delete(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + foto_vieja); } if (File.Exists(@configuracion.carpetas.ruta_imagenes_carpeta + "\\" + foto_vieja)) { File.Delete(@configuracion.carpetas.ruta_imagenes_carpeta + "\\" + foto_vieja); } string destfile_bs = @configuracion.carpetas.ruta_imagenes_carpeta + "\\" + foto; System.IO.File.Copy(ruta2 + foto, destfile_bs, true); string destfile_fotos = @configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + foto; System.IO.File.Copy(destfile_bs, destfile_fotos, true); if (File.Exists(ruta2 + foto)) { File.Delete(ruta2 + foto); } Escribir_Archivo ea = new Escribir_Archivo(); ea.escribir_imagen_eliminar(this.foto_vieja, @configuracion.carpetas.ruta_eliminar_carpeta + "\\eliminar_imagen_temporal_" + alias + ".txt"); //paciente = new Paciente(!bandera_online_offline); //bool actualizo_again = paciente.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica); //if (actualizo_again) //{ // System.Windows.Forms.MessageBox.Show("Tardaran unos minutos al subir la foto", "Espera", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // var datos = ea.leer(rutaArchivoEliminar); // foreach (string imagen in datos) // { // Uri siteUri = new Uri("ftp://jjdeveloperswdm.com/" + imagen); // bool verdad = DeleteFileOnServer(siteUri, "*****@*****.**", "bonita_smile"); // if (!verdad) // eliminarArchivo = false; // } // if (eliminarArchivo) // { // System.Windows.MessageBox.Show("elimino Archivo"); // ea.SetFileReadAccess(rutaArchivoEliminar, false); // File.Delete(@"\\DESKTOP-ED8E774\backup_bs\eliminar_imagen_temporal.txt"); // bool subir = SubirFicheroStockFTP(foto, @"\\DESKTOP-ED8E774\bs\"); // System.Windows.Forms.MessageBox.Show("Se subio correctamente la foto", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information); // Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault(); // Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault(); // Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault(); // if (admin != null) // { // admin.Main.Content = new Page6(); // } // else // if (recep != null) // { // recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica); // } // else // if (socio != null) // { // socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); // } // } //} //System.Windows.Forms.MessageBox.Show("Offline", "Offline", MessageBoxButtons.OK, MessageBoxIcon.Error); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault(); if (admin != null) { admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; admin.Main.Content = new Page6(alias); } else if (recep != null) { recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias); } else if (socio != null) { socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible; socio.Main4.Content = new Pacientes_socio(this.lista, this.alias); } } } else { // System.Windows.Forms.MessageBox.Show("No se pudo actualizar el paciente ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (txtNombre.Text.Equals("") || txtApellidos.Text.Equals("") || txtDireccion.Text.Equals("")) { System.Windows.Forms.MessageBox.Show("Le faltan campos por llenar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { valor = cmbClinica.SelectedItem.ToString(); string id_clinica = obtener_id_clinica(valor); Paciente pa = new Paciente(false); bool email_correcto = new Seguridad().email_bien_escrito(txtEmail.Text); if (email_correcto || txtEmail.Text.Equals("")) { if (new Seguridad().ValidarTelefonos7a10Digitos(txtTelefono.Text)) { string tel = txtTelefono.Text; //System.Windows.MessageBox.Show(tel); bool inserto = pa.insertarPaciente(txtNombre.Text, txtApellidos.Text, txtDireccion.Text, tel, "", "", txtEmail.Text, 0, id_clinica, alias); if (inserto) { //pa = new Paciente(true); //pa.insertarPaciente(txtNombre.Text, txtApellidos.Text, txtDireccion.Text, tel, "", "", txtEmail.Text, 0, id_clinica); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); if (admin != null) { admin.Main.Content = new Page6(alias); // System.Windows.Forms.MessageBox.Show("Se Ingreso el Paciente", "Se Ingreso", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (recep != null) { recep.Main3.Content = new Page6(alias); // System.Windows.Forms.MessageBox.Show("Se Ingreso el Paciente", "Se Ingreso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { //System.Windows.Forms.MessageBox.Show("No se pudo Ingresar el Paciente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { System.Windows.Forms.MessageBox.Show("El teléfono debe de tener 10 dígitos", "Teléfono no válido", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { System.Windows.Forms.MessageBox.Show("Correo no válido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("No selecciono el comboBox", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); if (txtNombre.Text.Equals("") || txtApellidos.Text.Equals("") || txtDireccion.Text.Equals("")) { System.Windows.Forms.MessageBox.Show("Le faltan campos por llenar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void Button_Click_1(object sender, RoutedEventArgs e) { if (txtNombre.Text.Equals("") || txtApellidos.Text.Equals("") || txtDireccion.Text.Equals("") || cmbClinica.SelectedIndex.Equals(-1)) { System.Windows.Forms.MessageBox.Show("Le faltan campos por llenar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { //System.Windows.MessageBox.Show("si avanzo"); valor = cmbClinica.SelectedItem.ToString(); string id_clinica = obtener_id_clinica(valor); PacienteModel pacienteModel = new PacienteModel(); ClinicaModel clinicaModel = new ClinicaModel(); pacienteModel.apellidos = txtApellidos.Text; pacienteModel.nombre = txtNombre.Text; pacienteModel.direccion = txtDireccion.Text; pacienteModel.telefono = txtTelefono.Text; pacienteModel.foto = ""; pacienteModel.email = txtEmail.Text; pacienteModel.marketing = 0; clinicaModel.id_clinica = id_clinica; //pacienteModel.id_clinica = int.Parse(txtclinica.Text.ToString()); pacienteModel.clinica = clinicaModel; try { bool email_correcto = new Seguridad().email_bien_escrito(txtEmail.Text); if (email_correcto || txtEmail.Text.Equals("")) { if (new Seguridad().ValidarTelefonos7a10Digitos(txtTelefono.Text)) { string tel = txtTelefono.Text; // new Ingresar_Antecedentes_Clinicos(pacienteModel).ShowDialog(); Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault(); Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault(); if (admin != null) { //System.Windows.MessageBox.Show("SI AVANZO A ADMIN"); admin.Main.Content = new Page7_Ingresar(pacienteModel, null, alias); } else if (recep != null) { recep.Main3.Content = new Page7_Ingresar(pacienteModel, null, alias); } } else { System.Windows.Forms.MessageBox.Show("El teléfono debe de tener 10 dígitos", "Teléfono no válido", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { System.Windows.Forms.MessageBox.Show("Correo no válido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { } } //MessageBox.Show(nombre + " " + apellidos + " " + direccion + " " + telefono + " " + email); }