コード例 #1
0
 private void AbrirCadastro(object o, EventArgs e)
 {
     Cadastrar.FrmFornecedor f = new Cadastrar.FrmFornecedor();
     this.Hide();
     f.ShowDialog();
 }
コード例 #2
0
        private void ConsultarFornecedor(Object o, EventArgs e)
        {
            try
            {
                Telas.Cadastrar.FrmFornecedor fcu = new Cadastrar.FrmFornecedor();
                fcu.label1.Text         = "Consultando o Fornecedor";
                fcu.txtFantasia.Text    = Convert.ToString(dataGridView1.CurrentRow.Cells[1].Value);
                fcu.txtRazao.Text       = Convert.ToString(dataGridView1.CurrentRow.Cells[2].Value);
                fcu.txtCnpj.Text        = Convert.ToString(dataGridView1.CurrentRow.Cells[3].Value);
                fcu.txtCep.Text         = Convert.ToString(dataGridView1.CurrentRow.Cells[4].Value);
                fcu.txtComplemento.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[5].Value);
                fcu.txtNumero.Text      = Convert.ToString(dataGridView1.CurrentRow.Cells[6].Value);
                fcu.txtTel.Text         = Convert.ToString(dataGridView1.CurrentRow.Cells[7].Value);
                fcu.txtEmail.Text       = Convert.ToString(dataGridView1.CurrentRow.Cells[8].Value);
                fcu.button1.Visible     = false;
                BLL.CEP Correios = new BLL.CEP();
                if (fcu.txtCep.Text.Length == 0)
                {
                    MessageBox.Show("Por favor digite o cep");
                    return;
                }
                Correios.NumeroCep = fcu.txtCep.Text;
                System.Data.SqlClient.SqlDataReader ddr;
                ddr = Correios.ConsultarCEP();
                ddr.Read();
                if (ddr.HasRows)
                {
                    // fcu.txtEndereco.Text = Convert.ToString(ddr["Descricao"]);
                    fcu.txtBairro.Text = Convert.ToString(ddr["Bairro"]);
                    fcu.txtCidade.Text = Convert.ToString(ddr["Cidade"]);
                    fcu.cbUF.Text      = Convert.ToString(ddr["UF"]);
                }
                else
                {
                    MessageBox.Show("Cep incorreto");
                    fcu.txtCep.Clear();
                    fcu.txtCep.Focus();
                }



                fcu.txtFantasia.ReadOnly    = true;
                fcu.txtRazao.ReadOnly       = true;
                fcu.txtCnpj.ReadOnly        = true;
                fcu.txtCep.ReadOnly         = true;
                fcu.txtComplemento.ReadOnly = true;
                fcu.txtNumero.ReadOnly      = true;
                fcu.txtTel.ReadOnly         = true;
                fcu.txtEmail.ReadOnly       = true;
                fcu.txtBairro.ReadOnly      = true;
                fcu.txtCidade.ReadOnly      = true;
                fcu.txtEndereco.ReadOnly    = true;
                fcu.cbUF.Enabled            = false;
                fcu.button1.Visible         = false;

                fcu.Text = "Consultando Fornecedor";



                fcu.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                //throw;
            }
        }
コード例 #3
0
 private void pictureBox6_Click(object sender, EventArgs e)
 {
     Cadastrar.FrmFornecedor f = new Cadastrar.FrmFornecedor();
     f.ShowDialog();
 }