示例#1
0
        private void tbCodigo_Leave(object sender, EventArgs e)
        {
            if (tbCodigo.Text.Length != 0)
            {
                fin    = new Finalizadora();
                fin.Id = Convert.ToInt32(tbCodigo.Text);
                fin.ConsultaFinalizadora();
                if (fin.Descricao != null)
                {
                    tbDescricao.Text = fin.Descricao;

                    butAlterar.Enabled = true;
                    butExcluir.Enabled = true;
                    butNovo.Focus();
                }
                else
                {
                    this.LimparCampos();
                    this.OrganizaBotoes();
                    tbCodigo.Focus();
                }
            }
            else
            {
                this.LimparCampos();
                this.OrganizaBotoes();
            }
        }
示例#2
0
        private void butConsultar_Click(object sender, EventArgs e)
        {
            if (tbCodigo.Text.Length == 0)
            {
                LimparCampos();
                OrganizaBotoes();
                butAlterar.Enabled = false;
                FormGridFinalizadora grid = new FormGridFinalizadora(this);
                grid.MdiParent = this.ParentForm;
                grid.Show();
            }
            else
            {
                fin    = new Finalizadora();
                fin.Id = Convert.ToInt32(tbCodigo.Text);
                fin.ConsultaFinalizadora();
                if (fin.Descricao != null)
                {
                    tbDescricao.Text = fin.Descricao;

                    butAlterar.Enabled = true;
                    butExcluir.Enabled = true;
                }
                else
                {
                    this.LimparCampos();
                    this.OrganizaBotoes();
                }
                tbCodigo.SelectAll();
            }
        }