예제 #1
0
        private List <Image> GetImage()
        {
            List <Image> tmpList = new List <Image>();

            try
            {
                MysqlConnent mysqlConnent = new MysqlConnent();

                int count = mysqlConnent.MySqlReadCount("SELECT COUNT(*) FROM 图片表 WHERE IsCheck = '0' AND IsPublic = '1'");
                Debug.WriteLine(count);
                List <string> account    = new List <string>();
                List <string> imageName  = new List <string>();
                List <string> introduce  = new List <string>();
                List <string> uploadTime = new List <string>();
                account    = mysqlConnent.MySqlRead("SELECT * FROM 图片表 WHERE IsCheck = '0' AND IsPublic = '1' ORDER BY uploadtime DESC", "account");
                imageName  = mysqlConnent.MySqlRead("SELECT * FROM 图片表 WHERE IsCheck = '0' AND IsPublic = '1' ORDER BY uploadtime DESC", "imageName");
                introduce  = mysqlConnent.MySqlRead("SELECT * FROM 图片表 WHERE IsCheck = '0' AND IsPublic = '1' ORDER BY uploadtime DESC", "introduce");
                uploadTime = mysqlConnent.MySqlRead("SELECT * FROM 图片表 WHERE IsCheck = '0' AND IsPublic = '1' ORDER BY uploadtime DESC", "uploadTime");
                for (int i = 0; i < count; i++)
                {
                    Image tmp = new Image();
                    tmp.account    = account[i];
                    tmp.imageName  = imageName[i];
                    tmp.introduce  = introduce[i];
                    tmp.uploadTime = uploadTime[i];
                    tmp.imagePath  = "C:/Users/Administrator/Desktop/test3/Image/" + imageName[i] + ".jpg";
                    //tmp.imagePath = "D:/Image/" + imageName[i] + ".jpg";
                    tmpList.Add(tmp);
                }
                return(tmpList);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                tmpList = null;
                return(tmpList);
            }
        }
예제 #2
0
        private List <Comment> GetComment()
        {
            List <Comment> tmpList = new List <Comment>();

            try
            {
                MysqlConnent mysqlConnent = new MysqlConnent();

                int count = mysqlConnent.MySqlReadCount("SELECT COUNT(*) FROM 评论表 WHERE IsCheck = '0'");
                Debug.WriteLine(count);
                List <string> account   = new List <string>();
                List <string> comment   = new List <string>();
                List <string> dateTime  = new List <string>();
                List <string> commentID = new List <string>();
                account   = mysqlConnent.MySqlRead("SELECT * FROM 评论表 WHERE IsCheck = '0'  ORDER BY DateTime DESC", "account");
                comment   = mysqlConnent.MySqlRead("SELECT * FROM 评论表 WHERE IsCheck = '0' ORDER BY DateTime DESC", "comment");
                dateTime  = mysqlConnent.MySqlRead("SELECT * FROM 评论表 WHERE IsCheck = '0'  ORDER BY DateTime DESC", "dateTime");
                commentID = mysqlConnent.MySqlRead("SELECT * FROM 评论表 WHERE IsCheck = '0'  ORDER BY DateTime DESC", "commentID");
                for (int i = 0; i < count; i++)
                {
                    Comment tmp = new Comment();
                    tmp.account     = account[i];
                    tmp.commentText = comment[i];
                    tmp.dateTime    = dateTime[i];
                    tmp.commentID   = commentID[i];
                    tmpList.Add(tmp);
                }
                return(tmpList);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                tmpList = null;
                return(tmpList);
            }
        }