예제 #1
0
        private void dataGridView1_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e)
        {
            var _dgv = (DataGridView)sender;

            try
            {
                if (_dgv.RowCount > 0)
                {
                    _novo = false;

                    this.txtID.Text       = _dgv[0, _dgv.CurrentRow.Index].Value.ToString();
                    this.txtNome.Text     = _dgv[1, _dgv.CurrentRow.Index].Value.ToString();
                    this.txtEndereco.Text = _dgv[2, _dgv.CurrentRow.Index].Value.ToString();
                    this.txtTelefone.Text = _dgv[3, _dgv.CurrentRow.Index].Value.ToString();
                    this.txtCelular.Text  = _dgv[4, _dgv.CurrentRow.Index].Value.ToString();

                    PreencheGridCentrais(this.txtID.Text);
                }
            }
            catch (Exception ex)
            {
                frmException _ex = new frmException(ex);
                _ex.ShowDialog();
            }
        }
예제 #2
0
        private void btnGravar_Click(object sender, EventArgs e)
        {
            var _cliente = new Cliente
            {
                Nome     = txtNome.Text,
                Endereco = txtEndereco.Text,
                Telefone = txtTelefone.Text,
                Celular  = txtCelular.Text
            };

            try
            {
                if (_novo)
                {
                    Negocio.SetCliente(_cliente);
                }

                MessageBox.Show("Cliente cadastrado com sucesso");
            }
            catch (Exception ex)
            {
                frmException _ex = new frmException(ex);
                _ex.ShowDialog();
            }
        }
예제 #3
0
 private void frmCadastroCliente_Load(object sender, EventArgs e)
 {
     try
     {
         PreencheGridClientes();
     }
     catch (Exception ex)
     {
         frmException _ex = new frmException(ex);
         _ex.ShowDialog();
     }
 }