public Album_Bus() { mAlbumDB = new AlbumDB(); mImage = new Image_Bus(); mComment = new AlbumComment_Bus(); }
//删除操作 public void DeleteAlbumByAlbumId(long albumId, string abAlbumPath) { //文件删除 if (abAlbumPath != null) { try { Directory.Delete(abAlbumPath, true); //迭代删除数据库数据 ImageComment_Bus imageComment = new ImageComment_Bus(); Image_Bus image = new Image_Bus(); DataTable dt = image.ViewImageListByAlbumId(albumId); long count = dt.Rows.Count; for (int i = 0; i < count; i++) { imageComment.DeleteAllImageCommentByImageId(Convert.ToInt64(dt.Rows[i]["imageId"])); } ImageDB imageDB = new ImageDB(); imageDB.DeleteAllImageByAlbumId(albumId); mComment.DeleteAllAlbumCommentByAlbumId(albumId); mAlbumDB.DeleteAlbumByAlbumId(albumId); } catch (Exception e) { // } } }
//删除操作 public void DeleteAlbumByAlbumId(long albumId, string userLoginName, string albumName) { try { string albumPath = MAP_PATH + "\\" + BASE_PATH + "\\" + USER_FILE_PREFIX + userLoginName + "\\" + ALBUM_FILE_PREFIX + albumName; Directory.Delete(albumPath, true); ImageComment_Bus imageComment = new ImageComment_Bus(); Image_Bus image = new Image_Bus(); DataTable dt = image.ViewImageListByAlbumId(albumId); long count = dt.Rows.Count; for (int i = 0; i < count; i++) { imageComment.DeleteAllImageCommentByImageId(Convert.ToInt64(dt.Rows[i]["imageId"])); } ImageDB imageDB = new ImageDB(); imageDB.DeleteAllImageByAlbumId(albumId); mComment.DeleteAllAlbumCommentByAlbumId(albumId); mAlbumDB.DeleteAlbumByAlbumId(albumId); } catch (Exception e) { // } }