예제 #1
0
        public void txtendcodi_Leave(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtendcodi.Text))
            {
                return;
            }

            var dr = EnderecoDao.GetById(txtendcodi.Text);

            if (dr.Read())
            {
                txtendcodi.Text     = dr["ENDCEP"].ToString();
                txtendnome.Text     = dr["ENDENDE"].ToString();
                cblbai.SelectedItem = Bairros.FirstOrDefault(q => q.Split('-')[0].Trim() == dr["BAICODI"].ToString());
                edicao = true;
            }
            else
            {
                edicao = false;
                if ((MessageBox.Show("Registro não encontrado \n deseja cadastra-lo?", "Cadastro", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No))
                {
                    limpar();
                }
                else
                {
                    txtendnome.Text = "";
                    txtendnome.Focus();
                }
            }
        }
예제 #2
0
 private void dvgbairro_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     txtendcodi.Text = dvgbairro.Rows[e.RowIndex].Cells["ENDCEP"].Value.ToString();
     txtendcodi_Leave(null, null);
     tbcbairro.SelectedIndex = 1;
     txtendnome.Focus();
     edicao = true;
     cblbai.SelectedItem = Bairros.FirstOrDefault(q => q.Split('-')[0].Trim() == dvgbairro.Rows[e.RowIndex].Cells["BAICODI"].Value.ToString());
 }