示例#1
0
        public void SetData(string lang)
        {
            int lang_type = LangConverter.Convert(lang);


            this.Pro_kind = ProductService.GetAllCategory(lang_type);


            this.Solution_Kind       = this.Solutionservice.GetAllCategory(lang_type);
            this.Solution_Kind_Top10 = this.Solution_Kind.OrderBy(e => e.num).Take(10);

            //CarouselService carouselservice = new CarouselService(Location);
            this.Carousel = this.CarouselService.GetCarouselAllForExpire(lang_type);

            //NewService newService = new NewService(Location);
            this.News_FinTop  = this.NewService.GetTopNews(lang_type, 3, 5);
            this.News_ProdTop = this.NewService.GetTopNews(lang_type, 2, 5);
            this.News_NewTop  = this.NewService.GetTopNews(lang_type, 1, 3);

            //VideoService videoService = new VideoService(Location);

            DemoCode = this.VideoService.GetAll().Where(e => e.StatVoid == 0 &&
                                                        e.Demo == 1)
                       .FirstOrDefault().Url;
        }
        public void SetData(int num, string lang)
        {
            this.Num  = num;
            this.Lang = lang;

            //ProductService productservice = new ProductService(Location);
            Current = _productservice.GetProductDetail(num);

            int lang_type = LangConverter.Convert(lang);

            if (Current != null)
            {
                Parent = _productservice
                         .GetProductFirstCategory(lang_type, Convert.ToInt32(Current.ProKind)).FirstOrDefault();

                SuperParent = _productservice
                              .GetProductFirstCategory(lang_type, Convert.ToInt32(Parent.Root)).FirstOrDefault();
            }


            //麵包屑
            ParentList = _productservice.GetProdkindParent(Convert.ToInt32(Current.ProKind));

            this.Carousels = _productservice.GetParentForCarcoual(Current.ProKind);
        }
        public override void SetData(string lang, int num)
        {
            //ProductService productService = new ProductService(Location);


            this.Num  = num;
            this.Lang = lang;
            int lang_type = LangConverter.Convert(Lang);

            //tree view
            this.pro_kinds = _productservice.GetCateAll(lang_type);

            //product category
            this.prod_category = _productservice
                                 .GetParentCategoryByPage(num, lang_type, 0);



            var parent = _productservice.GetProductFirstCategory(lang_type, num).FirstOrDefault();

            if (parent != null)
            {
                this.Title       = parent.Kind;
                this.Desc        = parent.Words;
                this.BannerImage = parent.Pic2;
                Pro_kinds        = _productservice.GetProductSecondCategory(lang_type, num);
            }
        }
示例#4
0
        //[OutputCache(Duration = 1300)]
        public ActionResult GetSubTree(string lang, int num)
        {
            //ProKindDAL prodal = new ProKindDAL(this.Site);
            int lang_type = LangConverter.Convert(lang.Trim());
            IEnumerable <ProKindNew> pro_kinds = _proKindDAL.GetByLangRoot(lang_type, num);

            return(PartialView("_SubProductTree", pro_kinds));
        }
示例#5
0
        //[OutputCache(Duration = 1300)]
        public ActionResult GetProductTree(string lang, int num, int currentnum, int subnum)
        {
            //ProductService service = new ProductService(this.Site);
            ViewBag.currentnum = currentnum;
            ViewBag.subnum     = subnum;
            //TempData["subnum"] = subnum;
            int lang_type = LangConverter.Convert(lang);
            IEnumerable <OfficialDAL.zp_get_cate_all_Result> pro_kinds = _prodService.GetCateAll(lang_type);

            return(PartialView("_ParentProductTree", pro_kinds));
        }
        public void SetData(int num, string lang, int?page)
        {
            this.Num  = num;
            this.Lang = lang;

            int currentPageIndex = page.HasValue ? page.Value - 1 : 0;

            if (currentPageIndex < 0)
            {
                currentPageIndex = 0;
            }

            int lang_type = LangConverter.Convert(lang);

            //ProductService productService = new ProductService(Location);

            Current = _productservice.GetProductFirstCategory(lang_type, num).FirstOrDefault();

            ChildSub = _productservice.GetByLangRootByid(lang_type, Current.Num).ToList().FirstOrDefault();

            //麵包屑
            ParentList = _productservice.GetProdkindParent(num);

            Parent = _productservice.GetProductFirstCategory(lang_type, (int)Current.Root).FirstOrDefault();

            //leaf
            if (ChildSub == null)
            {
                /*
                 * Child = _productservice.GetSubCategoryByPage(num, lang_type, 1000, 0).ToList()
                 *  .ToPagedList(currentPageIndex, defaultPageIndex);*/
                int offset = (defaultPageIndex * currentPageIndex) - defaultPageIndex;

                var query = _productservice.GetSubCategoryByPage(num, lang_type, 1000, 0).OrderBy(x => x.num)
                            .Select(p => p)
                            .Skip(offset)
                            .Take(defaultPageIndex);

                var result = new PagedResult <zp_get_sub_cate_by_page_Result>();
                result.Data       = query.ToList();
                result.TotalItems = query.ToList().Count;
                result.PageNumber = currentPageIndex;
                result.PageSize   = defaultPageIndex;
                this.Child        = result;
            }

            //tree view
            pro_kinds = _productservice.GetCateAll(lang_type);

            //get subs
            //sub_pro_kinds= _proKindDAL.GetByLangRoot(lang_type, num);
        }
示例#7
0
        /// <summary>
        /// Action uset lo log in a user after he has entered his credentials.
        /// </summary>
        public ActionResult Signin(string emailOrLogin, string password, string language)
        {
            string  passwordHash = Sha256Hash.Calculate(password);
            UserDto user         = service.AuthenticateUser(emailOrLogin, passwordHash);

            if (user == null)
            {
                TempData["LogonFailed"] = true;
                return(View("Logon"));
            }
            Session["User"] = UserAssembler.FromDtoToDomainObject(user);
            Session["Lang"] = LangConverter.Convert(language);
            return(RedirectToAction("Index", "Vehicles"));
        }
示例#8
0
        public IEnumerable <zp_get_pronews_list_Result> GetProkindlist(string lang)
        {
            {
                Func <IEnumerable <zp_get_pronews_list_Result> > func = new Func <IEnumerable <zp_get_pronews_list_Result> >(() =>
                {
                    int lang_type   = LangConverter.Convert(lang);
                    var prokind_new = _entity.zp_get_pronews_list(lang_type).ToList();

                    return(prokind_new);
                });

                return(_adapter.Catch <IEnumerable <zp_get_pronews_list_Result> >(func));
            }
        }
示例#9
0
        public ActionResult GetParentCategory(int num, string lang, int pageindex)
        {
            int lang_type = LangConverter.Convert(lang);

            IEnumerable <zp_get_parent_cate_by_page_Result> model = _prodService
                                                                    .GetParentCategoryByPage(num, lang_type, pageindex);

            int Col = (int)TempData["Col"];

            ViewBag.Col = (Col < 3) ? 6 : 4;

            if (Col == 1)
            {
                ViewBag.Col = 8;
            }
            ViewBag.Col = 4;

            return(PartialView("_ParentCate", model));
        }
        public void GetSubCategory(int num, string lang, int pageindex, int?page)
        {
            int lang_type = LangConverter.Convert(lang);
            //ProductService service = new ProductService(Site);
            //IEnumerable<zp_get_sub_cate_by_page_Result> model = service.GetSubCategoryByPage(num, lang_type, 3, pageindex);

            int currentPageIndex = page.HasValue ? page.Value - 1 : 0;

            if (currentPageIndex < 0)
            {
                currentPageIndex = 0;
            }
            currentPageIndex++;

            CancellationToken cancellationToken = default(CancellationToken);

            cancellationToken.ThrowIfCancellationRequested();
            int pageSize = 3;
            int offset   = (pageSize * currentPageIndex) - pageSize;

            var datas = _productservice.GetSubCategoryByPage(num, lang_type, 13, 0);

            var query = datas
                        .OrderByDescending(x => x.num)
                        .Select(p => p)
                        .Skip(offset)
                        .Take(pageSize)
            ;

            this.SubPageModel       = new PagedResult <zp_get_sub_cate_by_page_Result>();
            SubPageModel.Data       = query.ToList();
            SubPageModel.TotalItems = datas.Count();//query.ToList().Count();
            SubPageModel.PageNumber = currentPageIndex;
            SubPageModel.PageSize   = pageSize;


            /*
             * IPagedList<zp_get_sub_cate_by_page_Result> model =
             *  _prodService.GetSubCategoryByPage(num, lang_type, 13, pageindex)
             *  .ToPagedList(currentPageIndex, 3);
             */

            //int Col = (int)TempData["Col"];
            //ViewBag.Col = (Col < 3) ? 6 : 4;
            //ViewBag.Lang = lang;
            //if (Col == 1)
            //{
            //    ViewBag.Col = 8;
            //}

            //return PartialView("_SubCate", model);


            //else
            //{

            //    int lang_type = LangConverter.Convert(lang);
            //    //ProductService service = new ProductService(Site);
            //    IEnumerable<zp_get_parent_cate_by_page_Result> model = _productservice
            //        .GetParentCategoryByPageSize(num, lang_type, 100, pageindex);

            //    return PartialView("_SubCate2", model);
            //}
        }