예제 #1
0
        public ActionResult Index()
        {
            IndexInfo info = new IndexInfo();

            using (var db0 = getDB0())
            {
                #region banner
                info.banners = db0.Banner.Where(x => !x.i_Hide & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name).OrderByDescending(x => x.sort)
                               .Select(x => new m_Banner()
                {
                    banner_id   = x.banner_id,
                    banner_name = x.banner_name
                }).ToList();
                foreach (var i in info.banners)
                {
                    i.imgsrc = GetImg(i.banner_id.ToString(), "Banner", "Active", "BannerData", null);
                }
                #endregion
                if (System.Globalization.CultureInfo.CurrentCulture.Name == "ja-JP")
                {
                    #region get other img
                    info.NewProuctImgSrc = GetImg("IndexImg", "NewProduct_jp", "Active", "ParmData", null);
                    info.About1ImgSrc    = GetImg("IndexImg", "About1_jp", "Active", "ParmData", null);
                    info.About2ImgSrc    = GetImg("IndexImg", "About2_jp", "Active", "ParmData", null);
                    info.NewsImgSrc      = GetImg("IndexImg", "EXHIBITION_jp", "Active", "ParmData", null);
                    info.SupportImgSrc   = GetImg("IndexImg", "SUPPORT_jp", "Active", "ParmData", null);
                    #endregion
                    #region get other url
                    var open = openLogic();
                    info.url_1 = (string)open.getParmValue(ParmDefine.url_1_jp);
                    info.url_2 = (string)open.getParmValue(ParmDefine.url_2_jp);
                    info.url_3 = (string)open.getParmValue(ParmDefine.url_3_jp);
                    info.url_4 = (string)open.getParmValue(ParmDefine.url_4_jp);
                    info.url_5 = (string)open.getParmValue(ParmDefine.url_5_jp);
                    #endregion
                }
                else
                {
                    #region get other img
                    info.NewProuctImgSrc = GetImg("IndexImg", "NewProduct", "Active", "ParmData", null);
                    info.About1ImgSrc    = GetImg("IndexImg", "About1", "Active", "ParmData", null);
                    info.About2ImgSrc    = GetImg("IndexImg", "About2", "Active", "ParmData", null);
                    info.NewsImgSrc      = GetImg("IndexImg", "EXHIBITION", "Active", "ParmData", null);
                    info.SupportImgSrc   = GetImg("IndexImg", "SUPPORT", "Active", "ParmData", null);
                    #endregion
                    #region get other url
                    var open = openLogic();
                    info.url_1 = (string)open.getParmValue(ParmDefine.url_1);
                    info.url_2 = (string)open.getParmValue(ParmDefine.url_2);
                    info.url_3 = (string)open.getParmValue(ParmDefine.url_3);
                    info.url_4 = (string)open.getParmValue(ParmDefine.url_4);
                    info.url_5 = (string)open.getParmValue(ParmDefine.url_5);
                    #endregion
                }
            }
            return(View("Index", info));
        }
예제 #2
0
        public ActionResult Index()
        {
            IndexInfo info = new IndexInfo();
            using (var db0 = getDB0())
            {
                #region banner
                info.banners = db0.Banner.Where(x => !x.i_Hide & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name).OrderByDescending(x => x.sort)
                                         .Select(x => new m_Banner()
                                         {
                                             banner_id = x.banner_id,
                                             banner_name = x.banner_name
                                         }).ToList();
                foreach (var i in info.banners)
                {
                    i.imgsrc = GetImg(i.banner_id.ToString(), "Banner", "Active", "BannerData", null);
                }
                #endregion
                if (System.Globalization.CultureInfo.CurrentCulture.Name == "ja-JP")
                {
                    #region get other img
                    info.NewProuctImgSrc = GetImg("IndexImg", "NewProduct_jp", "Active", "ParmData", null);
                    info.About1ImgSrc = GetImg("IndexImg", "About1_jp", "Active", "ParmData", null);
                    info.About2ImgSrc = GetImg("IndexImg", "About2_jp", "Active", "ParmData", null);
                    info.NewsImgSrc = GetImg("IndexImg", "EXHIBITION_jp", "Active", "ParmData", null);
                    info.SupportImgSrc = GetImg("IndexImg", "SUPPORT_jp", "Active", "ParmData", null);
                    #endregion
                    #region get other url
                    var open = openLogic();
                    info.url_1 = (string)open.getParmValue(ParmDefine.url_1_jp);
                    info.url_2 = (string)open.getParmValue(ParmDefine.url_2_jp);
                    info.url_3 = (string)open.getParmValue(ParmDefine.url_3_jp);
                    info.url_4 = (string)open.getParmValue(ParmDefine.url_4_jp);
                    info.url_5 = (string)open.getParmValue(ParmDefine.url_5_jp);
                    #endregion
                }
                else {
                    #region get other img
                    info.NewProuctImgSrc = GetImg("IndexImg", "NewProduct", "Active", "ParmData", null);
                    info.About1ImgSrc = GetImg("IndexImg", "About1", "Active", "ParmData", null);
                    info.About2ImgSrc = GetImg("IndexImg", "About2", "Active", "ParmData", null);
                    info.NewsImgSrc = GetImg("IndexImg", "EXHIBITION", "Active", "ParmData", null);
                    info.SupportImgSrc = GetImg("IndexImg", "SUPPORT", "Active", "ParmData", null);
                    #endregion
                    #region get other url
                    var open = openLogic();
                    info.url_1 = (string)open.getParmValue(ParmDefine.url_1);
                    info.url_2 = (string)open.getParmValue(ParmDefine.url_2);
                    info.url_3 = (string)open.getParmValue(ParmDefine.url_3);
                    info.url_4 = (string)open.getParmValue(ParmDefine.url_4);
                    info.url_5 = (string)open.getParmValue(ParmDefine.url_5);
                    #endregion
                }

            }
            return View("Index", info);
        }
        public ActionResult Index()
        {
            Page_Load();//人次計數
            IndexInfo info = new IndexInfo();

            using (var db0 = getDB0())
            {
                #region banner
                info.banners = db0.Banner.Where(x => !x.i_Hide).OrderByDescending(x => new { x.sort, x.banner_id })
                               .Select(x => new m_Banner()
                {
                    banner_id   = x.banner_id,
                    banner_name = x.banner_name,
                    banner_url  = x.banner_url
                }).ToList();
                foreach (var i in info.banners)
                {
                    i.imgsrc = GetImg(i.banner_id.ToString(), "Banner", "Active", "BannerData", null, false);
                }
                #endregion
                #region news
                info.news = db0.News.Where(x => !x.i_Hide).OrderByDescending(x => new { x.sort, x.day, x.news_id })
                            .Select(x => new m_News()
                {
                    news_id    = x.news_id,
                    day        = x.day,
                    news_title = x.news_title,
                    news_info  = x.news_info
                }).Take(3).ToList();
                #endregion
                #region banner
                info.brands = db0.Brand.Where(x => !x.i_Hide).OrderByDescending(x => new { x.sort, x.brand_id })
                              .Select(x => new m_Brand()
                {
                    brand_category_id = x.brand_category_id,
                    brand_id          = x.brand_id,
                    category_name     = x.BrandCategory.category_name,
                    brand_name        = x.brand_name
                }).ToList();
                foreach (var i in info.brands)
                {
                    i.imgsrc = GetImg(i.brand_id.ToString(), "Banner", "Active", "BrandData", null, true);
                }
                #endregion
                #region facebook
                var open = openLogic();
                info.facebook_url       = (string)open.getParmValue(ParmDefine.FacebookUrl);
                info.isClickIndex_Count = (int)open.getParmValue(ParmDefine.Count);
                #endregion
            }
            return(View("Index", info));
        }
 public ActionResult Index()
 {
     Page_Load();//人次計數
     IndexInfo info = new IndexInfo();
     using (var db0 = getDB0())
     {
         #region banner
         info.banners = db0.Banner.Where(x => !x.i_Hide).OrderByDescending(x => new { x.sort, x.banner_id })
                                  .Select(x => new m_Banner()
                                  {
                                      banner_id = x.banner_id,
                                      banner_name = x.banner_name,
                                      banner_url = x.banner_url
                                  }).ToList();
         foreach (var i in info.banners)
         {
             i.imgsrc = GetImg(i.banner_id.ToString(), "Banner", "Active", "BannerData", null, false);
         }
         #endregion
         #region news
         info.news = db0.News.Where(x => !x.i_Hide).OrderByDescending(x => new { x.sort, x.day, x.news_id })
                                  .Select(x => new m_News()
                                  {
                                      news_id = x.news_id,
                                      day = x.day,
                                      news_title = x.news_title,
                                      news_info = x.news_info
                                  }).Take(3).ToList();
         #endregion
         #region banner
         info.brands = db0.Brand.Where(x => !x.i_Hide).OrderByDescending(x => new { x.sort, x.brand_id })
                                  .Select(x => new m_Brand()
                                  {
                                      brand_category_id = x.brand_category_id,
                                      brand_id = x.brand_id,
                                      category_name = x.BrandCategory.category_name,
                                      brand_name = x.brand_name
                                  }).ToList();
         foreach (var i in info.brands)
         {
             i.imgsrc = GetImg(i.brand_id.ToString(), "Banner", "Active", "BrandData", null, true);
         }
         #endregion
         #region facebook
         var open = openLogic();
         info.facebook_url = (string)open.getParmValue(ParmDefine.FacebookUrl);
         info.isClickIndex_Count = (int)open.getParmValue(ParmDefine.Count);
         #endregion
     }
     return View("Index", info);
 }
예제 #5
0
        public ActionResult Index()
        {
            IndexInfo info = new IndexInfo();
            info.p_hot = new List<m_Product>();
            info.p_new = new List<m_Product>();
            info.p_top = new List<m_Product>();
            info.news = new List<m_News>();
            #region Get AllProductList
            using (var db0 = getDB0())
            {
                #region banner&firm
                info.banners = db0.Banner.Where(x => !x.i_Hide & x.type == (int)BannerType.banner).OrderByDescending(x => x.sort)
                                         .Select(x => new m_Banner()
                                         {
                                             banner_id = x.banner_id,
                                             banner_name = x.banner_name,
                                             show_name = x.show_name,
                                             style_string = x.style_string
                                         }).ToList();
                foreach (var i in info.banners)
                {
                    i.imgsrc = GetImg(i.banner_id.ToString(), "Banner", "Active", "BannerData", null);
                }
                info.firms = db0.Banner.Where(x => !x.i_Hide & x.type == (int)BannerType.firm).OrderByDescending(x => x.sort)
                         .Select(x => new m_Banner()
                         {
                             banner_id = x.banner_id,
                             banner_name = x.banner_name
                         }).ToList();
                foreach (var i in info.firms)
                {
                    i.imgsrc = GetImg(i.banner_id.ToString(), "Firm", "Active", "BannerData", null);
                }
                #endregion
                #region products
                var items = db0.Product.AsQueryable();
                info.p_hot = items.Where(x => !x.i_Hide & x.is_Hot).OrderByDescending(x => x.sort)
                                             .Select(x => new m_Product()
                                             {
                                                 product_no = x.product_no,
                                                 product_name = x.product_name,
                                                 price = x.price,//實際銷售價格
                                                 price_gen = x.price_gen,//一般價格
                                                 kvalue = x.kvalue,
                                                 i_InsertDateTime = x.i_InsertDateTime,
                                                 shipping_state = x.shipping_state
                                             }).Take(48).ToList();//只取前48筆
                info.p_new = items.Where(x => !x.i_Hide).OrderByDescending(x => x.i_InsertDateTime)
                                             .Select(x => new m_Product()
                                             {
                                                 product_no = x.product_no,
                                                 product_name = x.product_name,
                                                 price = x.price,//實際銷售價格
                                                 price_gen = x.price_gen,//一般價格
                                                 kvalue = x.kvalue,
                                                 i_InsertDateTime = x.i_InsertDateTime,
                                                 shipping_state = x.shipping_state
                                             }).Take(48).ToList();//只取前48筆
                info.p_top = items.Where(x => !x.i_Hide & x.is_TopSales).OrderByDescending(x => x.sort)
                                             .Select(x => new m_Product()
                                             {
                                                 product_no = x.product_no,
                                                 product_name = x.product_name,
                                                 price = x.price,//實際銷售價格
                                                 price_gen = x.price_gen,//一般價格
                                                 kvalue = x.kvalue,
                                                 i_InsertDateTime = x.i_InsertDateTime,
                                                 shipping_state = x.shipping_state
                                             }).Take(48).ToList();//只取前48筆

                foreach (var i in info.p_hot)
                {
                    i.imgsrc = GetImg(i.product_no, "List", "Active", "Product", null);//顯示list圖片
                }
                foreach (var i in info.p_new)
                {
                    i.imgsrc = GetImg(i.product_no, "List", "Active", "Product", null);//顯示list圖片
                }
                foreach (var i in info.p_top)
                {
                    i.imgsrc = GetImg(i.product_no, "List", "Active", "Product", null);//顯示list圖片
                }
                #endregion
                #region news
                info.news = db0.News.Where(x => !x.i_Hide).OrderByDescending(x => x.sort)
                                                             .Select(x => new m_News()
                                                             {
                                                                 news_id = x.news_id,
                                                                 news_content = x.news_content,
                                                                 news_title = x.news_title,
                                                                 news_date = x.news_date
                                                             }).Take(2).ToList();//只取前兩筆

                foreach (var i in info.news)
                {
                    if (i.news_content != null)
                    {
                        i.news_content = RemoveHTMLTag(i.news_content);
                    }
                    i.imgsrc = GetImg(i.news_id.ToString(), "List", "Active", "News", null);//顯示list圖片
                }
                #endregion
            }
            #endregion 
            return View("Index", info);
        }
예제 #6
0
        public ActionResult Index()
        {
            IndexInfo info = new IndexInfo();
            using (var db0 = getDB0())
            {
                #region Banner
                info.banner = db0.Banner.Where(x => x.i_Hide == false & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name).OrderByDescending(x => x.sort).Take(5).ToList();

                foreach (var item in info.banner)
                {
                    item.imgsrc = GetImg(item.banner_id, "Banner", "Banner", "Banner");//顯示列表圖
                }
                #endregion
                #region 行程
                string lang = System.Globalization.CultureInfo.CurrentCulture.Name;
                info.hot = db0.StudyAbroad.Where(x => x.i_Hide == false & x.is_hot & !x.is_past & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name).OrderByDescending(x => x.sort).Take(6).ToList();

                info.vacations = db0.All_Category_L2.Where(x => x.all_category_l1_id == CategoryType.Vacation_2 && x.i_Hide == false)
                                  .OrderByDescending(x => x.sort)
                                  .Take(2)
                                  .Select(x => new Vacation()
                                  {
                                      vacation_id = x.all_category_l2_id,
                                      vacation_name = x.l2_name,
                                      data = db0.StudyAbroad
                                                .Where(y => !y.i_Hide & !y.is_past & y.vacation_category == x.all_category_l2_id & y.i_Lang == lang)
                                                .OrderByDescending(y => y.sort).Take(6).ToList()
                                  }).ToList();

                foreach (var item in info.hot)
                {
                    item.imgsrc = GetImg(item.study_abroad_id, "Photo1", "StudyAbroad", "Photo");//顯示列表圖
                }
                foreach (var item in info.vacations)
                {
                    foreach (var i in item.data)
                    {
                        i.imgsrc = GetImg(i.study_abroad_id, "Photo1", "StudyAbroad", "Photo");//顯示列表圖
                    }
                }
                #endregion
                #region 最新消息
                info.news = db0.News.Where(x => x.i_Hide == false & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name).OrderByDescending(x => x.date).Take(4).ToList();
                foreach (var item in info.news)
                {
                    item.imgsrc = GetImg(item.news_id, "Photo1", "News", "Photo");//顯示列表圖
                }
                #endregion
                #region 留學遊學資訊
                info.helpfulinfo = db0.HelpfulInfo.Where(x => x.i_Hide == false && x.show_index & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name).OrderByDescending(x => x.sort).Take(4).ToList();
                foreach (var item in info.helpfulinfo)
                {
                    item.imgsrc = GetImg(item.helpful_info_id, "Photo1", "HelpfulInfo", "Photo");//顯示列表圖
                }
                #endregion
                #region 心得分享
                info.feedback = db0.Feedback.Where(x => x.i_Hide == false & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name).OrderByDescending(x => x.sort).Take(4).ToList();
                foreach (var item in info.feedback)
                {
                    item.imgsrc = GetImg(item.feedback_id, "Photo1", "Feedback", "Photo");//顯示列表圖
                    item.feedback_content = item.feedback_content == null ? "" : RemoveHTMLTag(item.feedback_content);
                }
                #endregion
                #region 精彩照片集
                info.albums = db0.Albums.Where(x => x.i_Hide == false & x.i_Lang == System.Globalization.CultureInfo.CurrentCulture.Name).OrderByDescending(x => x.sort).Take(8).ToList();
                foreach (var item in info.albums)
                {
                    item.imgsrc = GetImg(item.albums_id, "Photo1", "Albums", "Photo");//顯示列表圖
                }
                #endregion
            }
            return View(info);
        }