Beispiel #1
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     Telas.FrmSubgrupoPesquisa frmSubgrupoPesquisa = new Telas.FrmSubgrupoPesquisa();
     frmSubgrupoPesquisa.ShowDialog();
     if (frmSubgrupoPesquisa.SubgrupoSelected != null)
     {
         subgrupoBindingSource.Position = subgrupoBindingSource.List.IndexOf(frmSubgrupoPesquisa.SubgrupoSelected);
     }
     frmSubgrupoPesquisa.Dispose();
 }
Beispiel #2
0
 private void FrmProduto_KeyDown(object sender, KeyEventArgs e)
 {
     if (estado.Equals(EstadoFormulario.ESPERA))
     {
         if (e.KeyCode == Keys.F2)
         {
             btnBuscar_Click(sender, e);
         }
         if (e.KeyCode == Keys.F3)
         {
             btnNovo_Click(sender, e);
         }
         else if (e.KeyCode == Keys.F4)
         {
             btnEditar_Click(sender, e);
         }
         else if (e.KeyCode == Keys.F5)
         {
             btnExcluir_Click(sender, e);
         }
         else if (e.KeyCode == Keys.F7)
         {
             btnEstoque_Click(sender, e);
         }
         else if (e.KeyCode == Keys.F8)
         {
             btnPontaEstoque_Click(sender, e);
         }
         else if (e.KeyCode == Keys.F9)
         {
             btnEstatistica_Click(sender, e);
         }
         else if (e.KeyCode == Keys.End)
         {
             produtoBindingSource.MoveLast();
         }
         else if (e.KeyCode == Keys.Home)
         {
             produtoBindingSource.MoveFirst();
         }
         else if (e.KeyCode == Keys.PageUp)
         {
             produtoBindingSource.MovePrevious();
         }
         else if (e.KeyCode == Keys.PageDown)
         {
             produtoBindingSource.MoveNext();
         }
         else if (e.KeyCode == Keys.Escape)
         {
             this.Close();
         }
     }
     else
     {
         if (e.KeyCode == Keys.Enter)
         {
             if (codigoFabricanteComboBox.Focused)
             {
                 codigoFabricanteComboBox_Leave(sender, e);
             }
             e.Handled = true;
             SendKeys.Send("{tab}");
         }
         else if (e.KeyCode == Keys.Escape)
         {
             btnCancelar_Click(sender, e);
         }
         else if (e.KeyCode == Keys.F6)
         {
             btnSalvar_Click(sender, e);
         }
         else if ((e.KeyCode == Keys.F2) && (codGrupoComboBox.Focused))
         {
             Telas.FrmGrupoPesquisa frmGrupoPesquisa = new Telas.FrmGrupoPesquisa();
             frmGrupoPesquisa.ShowDialog();
             if (frmGrupoPesquisa.SelectedGrupo != null)
             {
                 grupoBindingSource.Position = grupoBindingSource.List.IndexOf(frmGrupoPesquisa.SelectedGrupo);
             }
             frmGrupoPesquisa.Dispose();
         }
         else if ((e.KeyCode == Keys.F3) && (codGrupoComboBox.Focused))
         {
             Telas.FrmGrupo frmGrupo = new Telas.FrmGrupo();
             frmGrupo.ShowDialog();
             if (frmGrupo.GrupoSelected != null)
             {
                 grupoBindingSource.Position = grupoBindingSource.List.IndexOf(frmGrupo.GrupoSelected);
             }
             frmGrupo.Dispose();
         }
         else if ((e.KeyCode == Keys.F2) && (codSubgrupoComboBox.Focused))
         {
             Telas.FrmSubgrupoPesquisa frmSubGrupoPesquisa = new Telas.FrmSubgrupoPesquisa();
             frmSubGrupoPesquisa.ShowDialog();
             if (frmSubGrupoPesquisa.SubgrupoSelected != null)
             {
                 grupoBindingSource.Position    = grupoBindingSource.List.IndexOf(frmSubGrupoPesquisa.GrupoSelected);
                 subgrupoBindingSource.Position = subgrupoBindingSource.List.IndexOf(frmSubGrupoPesquisa.SubgrupoSelected);
             }
             frmSubGrupoPesquisa.Dispose();
         }
         else if ((e.KeyCode == Keys.F3) && (codSubgrupoComboBox.Focused))
         {
             Telas.FrmSubgrupo frmSubgrupo = new Telas.FrmSubgrupo(Convert.ToInt32(codGrupoComboBox.SelectedValue.ToString()));
             frmSubgrupo.ShowDialog();
             if (frmSubgrupo.SubgrupoSelected != null)
             {
                 grupoBindingSource.Position    = grupoBindingSource.List.IndexOf(frmSubgrupo.GrupoSelected);
                 subgrupoBindingSource.Position = subgrupoBindingSource.List.IndexOf(frmSubgrupo.SubgrupoSelected);
             }
             frmSubgrupo.Dispose();
         }
         else if ((e.KeyCode == Keys.F2) && (codigoFabricanteComboBox.Focused))
         {
             Telas.FrmPessoaPesquisa frmPessoaPesquisa = new Telas.FrmPessoaPesquisa(Pessoa.PESSOA_JURIDICA);
             frmPessoaPesquisa.ShowDialog();
             if (frmPessoaPesquisa.PessoaSelected != null)
             {
                 fabricanteBindingSource.Position = fabricanteBindingSource.List.IndexOf(frmPessoaPesquisa.PessoaSelected);
             }
             frmPessoaPesquisa.Dispose();
         }
         else if ((e.KeyCode == Keys.F3) && (codigoFabricanteComboBox.Focused))
         {
             Telas.FrmPessoa frmPessoa = new Telas.FrmPessoa();
             frmPessoa.ShowDialog();
             if (frmPessoa.PessoaSelected != null)
             {
                 fabricanteBindingSource.DataSource = GerenciadorPessoa.GetInstance().ObterTodos();
                 fabricanteBindingSource.Position   = fabricanteBindingSource.List.IndexOf(frmPessoa.PessoaSelected);
             }
             frmPessoa.Dispose();
         }
     }
 }