コード例 #1
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();
            }
        }
コード例 #2
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();
            }
        }
コード例 #3
0
        public ActionResult Index(int?pPage)
        {
            SupportPage mSupportPage = new SupportPage();

            if (pPage == null)
            {
                if (Session["LoaiHoTroPage"] != null)
                {
                    pPage = (int)Session["LoaiHoTroPage"];
                }
                else
                {
                    pPage = 1;
                }
            }
            else
            {
                Session["LoaiHoTroPage"] = pPage;
            }
            #endregion
            /*Lay danh sach cac tin theo page*/
            var mSupportTypeList = SupportService.LaySupportTypeTheoTrang((int)pPage, 10);
            if (mSupportTypeList.Count < 10)
            {
                mSupportPage.IsEnd = true;
            }
            //Tao Html cho danh sach tin nay
            mSupportPage.Html = V308HTMLHELPER.TaoDanhSachSupportType(mSupportTypeList, (int)pPage);
            mSupportPage.Page = (int)pPage;
            return(View("Index", mSupportPage));
        }
コード例 #4
0
ファイル: ImageTypeController.cs プロジェクト: war-man/Cfood
        public ActionResult Index(int?pType, int?pPage)
        {
            ImagesPage mImagesPage = new ImagesPage();
            string     mLevel      = "";

            if (pType == null)
            {
                if (Session["LoaiAnhType"] != null)
                {
                    pType = (int)Session["LoaiAnhType"];
                }
                else
                {
                    pType = 0;
                }
            }
            else
            {
                Session["LoaiAnhType"] = pType;
            }
            if (pPage == null)
            {
                if (Session["LoaiAnhPage"] != null)
                {
                    pPage = (int)Session["LoaiAnhPage"];
                }
                else
                {
                    pPage = 1;
                }
            }
            else
            {
                Session["LoaiAnhPage"] = pPage;
            }
            #endregion
            //lay Level cua Type
            if (pType != 0)
            {
                var mImageType = ImagesService.LayTheLoaiAnhTheoId((int)pType);
                if (mImageType != null)
                {
                    mLevel = mImageType.Level.Trim();
                }
            }
            /*Lay danh sach cac tin theo page*/
            var mImageTypeAll = ImagesService.LayNhomAnhAll();
            /*Lay danh sach cac tin theo page*/
            var mmImagesList = ImagesService.LayImageTypeTrangAndGroupIdAdmin((int)pPage, 10, (int)pType, mLevel);
            if (mmImagesList.Count < 10)
            {
                mImagesPage.IsEnd = true;
            }
            //Tao Html cho danh sach tin nay
            mImagesPage.Html     = V308HTMLHELPER.TaoDanhSachCacNhomAnh(mmImagesList, (int)pPage);
            mImagesPage.HtmlNhom = V308HTMLHELPER.TaoDanhSachNhomAnhHome2(mImageTypeAll, (int)pPage, (int)pType);
            mImagesPage.Page     = (int)pPage;
            mImagesPage.TypeId   = (int)pType;
            return(View("Index", mImagesPage));
        }
コード例 #5
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();
            }
        }
コード例 #6
0
        public ActionResult Index(int?pType, int?pPage)
        {
            FilePage mFilePage = new FilePage();
            string   mLevel    = "";

            if (pType == null)
            {
                if (Session["FileType"] != null)
                {
                    pType = (int)Session["FileType"];
                }
                else
                {
                    pType = 0;
                }
            }
            else
            {
                Session["FileType"] = pType;
            }
            if (pPage == null)
            {
                if (Session["FilePage"] != null)
                {
                    pPage = (int)Session["FilePage"];
                }
                else
                {
                    pPage = 1;
                }
            }
            else
            {
                Session["FilePage"] = pPage;
            }
            #endregion
            //lay Level cua Type
            if (pType != 0)
            {
                var mFileType = FileService.LayTheLoaiFileTheoId((int)pType);
                if (mFileType != null)
                {
                    mLevel = mFileType.Level.Trim();
                }
            }
            /*Lay danh sach cac tin theo page*/
            var mmFileList    = FileService.LayFileTheoTrangAndGroupIdAdmin((int)pPage, 10, (int)pType, mLevel);
            var mFileTypeList = FileService.LayNhomFileAll();
            if (mmFileList.Count < 10)
            {
                mFilePage.IsEnd = true;
            }
            //Tao Html cho danh sach tin nay
            mFilePage.Html     = V308HTMLHELPER.TaoDanhSachCacFile(mmFileList, (int)pPage);
            mFilePage.HtmlNhom = V308HTMLHELPER.TaoDanhSachNhomFileHome(mFileTypeList, (int)pPage, (int)pType);
            mFilePage.Page     = (int)pPage;
            mFilePage.TypeId   = (int)pType;
            return(View("Index", mFilePage));
        }
コード例 #7
0
ファイル: SupportController.cs プロジェクト: war-man/Cfood
        public ActionResult Create()
        {
            SupportPage mSupportPage = new SupportPage();
            var         mSupportType = SupportService.LaySupportTypeAll();

            mSupportPage.HtmlNhom = V308HTMLHELPER.TaoDanhSachSupportType2(mSupportType, 0);
            return(View("Create", mSupportPage));
        }
コード例 #8
0
ファイル: FileTypeController.cs プロジェクト: war-man/Cfood
        public ActionResult Create()
        {
            FilePage mFilePage     = new FilePage();
            var      mListFileType = FileService.LayNhomFileAll();

            //Tao danh sach cac nhom tin
            mFilePage.HtmlNhom = V308HTMLHELPER.TaoDanhSachNhomFile2(mListFileType, 0);
            return(View("Create", mFilePage));
        }
コード例 #9
0
ファイル: ImageController.cs プロジェクト: war-man/Cfood
        public ActionResult Create()
        {
            ImagesPage mImagesPage    = new ImagesPage();
            var        mListImageType = ImagesService.LayNhomAnhAll();

            //Tao danh sach cac nhom tin
            mImagesPage.HtmlNhom = V308HTMLHELPER.TaoDanhSachNhomAnh4(mListImageType, 0);
            return(View("Create", mImagesPage));
        }
コード例 #10
0
        public ActionResult Index(int?pType, int?pPage)
        {
            ProductPage mProductPage = new ProductPage();

            if (pType == null)
            {
                if (Session["OrderType"] != null)
                {
                    pType = (int)Session["OrderType"];
                }
                else
                {
                    pType = 0;
                }
            }
            else
            {
                Session["OrderType"] = pType;
            }
            if (pPage == null)
            {
                if (Session["OrderPage"] != null)
                {
                    pPage = (int)Session["OrderPage"];
                }
                else
                {
                    pPage = 1;
                }
            }
            else
            {
                Session["OrderPage"] = pPage;
            }
            #endregion
            /*Lay danh sach cac tin theo page*/
            var mProductList = ProductsService.LayOrderTheoTrangAndType((int)pPage, 6, (int)pType);
            //lay danh sach cac kieu san pham
            if (mProductList.Count < 6)
            {
                mProductPage.IsEnd = true;
            }
            //Tao Html cho danh sach tin nay
            mProductPage.Html   = V308HTMLHELPER.TaoDanhSachHoaDon(mProductList, (int)pPage);
            mProductPage.Page   = (int)pPage;
            mProductPage.TypeId = (int)pType;
            return(View("Index", mProductPage));
        }
コード例 #11
0
ファイル: AccountController.cs プロジェクト: war-man/Cfood
        public ActionResult Index(int?pType, int?pPage)
        {
            var mAccountPage = new AccountPage();

            if (pType == null)
            {
                if (Session["AccountType"] != null)
                {
                    pType = (int)Session["AccountType"];
                }
                else
                {
                    pType = 0;
                }
            }
            else
            {
                Session["AccountType"] = pType;
            }
            if (pPage == null)
            {
                if (Session["AccountPage"] != null)
                {
                    pPage = (int)Session["AccountPage"];
                }
                else
                {
                    pPage = 1;
                }
            }
            else
            {
                Session["AccountPage"] = pPage;
            }
            #endregion
            /*Lay danh sach cac tin theo page*/
            var mmAccountList = AccountService.LayAccountTheoTrangAndType((int)pPage, 10, (int)pType);
            if (mmAccountList.Count < 10)
            {
                mAccountPage.IsEnd = true;
            }
            //Tao Html cho danh sach tin nay
            mAccountPage.Html   = V308HTMLHELPER.TaoDanhSachCacAccount(mmAccountList, (int)pPage);
            mAccountPage.Page   = (int)pPage;
            mAccountPage.TypeId = (int)pType;
            return(View("Index", mAccountPage));
        }
コード例 #12
0
ファイル: SupportController.cs プロジェクト: war-man/Cfood
        public ActionResult Edit(int pId = 0)
        {
            SupportPage mSupportPage = new SupportPage();
            var         mSupport     = SupportService.LayTheoId(pId);

            if (mSupport != null)
            {
                var mSupportType = SupportService.LaySupportTypeAll();
                mSupportPage.HtmlNhom = V308HTMLHELPER.TaoDanhSachSupportType3(mSupportType, (int)mSupport.TypeID);
                mSupportPage.pSupport = mSupport;
            }
            else
            {
                mSupportPage.Html = "Không tìm thấy tin tức cần sửa.";
            }
            return(View("Edit", mSupportPage));
        }
コード例 #13
0
ファイル: ImageController.cs プロジェクト: war-man/Cfood
        public ActionResult Edit(int pId = 0)
        {
            ImagesPage mImagesPage = new ImagesPage();
            var        mImage      = ImagesService.LayAnhTheoId(pId);

            if (mImage != null)
            {
                var mImageTypeList = ImagesService.LayNhomAnhAll();
                //Tao danh sach cac nhom tin
                mImagesPage.HtmlNhom = V308HTMLHELPER.TaoDanhSachNhomAnh4(mImageTypeList, (int)mImage.TypeID);
                mImagesPage.pImage   = mImage;
            }
            else
            {
                mImagesPage.Html = "Không tìm thấy tin tức cần sửa.";
            }
            return(View("Edit", mImagesPage));
        }
コード例 #14
0
ファイル: FileTypeController.cs プロジェクト: war-man/Cfood
        public ActionResult Edit(int pId = 0)
        {
            FilePage mFilePage = new FilePage();
            var      mFileType = FileService.LayTheLoaiFileTheoId(pId);

            if (mFileType != null)
            {
                var mFileTypeList = FileService.LayNhomFileAll();
                //Tao danh sach cac nhom tin
                mFilePage.HtmlNhom  = V308HTMLHELPER.TaoDanhSachNhomFile3(mFileTypeList, (int)mFileType.ParentID);
                mFilePage.pFileType = mFileType;
            }
            else
            {
                mFilePage.Html = "Không tìm thấy loại file cần sửa.";
            }
            return(View("Edit", mFilePage));
        }
コード例 #15
0
        public ActionResult Detail(int pId = 0)
        {
            ProductPage mProductPage  = new ProductPage();
            var         mProductOrder = ProductsService.LayProductOrderTheoId(pId);

            if (mProductOrder != null)
            {
                var mShopCart = JsonSerializer.DeserializeFromString <ShopCart>(mProductOrder.ProductDetail);
                mProductPage.pProductOrder  = mProductOrder;
                mProductPage.Voucher        = mShopCart.Voucher;
                mProductOrder.ProductDetail = V308HTMLHELPER.TaoDanhSachSanPhamGioHangAdmin(mShopCart.List);
                mProductPage.ShopCart       = mShopCart;
            }
            else
            {
                mProductPage.pProductOrder = new ProductOrder();
                mProductPage.Html          = "Không tìm thấy sản phẩm.";
            }
            return(View("Detail", mProductPage));
        }
コード例 #16
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();
            }
        }
コード例 #17
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();
            }
        }
コード例 #18
0
ファイル: HomeController.cs プロジェクト: war-man/Cfood
        public JsonResult ThucHienThanhToan(string pFullName, string pEmail, string pMobile, string pAddress, string pAddressDelivery, string pCity, string pDistrict, string pTimeDelivery, string pDayDelivery)
        {
            V308CMSEntities   mEntities         = new V308CMSEntities();
            AccountRepository accountRepository = new AccountRepository(mEntities);
            ShopCart          mShopCart;
            List <Product>    mList;
            ProductOrder      mProductOrder = new ProductOrder();

            try
            {
                if (HttpContext.User.Identity.IsAuthenticated == true && Session["UserId"] != null)
                {
                    if (Session["ShopCart"] != null)
                    {
                        mShopCart = (ShopCart)Session["ShopCart"];
                        mList     = mShopCart.List;
                        mProductOrder.AccountID = (int)Session["UserId"];
                        mProductOrder.Address   = pAddress + "____" + pAddressDelivery;
                        mProductOrder.Date      = DateTime.Now;
                        mProductOrder.Detail    = "Đơn mua hàng - Giao ngày:" + pDayDelivery + " - Giờ giao: " + pTimeDelivery;
                        mProductOrder.Email     = pEmail;
                        mProductOrder.FullName  = pFullName;
                        mProductOrder.Phone     = pMobile;
                        mProductOrder.Status    = 0;
                        //mProductOrder.ProductDetail = V308HTMLHELPER.TaoDanhSachSanPhamGioHang(mList);
                        mProductOrder.ProductDetail = JsonSerializer.SerializeToString <ShopCart>(mShopCart);
                        mProductOrder.Price         = mShopCart.getTotalPrice();
                        mEntities.AddToProductOrder(mProductOrder);
                        mEntities.SaveChanges();
                        Session["ShopCart"] = new ShopCart();
                        //Gửi email báo cho người mua và quản trị về việc mua hàng
                        //gửi email cho khách
                        string EmailContent = "Thông tin đơn hàng của " + pFullName + " từ C-FOOD: <br/> " + V308HTMLHELPER.TaoDanhSachSanPhamGioHang(mList) + " <br/> Email: " + pEmail + "<br/> Mobile: " + pMobile + " <br/> Ngày : " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss") + "";
                        //V308Mail.SendMail(pEmail, "Thông tin đơn hàng của " + pFullName + " từ C-FOOD: " + " - " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss") + "", EmailContent);
                        //gửi email tới admin
                        string EmailContent2 = "Thông tin đơn hàng của " + pFullName + " từ C-FOOD: <br/> " + V308HTMLHELPER.TaoDanhSachSanPhamGioHang(mList) + " <br/> Email: " + pEmail + "<br/> Mobile: " + pMobile + " <br/> Ngày : " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss") + "";
                        //V308Mail.SendMail("*****@*****.**", "Thông tin đơn hàng của " + pFullName + " từ C-FOOD: " + " - " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss") + "", EmailContent2);

                        return(Json(new { code = 1, message = "Hoàn thành mua bán. Chúng tôi sẽ liên lạc ngay với bạn qua số điện thoại bạn đã cung cấp." }));
                    }
                    else
                    {
                        return(Json(new { code = 3, message = "Giỏ hàng chưa có sản phẩm nào." }));
                    }
                }
                else
                {
                    return(Json(new { code = 2, message = "Vui lòng đăng nhập." }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { code = 0, message = "Có lỗi xảy ra. Vui lòng thử lại." }));
            }
            finally
            {
                mEntities.Dispose();
                accountRepository.Dispose();
            }
        }
コード例 #19
0
ファイル: HomeController.cs プロジェクト: war-man/Cfood
        public JsonResult getShopCart()
        {
            V308CMSEntities   mEntities         = new V308CMSEntities();
            AccountRepository accountRepository = new AccountRepository(mEntities);
            ProductRepository productRepository = new ProductRepository(mEntities);

            try
            {
                ShopCart mShopCart;
                if (Session["ShopCart"] != null)
                {
                    mShopCart = (ShopCart)Session["ShopCart"];
                    return(Json(new { code = 1, count = 1, totalprice = String.Format("{0: 0,0}", (mShopCart.getTotalPrice())), message = "Không tìm thấy sản phẩm.", html = V308HTMLHELPER.createShopCart(mShopCart) }));
                }
                else
                {
                    return(Json(new { code = 0, count = 1, totalprice = 0, message = "Không tìm thấy sản phẩm." }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { code = 0, count = 1, totalprice = 0, message = "Có lỗi xảy ra. Vui lòng thử lại." }));
            }
            finally
            {
                mEntities.Dispose();
                accountRepository.Dispose();
            }
        }