Esempio n. 1
0
 private void button2_Click(object sender, EventArgs e)
 {
     regAtual.p.nome        = txtNome.Text;
     regAtual.p.dnasc       = dtNascto.Value;
     regAtual.p.tipoUsuario = "ALUNO";
     regAtual.ra            = txtRa.Text;
     if (novo && regAtual.p.cpf == "")
     {
         regAtual.p.Definir_Cpf(RetornaCpf());
         if (CRUD.InsereLinha("pessoa", Pessoas_gen.Campos(), regAtual.p.ListarValores()) > 0)
         {
             CRUD.InsereLinha("aluno", Aluno.Campos(), regAtual.ListarValores());
             InformaDiag.InformaSalvo();
         }
     }
     else
     {
         if (CRUD.UpdateLine("pessoa", Pessoas_gen.Campos(), regAtual.p.ListarValores(), "CPF=" + regAtual.p.cpf) > 0)
         {
             CRUD.UpdateLine("aluno", Aluno.Campos(), regAtual.ListarValores(), "CPF=" + regAtual.p.cpf);
             InformaDiag.InformaSalvo();
         }
     }
     novo = false;
 }
Esempio n. 2
0
 private void btnSalva_Click(object sender, EventArgs e)
 {
     regAtual.p.nome        = txtNome.Text;
     regAtual.p.dnasc       = dtNascto.Value;
     regAtual.p.tipoUsuario = comboTipo.SelectedText;
     if (novo && regAtual.p.cpf != "")
     {
         string[] cs = txtCpf.Text.Split(".-".ToArray());
         string   c  = "";
         for (int i = 0; i < 4; i++)
         {
             c += cs[i];
         }
         regAtual.p.Definir_Cpf(c);
         if (CRUD.InsereLinha("pessoa", Pessoas_gen.Campos(), regAtual.p.ListarValores()) > 0)
         {
             CRUD.InsereLinha("servidor", Servidor.Campos(), regAtual.ListarValores());
             InformaDiag.InformaSalvo();
         }
     }
     else
     {
         if (CRUD.UpdateLine("pessoa", Pessoas_gen.Campos(), regAtual.p.ListarValores(), "CPF=" + regAtual.p.cpf) > 0)
         {
             CRUD.UpdateLine("servidor", Servidor.Campos(), regAtual.ListarValores(), "CPF=" + regAtual.p.cpf);
             InformaDiag.InformaSalvo();
         }
     }
     novo = false;
 }
Esempio n. 3
0
 private void btnSalva_Click(object sender, EventArgs e)
 {
     regAtual.logradouro    = comboLogra.SelectedText;
     regAtual.identificador = txtDescricao.Text;
     if (int.TryParse(txtNumero.Text, out int v))
     {
         regAtual.numero = v;
     }
     if (novo && regAtual.p.cpf == "")
     {
         regAtual.p.Definir_Cpf(cpf);
         if (CRUD.InsereLinha("endereco", Endereco.Campos(), regAtual.ListarValores()) > 0)
         {
             InformaDiag.InformaSalvo();
         }
     }
     else
     {
         if (CRUD.UpdateLine("endereco", Endereco.Campos(), regAtual.ListarValores(), "CPF=" + regAtual.p.cpf + " AND Logradouro='" + regAtual.logradouro + "'") > 0)
         {
             InformaDiag.InformaSalvo();
         }
         resEndereco.RemoveAt(pos);
         resEndereco.Insert(pos, regAtual);
     }
     novo = false;
 }
Esempio n. 4
0
 private void btnSalvar_Click(object sender, EventArgs e)
 {
     regAtual.qtPreparada = int.Parse(txtQtd.Value.ToString());
     regAtual.refeicao = int.Parse(txtRefeicao.Text);
     if (novo)
     {
         regAtual.Definir_data(txtData.Text);
         if (CRUD.InsereLinha("cardapio", Cardapio.Campos(), regAtual.ListarValores()) > 0)
             InformaDiag.InformaSalvo();
     }
     else
     {
         if (CRUD.UpdateLine("cardapio", Cardapio.Campos(), regAtual.ListarValores(), "Data='" + regAtual.dtPreparo + "'") > 0)
             InformaDiag.InformaSalvo();
     }
     novo = false;
 }
Esempio n. 5
0
 private void btnSalva_Click(object sender, EventArgs e)
 {
     if (novo)
     {
         regAtual.DefinirData(DateTime.Parse(txtData.Text));
         if (CRUD.InsereLinha("compra", Compra.Campos(), regAtual.ListarValores()) > 0)
         {
             InformaDiag.InformaSalvo();
         }
     }
     else
     {
         if (CRUD.UpdateLine("compra", Compra.Campos(), regAtual.ListarValores(), "Dt=" + regAtual.dt.ToString() + " AND CPF=" + regAtual.p.cpf) > 0)
         {
             InformaDiag.InformaSalvo();
         }
     }
     novo = false;
 }
Esempio n. 6
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;
 }
Esempio n. 7
0
 private void btnSalva_Click(object sender, EventArgs e)
 {
     regAtual.telefone = txtTelefone.Text;
     if (novo && regAtual.p.cpf == "")
     {
         regAtual.p.Definir_Cpf(ncpf);
         if (CRUD.InsereLinha("telefone", Telefone.Campos(), regAtual.ListarValores()) > 0)
         {
             InformaDiag.InformaSalvo();
         }
     }
     else
     {
         if (CRUD.UpdateLine("telefone", Telefone.Campos(), regAtual.ListarValores(), "CPF=" + regAtual.p.cpf + " AND Telefone=" + regAtual.telefone) > 0)
         {
             InformaDiag.InformaSalvo();
         }
         resTelefone.RemoveAt(pos);
         resTelefone.Insert(pos, regAtual);
     }
     novo = false;
 }
Esempio n. 8
0
 private void btnSalva_Click(object sender, EventArgs e)
 {
     regAtual.rbase      = txtBase.Text;
     regAtual.rguarnicao = txtGuarnicao.Text;
     regAtual.rsalada    = txtSalada.Text;
     regAtual.rsobremesa = txtSobremesa.Text;
     regAtual.rsuco      = txtSuco.Text;
     if (novo && regAtual.id <= 0)
     {
         regAtual.Definir_id(txtId.Text);
         if (CRUD.InsereLinha("refeicao", Refeicao.Campos(), regAtual.ListarValores()) > 0)
         {
             InformaDiag.InformaSalvo();
         }
     }
     else
     {
         if (CRUD.UpdateLine("refeicao", Refeicao.Campos(), regAtual.ListarValores(), "Id=" + regAtual.id.ToString()) > 0)
         {
             InformaDiag.InformaSalvo();
         }
     }
     novo = false;
 }