// CUSTOM public static void IniciarDatosCajero() { Cajero cajero = IniciarCaja.Cajero; if (cajero != null) { _lblRutCajero.Text = cajero.Rut.ToString() + "-" + cajero.Digito; _lblNombreCajero.Text = cajero.Nombre; } }
private void btnAgregar_Click(object sender, EventArgs e) { try { string pass = txtPass.Text.Trim(), repetir = txtRepetir.Text.Trim(); string nombre = txtNombre.Text.Trim(); string sRut = txtRut.Text.Trim(); int rut = -1; if (!int.TryParse(sRut, out rut)) { MessageBox.Show("El rut no es válido"); txtRut.Text = string.Empty; txtDigito.Text = string.Empty; txtRut.Focus(); return; } if (nombre.Length >= 50) { MessageBox.Show("El nombre no puede superar los 50 caracteres."); txtNombre.Text = string.Empty; txtNombre.Focus(); return; } if (pass != repetir) { MessageBox.Show("Las contraseñas no coinciden"); txtPass.Text = string.Empty; txtRepetir.Text = string.Empty; txtPass.Focus(); return; } Cajero cajero = new Cajero(); cajero.nombre = nombre; cajero.rut = rut; cajero.pass = pass; CajeroTableAdapter ta = new CajeroTableAdapter(); ta.Insert(cajero.rut, cajero.nombre, cajero.pass); } catch (Exception ex) { MessageBox.Show("El cajero ya existe"); clear(); Console.WriteLine(ex.Message); } }
private void _btnIngresar_Click(object sender, EventArgs e) { string txtRut = _txtRut.Text; char digito = _txtDigito.Text[0]; string txtPass = _txtPass.Text; int rut; if (int.TryParse(txtRut, out rut)) { _cajero = new Cajero(_nombreCajero, rut, digito, _telefonoCajero, txtPass); MenuPrincipal.IniciarDatosCajero(); } else { MessageBox.Show("Meta bien los deos! se pide un rut numerico >:C"); } }