Levelcode-IBRCAD/IBRCAD/frm_consultafornecedor.cs

73 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BLL;
using DAL;
namespace IBRCAD
{
public partial class frm_consultafornecedor : Form
{
public int codigo;
public frm_consultafornecedor()
{
InitializeComponent();
}
private void Frm_consultafornecedor_Load(object sender, EventArgs e)
{
this.BtLocalizar_Click(sender, e);
dgvDados.Columns[0].HeaderText = "Código";
//dgvDados.Columns[0].Width = 50;
dgvDados.Columns[1].HeaderText = "Nome";
//dgvDados.Columns[1].Width = 700;
dgvDados.Columns[2].HeaderText = "Razão Social";
dgvDados.Columns[3].HeaderText = "IE";
dgvDados.Columns[4].HeaderText = "CNPJ";
dgvDados.Columns[5].HeaderText = "CEP";
dgvDados.Columns[6].HeaderText = "Endereço";
dgvDados.Columns[7].HeaderText = "Bairro";
dgvDados.Columns[8].HeaderText = "Fone";
dgvDados.Columns[9].HeaderText = "Celular";
dgvDados.Columns[10].HeaderText = "E-mail";
dgvDados.Columns[11].HeaderText = "Número";
dgvDados.Columns[12].HeaderText = "Cidade";
dgvDados.Columns[13].HeaderText = "Estado";
}
private void BtLocalizar_Click(object sender, EventArgs e)
{
DALLconexao cx = new DALLconexao(DadosDaConexao.StringDeConexao);
BLLFornecedor bll = new BLLFornecedor(cx);
if (rbNome.Checked == true)
{
dgvDados.DataSource = bll.LocalizarPorNome(txtValor.Text);
}
else
{
dgvDados.DataSource = bll.LocalizarPorCNPJ(txtValor.Text);
}
}
private void DgvDados_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0)
{
this.codigo = Convert.ToInt32(dgvDados.Rows[e.RowIndex].Cells[0].Value);
this.Close();
}
}
private void Btn_imprimir_Click(object sender, EventArgs e)
{
//printDGV.Print_DataGridView(dgvDados);
}
}
}