Ejemplo n.º 1
0
        public ActionResult Footer()
        {
            V308CMSEntities      mEntities      = new V308CMSEntities();
            NewsRepository       newsRepository = new NewsRepository(mEntities);
            List <NewsGroups>    mNewsGroupsList;
            List <NewsGroupPage> mNewsGroupPageList = new List <NewsGroupPage>();

            try
            {
                //lay cac nhom con cua: 14 la nhom cha Footer
                mNewsGroupsList = newsRepository.getNewsGroupAffterParent(14);
                foreach (NewsGroups it in mNewsGroupsList)
                {
                    NewsGroupPage mNewsGroupPage = new NewsGroupPage();
                    //lay danh sach cac tin ben trong
                    List <News> mList = newsRepository.LayTinTheoGroupId(it.ID);
                    mNewsGroupPage.Name     = it.Name;
                    mNewsGroupPage.TypeId   = it.ID;
                    mNewsGroupPage.NewsList = mList;
                    mNewsGroupPageList.Add(mNewsGroupPage);
                }
                return(View(mNewsGroupPageList));
            }
            catch (Exception ex)
            {
                return(Content("Xảy ra lỗi hệ thống ! Vui lòng thử lại."));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }
Ejemplo n.º 2
0
        public ActionResult DanhSachTinLienQuan(int pGroupId, int pNewsId)
        {
            V308CMSEntities mEntities      = new V308CMSEntities();
            NewsRepository  newsRepository = new NewsRepository(mEntities);
            List <News>     mList          = null;
            string          str            = "";

            try
            {
                //lay danh sach tin lien quan
                mList = newsRepository.LayDanhSachTinTheoGroupId(6, pGroupId);
                //tao HTML
                str = V308HTMLHELPER.TaoDanhSachNhomTinLienQuan(mList, pNewsId);
                return(View((object)str));
            }
            catch (Exception ex)
            {
                return(Content("<dx></dx>"));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }
Ejemplo n.º 3
0
        public ActionResult ChuyenBiet()
        {
            V308CMSEntities  mEntities      = new V308CMSEntities();
            NewsRepository   newsRepository = new NewsRepository(mEntities);
            TinTucChuyenBiet Str            = new TinTucChuyenBiet();
            List <News>      mKhuyenMai     = null;
            List <News>      mCauDo         = null;
            List <News>      mSalon         = null;
            List <News>      mTamsu         = null;

            try
            {
                mKhuyenMai    = newsRepository.LayDanhSachTinTheoGroupId(5, 9);
                mCauDo        = newsRepository.LayDanhSachTinTheoGroupId(5, 10);
                mSalon        = newsRepository.LayDanhSachTinTheoGroupId(5, 11);
                mTamsu        = newsRepository.LayDanhSachTinTheoGroupId(5, 12);
                Str.khuyenmai = V308HTMLHELPER.TaoDanhSachTinCauDo(mKhuyenMai, "Khuyến Mại", 9);
                Str.caudo     = V308HTMLHELPER.TaoDanhSachTinCauDo(mCauDo, "Câu Đố", 10);
                Str.tamsu     = V308HTMLHELPER.TaoDanhSachTinCauDo(mTamsu, "Tâm Sự", 11);
                Str.salon     = V308HTMLHELPER.TaoDanhSachTinCauDo(mSalon, "Salon", 12);
                return(View(Str));
            }
            catch (Exception ex)
            {
                return(Content("<dx></dx>"));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }
Ejemplo n.º 4
0
        public ActionResult NewsDetail(int pId = 0)
        {
            V308CMSEntities mEntities      = new V308CMSEntities();
            NewsRepository  newsRepository = new NewsRepository(mEntities);
            NewsPage        mCommonModel   = new NewsPage();
            StringBuilder   mStr           = new StringBuilder();
            News            mNews;

            try
            {
                //lay chi tiet san pham
                mNews = newsRepository.LayTinTheoId(pId);
                if (mNews != null)
                {
                    mCommonModel.pNews = mNews;
                    //mListLienQuan = newsRepository.LayTinTucLienQuan(mNews.ID, (int)mNews.TypeID, 4);
                    //tao Html tin tuc lien quan
                }
                else
                {
                    mCommonModel.Html = "Không tìm thấy sản phẩm";
                }
                return(View(mCommonModel));
            }
            catch (Exception ex)
            {
                return(Content("<h2>Có lỗi xảy ra trên hệ thống ! Vui lòng thử lại sau.</h2>"));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }
Ejemplo n.º 5
0
        public ActionResult HeadMenu()
        {
            V308CMSEntities   mEntities      = new V308CMSEntities();
            NewsRepository    newsRepository = new NewsRepository(mEntities);
            List <NewsGroups> mNewsGroupsList;
            NewsPage          mNewsPage = new NewsPage();

            try
            {
                //lay cac menu của MENU
                mNewsGroupsList = newsRepository.LayNhomTinAll();
                //Tao danh sach cac nhom tin
                mNewsPage.HtmlNhomTin = V308HTMLHELPER.TaoDanhSachMenu(mNewsGroupsList);
                return(View(mNewsPage));
            }
            catch (Exception ex)
            {
                return(Content("Xảy ra lỗi hệ thống ! Vui lòng thử lại."));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }
Ejemplo n.º 6
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         nRepo.Dispose();
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 7
0
 private void DisposeRepos()
 {
     mEntities.Dispose();
     ImageRepos.Dispose();
     ProductTypeRepos.Dispose();
     ProductRepos.Dispose();
     NewsRepos.Dispose();
     MenuConfigRepos.Dispose();
 }
Ejemplo n.º 8
0
 private void DisposeRepos()
 {
     ProductRepos.Dispose();
     imagesRepos.Dispose();
     NewsRepos.Dispose();
     accountRepos.Dispose();
     MenuRepos.Dispose();
     mEntities.Dispose();
 }
Ejemplo n.º 9
0
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             newsRepository.Dispose();
         }
     }
     this.disposed = true;
 }
Ejemplo n.º 10
0
        private void DisposeRepos()
        {
            mEntities.Dispose();
            ImageRepos.Dispose();

            ProductRepos.Dispose();
            AccountRepos.Dispose();
            NewsRepos.Dispose();
            CommentRepo.Dispose();
            CategoryRepo.Dispose();
        }
Ejemplo n.º 11
0
        public ActionResult Comment()
        {
            V308CMSEntities mEntities      = new V308CMSEntities();
            NewsRepository  newsRepository = new NewsRepository(mEntities);
            List <News>     mList          = null;
            StringBuilder   str            = new StringBuilder();
            NewsPage        mNewsPage      = new NewsPage();
            int             i = 0;

            try
            {
                //lay danh sach tin lien quan
                mList = newsRepository.LayDanhSachTinTheoGroupId(4, 11);
                foreach (News it in mList)
                {
                    str.Append("<div class=\"line\">");
                    str.Append("<div class=\"item-wrap style1 last \">");
                    str.Append("<div class=\"item-image\">");
                    str.Append("<img src=\"" + it.Image + "\" alt=\"" + it.Image + "\">");
                    str.Append("</div>");
                    str.Append("<div class=\"item-info\">");
                    str.Append(" <div class=\"item-content\">");
                    str.Append("<div class=\"item-description\">" + it.Summary + "");
                    str.Append("</div>");
                    str.Append("<div class=\"name_school\">");
                    str.Append("<strong>" + it.Title + "</strong>");
                    str.Append("</div>");
                    str.Append("<div class=\"tooltip-meta\">");
                    str.Append("</div>");
                    str.Append("</div>");
                    str.Append("</div>");
                    str.Append("</div>");
                    str.Append("<div class=\"Testimonials_field\">");
                    str.Append("<strong>" + it.Title + "</strong>");
                    str.Append("</div>");
                    str.Append("</div>");
                }
                mNewsPage.Html = str.ToString();
                return(View(mNewsPage));
            }
            catch (Exception ex)
            {
                return(Content("<dx></dx>"));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }
Ejemplo n.º 12
0
        private void DisposeRepos()
        {
            mEntities.Dispose();
            ProductRepos.Dispose();

            AccountRepos.Dispose();
            NewsRepos.Dispose();
            CommentRepo.Dispose();
            CategoryRepo.Dispose();
            LinkRepo.Dispose();
            BannerRepo.Dispose();
            TicketRepo.Dispose();
            CouponRepo.Dispose();
        }
Ejemplo n.º 13
0
 private void DisposeRepos()
 {
     mEntities.Dispose();
     if (ProductRepos != null)
     {
         ProductRepos.Dispose();
     }
     if (NewsRepos != null)
     {
         NewsRepos.Dispose();
     }
     if (MarketRepos != null)
     {
         MarketRepos.Dispose();
     }
 }
Ejemplo n.º 14
0
        public ActionResult LienHe()
        {
            V308CMSEntities mEntities      = new V308CMSEntities();
            NewsRepository  newsRepository = new NewsRepository(mEntities);
            string          str            = "";

            try
            {
                return(View((object)str));
            }
            catch (Exception ex)
            {
                return(Content("<dx></dx>"));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }
Ejemplo n.º 15
0
        public ActionResult DanhSachNhomTin()
        {
            V308CMSEntities   mEntities        = new V308CMSEntities();
            NewsRepository    newsRepository   = new NewsRepository(mEntities);
            List <News>       mList            = null;
            List <NewsGroups> mListNhom        = null;
            string            str              = "";
            DanhSachNhomTin   mDanhSachNhomTin = new DanhSachNhomTin();
            NhomTin           mNhomTin         = null;

            try
            {
                //lay danh sach nhom tin
                mListNhom = newsRepository.LayDanhSachNhomTin();
                //lay danh sach cac tin theo nhom
                foreach (NewsGroups it in mListNhom)
                {
                    mNhomTin           = new NhomTin();
                    mNhomTin.ID        = it.ID;
                    mNhomTin.GroupName = it.Name;
                    mNhomTin.Order     = (int)it.Number;
                    //lay danh sach cac tin hot nhat theo nhom
                    mList             = newsRepository.LayDanhSachTinTheoGroupId(6, it.ID);
                    mNhomTin.NewsList = mList;
                    mDanhSachNhomTin.List.Add(mNhomTin);
                }
                str = V308HTMLHELPER.TaoDanhSachTinTrangChu(mDanhSachNhomTin);
                return(View((object)str));
            }
            catch (Exception ex)
            {
                return(Content("<dx></dx>"));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }
Ejemplo n.º 16
0
        public ActionResult TinNhanh()
        {
            V308CMSEntities mEntities      = new V308CMSEntities();
            NewsRepository  newsRepository = new NewsRepository(mEntities);
            List <News>     mList          = null;
            string          str            = "";

            try
            {
                mList = newsRepository.LayDanhSachTinNhanh(5);
                str   = V308HTMLHELPER.TaoDanhSachTinHot(mList);
                return(View((object)str));
            }
            catch (Exception ex)
            {
                return(Content("<dx></dx>"));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }
Ejemplo n.º 17
0
        public ActionResult Banner()
        {
            V308CMSEntities mEntities      = new V308CMSEntities();
            NewsRepository  newsRepository = new NewsRepository(mEntities);
            List <News>     mList          = null;
            BannerPage      mBannerPage    = new BannerPage();

            try
            {
                mList            = newsRepository.LayDanhSachTinTheoGroupId(10, 26);
                mBannerPage.List = mList;
                return(View(mBannerPage));
            }
            catch (Exception ex)
            {
                return(Content("<dx></dx>"));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }
Ejemplo n.º 18
0
 public void Dispose()
 {
     _repository?.Dispose();
 }
Ejemplo n.º 19
0
        public ActionResult News(int pPage = 1, int pType = 1)
        {
            V308CMSEntities mEntities      = new V308CMSEntities();
            NewsRepository  newsRepository = new NewsRepository(mEntities);
            NewsPage        mCommonModel   = new NewsPage();
            StringBuilder   mStr           = new StringBuilder();
            List <News>     mList;
            NewsGroups      mNewsGroups;

            try
            {
                //lay chi tiet loai tin tuc
                mNewsGroups = newsRepository.LayTheLoaiTinTheoId(pType);
                if (mNewsGroups != null)
                {
                    mCommonModel.NewsGroups = mNewsGroups;
                    //lay chi tiet san pham
                    mList = newsRepository.LayTinTheoTrangAndGroupIdAndLevel(pPage, 10, pType, mNewsGroups.Level);
                    if (mList.Count > 0)
                    {
                        foreach (News it in mList)
                        {
                            if (mNewsGroups.Level.Substring(0, 5) == "10006")
                            {
                                mStr.Append("<div class=\"news\">");
                                mStr.Append("<h2 class=\"title\"><a href=\"/" + Ultility.LocDau(it.Title) + "-youtube" + it.ID + ".html\">" + it.Title + "</a></h2>");
                                mStr.Append("<div class=\"image_container\">");
                                mStr.Append("<div class=\"image_cell\">");
                                mStr.Append("<a href=\"/" + Ultility.LocDau(it.Title) + "-youtube" + it.ID + ".html\">");
                                mStr.Append("<img class=\"image_news\" src=\"https://i.ytimg.com/vi/" + it.Summary + "/hqdefault.jpg?custom=true&w=250&h=141&stc=true&jpg444=true&jpgq=90&sp=68\" alt=\"" + it.Title + "\">");
                                mStr.Append("</a>");
                                mStr.Append("</div>");
                                mStr.Append("</div>");
                                mStr.Append("<div class=\"create_time\"><span class=\"crateTimeTitle\">Thời gian đăng :</span> " + ConverterUlti.GetNgayDangByDateTime(it.Date.Value) + "</div>");
                                mStr.Append("<p class=\"description\">" + it.Title + "</p>");
                                mStr.Append("</div>");
                            }
                            else
                            {
                                mStr.Append("<div class=\"news\">");
                                mStr.Append("<h2 class=\"title\"><a href=\"/" + Ultility.LocDau(it.Title) + "-n" + it.ID + ".html\">" + it.Title + "</a></h2>");
                                mStr.Append("<div class=\"image_container\">");
                                mStr.Append("<div class=\"image_cell\">");
                                mStr.Append("<a href=\"/" + Ultility.LocDau(it.Title) + "-n" + it.ID + ".html\">");
                                mStr.Append("<img class=\"image_news\" src=\"" + it.Image + "\" alt=\"" + it.Title + "\">");
                                mStr.Append("</a>");
                                mStr.Append("</div>");
                                mStr.Append("</div>");
                                mStr.Append("<div class=\"create_time\"><span class=\"crateTimeTitle\">Thời gian đăng :</span> " + ConverterUlti.GetNgayDangByDateTime(it.Date.Value) + "</div>");
                                mStr.Append("<p class=\"description\">" + it.Summary + "</p>");
                                mStr.Append("</div>");
                            }
                        }
                        if (mList.Count < 10)
                        {
                            mCommonModel.IsEnd = true;
                        }
                        mCommonModel.Page = pPage;
                        mCommonModel.Html = mStr.ToString();
                    }
                    else
                    {
                        mCommonModel.Html = "Không tìm thấy sản phẩm";
                    }
                }
                return(View(mCommonModel));
            }
            catch (Exception ex)
            {
                return(Content("<h2>Có lỗi xảy ra trên hệ thống ! Vui lòng thử lại sau.</h2>"));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }
 public void TestCleanUp()
 {
     newsRepo.Dispose();
     transaction.Dispose();
 }
Ejemplo n.º 21
0
        public ActionResult TinHot()
        {
            V308CMSEntities mEntities      = new V308CMSEntities();
            NewsRepository  newsRepository = new NewsRepository(mEntities);
            List <News>     mList          = null;
            StringBuilder   str            = new StringBuilder();
            StringBuilder   str2           = new StringBuilder();
            NewsPage        mNewsPage      = new NewsPage();
            int             i = 0;

            try
            {
                //lay danh sach tin lien quan
                mList = newsRepository.LayDanhSachTinTheoGroupId(5, 12);
                foreach (News it in mList)
                {
                    if (i == 0)
                    {
                        str2.Append("<div class=\"item-image\">");
                        str2.Append("<a href=\"javascript:void(0);\">");
                        str2.Append("<span class=\"image-inset\">");
                        str2.Append("<img src=\"" + it.Image + "\" alt=\"" + it.Title + "\">");
                        str2.Append("</span>");
                        str2.Append("</a>");
                        str2.Append("</div>");


                        str2.Append("<div class=\"item-title\"><a href=\"/chi-tiet/" + it.ID + "/" + Ultility.LocDau(it.Title) + ".html\">" + it.Title + "</a></div>");
                        str2.Append("<div class=\"item-post-read\">");
                        str2.Append("<div class=\"item-post\">" + ConverterUlti.GetNgayDangByDateTime(it.Date.Value) + "</div>");
                        str2.Append("</div>");
                        str2.Append("<div class=\"item-desc\">");
                        str2.Append("<p>" + it.Summary + "</p>");
                        str2.Append("</div>");

                        str2.Append("<div class=\"item-readmore\"><a href=\"/chi-tiet/" + it.ID + "/" + Ultility.LocDau(it.Title) + ".html\">CHI TIẾT</a></div>");
                    }
                    else
                    {
                        str.Append("<li>");
                        str.Append("<div class=\"left\">");
                        str.Append("<div class=\"item-post-read\">");
                        str.Append("<div class=\"item-post\">" + ConverterUlti.GetNgayDangByDateTime(it.Date.Value) + "</div>");
                        str.Append("</div>");
                        str.Append("<div class=\"item-comments\">");
                        //str.Append("<a class=\"item-comments\" href=\"javascript:void(0);\">0 comment	</a>");
                        str.Append("</div>");
                        str.Append("</div>");
                        str.Append("<div class=\"right\">");
                        str.Append("<a href=\"/chi-tiet/" + it.ID + "/" + Ultility.LocDau(it.Title) + ".html\">" + it.Title + "</a>");

                        str.Append("<div class=\"item-desc\">");
                        str.Append("<p>" + it.Summary + "</p>");
                        str.Append("</div>");
                        str.Append("</div>");
                        str.Append("</li>");
                    }
                    i++;
                }
                mNewsPage.Html        = str.ToString();
                mNewsPage.HtmlNhomTin = str2.ToString();
                return(View(mNewsPage));
            }
            catch (Exception ex)
            {
                return(Content("<dx></dx>"));
            }
            finally
            {
                mEntities.Dispose();
                newsRepository.Dispose();
            }
        }