Пример #1
0
 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();
 }
Пример #2
0
 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();
 }
Пример #3
0
        public bool nova(String avaId)
        {
            Avaliacao ava;

            String lastId = "";
            bco.conecta();
            bco.beginTransaction();
            ava = new Avaliacao();
            sql = "UPDATE avaliacao SET ava_dtrealiz = '@1' WHERE ava_id = @2";
            sql = sql.Replace("@1", DateTime.Now.ToString());
            sql = sql.Replace("@2", avaId);
            result = bco.executeNonQuery(sql);
            if (result)
            {
                sql = "INSERT INTO anamnese (prob_card, prob_orto, prob_neuro, prob_gastro, prob_resp, " +
                "prob_desc, fumante, fumante_ex, diabetico, diabete_familia, gestante, " +
                "alergia, tontura, vertigem, osteoporose, hipertenso, bebida, " +
                "infarto_familia, medicamento, cirurgia, dores, estado_geral, " +
                "refeicoes, atividade_fisica, partes_corpo, objetivo) " +
                "VALUES ('', '', '', '', '', " +
                "'', '', '', '', '', '', " +
                "'', '', '', '', '', '', " +
                "'', '', '', '', '', " +
                "'', '', '', '')";
                result = bco.executeNonQuery(sql);
            }
            if (result)
            {
                lastId = getLastId();
                sql = "UPDATE avaliacao SET ana_id = @1 WHERE ava_id = @2";
                sql = sql.Replace("@1", lastId);
                sql = sql.Replace("@2", avaId);
                result = bco.executeNonQuery(sql);
            }
            try
            {
                bco.commitTransaction();
            }
            catch
            {
                bco.rollbackTransaction();
            }
            bco.desconecta();

            return result;
        }
Пример #4
0
        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
            {

            }
        }
Пример #5
0
        public DataTable getAgendaAvaliacoes(Avaliacao ava, String status, String dtIni, String dtFim, bool ligaData, bool msmDia)
        {
            String select, from;
            String where = "";
            select = "SELECT av.ava_id, av.ava_dtagend, av.ava_dtrealiz, f.func_nome, a.alu_nome";
            from = " FROM avaliacao as av INNER JOIN funcionario as f ON av.func_id = f.func_id " +
                "INNER JOIN aluno as a ON av.alu_id = a.alu_id";

            if (ava.FuncId != "")
            {
                where += " WHERE av.func_id = " + ava.FuncId;
                if (ava.AluId != "")
                {
                    where += " AND av.alu_id = " + ava.AluId;
                    if (status != "Todas")
                    {
                        if (status.Equals("Realizadas"))
                            where += " AND av.ava_dtrealiz is not null";
                        if (status.Equals("Não realizadas"))
                            where += " AND av.ava_dtrealiz is null";
                        if (status.Equals("Em atraso"))
                            where += " AND av.ava_dtrealiz is null AND av.ava_dtagend < '" + DateTime.Today + "'";
                        if (ligaData)
                            where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend <= '" + dtFim + "'";
                    }
                    else
                        if (ligaData)
                        {
                            if(msmDia)
                                where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend < '" + DateTime.Parse(dtIni).AddDays(1) + "'";
                            else
                                where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend <= '" + dtFim + "'";
                        }
                }
                else
                {
                    if (status != "Todas")
                    {
                        if (status.Equals("Realizadas"))
                            where += " AND av.ava_dtrealiz is not null";
                        if (status.Equals("Não realizadas"))
                            where += " AND av.ava_dtrealiz is null";
                        if (status.Equals("Em atraso"))
                            where += " AND av.ava_dtrealiz is null AND av.ava_dtagend < '" + DateTime.Today + "'";
                        if (ligaData)
                        {
                            if (msmDia)
                                where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend < '" + DateTime.Parse(dtIni).AddDays(1) + "'";
                            else
                                where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend <= '" + dtFim + "'";
                        }
                    }
                    else
                        if (ligaData)
                        {
                            if (msmDia)
                                where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend < '" + DateTime.Parse(dtIni).AddDays(1) + "'";
                            else
                                where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend <= '" + dtFim + "'";
                        }
                }
            }
            else
            {
                if (ava.AluId != "")
                {
                    where += " WHERE av.alu_id = " + ava.AluId;
                    if (status != "Todas")
                    {
                        if (status.Equals("Realizadas"))
                            where += " AND av.ava_dtrealiz is not null";
                        if (status.Equals("Não realizadas"))
                            where += " AND av.ava_dtrealiz is null";
                        if (status.Equals("Em atraso"))
                            where += " AND av.ava_dtrealiz is null AND av.ava_dtagend < '" + DateTime.Today + "'";
                        if (ligaData)
                            where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend <= '" + dtFim + "'";
                    }
                    else
                        if (ligaData)
                        {
                            if (msmDia)
                                where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend < '" + DateTime.Parse(dtIni).AddDays(1) + "'";
                            else
                                where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend <= '" + dtFim + "'";
                        }
                }
                else
                {
                    if (status != "Todas")
                    {
                        where += " WHERE ";
                        if (status.Equals("Realizadas"))
                            where += " av.ava_dtrealiz is not null";
                        if (status.Equals("Não realizadas"))
                            where += " av.ava_dtrealiz is null";
                        if (status.Equals("Em atraso"))
                            where += " av.ava_dtrealiz is null AND av.ava_dtagend < '" + DateTime.Today + "'";
                        if (ligaData)
                        {
                            if (msmDia)
                                where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend < '" + DateTime.Parse(dtIni).AddDays(1) + "'";
                            else
                                where += " AND av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend <= '" + dtFim + "'";
                        }
                    }
                    else
                        if (ligaData)
                        {
                            where += " WHERE ";
                            if (msmDia)
                                where += " av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend < '" + DateTime.Parse(dtIni).AddDays(1) + "'";
                            else
                                where += " av.ava_dtagend >= '" + dtIni + "'" + " AND av.ava_dtagend <= '" + dtFim + "'";
                        }
                }
            }

            sql = select + from + where;
            bco.conecta();
            bco.executeQuery(sql, out dt);
            bco.desconecta();
            return dt;
        }
Пример #6
0
 public bool novoAgendamento(Avaliacao ava)
 {
     sql = "INSERT INTO avaliacao(alu_id, func_id, ava_dtagend) "+
         "VALUES ('@1', '@2', '@3')";
     sql = sql.Replace("@1", ava.AluId);
     sql = sql.Replace("@2", ava.FuncId);
     sql = sql.Replace("@3", ava.DtAgen);
     bco.conecta();
     result = bco.executeNonQuery(sql);
     bco.desconecta();
     return result;
 }
Пример #7
0
 public Avaliacao getById(String id)
 {
     Avaliacao ava = new Avaliacao();
     sql = "SELECT * FROM avaliacao WHERE ava_id = @1";
     sql = sql.Replace("@1", id);
     bco.conecta();
     bco.executeQuery(sql, out dt);
     bco.desconecta();
     if (dt.Rows.Count > 0)
     {
         ava.Id = id;
         ava.AluId = dt.Rows[0]["alu_id"].ToString();
         ava.FuncId = dt.Rows[0]["func_id"].ToString();
         ava.AnaId = dt.Rows[0]["ana_id"].ToString();
         ava.DtAgen = dt.Rows[0]["ava_dtagend"].ToString();
         ava.DtRealizada = dt.Rows[0]["ava_dtrealiz"].ToString();
         ava.PerId = dt.Rows[0]["per_id"].ToString();
         ava.CompId = dt.Rows[0]["comp_id"].ToString();
         ava.NeuroId = dt.Rows[0]["neuro_id"].ToString();
     }
     return ava;
 }