public PantallaAgregarDentista(RegistroDentista Dentista) : base(Dentista) { InitializeComponent(); InitializeComponent3(); AceptarCambios = false; tbCedula.Enabled = true; }
private void btnAceptar_Click(object sender, EventArgs e) { if (!FaltanCampos) { Interface = new InterfaceUsuario(this); RegistroDentista t = ObtenerRegistroDentista, Encontrado = Interface.ObtenerUnDentista(tbCedula.Text); if (Interface.RegistrarDentista(t) && Encontrado?.Cedula != tbCedula.Text) { MessageBox.Show("Dentista registrado correctamente", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information); AceptarCambios = true; Close(); } else { if (tbCedula.Text == Encontrado?.Cedula) { Validar.MensajeErrorOK("Cedula registrada anteriormente, favor de cambiarla"); } else { Validar.MensajeErrorBaseDeDatos(); } } } }
private void TbCedula_LostFocus(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(tbCedula.Text)) { RegistroDentista temp = Interface.ObtenerUnDentista(tbCedula.Text); if (temp == null) { if (DialogResult.Yes == MessageBox.Show("Dentista no registrado\n\n¿Desea registrarlo?", "AVISO", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { PantallaAgregarDentista Pant = new PantallaAgregarDentista(ObtenerRegistroDentista); Pant.ShowDialog(); if (Pant.AceptarCambios) { InitializeComponent4(Pant.ObtenerRegistroDentista); btnDentista.BackgroundImage = Presentacion.Properties.Resources.IconoDentistaModificar; AgregarDentista = false; } } else { btnDentista.BackgroundImage = Presentacion.Properties.Resources.IconoDentistaAgregar; AgregarDentista = true; } } else { if (DialogResult.Yes == MessageBox.Show("Dentista registrado\n\n¿Desea rellenar campos faltantes?", "AVISO", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { InitializeComponent4(temp); btnDentista.BackgroundImage = Presentacion.Properties.Resources.IconoDentistaModificar; } } } }
public PantallaModificarDentista(RegistroDentista Dentista) { InitializeComponent(); InitializeComponent2(); InitializeComponent3(); InitializeComponent4(Dentista); AceptarCambios = false; }
protected virtual void InitializeComponent4(RegistroDentista Dentista) { tbCedula.Text = Dentista?.Cedula; tbRFC.Text = Dentista?.RFC; tbNombreDentista.Text = Dentista?.Nombre; tbApellidos.Text = Dentista?.Apellidos; tbTelefono.Text = Dentista?.TelOficina; cbPaíses.Text = Dentista?.Pais; cbEstado.Text = Dentista?.Estado; cbMunicipio.Text = Dentista?.Municipio; cbCiudad.Text = Dentista?.Ciudad; tbColonia.Text = Dentista?.Colonia; tbCalle.Text = Dentista?.Direccion; tbCP.Text = Dentista?.CodPos; tbEmail.Text = Dentista?.Email?.Split('@')[0]; cbEmail.Text = Dentista?.Email?.Split('@')[1]; }
private void btnModificarDentista_Click(object sender, System.EventArgs e) { if (!Validar.ValidarUnaPantalla(new PantallaModificarDentista(null).GetType())) { Interface = new InterfaceUsuario(this); PantallaPedirInformación temp = new PantallaPedirInformación(); bool Cancelado = true; RegistroDentista Dentista = temp.PedirDentista(out Cancelado); if (!Cancelado) { if (Dentista != null) { Interface.DesplegarPantallaModificarDentista(Dentista); } else { MessageBox.Show("El número de dentista ingresado no existe", "AVISO", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } } } }
public RegistroDentista PedirDentista(out bool Cancelado) { InterfaceUsuario Interface = new InterfaceUsuario(this); Validacion = new Validar(this); pbIcono.BackgroundImage = Properties.Resources.IconoDentista; tbNumEmpleado.MaxLength = 10; lblInfo.Text = "Ingrese clave del dentista a modificar"; Text = lblPedir.Text = lblTitulo.Text = "Cédula Dentista"; AlinearCentroHorizontal(lblInfo, lblPedir); bool Cerrado = true; tbNumEmpleado.KeyPress += delegate(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13 || e.KeyChar == Convert.ToChar(Keys.Escape)) { if (!Validacion.ValidarTextBox(tbNumEmpleado)) { Close(); Cerrado = false; } if (e.KeyChar == Convert.ToChar(Keys.Escape)) { Close(); Cerrado = true; } } }; ShowDialog(); Cancelado = Cerrado; RegistroDentista temp = null; if (!Cerrado) { temp = Interface.ObtenerUnDentista(tbNumEmpleado.Text); } return(temp); }
public bool ActualizarDentista(RegistroDentista Dentista) { Manejador = new ManejadorRegistroDentista(); return((Manejador as ManejadorRegistroDentista).ActualizarDentista(Dentista)); }
public bool RegistrarDentista(RegistroDentista Dentista) { Manejador = new ManejadorRegistroDentista(); return((Manejador as ManejadorRegistroDentista).RegistrarDentista(Dentista)); }
public void DesplegarPantallaModificarDentista(RegistroDentista Dentista) { Manejador = new ManejadorRecepcion(); Manejador.DesplegarPantalla(new PantallaModificarDentista(Dentista)); }
public PantallaDentista(RegistroDentista Dentista) : this() { InitializeComponent4(Dentista); }
public bool ActualizarDentista(RegistroDentista Dentista) { Interface = new InterfaceBaseDeDatos(); return(Interface.ActualizarDentista(Dentista)); }