Exemple #1
0
        public UnidadeCurricularDTO AddPrecedente(UnidadeCurricularDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_DISCIPLINA_PLANO_ADDPRECEDENTE";


                BaseDados.AddParameter("@DISCIPLINA_ID", dto.Codigo);

                BaseDados.AddParameter("@PRECEDENTE_ID", dto.PrecedenteID <= 0 ? (object)DBNull.Value : dto.PrecedenteID);
                BaseDados.ExecuteNonQuery();
                dto.Sucesso = true;
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(dto);
        }
Exemple #2
0
        public List <HorarioDTO> ObterPorFiltro(HorarioDTO dto)
        {
            List <HorarioDTO> lista = new List <HorarioDTO>();

            try
            {
                BaseDados.ComandText = "stp_ACA_HORARIO_OBTERPORFILTRO";


                BaseDados.AddParameter("@HORA", -1);
                BaseDados.AddParameter("@TURMA", dto.HorTurma.Codigo);
                BaseDados.AddParameter("@CURSO", dto.HorTurma.Curso);
                BaseDados.AddParameter("@PERIODO", dto.HorPeriodo);
                BaseDados.AddParameter("@ANO", dto.HorAnoLectivo.AnoCodigo);
                BaseDados.AddParameter("@FILIAL", dto.Filial);

                MySqlDataReader dr = BaseDados.ExecuteReader();

                while (dr.Read())
                {
                    dto = new HorarioDTO();

                    dto.HorInicio  = int.Parse(dr["HOR_INICIO"].ToString());
                    dto.HorTermino = int.Parse(dr["HOR_TERMINO"].ToString());

                    TurmaDTO dtoTurma = new TurmaDTO();
                    dtoTurma.Codigo = int.Parse(dr["HOR_CODIGO_TURMA"].ToString());
                    dtoTurma.Sigla  = dr["TURMA"].ToString();
                    dtoTurma.Turno  = dr["TUR_TURNO"].ToString();
                    dtoTurma.Classe = int.Parse(dr["PLAN_CODIGO"].ToString());
                    dto.HorTurma    = dtoTurma;
                    UnidadeCurricularDTO dtoDisciplina = new UnidadeCurricularDTO();

                    dtoDisciplina.Conteudo        = dr["COOR_DESCRICAO"].ToString();
                    dtoDisciplina.PlanoCurricular = new AnoCurricularDTO(int.Parse(dr["PLAN_CODIGO"].ToString()), new RamoDTO(int.Parse(dr["CUR_CODIGO"].ToString()), dr["CUR_ESPECIFICACAO"].ToString(), null, "", 0, 0, 1, ""),
                                                                         -1, dr["ANO_CURRICULAR"].ToString(), dr["CURSO"].ToString());
                    dto.HorDisiciplina = dtoDisciplina;
                    dto.SegundaFeira   = dr["HOR_SEGUNDA"].ToString();
                    dto.TercaFeira     = dr["HOR_TERCA"].ToString();
                    dto.QuartaFeira    = dr["HOR_QUARTA"].ToString();
                    dto.QuintaFeira    = dr["HOR_QUINTA"].ToString();
                    dto.SextaFeira     = dr["HOR_SEXTA"].ToString();
                    dto.Sabado         = dr["HOR_SABADO"].ToString();
                    dto.Horario        = HorarioAula(dto.HorInicio, dto.HorTermino);
                    lista.Add(dto);
                }
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(lista);
        }
Exemple #3
0
        public UnidadeCurricularDTO Inserir(UnidadeCurricularDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_DISCIPLINA_PLANO_ADICIONAR";

                BaseDados.AddParameter("@PLANO", dto.PlanoCurricular.Codigo);

                BaseDados.AddParameter("@DISCIPLINA", dto.Disciplina.Codigo);
                BaseDados.AddParameter("@TIPO", dto.Tipo);

                /*
                 * if (dto.Tipo.Equals("1"))
                 * {
                 *  BaseDados.AddParameter("@PERIODO", 0);
                 * }
                 * else
                 * {
                 *
                 * }*/
                BaseDados.AddParameter("@PERIODO", dto.PeriodoLectivo.Codigo);
                BaseDados.AddParameter("@CLASSIFICACAO", dto.Classificacao);
                BaseDados.AddParameter("@CARGA", dto.CargaHoraria);
                BaseDados.AddParameter("@CONTEUDO", dto.Conteudo);
                BaseDados.AddParameter("@ESTADO", dto.Status);
                BaseDados.AddParameter("@ANO", dto.AnoLectivo);
                BaseDados.AddParameter("@TURNO", dto.Turma);
                dto.Codigo  = BaseDados.ExecuteInsert();
                dto.Sucesso = true;
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(dto);
        }
Exemple #4
0
        public void Apagar(UnidadeCurricularDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_DISCIPLINA_PLANO_EXCLUIR";


                BaseDados.AddParameter("@CODIGO", dto.Codigo);
                BaseDados.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }
        }
Exemple #5
0
        public List <UnidadeCurricularDTO> ObterMinhaDisciplinas(DocenteDTO dto)
        {
            List <UnidadeCurricularDTO> lista = new List <UnidadeCurricularDTO>();

            try
            {
                BaseDados.ComandText = "stp_ACA_DOCENTE_OBTERMINHASDISCIPLINAS";

                BaseDados.AddParameter("DOCENTE", dto.Codigo);
                BaseDados.AddParameter("PERIODO", dto.AnoCurricular);
                BaseDados.AddParameter("TURMA", dto.Turma);


                MySqlDataReader dr = BaseDados.ExecuteReader();

                while (dr.Read())
                {
                    UnidadeCurricularDTO objUnidadeCurricular = new UnidadeCurricularDTO();

                    objUnidadeCurricular.Codigo         = int.Parse(dr[0]);
                    objUnidadeCurricular.NomeDisciplina = dr[1];

                    lista.Add(objUnidadeCurricular);
                }
            }
            catch (Exception ex)
            {
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            lista.Insert(0, new UnidadeCurricularDTO(-1, "SELECCIONE"));

            return(lista);
        }
Exemple #6
0
        public UnidadeCurricularDTO Alterar(UnidadeCurricularDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_DISCIPLINA_PLANO_ALTERAR";



                BaseDados.AddParameter("@PLANO", dto.PlanoCurricular.Codigo);

                BaseDados.AddParameter("@DISCIPLINA", dto.Disciplina.Codigo);
                BaseDados.AddParameter("@TIPO", dto.Tipo);

                BaseDados.AddParameter("@PERIODO", dto.PeriodoLectivo.Codigo);
                BaseDados.AddParameter("@CLASSIFICACAO", dto.Classificacao);
                BaseDados.AddParameter("@CARGA", dto.CargaHoraria);
                BaseDados.AddParameter("@CONTEUDO", dto.Conteudo);
                BaseDados.AddParameter("@ESTADO", dto.Status);
                BaseDados.AddParameter("@CODIGO", dto.Codigo);
                BaseDados.AddParameter("@UNIDADE", dto.Disciplina.Descricao.ToUpper());
                BaseDados.AddParameter("@SIGLA", dto.Disciplina.Sigla);
                BaseDados.AddParameter("@TURNO", dto.Turma);

                BaseDados.ExecuteNonQuery();
                dto.Sucesso = true;
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(dto);
        }
Exemple #7
0
        public UnidadeCurricularDTO AddOtherInfo(UnidadeCurricularDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_DISCIPLINA_PLANO_ADDOTHERINFO";

                BaseDados.AddParameter("@CLASSIFICACAO", dto.Classificacao);
                BaseDados.AddParameter("@CARGA", dto.CargaHoraria);
                BaseDados.AddParameter("@CODIGO", dto.Codigo);
                BaseDados.AddParameter("@ORDEM", dto.Ordem);
                BaseDados.AddParameter("@UNIDADE", dto.DocumentDesignation);
                BaseDados.AddParameter("@PROVA_GLOBAL", dto.AllowPG == true ? 1 : 0);
                BaseDados.AddParameter("@EXAME", dto.AllowEX == true ? 1 : 0);
                BaseDados.AddParameter("@RECURSO", dto.AllowRC == true ? 1 : 0);
                BaseDados.AddParameter("@PERIODO_ID", dto.PeriodoLectivo.Codigo <= 0 ? (object)DBNull.Value : dto.PeriodoLectivo.Codigo);
                BaseDados.AddParameter("@NIVEL", dto.NivelEnsino);
                BaseDados.AddParameter("@TEORIA", dto.CargaTeorica);
                BaseDados.AddParameter("@PRATICA", dto.CargaTeoriaPratica);
                BaseDados.AddParameter("@TRABALHOS", dto.PraticaLaboratorial);
                BaseDados.AddParameter("@CARGA_PERIODO", dto.CargaHorariaPeriodo);
                BaseDados.AddParameter("@NOME", dto.NomeDisciplina);
                BaseDados.AddParameter("@PROCEDENTE", dto.PrecedenteID <= 0 ? (object)DBNull.Value : dto.PrecedenteID);
                BaseDados.AddParameter("FAMILIA", string.Empty);
                BaseDados.ExecuteNonQuery();
                dto.Sucesso = true;
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(dto);
        }
Exemple #8
0
        public List <HorarioDTO> ObterPorDocente(HorarioDTO dto)
        {
            BaseDados.ComandText = "stp_ACA_HORARIO_DOCENTE_OBTERPORFILTRO";


            BaseDados.AddParameter("@DOCENTE", dto.HorDocente.Codigo);
            BaseDados.AddParameter("@DIA", dto.HorDiaSemana);
            BaseDados.AddParameter("@DISCIPLINA", dto.HorDisiciplina.Codigo);
            BaseDados.AddParameter("@HORA", dto.HorInicio);
            BaseDados.AddParameter("@TURMA", dto.HorTurma.Codigo);
            BaseDados.AddParameter("@ANO", dto.HorAnoLectivo.AnoCodigo);
            BaseDados.AddParameter("@CURSO", dto.HorDisiciplina.PlanoCurricular.Ramo.RamCodigo);
            BaseDados.AddParameter("PERIODO", dto.HorPeriodo);

            List <HorarioDTO> lista = new List <HorarioDTO>();

            try
            {
                MySqlDataReader dr = BaseDados.ExecuteReader();

                while (dr.Read())
                {
                    dto = new HorarioDTO();

                    dto.HorCodigo    = Int32.Parse(dr["HOR_CODIGO"].ToString());
                    dto.HorDocente   = new DocenteDTO(dr["HOR_CODIGO_DOCENTE"].ToString(), dr["NOME_DOCENTE"].ToString());
                    dto.HorDiaSemana = Int32.Parse(dr["HOR_DIA_SEMANA"].ToString());
                    dto.HorInicio    = int.Parse(dr["HOR_INICIO"].ToString());
                    //dto.HorRegime = dr["HOR_REGIME"].ToString();
                    dto.HorTermino = int.Parse(dr["HOR_TERMINO"].ToString());

                    TurmaDTO dtoTurma = new TurmaDTO();
                    dtoTurma.Codigo = int.Parse(dr["HOR_TURMA"].ToString());
                    dtoTurma.Sigla  = dr["TURMA"].ToString();
                    dtoTurma.Turno  = dr["TUR_TURNO"].ToString();
                    dto.HorTurma    = dtoTurma;//daoTurma.ObterPorPK(dtoTurma);
                    UnidadeCurricularDTO dtoDisciplina = new UnidadeCurricularDTO();
                    dtoDisciplina.NomeDisciplina  = dr["DISCIPLINA"].ToString();
                    dtoDisciplina.Tipo            = dr["DIS_SIGLA"].ToString();
                    dtoDisciplina.Conteudo        = dr["COOR_DESCRICAO"].ToString();
                    dtoDisciplina.Codigo          = int.Parse(dr["HOR_DISCIPLINA"].ToString());
                    dtoDisciplina.PlanoCurricular = new AnoCurricularDTO(int.Parse(dr["PLAN_CODIGO"].ToString()), new RamoDTO(int.Parse(dr["CUR_CODIGO"].ToString()), dr["CUR_ESPECIFICACAO"].ToString(), null, "", 0, 0, 1, ""),
                                                                         -1, dr["ANO_CURRICULAR"].ToString(), dr["CURSO"].ToString());
                    dto.HorDisiciplina = dtoDisciplina;//new DisciplinaPlanoDAO().ObterPorPK(new DisciplinaPlanoDTO(int.Parse(dr["HOR_DISCIPLINA"].ToString())));
                    dto.HorAnoLectivo  = new AnoLectivoDTO(dr["ANO_ANO_LECTIVO"].ToString());
                    if (!lista.Exists(t => t.HorDiaSemana == dto.HorDiaSemana && t.HorDocente.Codigo == dto.HorDocente.Codigo && t.HorInicio == dto.HorInicio))
                    {
                        lista.Add(dto);
                    }
                }
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(lista);
        }
Exemple #9
0
        public List <UnidadeCurricularDTO> ObterPorFiltro(UnidadeCurricularDTO dto)
        {
            List <UnidadeCurricularDTO> lista;

            try
            {
                BaseDados.ComandText = "stp_ACA_DISCIPLINA_PLANO_OBTERPORFILTRO";


                BaseDados.AddParameter("@ANO", dto.AnoLectivo);
                BaseDados.AddParameter("@PERIODO", dto.PeriodoLectivo.Codigo);
                BaseDados.AddParameter("@CURSO", dto.PlanoCurricular.Ramo.RamCurso.Codigo);
                BaseDados.AddParameter("@RAMO", dto.PlanoCurricular.Ramo.RamCodigo);
                BaseDados.AddParameter("@CLASSE", dto.PlanoCurricular.AnoCurricular);
                BaseDados.AddParameter("@PLANO", dto.PlanoCurricular.Codigo);

                MySqlDataReader dr = BaseDados.ExecuteReader();
                lista = new List <UnidadeCurricularDTO>();

                while (dr.Read())
                {
                    dto = new UnidadeCurricularDTO();

                    dto.Codigo = Int32.Parse(dr["DIS_PLAN_CODIGO"].ToString());

                    AnoCurricularDTO dtoPlano = new AnoCurricularDTO();
                    dtoPlano.Codigo    = Int32.Parse(dr["DIS_PLAN_CODIGO_PLANO"].ToString());
                    dtoPlano.Descricao = dr["PLAN_DESCRICAO"].ToString();
                    dtoPlano.Ramo      = new RamoDTO(int.Parse(dr["CUR_CODIGO"].ToString()), dr["CUR_NOME"].ToString(), null, dr["CUR_ABREVIATURA"].ToString(), 0, 0, 1, dr["CUR_AREA_FORMACAO"].ToString());

                    if (!dr["DIS_PLAN_CODIGO_PERIODO"].ToString().Equals("0"))
                    {
                        dto.PeriodoLectivo = new PeriodoLectivoDTO(int.Parse(dr["DIS_PLAN_CODIGO_PERIODO"].ToString()), dr["PER_DESCRICAO"].ToString(), -1, 1);
                    }
                    else
                    {
                        dto.PeriodoLectivo = new PeriodoLectivoDTO(0, "ANUAL", -1, 1);
                    }


                    dto.PlanoCurricular = dtoPlano;
                    dto.Disciplina      = new DisciplinaDTO(int.Parse(dr["DIS_PLAN_CODIGO_DISCIPLINA"].ToString()), dr["DIS_DESCRICAO"].ToString(), dr["DIS_SIGLA"].ToString());

                    dto.CargaHoraria  = Int32.Parse(dr["DIS_PLAN_CARGA_HORARIA"].ToString());
                    dto.Classificacao = dr["DIS_PLAN_NIVEL"].ToString();


                    dto.Tipo                = dr["DIS_PLAN_TIPO"].ToString();
                    dto.Conteudo            = dr["DIS_PLAN_CONTEUDO_PROGRAMATICO"].ToString();
                    dto.Status              = int.Parse(dr["DIS_PLAN_STATUS"].ToString());
                    dto.Creditos            = dr["DIS_PLAN_CREDITO"].ToString();
                    dto.NomeDisciplina      = dto.Disciplina.Sigla.ToUpper() + " - " + dto.Disciplina.Descricao.ToUpper() + " (" + dto.PeriodoLectivo.Descricao + ")";
                    dto.AnoLectivo          = int.Parse(dr["ANO_ANO_LECTIVO"].ToString());
                    dto.NivelEnsino         = dr["CUR_FORMACAO"].ToString();
                    dto.Turma               = dr["DIS_PLAN_TURNO"].ToString();
                    dto.AllowEX             = dr["DIS_PLAN_EXAME"].ToString() == "1" ? true : false;
                    dto.AllowPG             = dr["DIS_PLAN_PROVA_GLOBAL"].ToString() == "1" ? true : false;
                    dto.AllowRC             = dr["DIS_PLAN_RECURSO"].ToString() == "1" ? true : false;
                    dto.NomeDisciplina      = dr["DIS_DESCRICAO"].ToString();
                    dto.DocumentDesignation = dr["DIS_PLAN_DESIGNACAO"].ToString() != string.Empty ? dr["DIS_PLAN_DESIGNACAO"].ToString() : dto.Disciplina.Sigla;
                    dto.Ordem               = int.Parse(dr["DIS_PLAN_ORDEM"].ToString() ?? "1");
                    dto.CargaTeorica        = int.Parse(dr["DIS_PLAN_TEORIA"].ToString() ?? "0");
                    dto.CargaTeoriaPratica  = int.Parse(dr["DIS_PLAN_TEORIA_PRATICA"].ToString() ?? "0");
                    dto.PraticaLaboratorial = int.Parse(dr["DIS_PLAN_NRO_TRABALHOS"].ToString() ?? "0");
                    dto.Nivel               = dr["DIS_PLAN_NIVEL"].ToString();
                    dto.CargaHorariaPeriodo = int.Parse(dr["DIS_PLAN_HORAS_SEMESTRAL"].ToString() ?? "0");
                    dto.PrecedenteID        = int.Parse(dr["DIS_PLAN_PROCEDENTE"].ToString() ?? "-1");
                    dto.AnoCivil            = int.Parse(dr["DIS_PLAN_ANO_LECTIVO"].ToString());
                    lista.Add(dto);
                }
            }
            catch (Exception ex)
            {
                dto                = new UnidadeCurricularDTO();
                dto.Sucesso        = false;
                dto.MensagemErro   = ex.Message.Replace("'", "");
                dto.NomeDisciplina = dto.MensagemErro;
                lista              = new List <UnidadeCurricularDTO>();
                lista.Add(dto);
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(lista);
        }
Exemple #10
0
        public UnidadeCurricularDTO ObterPorPK(UnidadeCurricularDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_DISCIPLINA_PLANO_OBTERPORPK";


                BaseDados.AddParameter("@CODIGO", dto.Codigo);
                if (dto.Disciplina != null)
                {
                    BaseDados.AddParameter("@DISCIPLINA", dto.Disciplina.Codigo);
                }
                else
                {
                    BaseDados.AddParameter("@DISCIPLINA", -1);
                }

                if (dto.PlanoCurricular != null)
                {
                    BaseDados.AddParameter("@PLANO", dto.PlanoCurricular.Codigo);
                }
                else
                {
                    BaseDados.AddParameter("@PLANO", -1);
                }

                if (dto.PeriodoLectivo != null)
                {
                    BaseDados.AddParameter("@PERIODO", dto.PeriodoLectivo.Codigo);
                }
                else
                {
                    BaseDados.AddParameter("@PERIODO", -1);
                }


                MySqlDataReader dr = BaseDados.ExecuteReader();
                dto = new UnidadeCurricularDTO();

                while (dr.Read())
                {
                    dto.Codigo = Int32.Parse(dr["DIS_PLAN_CODIGO"].ToString());



                    dto.PeriodoLectivo  = new PeriodoLectivoDTO(Int32.Parse(dr["DIS_PLAN_CODIGO_PERIODO"].ToString()), dr["DIS_PLAN_CODIGO_PERIODO"].ToString(), -1, 1);
                    dto.PlanoCurricular = new AnoCurricularDTO(Int32.Parse(dr["DIS_PLAN_CODIGO_PLANO"].ToString()), dr["PLAN_DESCRICAO"].ToString());
                    dto.Disciplina      = new DisciplinaDTO(Int32.Parse(dr["DIS_PLAN_CODIGO_DISCIPLINA"].ToString()), dr["DIS_DESCRICAO"].ToString(), dr["DIS_SIGLA"].ToString());

                    dto.CargaHoraria  = Int32.Parse(dr["DIS_PLAN_CARGA_HORARIA"].ToString());
                    dto.Classificacao = dr["DIS_PLAN_NIVEL"].ToString();


                    dto.Tipo     = dr["DIS_PLAN_TIPO"].ToString();
                    dto.Conteudo = dr["DIS_PLAN_CONTEUDO_PROGRAMATICO"].ToString();
                    dto.Status   = int.Parse(dr["DIS_PLAN_STATUS"].ToString());
                    if (!dto.Classificacao.Equals("-1"))
                    {
                        dto.NomeDisciplina = dto.Disciplina.Descricao.ToUpper() + " " + dto.Classificacao;
                    }
                    else
                    {
                        dto.NomeDisciplina = dto.Disciplina.Descricao.ToUpper();
                    }
                    dto.Turma    = dr["DIS_PLAN_TURNO"].ToString();
                    dto.Creditos = dr["DIS_PLAN_CREDITO"].ToString();
                }
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(dto);
        }