Exemplo n.º 1
0
        public TopReviewModels BaiNhanXet2BaiNhanXetViewModels(BaiNhanXet topReview)
        {
            
            AccountBus acBus = new AccountBus();
            ReviewFilmsBus bus = new ReviewFilmsBus();
            ThanhVien temp = acBus.getMemberByUserId(topReview.MS_TaiKhoan);

            TopReviewModels result = new TopReviewModels();

            result.UserName = temp.HoTen;
            result.postDate = (DateTime) topReview.NgayDang;

            result.content = topReview.NoiDung;
            result.totalRank = bus.getTotalRank(topReview.MaSo);

            result.title = topReview.TieuDe;
            result.MS_Phim = (int) topReview.MS_Phim;
            result.MS_ReView = (int) topReview.MaSo;

            FilmBus filmBus = new FilmBus();

            Phim p = filmBus.getFilmByID(result.MS_Phim.ToString());
            result.ulr_HinhAnh = p.HinhAnh;
            result.TenPhim = p.TenPhim;
            return result;
        }
Exemplo n.º 2
0
        internal TopReviewModels getReview(string IDReview)
        {

            ReviewFilmsBus bus = new ReviewFilmsBus();
            BaiNhanXet Review = bus.getReview(Int32.Parse(IDReview));
            if (Review != null)
            {
                return BaiNhanXet2BaiNhanXetViewModels(Review);
            }
            else
                return null;
        }
Exemplo n.º 3
0
        internal List<TopReviewModels> getTop10Review(string IDPhim)
        {
            ReviewFilmsBus bus = new ReviewFilmsBus();
            List<BaiNhanXet> topReview = bus.getTop10Review(Int32.Parse(IDPhim));
            if (topReview != null)
            {

                List<TopReviewModels> result = new List<TopReviewModels>();
                foreach(BaiNhanXet bai in topReview){
                    TopReviewModels temp =  BaiNhanXet2BaiNhanXetViewModels(bai);
                    result.Add(temp);
                }



                return result;
            }
            else
                return null;
        }
Exemplo n.º 4
0
        internal List<TopReviewModels> getMyListReview(string IDUser)
        {
            List<TopReviewModels> result = new List<TopReviewModels>();

            ReviewFilmsBus bus = new ReviewFilmsBus();
            List<BaiNhanXet> Review = bus.getMyListReview(IDUser);
            if (Review != null)
            {
                foreach(BaiNhanXet bainhanxet in Review)
                {
                    result.Add(BaiNhanXet2BaiNhanXetViewModels(bainhanxet));
                }
                return result;
            }
            else
                return null;
        }
Exemplo n.º 5
0
        internal List<TopReviewModels> getAllReviewFilm()
        {
            ReviewFilmsBus reviewBus = new ReviewFilmsBus();

            List<BaiNhanXet> lstBaiNhanXet = reviewBus.getAllReviewFilm();

            List<TopReviewModels> result = BaiNhanXet2TopReviewModel(lstBaiNhanXet);

            return result;
        }
Exemplo n.º 6
0
        internal CommentViewModels addComment(string CommentContent, string IDPost, string IDUser)
        {
            CommentViewModels result = new CommentViewModels();
            ReviewFilmsBus reviewBus = new ReviewFilmsBus();

            BinhLuan binhLuan = new BinhLuan();

            binhLuan.MS_BaiNhanXet = Int32.Parse(IDPost);
            binhLuan.MS_ThanhVien = IDUser;
            binhLuan.NoiDung = CommentContent;
            binhLuan.NgayDang = System.DateTime.Now;
            if(reviewBus.addComment(binhLuan))
            {
                result = BinhLuan2ViewModels(binhLuan);
            }
            
            return result;

        }
Exemplo n.º 7
0
 internal bool deletePost(string IDPost)
 {
     ReviewFilmsBus bus = new ReviewFilmsBus();
     return bus.deletePost(Int32.Parse(IDPost));
 }
Exemplo n.º 8
0
 internal bool editPost(BaiNhanXet baiNhanXet)
 {
     ReviewFilmsBus bus = new ReviewFilmsBus();
     return bus.editPost(baiNhanXet);
 }
Exemplo n.º 9
0
 internal int addPost(Business.BaiNhanXet baiNhanXet)
 {
     ReviewFilmsBus bus = new ReviewFilmsBus();
     return bus.addPost(baiNhanXet);
 }
Exemplo n.º 10
0
        public List<HistoryViewModels> getActivitiesLog(string IDUser)
        {
            //ReviewFilmsBus reviewFilmsBus = new ReviewFilmsBus();
            List<HistoryViewModels> result = new List<HistoryViewModels>();

            CommentBus commentBus = new CommentBus();

            ReviewFilmsBus reviewBus = new ReviewFilmsBus();
            AccountBus accBus = new AccountBus();
            FilmBus filmBus = new FilmBus();
            ThanhVien thanhVien = accBus.getMemberByUserId(IDUser);

            List<BinhLuan> lstBinhLuan = commentBus.getMyComments(IDUser);




            foreach (BinhLuan binhLuan in lstBinhLuan)
            {

                HistoryViewModels temp = new HistoryViewModels();

                BaiNhanXet baiNhanXet = reviewBus.getReview((int)binhLuan.MS_BaiNhanXet);
                Phim phim = filmBus.getFilmByID(baiNhanXet.MS_Phim.ToString());

                temp.tenBaiNhanXet = baiNhanXet.TieuDe;
                temp.MS_BaiNhanXet = (int)binhLuan.MS_BaiNhanXet;
                temp.tenPhim = phim.TenPhim;
                temp.MS_Phim = (int)phim.MaSo;
                temp.action = "Comment";
                temp.Hoten = thanhVien.HoTen;
                temp.content = binhLuan.NoiDung;
                temp.dateAction = (DateTime)binhLuan.NgayDang;
                result.Add(temp);


            }

            FilmLikeBus filmLikeBus = new FilmLikeBus();

            List<DanhSachPhimYeuThich> lstPhimYeuThich = filmLikeBus.getMyListFilmLike(IDUser);


            foreach (DanhSachPhimYeuThich phimYeuThich in lstPhimYeuThich)
            {

                HistoryViewModels temp = new HistoryViewModels();

                Phim p = filmBus.getFilmByID(phimYeuThich.MS_Phim.ToString());
                temp.tenPhim = p.TenPhim;
                temp.MS_Phim = p.MaSo;
                temp.Hoten = thanhVien.HoTen;
                temp.action = "Like";
                temp.content = thanhVien.HoTen + " đã thích " + p.TenPhim;
                temp.dateAction = (DateTime)phimYeuThich.ThoiGian;
                result.Add(temp);


            }


            List<BaiNhanXet> lstNhanXet = reviewBus.getMyListReview(IDUser);

            foreach (BaiNhanXet baiNhanXet in lstNhanXet)
            {

                HistoryViewModels temp = new HistoryViewModels();
                Phim p = filmBus.getFilmByID(baiNhanXet.MS_Phim.ToString());
                temp.tenPhim = p.TenPhim;
                temp.MS_Phim = p.MaSo;
                temp.tenBaiNhanXet = baiNhanXet.TieuDe;
                temp.MS_BaiNhanXet = baiNhanXet.MaSo;
                temp.Hoten = thanhVien.HoTen;
                temp.action = "Post";
                temp.content = thanhVien.HoTen + " đã thêm bài nhận xét ...." + baiNhanXet.MS_Phim;
                temp.dateAction = (DateTime)baiNhanXet.NgayDang;
                result.Add(temp);


            }

            result.Sort((x, y) => y.dateAction.CompareTo(x.dateAction));


            return result;

        }