private void txtComprador_KeyPress(object sender, KeyPressEventArgs e) { Fun.AnalisaInteiro(e); // somente numeros inteiros if (e.KeyChar == 13) { e.Handled = true; if (!string.IsNullOrEmpty(txtComprador.Text)) { if (Vnd.ConsultaId(int.Parse(txtComprador.Text))) { lblComprador.Text = Vnd.Nome.ToString(); GrdPro.Focus(); SendKeys.SendWait("{ENTER}"); } else { lblComprador.Text = "Cliente não encontrado !"; txtComprador.Focus(); } } else { txtComprador.Focus(); } } }
private void fOrcamento_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 27) { e.Handled = true; if (ActiveControl.Name.ToUpper() == "GRDPRO") { CalculaTotal(); txtFormaPagamento.BackColor = Color.Yellow; txtFormaPagamento.Focus(); } else if (ActiveControl.Name.ToUpper() == "TXTEDITOR") { txtEditor.Visible = false; CalculaTotal(); GrdPro.Focus(); } else if (ActiveControl.Name.ToUpper() == "TXTORCAMENTO") { this.Close(); } else { LimpaTexto(); gpoDados.Enabled = false; txtEntrada.Text = ""; txtEntrada.Focus(); } } }
private void txtEditor_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { e.Handled = true; // produtos if (!string.IsNullOrEmpty(txtEditor.Text)) { if (!ProcuraMesmoProduto(txtEditor.Text)) // procura o mesmo produto dentro da grade { if (txtEditor.Text.Length < 13) // procura por id quando o codigo informado for menor que 13 digitos { if (Pro.Consulta(int.Parse(txtEditor.Text))) { AdicionaGrade(); } else { MessageBox.Show("Item não encontrado !"); txtEditor.Focus(); } } else { // consulta por codigo de barras para codigos de barras de 13 digitos ou mais. if (Pro.Consulta(0, txtEditor.Text)) { AdicionaGrade(); } else { MessageBox.Show("Código de Barras não encontrado no Banco de Dados !"); txtEditor.Focus(); } } } else { CalculaTotal(); txtEditor.Text = ""; txtEditor.Visible = false; GrdPro.Focus(); SendKeys.SendWait("{DOWN}"); } } } }
private void txtEditor_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F2) { e.Handled = true; fShow fsw = new fShow("PRODUTOS", new string[] { "ID", "DESCRICAO", "CODEBAR", "ESTOQUE_ATUAL", "PRECO_VENDA" }, "DESCRICAO"); fsw.ShowDialog(); txtEditor.Text = int.Parse(fsw.ParametroID.ToString()).ToString(); if (!string.IsNullOrEmpty(txtEditor.Text)) { SendKeys.SendWait("{ENTER}"); txtEditor.Visible = false; GrdPro.Focus(); } } }
private void AdicionaGrade() { if (txtEditor.Text.Length >= 13) { txtEditor.Text = Pro.Id.ToString(); } //GrdPro.Columns.Add(txtEditor.Text); grdProdutos = new ListViewItem(txtEditor.Text); grdProdutos.ForeColor = Color.White; grdProdutos.SubItems.Add(Pro.Descricao.ToString()); grdProdutos.SubItems.Add(Pro.Unidade.ToString()); grdProdutos.SubItems.Add(Pro.Preco_Venda.ToString("N")); grdProdutos.SubItems.Add("1"); grdProdutos.SubItems.Add(Pro.Preco_Venda.ToString("N")); grdProdutos.SubItems.Add(Pro.Local_Estoque.ToString()); GrdPro.Items.Add(grdProdutos); CalculaTotal(); txtEditor.Text = ""; txtEditor.Visible = false; GrdPro.Focus(); SendKeys.SendWait("{END}"); }