Exemple #1
0
        public MainWindowViewModel(IWebApiService webApiService, SearchSortService searchService)
        {
            this.webApiService = webApiService;
            this.searchService = searchService;

            CurrentPageCount   = Settings.Default.CountPerPage <= 0 ? 100 : Settings.Default.CountPerPage;
            CurrentSearchField = SearchFields.FirstOrDefault(x => x.FieldName == Settings.Default.SearchFieldName) ?? SearchFields[0];
            LastPage           = 1;
            CurrentPage        = 1;

            CurrentPrinter = Printers.FirstOrDefault(x => x.PrinterName == Settings.Default.DefaultPrinter);
        }
Exemple #2
0
        public ActionResult AppReCommendProduct(int pageIndex = 1, int pageSize = 10)
        {
            Parameters param = CreateParam(pageIndex, pageSize);

            if (Request.QueryString["IsCheckProduct"] != null && Request.QueryString["IsCheckProduct"] == "1")//剔除下架商品
            {
            }
            SearchSortService   dal   = new SearchSortService();
            XMLReturnClassLists model = dal.GetLists(param);//接口查询 商品列表

            ViewBag.pageIndex = pageIndex;
            ViewBag.pageSize  = pageSize;
            return(View(model));
        }
Exemple #3
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();

            System.Web.HttpContext.Current.Application.Lock();

            var productRepository = new ProductRepository();

            System.Web.HttpContext.Current.Application[Extensions.ProductRepositoryKey] = productRepository;

            var cardRepository = new CardRepository(productRepository);

            System.Web.HttpContext.Current.Application[Extensions.CardRepositoryKey] = cardRepository;

            var categoryService = new CategoryService(cardRepository);

            System.Web.HttpContext.Current.Application[Extensions.CategoryServiceKey] = categoryService;

            var scenarioService = new ScenarioService(productRepository, cardRepository);

            System.Web.HttpContext.Current.Application[Extensions.ScenarioServiceKey] = scenarioService;

            var ringsDbService = new RingsDbService(cardRepository);

            System.Web.HttpContext.Current.Application[Extensions.RingsDbKey] = ringsDbService;

            var advancedSearchService = new AdvancedSearchService();
            var sortService           = new SearchSortService(ringsDbService);

            var noteService = new NoteService();

            System.Web.HttpContext.Current.Application[Extensions.NoteServiceKey] = noteService;

            var searchService = new SearchService(productRepository, cardRepository, scenarioService, advancedSearchService, sortService, ringsDbService, noteService);

            System.Web.HttpContext.Current.Application[Extensions.SearchServiceKey] = searchService;

            var statService = new StatService(cardRepository);

            System.Web.HttpContext.Current.Application[Extensions.StatServiceKey] = statService;

            var octgnService = new OctgnService(productRepository, cardRepository);

            System.Web.HttpContext.Current.Application[Extensions.OctgnServiceKey] = octgnService;

            var templateService = new TemplateService();

            System.Web.HttpContext.Current.Application[Extensions.TemplateServiceKey] = templateService;

            var tagService = new TagService();

            System.Web.HttpContext.Current.Application[Extensions.TagServiceKey] = tagService;

            System.Web.HttpContext.Current.Application.UnLock();
        }
Exemple #4
0
        //修改热度
        public int EditeHotValue(string productNo, int hotValue, int sevenHotValue, int type)
        {
            SearchSortService dal = new SearchSortService();

            return(dal.EditeHotValue(productNo, hotValue, sevenHotValue, type));
        }
Exemple #5
0
        public ActionResult TopShopProductList(int pageIndex = 1, int pageSize = 10)
        {
            Parameters param = CreateParam(pageIndex, pageSize);

            if (Request.QueryString["IsRecord"] != null && Request.QueryString["IsRecord"] == "1")//说明是查询并保存
            {
                SWfsSortHistoryService sshsDal = new SWfsSortHistoryService();
                Passport passport = PresentationHelper.GetPassport();
                if (passport != null && !string.IsNullOrEmpty(passport.UserName))
                {
                    string thisUrl = Request.Url.ToString().Replace("http://" + Request.Url.Host, "").Replace("IsRecord", "IsRecoaddrd");
                    if (!string.IsNullOrEmpty(Request.QueryString["ProductName"]) && Request.QueryString["ProductName"] != "")
                    {
                        string ProductName = Server.UrlDecode(Request.QueryString["ProductName"]);
                        ProductName = ProductName.Replace(" ", "+");
                        thisUrl     = thisUrl.Replace(ProductName, Server.UrlEncode(Request.QueryString["ProductName"]));
                    }
                    sshsDal.InsertHistory(param, thisUrl, passport.UserName);
                    return(Redirect(thisUrl));
                }
            }

            SearchSortService dal = new SearchSortService();
            //param.brandNO = "B1885";
            XMLReturnClassLists model = dal.GetTopShopLists(param);//接口查询 商品列表

            //按品牌编号查询修改热度的商品列表
            if (model.ListProducts.Count() > 0)
            {
                IEnumerable <ProductHot> hotProductList = dal.GetProductListByProductNoList(model.ListProducts.Select(p => p.ProductNo));
                for (int i = 0; i < model.ListProducts.Count; i++)
                {
                    if (hotProductList.Count(p => p.ProductNo == model.ListProducts[i].ProductNo) > 0)
                    {
                        model.ListProducts[i].EditeHot      = model.ListProducts[i].Hot + hotProductList.Where(p => p.ProductNo == model.ListProducts[i].ProductNo).ElementAt(0).ProductHotValue;
                        model.ListProducts[i].EditeSevenHot = model.ListProducts[i].SevenHot + hotProductList.Where(p => p.ProductNo == model.ListProducts[i].ProductNo).ElementAt(0).ProductSevenHotValue;
                    }
                    else
                    {
                        model.ListProducts[i].EditeHot      = model.ListProducts[i].Hot;
                        model.ListProducts[i].EditeSevenHot = model.ListProducts[i].SevenHot;
                    }
                }
            }

            ProductSortService tian       = new ProductSortService();
            string             categoryNo = string.Empty;

            if (!string.IsNullOrEmpty(param.categoryNO))
            {
                categoryNo = param.categoryNO;
            }
            else
            {
                categoryNo = param.brandNO;
            }
            //IEnumerable<SWfsSortProduct> saveProductList = tian.GetSortProductList(categoryNo);
            //if (saveProductList.Count() > 0)
            //{
            //    for (int i = 0; i < model.ListProducts.Count; i++)//对比商品是否已经加入排序池
            //    {
            //        if (saveProductList.Count(q => q.ProductNo == model.ListProducts.ElementAt(i).ProductNo) > 0)
            //        {
            //            model.ListProducts.ElementAt(i).IsSelected = 1;
            //        }
            //    }
            //}
            List <SearchResultCategorys> result = new List <SearchResultCategorys>();

            //分类递归
            if (!string.IsNullOrEmpty(Request.QueryString["categoryNO"]) && Request.QueryString["categoryNO"].Length >= 3)
            {
                List <SearchResultCategorys> first = model.ListCategorys.Where(p => p.CategoryNo.Contains(Request.QueryString["categoryNO"]) && p.CategoryNo.Length == (Request.QueryString["categoryNO"].Length + 3)).ToList();
                List <SearchResultCategorys> second;
                List <SearchResultCategorys> third;
                for (int i = 0; i < first.Count; i++)
                {
                    result.Add(first[i]);
                    second = model.ListCategorys.Where(p => p.PrentNo == first[i].CategoryNo).ToList();
                    for (int j = 0; j < second.Count; j++)
                    {
                        second[j].CateGoryName = "|-" + second[j].CateGoryName;
                        result.Add(second[j]);
                        third = model.ListCategorys.Where(p => p.PrentNo == second[j].CategoryNo).ToList();
                        for (int k = 0; k < third.Count; k++)
                        {
                            third[k].CateGoryName = "|-|-" + third[k].CateGoryName;
                            result.Add(third[k]);
                        }
                    }
                }
                first  = null;
                second = null;
                third  = null;
            }
            else
            {
                List <SearchResultCategorys> first = model.ListCategorys.Where(p => p.CateGoryLevel == 2).ToList();
                List <SearchResultCategorys> second;
                List <SearchResultCategorys> third;
                for (int i = 0; i < first.Count; i++)
                {
                    result.Add(first[i]);
                    second = model.ListCategorys.Where(p => p.PrentNo == first[i].CategoryNo).ToList();
                    for (int j = 0; j < second.Count; j++)
                    {
                        second[j].CateGoryName = "|-" + second[j].CateGoryName;
                        result.Add(second[j]);
                        third = model.ListCategorys.Where(p => p.PrentNo == second[j].CategoryNo).ToList();
                        for (int k = 0; k < third.Count; k++)
                        {
                            third[k].CateGoryName = "|-|-" + third[k].CateGoryName;
                            result.Add(third[k]);
                        }
                    }
                }
                first  = null;
                second = null;
                third  = null;
            }
            model.ListCategorys = result;
            //model.SaveProductCount = saveProductList.Count();
            SWfsSortHistoryService  HistoryDal  = new SWfsSortHistoryService();
            IList <SWfsSortHistory> listHistory = HistoryDal.SelectHistory();

            ViewBag.listHistory = listHistory;
            return(View(model));
        }