コード例 #1
0
        public ChatOnlineColecao ConsultarChatMensagemNova(int chatOn)
        {
            if (online.Conectar(EmpConexao))
            {
                online.AddParametrosMySql("@recebe", chatOn);
                DataTable dataTable = online.dataTableMySql("spConsultarChatMensagemNova");

                if (dataTable != null)
                {
                    ChatOnlineColecao colecao = new ChatOnlineColecao();
                    foreach (DataRow chat in dataTable.Rows)
                    {
                        ChatOnlineInfo chatInfo = new ChatOnlineInfo
                        {
                            chatid      = Convert.ToInt32(chat["quant"]),
                            chatmessage = Convert.ToString(chat["uselogin"]) + " (" + Convert.ToInt32(chat["quant"]) + ")",
                            chatidenvio = Convert.ToInt32(chat["chatidenvio"]),
                        };

                        colecao.Add(chatInfo);
                    }

                    return(colecao);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }