public WCliente(Objeto.Cliente cliente) { InitializeComponent(); _Cliente = new Objeto.Cliente(); _Cliente.Codigo = txtCodigo.Conteudo = cliente.Codigo; _Cliente.Nome = txtNome.Conteudo = cliente.Nome; }
private void btnCancelar_Click(object sender, RoutedEventArgs e) { try { this.Cursor = Cursors.Wait; _Cliente = null; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Cliente", MessageBoxButton.OK, MessageBoxImage.Error); } finally { this.Cursor = Cursors.Arrow; } }
private void BuscarCliente() { Objeto.Cliente cliente = new Objeto.Cliente(); cliente.Codigo = cmbCliente.Codigo; cliente.Nome = cmbCliente.Nome; WCliente wCliente = new WCliente(cliente); wCliente.Owner = this; wCliente.ShowDialog(); if (wCliente.Cliente != null) { cmbCliente.Id = wCliente.Cliente.Id; cmbCliente.Codigo = wCliente.Cliente.Codigo; cmbCliente.Nome = wCliente.Cliente.Nome; cmbResponsavel.cmbComboBox.Focus(); } else { if (_orcamento != null && _orcamento.Cliente == null) cmbCliente.Limpar(); } }
private void btnSelecionar_Click(object sender, RoutedEventArgs e) { try { this.Cursor = Cursors.Wait; // Verifica se o grid está selecionado if (dgClientes.SelectedItem != null) { // verifica se existe algum item selecionado da edição if (dgClientes.SelectedItem.GetType() == typeof(Objeto.Cliente)) { // salva as alterações _Cliente = (Objeto.Cliente)dgClientes.SelectedItem; this.Close(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Cliente", MessageBoxButton.OK, MessageBoxImage.Error); } finally { this.Cursor = Cursors.Arrow; } }