Beispiel #1
0
        public string retornaCabecalho(string login, string tipo)
        {
            try
            {
                string xml = null;
                string sql = "select id, assunto, data, tamanho, logremdest, lida from mensagem where tipo = '" + tipo + "' and loginusuario = '" + login + "';";

                List <mensagemCabecalho> listaCabecalho = new List <mensagemCabecalho>();

                DataTable data = retornaDataTableSql(sql);
                int       i;

                for (i = 0; i < data.Rows.Count; i++)
                {
                    int      codigo     = Convert.ToInt32(data.Rows[i][data.Columns[0]]);
                    string   assunto    = data.Rows[i][data.Columns[1]].ToString();
                    DateTime date       = Convert.ToDateTime(data.Rows[i][data.Columns[2]]);
                    int      tamanho    = Convert.ToInt32(data.Rows[i][data.Columns[3]]);
                    string   logremdest = data.Rows[i][data.Columns[4]].ToString();
                    bool     lida       = Convert.ToBoolean(data.Rows[i][data.Columns[5]]);

                    mensagemCabecalho cabeca = new mensagemCabecalho(codigo, date, assunto, tipo, lida, tamanho, logremdest);

                    listaCabecalho.Add(cabeca);
                }

                if (listaCabecalho.Count > 0)
                {
                    xml = serial.serializarObjeto(listaCabecalho);
                }

                return(xml);
            }
            catch (excecao.excecao except)
            {
                throw except;
            }
        }
Beispiel #2
0
        ///<summary>
        ///
        /// Metodo para carregar a list view através do parametro passado
        ///
        ///</summary>
        private void carregaLista(string tipo)
        {
            mensagensGridView.Columns[0].HeaderText = tipo;
            mensagensGridView.Columns[0].Name       = tipo.ToLower();

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

            if (tipo.Equals(remete))
            {
                lista = listaEntrada;
            }
            else if (tipo.Equals(destino))
            {
                lista = listaEnviados;
            }

            if (lista != null)
            {
                mensagensGridView.Rows.Clear();
                mensagensGridView.Rows.Add(lista.Count());

                for (int i = 0; i < lista.Count(); i++)
                {
                    mensagemCabecalho item = lista[i];
                    mensagensGridView.Rows[i].Cells[0].Value = item.getLogremdest();
                    mensagensGridView.Rows[i].Cells[1].Value = item.getAssunto();
                    mensagensGridView.Rows[i].Cells[2].Value = item.getData();
                    mensagensGridView.Rows[i].Cells[3].Value = item.getTamanho();
                    mensagensGridView.Rows[i].Cells[4].Value = item.getCodigo();
                }
            }
            else if (lista == null)
            {
                mensagensGridView.Rows.Clear();
            }
        }
Beispiel #3
0
        public string retornaCabecalho(string login, string tipo)
        {
            try
            {
                string xml = null;
                string sql = "select id, assunto, data, tamanho, logremdest, lida from mensagem where tipo = '" + tipo + "' and loginusuario = '" + login + "';";

                List<mensagemCabecalho> listaCabecalho = new List<mensagemCabecalho>();

                DataTable data = retornaDataTableSql(sql);
                int i;

                    for (i = 0; i < data.Rows.Count; i++)
                    {
                        int codigo = Convert.ToInt32(data.Rows[i][data.Columns[0]]);
                        string assunto = data.Rows[i][data.Columns[1]].ToString();
                        DateTime date = Convert.ToDateTime(data.Rows[i][data.Columns[2]]);
                        int tamanho = Convert.ToInt32(data.Rows[i][data.Columns[3]]);
                        string logremdest = data.Rows[i][data.Columns[4]].ToString();
                        bool lida = Convert.ToBoolean(data.Rows[i][data.Columns[5]]);

                        mensagemCabecalho cabeca = new mensagemCabecalho(codigo, date, assunto, tipo, lida, tamanho, logremdest);

                        listaCabecalho.Add(cabeca);
                    }

                    if (listaCabecalho.Count > 0) xml = serial.serializarObjeto(listaCabecalho);

                    return xml;

            }
            catch (excecao.excecao except)
            {
                throw except;
            }
        }