Ejemplo n.º 1
0
        public List <BolseiroDTO> ObterPorFiltro(BolseiroDTO dto)
        {
            List <BolseiroDTO> lista = new List <BolseiroDTO>();

            try
            {
                BaseDados.ComandText = "stp_ACA_ALUNO_BOLSA_OBTERPORFILTRO";

                BaseDados.AddParameter("@BOLSA", dto.Bolsa);

                MySqlDataReader dr = BaseDados.ExecuteReader();

                while (dr.Read())
                {
                    dto = new BolseiroDTO
                    {
                        Inicio = Convert.ToDateTime(dr["BOL_ALU_INICIO"].ToString()),
                        Aluno  = dr["ALUNO"].ToString()
                    };
                    dto.Adesao = dto.Inicio.ToShortDateString();
                    lista.Add(dto);
                }
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(lista);
        }
Ejemplo n.º 2
0
        public bool IsBolseiro(BolseiroDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_ALUNO_BOLSA_OBTERBOLSA";
                BaseDados.AddParameter("@ALUNO", dto.Aluno);

                MySqlDataReader dr = BaseDados.ExecuteReader();

                while (dr.Read())
                {
                    dto.Sucesso = true;
                    break;
                }
            }
            catch (Exception ex)
            {
                dto.MensagemErro = ex.Message;
                dto.Sucesso      = false;
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(dto.Sucesso);
        }
Ejemplo n.º 3
0
        public bool ConfirmarCriterio(BolseiroDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_ALUNO_BOLSA_CRITERIO";

                BaseDados.AddParameter("@ALUNO", dto.Aluno);
                BaseDados.AddParameter("@CRITERIO", dto.Estado);

                MySqlDataReader dr = BaseDados.ExecuteReader();

                while (dr.Read())
                {
                    if (dto.Estado == "ME" && int.Parse(dr["TIPO"].ToString()) > 1)
                    {
                        dto.Sucesso = true;
                    }
                    else if ((dto.Estado == "FN" || dto.Estado == "PF") && int.Parse(dr["TIPO"].ToString()) == 1)
                    {
                        dto.Sucesso = true;
                    }
                    else if (dto.Estado == "QM")
                    {
                        dto.Sucesso = true;
                    }
                    else if (dto.Estado == "OT")
                    {
                        dto.Sucesso = true;
                    }
                    else
                    {
                        dto.Sucesso = false;
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message;
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(dto.Sucesso);
        }
Ejemplo n.º 4
0
        public List <BolsaItemDTO> BolsaItem(BolseiroDTO dto)
        {
            List <BolsaItemDTO> lista = new List <BolsaItemDTO>();
            BolsaItemDTO        item;

            try
            {
                BaseDados.ComandText = "stp_ACA_BOLSA_ITEM_OBTERBOLSA";

                BaseDados.AddParameter("@ALUNO", dto.Aluno);
                BaseDados.AddParameter("@ANO", dto.AnoLectivo);

                MySqlDataReader dr = BaseDados.ExecuteReader();

                while (dr.Read())
                {
                    item                = new BolsaItemDTO();
                    item.Bolsa          = dr[0];
                    item.ItemCobranca   = dr[1];
                    item.Valor          = decimal.Parse(dr[2]);
                    item.Multa          = dr[3];
                    item.AnoLectivo     = int.Parse(dr[4]);
                    item.CategoryID     = int.Parse(dr[6]);
                    item.Sucesso        = dr[7] != "1" ? true : false;
                    item.ItemDesignacao = dr[8];
                    lista.Add(item);
                }
            }
            catch (Exception ex)
            {
                item = new BolsaItemDTO();
                item.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(lista);
        }
Ejemplo n.º 5
0
        public List <BolseiroDTO> Adicionar(BolseiroDTO dto)
        {
            List <BolseiroDTO> lista = new List <BolseiroDTO>();

            try
            {
                BaseDados.ComandText = "stp_ACA_ALUNO_BOLSA_ADICIONAR";

                BaseDados.AddParameter("@ALUNO", dto.Aluno);
                BaseDados.AddParameter("@BOLSA", dto.Bolsa);
                BaseDados.AddParameter("@INICIO", dto.Inicio);
                BaseDados.AddParameter("@TERMINO", dto.Estado);
                BaseDados.AddParameter("@UTILIZADOR", dto.Utilizador);

                MySqlDataReader dr = BaseDados.ExecuteReader();

                while (dr.Read())
                {
                    dto        = new BolseiroDTO();
                    dto.Inicio = Convert.ToDateTime(dr["BOL_ALU_INICIO"].ToString());
                    dto.Aluno  = dr["ALUNO"].ToString();
                    dto.Adesao = dto.Inicio.ToShortDateString();
                    lista.Add(dto);
                }
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
                lista            = ObterPorFiltro(dto);
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(lista);
        }