Example #1
0
 public Desejo()
 {
     IdDesejo = -1;
     Usuario = null;
     Departamento = null;
     DescricaoCurta = "";
     DescricaoLonga = "";
     LocalBusca = null;
     LocalEntrega = null;
     DataAnuncio = DateTime.MinValue;
     HasPropostaSelecionada = -1;
     NumPropostas = 0;
     IdPropostaAceita = -1;
     IsDeleted = 0;//para setar a busca inicialmente para considerar somente desejos não deletados
     Avaliacao = 0;
 }      
Example #2
0
        }//populateDesejo()

        private static Departamento populateDepartamento(SqlDataReader dr)
        {
            Departamento departamentoReturn = new Departamento();

            departamentoReturn.Id = System.Convert.ToInt32(dr["id_departamento"]);

            if (dr.IsDBNull(dr.GetOrdinal("id_depto_pai")))
            {
                departamentoReturn.IdPai = -1;
            }
            else
            {
                departamentoReturn.IdPai = System.Convert.ToInt32(dr["id_depto_pai"]);
            }

            departamentoReturn.Nome = System.Convert.ToString(dr["nome_departamento"]);

            return departamentoReturn;
        }//populateDepartamento()
Example #3
0
        }//queryDesejo()

        public static ArrayList queryDepartamento(Departamento departamentoBusca, LIqueryParameters paramsBusca)
        {
            ArrayList alReturn = null;
            SqlDataReader dr = null;
            SqlConnection conn = null;
            SqlCommand cmd = null;
            bool bWhere = false;

            String strSql = "SELECT * from Departamento";

            if (departamentoBusca.Id >= 0)
            {
                if (bWhere)
                {
                    strSql += " AND ";
                }
                else
                {
                    strSql += " WHERE ";
                    bWhere = true;
                }
                strSql += "id_departamento = " + departamentoBusca.Id.ToString();
            }

            if (departamentoBusca.IdPai >= 0)
            {
                if (bWhere)
                {
                    strSql += " AND ";
                }
                else
                {
                    strSql += " WHERE ";
                    bWhere = true;
                }
                strSql += "id_depto_pai = " + departamentoBusca.IdPai.ToString();
            }

            if (departamentoBusca.Nome != "")
            {
                if (bWhere)
                {
                    strSql += " AND ";
                }
                else
                {
                    strSql += " WHERE ";
                    bWhere = true;
                }
                strSql += "nome_departamento LIKE '%" + departamentoBusca.Nome + "%'";
            }

            try
            {
                conn = new SqlConnection(ConnString);
                conn.Open();
                cmd = conn.CreateCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = strSql;
                dr = cmd.ExecuteReader();
                alReturn = new ArrayList();
                while (dr.Read())
                {
                    alReturn.Add(populateDepartamento(dr));
                }//while
                return alReturn;
            }
            catch
            {
                return new ArrayList();
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                if (conn != null)
                {
                    conn.Close();
                }
            }
        }//queryDepartamento()