Example #1
0
 private void btnSalva_Click(object sender, EventArgs e)
 {
     if (novo && regAtual.nome == "")
     {
         regAtual.DefinirSetor(txtSetor.Text);
         if (CRUD.InsereLinha("departamento", Departamento.Campos(), regAtual.ListarValores()) > 0)
         {
             InformaDiag.InformaSalvo();
         }
     }
     else
     {
         if (CRUD.UpdateLine("departamento", Departamento.Campos(), regAtual.ListarValores(), "Nome='" + regAtual.nome + "'") > 0)
         {
             InformaDiag.InformaSalvo();
         }
         resSetor.RemoveAt(pos);
         resSetor.Insert(pos, regAtual);
     }
     novo = false;
 }
Example #2
0
        private void btnPesquisar_Click(object sender, EventArgs e)
        {
            string psq = txtSetor.Text;

            if (psq.Length > 2)
            {
                resSetor = Departamento.ConverteObject(CRUD.SelecionarTabela("departamento", Departamento.Campos(), "Nome LIKE '" + psq + "'", "ASC"));
                if (resSetor.Count() > 0)
                {
                    regAtual = resSetor.First();
                    pos      = 0;
                    MostraDados();
                    if (resSetor.Count() > 1)
                    {
                        AtivaNavegador();
                    }
                }
            }
        }
Example #3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            string pesquisa = comboSetor.Text;

            comboSetor.Items.Clear();
            if (pesquisa.Length > 0)
            {
                resS = Departamento.ConverteObject(CRUD.SelecionarTabela("departamento", Departamento.Campos(), "Nome LIKE '%" + pesquisa + "%'", "LIMIT 15"));

                foreach (Departamento f in resS)
                {
                    comboSetor.Items.Add(f.nome);
                }
            }
            timer1.Enabled = false;
        }