Exemplo n.º 1
0
        public Model.Chat selectRecentMessage(String myID, String otherID)
        {
            List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(selectMessage, otherID, myID));

            Model.Chat chat = new Model.Chat();
            if (sqlResult == null || sqlResult.Count < 1)
            {
                //如果没找到和这个人的聊天记录,说明这个人可能是该用户在首页点击的chat_id
                return(null);
            }
            else
            {
                return(Model.Chat.createChat(sqlResult[0]));
            }
        }
Exemplo n.º 2
0
        public String selectNewMessage(String myID, String otherID, DateTime lastTime)
        {
            List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(selectNew, myID, otherID, lastTime));

            Model.Chat chat = new Model.Chat();
            if (sqlResult == null || sqlResult.Count < 1)
            {
                //如果没找到和这个人的聊天记录,说明这个人可能是该用户在首页点击的chat_id
                return(null);
            }
            else
            {
                chat = Model.Chat.createChat(sqlResult[0]);
                return(chat.content);
            }
        }
Exemplo n.º 3
0
        public List <Model.Release> selectGoodsByGoodID(int goodsID)
        {
            List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(selectByID, goodsID));
            List <Model.Release> release = new List <Model.Release>();

            if (sqlResult == null || sqlResult.Count < 1)
            {
                return(release);
            }
            else
            {
                foreach (Dictionary <String, Object> dic in sqlResult)
                {
                    release.Add(Model.Release.createRelease(dic));
                }
                return(release);
            }
        }
Exemplo n.º 4
0
        public List <Model.Release> selectGoodsRandom()
        {
            List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(selectAll);
            List <Model.Release> release = new List <Model.Release>();

            if (sqlResult == null || sqlResult.Count < 1)
            {
                return(release);
            }
            else
            {
                foreach (Dictionary <String, Object> dic in sqlResult)
                {
                    release.Add(Model.Release.createRelease(dic));
                }
                return(release);
            }
        }
Exemplo n.º 5
0
        public List <Model.Chat> selectAllMessage(String myID, String otherID)
        {
            List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(selectAllMessages, myID, otherID, otherID, myID));
            List <Model.Chat> message = new List <Model.Chat>();

            if (sqlResult == null || sqlResult.Count < 1)
            {
                //如果没找到和这个人的聊天记录,说明这个人可能是该用户在首页点击的chat_id
                return(null);
            }
            else
            {
                foreach (Dictionary <String, Object> dic in sqlResult)
                {
                    message.Add(Model.Chat.createChat(dic));
                }
                return(message);
            }
        }
Exemplo n.º 6
0
        public List <Model.Release> selectGoodsByCategory(String Category)
        {
            String sql = String.Format(selectByCategory, Category);
            List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(sql);
            List <Model.Release> release = new List <Model.Release>();

            if (sqlResult == null || sqlResult.Count < 1)
            {
                return(release);
            }
            else
            {
                foreach (Dictionary <String, Object> dic in sqlResult)
                {
                    release.Add(Model.Release.createRelease(dic));
                }
                return(release);
            }
        }