private void btnGuardar_Click(object sender, RoutedEventArgs e) { if (txtEmail.Text.Length == 0) { MessageBox.Show("Enter an email."); txtEmail.Focus(); } else if (!Regex.IsMatch(txtEmail.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$")) { MessageBox.Show("Enter a valid email."); txtEmail.Select(0, txtEmail.Text.Length); txtEmail.Focus(); } else { if (txtApellido.Text != "" && txtDni.Text != "" && txtEmail.Text != "" && txtNombre.Text != "" && txtTelefono.Text != "") { oCliente.cli_dni = txtDni.Text; oCliente.cli_nombre = txtNombre.Text; oCliente.cli_apellido = txtApellido.Text; oCliente.cli_email = txtEmail.Text; oCliente.cli_telefono = txtTelefono.Text; limpiar(); _clienteRepositorio.AgrgarCliente(oCliente); } else { MessageBox.Show("Completar todos los campos"); } } }
private void btnGuardarUsuario_Click(object sender, RoutedEventArgs e) { if (txtEmail.Text.Length == 0) { MessageBox.Show("Ingrese un email.", "Gestion Cliente", MessageBoxButton.OK, MessageBoxImage.Exclamation); txtEmail.Focus(); } else if (!Regex.IsMatch(txtEmail.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$")) { MessageBox.Show("Debe ingresar un email Valido.", "Gestion Cliente", MessageBoxButton.OK, MessageBoxImage.Exclamation); txtEmail.Select(0, txtEmail.Text.Length); txtEmail.Focus(); } else { if (txtApellido.Text != "" && txtDNI.Text != "" && txtEmail.Text != "" && txtNombre.Text != "" && txtTelefono.Text != "") { if (validarDNI(txtDNI.Text)) { MessageBox.Show("El DNI ya existe en el sistema", "Gestion Clientes", MessageBoxButton.OK, MessageBoxImage.Error); limpiar(); } else { if (MessageBox.Show("Guardar Cliente", "Mensaje", MessageBoxButton.OK, MessageBoxImage.Question) == MessageBoxResult.OK) { oCliente.cli_dni = txtDNI.Text; oCliente.cli_nombre = txtNombre.Text; oCliente.cli_apellido = txtApellido.Text; oCliente.cli_email = txtEmail.Text; oCliente.cli_telefono = txtTelefono.Text; _clienteRepositorio.AgrgarCliente(oCliente); list_clientes.ItemsSource = _clienteRepositorio.listarClientes(); MessageBox.Show("Cliente dado de alta", "Gestion Clientes", MessageBoxButton.OK, MessageBoxImage.Asterisk); limpiar(); } } } else { MessageBox.Show("Debe completar todos los campos", "Gestion Clientes", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void btnNuevoCliente_Click(object sender, RoutedEventArgs e) { if (txtEmail.Text.Length == 0) { MessageBox.Show("Enter an email."); txtEmail.Focus(); } else if (!Regex.IsMatch(txtEmail.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$")) { MessageBox.Show("Enter a valid email."); txtEmail.Select(0, txtEmail.Text.Length); txtEmail.Focus(); } else { if (txtApellido.Text != "" && txtDNI.Text != "" && txtEmail.Text != "" && txtNombre.Text != "" && txtTelefono.Text != "") { if (MessageBox.Show("Guardar Cliente", "Mensaje", MessageBoxButton.OK, MessageBoxImage.Question) == MessageBoxResult.OK) { oCliente.cli_dni = txtDNI.Text; oCliente.cli_nombre = txtNombre.Text; oCliente.cli_apellido = txtApellido.Text; oCliente.cli_email = txtEmail.Text; oCliente.cli_telefono = txtTelefono.Text; _clienteRepositorio.AgrgarCliente(oCliente); gridPrincipalUsuarioSinTabla.Children.Clear(); userControls.userControlABM.UserControlAVenta venta = new userControls.userControlABM.UserControlAVenta(); venta.DniCliente = txtDNI.Text; venta.NombreUsuario = nombreUsuario; venta.NumeroAsietnto = numeroAsietnto; venta.CodigoAutobus = codigoAutobus; venta.CodigoEmpresa = codigoEmpresa; venta.ServicioCodigo = servicioCodigo; venta.Pisos = pisos; gridPrincipalUsuarioSinTabla.Children.Add(venta); } } else { MessageBox.Show("Completar todos los campos"); } } }