private void button_Click(object sender, RoutedEventArgs e) { string account = textBox.Text; string password = passwordBox.Password; MysqlConnent mysqlConnent = new MysqlConnent(); string isTrue = mysqlConnent.MySqlHasRows("SELECT * FROM 管理员账号表 WHERE CheckAccount ='" + account + "' AND CheckPassword ='******'"); if (isTrue == "true") { ListWindows tmp = new ListWindows(); tmp.Show(); this.Close(); } else { MessageBox.Show("账号或密码错误"); } }
private void Button_Click(object sender, RoutedEventArgs e) { MysqlConnent mysqlConnent = new MysqlConnent(); if (viewNum == 0) { foreach (Image item in ImageList) { mysqlConnent.MySqlReadCount("UPDATE 图片表 SET IsCheck = '1' WHERE ImageName = '" + item.imageName + "'"); } ImageList.Clear(); } else { foreach (Comment item in CommentList) { mysqlConnent.MySqlReadCount("UPDATE 评论表 SET IsCheck = '1' WHERE CommentID = '" + item.commentID + "'"); } CommentList.Clear(); } lv.Items.Refresh(); }
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); } }
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); } }