public frmTermoNovo(Usuario user, String terId) { InitializeComponent(); ter = new Termo(); util = new Utils(); this.user = user; lblUserOn.Text = user.Login; alu = new Aluno(); if (terId != "") //atualizar { lblUltimaAlter.Visible = true; lblUltimaAlter1.Visible = true; ter.TerId = terId; ter = ter.getTermoById(); userTermo = new Usuario(); userTermo.Id = Convert.ToInt32(ter.TerQuemCadastrou); userTermo = userTermo.getUserById(); lblUltimaAlter.Text = userTermo.Login; btnSelecionar.Visible = false; alu.TerId = terId; ttbAluno.Text = alu.getAlunoByTermo(); pictureBox1.ImageLocation = fotoPath + "" + ter.TerId + ".jpg"; } else { lblUltimaAlter.Visible = false; lblUltimaAlter1.Visible = false; } }
public bool atualizar(Aluno alu) { bool result = true; sql = "UPDATE aluno SET cid_cod = @1, alu_nome = '@2', alu_rg = '@3', alu_cpf = '@4', alu_bairro = '@5', alu_rua = '@6', alu_numero = '@7', alu_cep = '@8'," + " alu_fone = '@9', alu_cel = '@A', alu_email = '@B', alu_dtnasc = '@C', alu_sexo = '@E' " + "WHERE alu_id = @F"; sql = sql.Replace("@1", alu.Cidade); sql = sql.Replace("@2", alu.Nome); sql = sql.Replace("@3", alu.Rg); sql = sql.Replace("@4", alu.Cpf); sql = sql.Replace("@5", alu.Bairro); sql = sql.Replace("@6", alu.Rua); sql = sql.Replace("@7", alu.Numero); sql = sql.Replace("@8", alu.Cep); sql = sql.Replace("@9", alu.Fone); sql = sql.Replace("@A", alu.Cel); sql = sql.Replace("@B", alu.Email); sql = sql.Replace("@C", alu.DtNasc); sql = sql.Replace("@E", "" + alu.Sexo); sql = sql.Replace("@F", "" + alu.Id); bco.conecta(); result = bco.executeNonQuery(sql); bco.desconecta(); return result; }
public bool cadastrar(Aluno alu) { bool result = true; sql = "INSERT INTO aluno (cid_cod, alu_nome, alu_rg, alu_cpf, alu_bairro, alu_rua, alu_numero, alu_cep," + " alu_fone, alu_cel, alu_email, alu_dtnasc, alu_sexo) " + "VALUES(@1, '@2', '@3', '@4', '@5', '@6', '@7', '@8', '@9', '@A', " + "'@B', '@C', '@E')"; sql = sql.Replace("@1", alu.Cidade); sql = sql.Replace("@2", alu.Nome); sql = sql.Replace("@3", alu.Rg); sql = sql.Replace("@4", alu.Cpf); sql = sql.Replace("@5", alu.Bairro); sql = sql.Replace("@6", alu.Rua); sql = sql.Replace("@7", alu.Numero); sql = sql.Replace("@8", alu.Cep); sql = sql.Replace("@9", alu.Fone); sql = sql.Replace("@A", alu.Cel); sql = sql.Replace("@B", alu.Email); sql = sql.Replace("@C", alu.DtNasc); sql = sql.Replace("@E", ""+alu.Sexo); bco.conecta(); result = bco.executeNonQuery(sql); bco.desconecta(); return result; }
public frmAvControlar(Usuario user) { InitializeComponent(); msmDia = true; ava = new Avaliacao(); status = "Todas"; ttbAluno.Enabled = false; ttbAvaliador.Enabled = false; chAllAluno.Checked = true; rbTodas.Checked = true; dtpFim.Value = DateTime.Today; dtpInicio.Value = DateTime.Today; func = new Funcionario(); alu = new Aluno(); this.user = user; chkPeriodo.Checked = true; atualizaInfo(); if (!user.hasPermissionField("escolher funcionário")) { isADM = false; func = func.getFuncByUser(user.Id); this.Text = "Agenda " + func.Nome; ttbAvaliador.Text = func.Nome; ava.FuncId = func.Id; gpbAvaliador.Enabled = false; gpbInfo.Visible = false; } else isADM = true; buscar(); }
public frmAvaliacao(String avaId) { InitializeComponent(); ava = new Avaliacao(); func = new Funcionario(); alu = new Aluno(); ana = new Anamnese(); per = new Perimetro(); comp = new Composicao(); neuro = new Neuromotor(); util = new Utils(); util.desabilitarCampos(tbAnamnese.Controls, false); ttbGeralSaude.Enabled = true; ttbAtividadeFisica.Enabled = true; ttbPartesModificar.Enabled = true; ttbObjetivoPraticaExe.Enabled = true; util.numericMaskFormata(tbPerimetros.Controls); util.numericMaskFormata(tbComposicao.Controls); util.numericMaskFormata(ttbNeuroWells); ava.Id = avaId; ava = ava.getById(); func.Id = ava.FuncId; func.getDadosFunc(); alu.Id = Convert.ToInt32(ava.AluId); alu = alu.getAlunoById(); if (alu.Sexo == 'm') { lblProtocolo.Text = "Pollock - 3 dobras"; ttbCompAxilarMedia.Enabled = false; ttbCompSubEscap.Enabled = false; ttbCompSupraIliaca.Enabled = false; ttbCompTricipital.Enabled = false; } else { lblProtocolo.Text = "Pollock - 7 dobras"; } lblAvaliado.Text = alu.Nome; lblAvaliador.Text = func.Nome; lblIdade.Text = ""+util.getIdade(alu.DtNasc); lblCodigo.Text = ava.Id; if (!ava.jaRealizada()) { ana.nova(ava.Id); per.nova(ava.Id); comp.nova(ava.Id, alu.Sexo); neuro.novo(ava.Id); ava = ava.getById(); } setarCamposAna(); setarCamposPer(); setarCamposComp(); setarCamposNeuro(); lblData.Text = ava.DtRealizada; atualizaTermo(); }
public bool addTermo(Aluno alu) { bool result = false; sql = "UPDATE aluno SET ter_id = @1 WHERE alu_id = @2"; sql = sql.Replace("@1", alu.TerId); sql = sql.Replace("@2", alu.Id+""); bco.conecta(); result = bco.executeNonQuery(sql); bco.desconecta(); return result; }
public frmAluGerenciamento(bool pesquisa, Usuario user) { InitializeComponent(); this.user = user; pesquisaConcluida = false; lblSelecionar.Visible = false; alu = new Aluno(); getEstatisticas(); atualizaDtgv(); isPesquisa = pesquisa; if (pesquisa) adptaParaPesquisa(); }
private void btnAluno_Click(object sender, EventArgs e) { frmAluGerenciamento frmAlu = new frmAluGerenciamento(true, null); frmAlu.ShowDialog(); if (frmAlu.getPesquisaRealizada()) { alu.Id = frmAlu.getAluId(); alu = alu.getAlunoById(); ttbAluno.Text = alu.Nome; } else { alu = new Aluno(); ttbAluno.Text = ""; } }
public frmMensalidadeControlarcs(Usuario user, String matCod) { InitializeComponent(); Caixa cai = new Caixa(); cai.CaiData = DateTime.Today.ToShortDateString(); cai = cai.getCaixaByData(); if (cai.CaiAbert == "") { MessageBox.Show("Caixa não foi aberto!", "Venda não permitida!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Close(); } mat = new Matricula(); mat.Id = matCod; mat = mat.getById(); this.user = user; Aluno aluAux = new Aluno(); aluAux.Id = Convert.ToInt32(mat.AluId); aluAux = aluAux.getAlunoById(); lblAluno.Text = aluAux.Nome; lblCod.Text = mat.Id; lblDtVcmto.Text = mat.DtVcmto; lblDtInicio.Text = DateTime.Parse(mat.DtIni).ToShortDateString(); Modalidade modAux = new Modalidade(); modAux.Id = mat.ModId; modAux = modAux.getById(); lblModalidade.Text = modAux.Desc; if (mat.DtFim != "") { btnNovo.Visible = false; } if (mat.Tipo == "d") atualizaInterface(); else { lblQtdeDias.Visible = false; lblCreditos.Visible = false; lblDias.Visible = false; dtgvMensalidades.Columns["colunaCoringa"].Visible = false; dtgvMensalidades.Columns["vcmto"].Visible = true; } dtgvMensalidades.DataSource = mat.getMensalidades(); }
public frmAgendaAvNova(String funcId, String avaId, String aluId) { InitializeComponent(); restricaoHorario = false; ttbAluno.Enabled = ttbAvaliador.Enabled = false; lblHorarioComRestricao.Visible = false; func = new Funcionario(); ava = new Avaliacao(); util = new Utils(); alu = new Aluno(); util.setCamposObrigatorios(Controls); func.Id = funcId; ava.Id = avaId; if (aluId != "") //chamada a partir da matricual na musculação { alu.Id = Convert.ToInt32(aluId); alu = alu.getAlunoById(); ava.AluId = aluId; gpbAluno.Enabled = false; ttbAluno.Text = alu.Nome; } if (func.Id != "") { func.getDadosFunc(); ttbAvaliador.Text = func.Nome; gpbAvaliador.Enabled = false; } else //pode escolher avaliador(adm) { } if (ava.Id != "") //atualizar { } else //nova avaliação { } }
public frmAluNovo(String aluCod, Usuario user) { InitializeComponent(); util = new Utils(); this.user = user; if (aluCod != "") //atualiza { alu = new Aluno(); alu.Id = Convert.ToInt32(aluCod); DataTable dtAux = alu.getAluno(); DataRow linha = dtAux.Rows[0]; alu.Nome = linha["alu_nome"].ToString(); alu.Cidade = linha["cid_cod"].ToString(); alu.Rg = linha["alu_rg"].ToString(); alu.Cpf = linha["alu_cpf"].ToString(); alu.Bairro = linha["alu_bairro"].ToString(); alu.Rua = linha["alu_rua"].ToString(); alu.Numero = linha["alu_numero"].ToString(); alu.Cep = linha["alu_cep"].ToString(); alu.Fone = linha["alu_fone"].ToString(); alu.Cel = linha["alu_cel"].ToString(); alu.Email = linha["alu_email"].ToString(); alu.DtNasc = linha["alu_dtnasc"].ToString(); alu.Sexo = Convert.ToChar(linha["alu_sexo"]); adptaInterface(); } else //cadastro { carregaCbb(); cbbEstado.SelectedIndex = cbbEstado.Items.Count - 2; cbbCidade.SelectedValue = util.getCodCidade("Presidente Prudente"); primeiroLoadCidades = false; rbMasc.Checked = true; } }
private void btnSelecionar_Click(object sender, EventArgs e) { frmAluGerenciamento frmAluGer = new frmAluGerenciamento(true, user); frmAluGer.ShowDialog(); if (frmAluGer.getPesquisaRealizada()) { alu.Id = frmAluGer.getAluId(); alu = alu.getAlunoById(); if (alu.TerId == "") ttbAluno.Text = alu.Nome; else { MessageBox.Show("Aluno já possui termo cadastrado em seu nome!", "Não permitido!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); ttbAluno.Text = ""; } } else ttbAluno.Text = ""; }
private void btnConfirmar_Click(object sender, EventArgs e) { Aluno aluAux = new Aluno(); aluAux.Id = Convert.ToInt32(mat.AluId); aluAux = aluAux.getAlunoById(); mov.AcessId = "" + user.Id; mov.CaiData = DateTime.Today.ToShortDateString(); mov.Desc = "Pagamento mensalidade mês de " + DateTime.Parse(lblMensVenc.Text).ToString("MMMM") + " do aluno " + aluAux.Nome; mov.MatCod = mat.Id; mov.Valor = "" + (valorFinal - valorProdutos); if (MessageBox.Show("Deseja realmente efetuar o pagamento?", "Confirma?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (mov.novaEntrada()) { for (int i = 0; i < dtVendasSemEntrada.Rows.Count; i++) { mov.MatCod = ""; mov.Desc = "venda produto"; mov.VenCod = dtVendasSemEntrada.Rows[i]["ven_cod"].ToString(); mov.Valor = dtVendasSemEntrada.Rows[i]["ven_valor"].ToString(); mov.novaEntrada(); } MessageBox.Show("Pagamento realizado com sucesso!", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information); if (MessageBox.Show("Deseja imprimir o comprovante de pagamento?", "Imprimir comprovante", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) MessageBox.Show("Em breve, usar chamada relatório mensalidade!"); this.Close(); } else MessageBox.Show("Ocorreu um erro ao pagar mensalidade!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public frmVendaNova(Usuario user, String venCod) { InitializeComponent(); Caixa cai = new Caixa(); cai.CaiData = DateTime.Today.ToShortDateString(); cai = cai.getCaixaByData(); if (cai.CaiAbert == "") { MessageBox.Show("Caixa não foi aberto!", "Venda não permitida!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Close(); } inicializaItensVenda(); this.user = user; lblUserOn.Text = user.Login; if (venCod != "") { ven = new Venda(); ven.Cod = venCod; ven = ven.getById(); btnConfirmar.Visible = false; gpbProduto.Visible = false; Usuario userAux = new Usuario(); userAux.Id = Convert.ToInt32(ven.AcessId); userAux = userAux.getUserById(); lblQuemRealizou.Text = userAux.Login; lblDataVenda.Text = Convert.ToDateTime(ven.Data).ToShortDateString(); btnAluAdd.Visible = false; btnClear.Visible = false; btnConfirmar.Visible = false; btnRemoveItem.Visible = false; cbbFormaPgmto.Enabled = false; foreach (ItensVenda p in ven.getItens()) { DataRow linha = dttItensVenda.NewRow(); linha["prod_id"] = p.ProdId; Produto prod = new Produto(); prod.Id = p.ProdId; prod = prod.getById(); linha["nome"] = prod.Desc; linha["qtde"] = p.Qtde; linha["valor"] = p.Valor; linha["preco_unit"] = Convert.ToDecimal(p.Valor) / Convert.ToInt32(p.Qtde); qtdeTotal += Convert.ToInt32(p.Qtde); dttItensVenda.Rows.Add(linha); } if (ven.AluId != "") { Aluno aluAux = new Aluno(); aluAux.Id = Convert.ToInt32(ven.AluId); aluAux = aluAux.getAlunoById(); ttbAluNome.Text = aluAux.Nome; } else ttbAluNome.Text = "---"; lblQtdeItens.Text = "" + qtdeTotal; lblValorTotal.Text = ven.Valor; cbbFormaPgmto.Text = ven.FormaPgmto; } else { ttbQtde.Enabled = false; lblDataVenda.Text = DateTime.Today.ToShortDateString(); lblQuemRealizou.Text = user.Login; valor = 0; qtde = 1; valorTotal = 0; qtdeTotal = 0; lblValorTotal.Text = "R$" + valorTotal; lblQtdeItens.Text = "" + qtdeTotal; lblSubTotal.Text = "R$" + qtde * valor; btnClear.Enabled = false; btnRemoveItem.Enabled = false; cbbFormaPgmto.Text = "À vista"; cbbFormaPgmto.Enabled = false; } }
private void btnAluAdd_Click(object sender, EventArgs e) { frmAluGerenciamento frmAlu = new frmAluGerenciamento(true, user); frmAlu.ShowDialog(); if (frmAlu.getPesquisaRealizada()) { alu = new Aluno(); alu.Id = frmAlu.getAluId(); alu = alu.getAlunoById(); ttbAluNome.Text = alu.Nome; cbbFormaPgmto.Enabled = true; cbbFormaPgmto.Text = "Na mensalidade"; } else { alu = new Aluno(); ttbAluNome.Text = ""; cbbFormaPgmto.Enabled = false; cbbFormaPgmto.Text = "À vista"; } }
private void btnCadastrar_Click(object sender, EventArgs e) { String fone, cel; fone = ttbFoneDDD.Text + ttbFone.Text; cel = ttbCelDDD.Text + ttbCel.Text; bool celValido = false; bool foneValido = false; if (ttbFone.Text.Length >= 8 && ttbFoneDDD.Text.Length == 2) foneValido = true; else { if (ttbFone.Text.Length < 8) ttbFone.BackColor = Color.Red; if (ttbFoneDDD.Text.Length != 2) ttbFoneDDD.BackColor = Color.Red; foneValido = false; } if (ttbCel.Text.Length >= 8 && ttbCelDDD.Text.Length == 2) celValido= true; else { if (ttbCel.Text.Length < 8) ttbCel.BackColor = Color.Red; if (ttbCelDDD.Text.Length != 2) ttbCelDDD.BackColor = Color.Red; celValido = false; } if (ttbBairro.Text == "") ttbBairro.BackColor = Color.Red; if (!ttbCEP.MaskCompleted) ttbCEP.BackColor = Color.Red; if (!ttbCPF.MaskCompleted) ttbCPF.BackColor = Color.Red; if (ttbNome.Text == "") ttbNome.BackColor = Color.Red; if (ttbNum.Text == "") ttbNum.BackColor = Color.Red; if (ttbRG.Text == "") ttbRG.BackColor = Color.Red; if (ttbRua.Text == "") ttbRua.BackColor = Color.Red; if (!util.validaEmail(ttbEmail.Text)) ttbEmail.BackColor = Color.Red; if (ttbBairro.Text != "" && celValido && ttbCEP.MaskCompleted && ttbCPF.MaskCompleted && foneValido && ttbNome.Text != "" && ttbNum.Text != "" && ttbRG.Text != "" && ttbRua.Text != "" && util.validaEmail(ttbEmail.Text)) { String codCid = "" + util.getCodCidade(cbbCidade.Text); String cpf = util.filtraApenasNumeros(ttbCPF.Text); String cep = util.filtraApenasNumeros(ttbCEP.Text); if (alu != null && !erro) //atualizar { int codigo = alu.Id; alu = new Aluno(ttbNome.Text, ttbRG.Text, cpf, ttbBairro.Text, ttbRua.Text, ttbNum.Text, cep, cel, fone, ttbEmail.Text, codCid, util.dateToString(dtNasc.Value), sexo); alu.Id = codigo; util.gravarFoto(fotoPath + "" + alu.Id + ".jpg", imagem.Image); if (alu.atualizar()) { MessageBox.Show("Atualização realizada com sucesso!", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else MessageBox.Show("Ocorreu um erro e a atualização não foi realizada!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } else //cadastrar { alu = new Aluno(ttbNome.Text, ttbRG.Text, cpf, ttbBairro.Text, ttbRua.Text, ttbNum.Text, cep, cel, fone, ttbEmail.Text, codCid, util.dateToString(dtNasc.Value), sexo); if (alu.cadastrar()) { alu.Id = alu.getUltimoId(); util.gravarFoto(fotoPath + "" + alu.Id + ".jpg", imagem.Image); String msg = ""; if (alu.Sexo == 'm') msg = "Aluno " + alu.Nome + " foi cadastrado com sucesso!"; else msg = "Aluna " + alu.Nome + " foi cadastrada com sucesso!"; MessageBox.Show(msg, "Cadastro realizado com sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information); if (MessageBox.Show("Deseja realizar a matrícula do aluno em alguma modalidade?", "Matrícula", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) new frmMatriculaNova(user, "", "" + alu.Id).ShowDialog(); this.Close(); } else { erro = true; MessageBox.Show("Ocorreu um erro e o cadastro não foi realizado!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
public bool excluir(Aluno alu) { bool result = true; sql = "DELETE FROM aluno WHERE alu_id = @1"; sql = sql.Replace("@1", ""+alu.Id); bco.conecta(); result = bco.executeNonQuery(sql); bco.desconecta(); return result; }
private void btnAluBuscar_Click(object sender, EventArgs e) { frmAluGerenciamento frmAlu = new frmAluGerenciamento(true, user); frmAlu.ShowDialog(); if (frmAlu.getPesquisaRealizada()) { aluno.Id = frmAlu.getAluId(); aluno = aluno.getAlunoById(); ttbAluno.Text = aluno.Nome; imagem.Image = new Bitmap(fotoPath + aluno.Id + ".jpg"); } else { aluno.Id = 0; ttbAluno.Text = ""; } }
public frmMatriculaNova(Usuario user, String matId, String aluId) { InitializeComponent(); gpbCreditos.Enabled = false; mat = new Matricula(); aluno = new Aluno(); mod = new Modalidade(); this.user = user; lblUserOn.Text = user.Login; lblDtIni.Text = DateTime.Today.ToShortDateString(); rbMensalista.Checked = true; if (matId == "") { btnConfirmar.Image = imageList1.Images[0]; chkEncerrar.Visible = false; } else { chkEncerrar.Visible = true; btnConfirmar.Image = imageList1.Images[1]; mat.Id = matId; mat = mat.getById(); aluno.Id = Convert.ToInt32(mat.AluId); aluno = aluno.getAlunoById(); imagem.Image = new Bitmap(fotoPath + aluno.Id + ".jpg"); ttbAluno.Text = aluno.Nome; mod.Id = mat.ModId; mod = mod.getById(); ttbModalidade.Text = mod.Desc; if (mat.Tipo.Equals("d")) { rbDiarista.Checked = true; ttbQtdeDias.Value = Convert.ToDecimal(mat.QtdeDias); } else { rbMensalista.Checked = true; ttbDtVcmto.Value = Convert.ToDecimal(mat.DtVcmto); ttbTolerancia.Value = Convert.ToDecimal(mat.Tolerancia); } ttbObs.Text = mat.Obs; lblDtIni.Text = DateTime.Parse(mat.DtIni).ToShortDateString(); btnAluBuscar.Enabled = false; btnModBuscar.Enabled = false; if (mat.DtFim != "") { lblEncerrada.Visible = true; lblEncerrada.Text = "Matrícula encerrada!"; chkEncerrar.Visible = false; chkEncerrar.Checked = true; btnConfirmar.Enabled = false; ttbDtVcmto.Enabled = false; ttbObs.Enabled = false; ttbQtdeDias.Enabled = false; ttbTolerancia.Enabled = false; } } if (aluId != "") { aluno.Id = Convert.ToInt32(aluId); aluno = aluno.getAlunoById(); ttbAluno.Text = aluno.Nome; btnAluBuscar.Enabled = false; } }
public DataTable getAlunos(Aluno alu, String filtro) { char sexo = ' '; if (filtro.Equals("todos")) { sql = "SELECT * FROM aluno WHERE alu_nome ILIKE '@1%'"; sql = sql.Replace("@1", alu.Nome); } else { if (filtro.Equals("mulheres")) sexo = 'f'; if (filtro.Equals("homens")) sexo = 'm'; sql = "SELECT * FROM aluno WHERE alu_nome ILIKE '@1%' AND alu_sexo = '@2'"; sql = sql.Replace("@1", alu.Nome); sql = sql.Replace("@2", "" + sexo); } bco.conecta(); bco.executeQuery(sql, out dt); bco.desconecta(); return dt; }
public Aluno getAlunoById(int aluCod) { Aluno alu = null; sql = "SELECT alu_id, alu_nome, ter_id, alu_sexo, alu_dtnasc FROM aluno WHERE alu_id = @1"; sql = sql.Replace("@1", ""+aluCod); bco.conecta(); bco.executeQuery(sql, out dt); bco.desconecta(); if (dt.Rows.Count > 0) { alu = new Aluno(); alu.Id = aluCod; alu.Nome = dt.Rows[0]["alu_nome"].ToString(); alu.TerId = dt.Rows[0]["ter_id"].ToString(); alu.Sexo = Convert.ToChar(dt.Rows[0]["alu_sexo"]); alu.DtNasc = dt.Rows[0]["alu_dtnasc"].ToString(); } return alu; }
public DataTable getAluno(Aluno alu) { sql = "SELECT * FROM aluno WHERE alu_id = @1"; sql = sql.Replace("@1", ""+alu.Id); bco.conecta(); bco.executeQuery(sql, out dt); bco.desconecta(); return dt; }