Пример #1
0
        public ActionResult Details(int?id)
        {
            shNewService _tintuc = new shNewService();
            shNew        tintuc  = _tintuc.FindList().Where(x => x.NewId == id).FirstOrDefault();

            if (tintuc == null)
            {
                tintuc = new shNew();
            }



            return(View(tintuc));
        }
Пример #2
0
        public IEnumerable <TimKiemNangCao> TimKiemNangCao(string keyword)
        {
            List <TimKiemNangCao> ds      = new List <TimKiemNangCao>();
            TimKiemNangCao        timkiem = new TimKiemNangCao();

            // 1. Tìm kiếm trong bảng sản phẩm
            shProductService        _product  = new shProductService();
            IEnumerable <shProduct> dsProduct = _product.FindList().Where(x => TypeHelper.CompareString(x.ProductName, keyword));

            foreach (var product in dsProduct)
            {
                timkiem             = new TimKiemNangCao();
                timkiem.CategoryId  = TheLoaiTimKiemNangCao.SanPham.GetHashCode();
                timkiem.Category    = "Sản phẩm";
                timkiem.Name        = product.ProductName;
                timkiem.MetaTitle   = product.MetaTitle + "-" + product.ProductId;
                timkiem.keyword     = keyword;
                timkiem.CreatedDate = product.CreateDate;
                timkiem.Description = " Bộ sản phẩm có kết cấu và giá sản phẩm: &nbsp;&nbsp;&nbsp;&nbsp; Kích ...";
                timkiem.ProductGuid = product.ProductGuid;
                ds.Add(timkiem);
            }


            // 3. Tìm kiếm trong bảng set sản phẩm
            shSectionService           _section = new shSectionService();
            IEnumerable <shProductSet> dsSet    = _section.FindList().Where(x => TypeHelper.CompareString(x.SectionName, keyword));

            foreach (var set in dsSet)
            {
                shProduct product = _product.FindByKey(set.ProductGuid);

                timkiem             = new TimKiemNangCao();
                timkiem.CategoryId  = TheLoaiTimKiemNangCao.SetSanPham.GetHashCode();
                timkiem.Category    = "Sản phẩm";
                timkiem.Name        = product.ProductName + "- Set " + set.SectionName + keyword;
                timkiem.MetaTitle   = product.MetaTitle + "-" + product.ProductId;
                timkiem.keyword     = keyword;
                timkiem.CreatedDate = set.CreateDate;
                timkiem.Description = " Bộ sản phẩm có kết cấu và giá sản phẩm: &nbsp;&nbsp;&nbsp;&nbsp; Kích ...";
                timkiem.ProductGuid = product.ProductGuid;
                ds.Add(timkiem);
            }

            // 4. Tìm kiếm trong bảng kích thước theo set
            shSizeService           _size  = new shSizeService();
            IEnumerable <shSetSize> dsSize = _size.FindList().Where(x => TypeHelper.CompareString(x.SizeName, keyword));

            foreach (var size in dsSize)
            {
                shProduct product = _product.FindByKey(size.ProductGuid);

                timkiem             = new TimKiemNangCao();
                timkiem.CategoryId  = TheLoaiTimKiemNangCao.SetSanPham.GetHashCode();
                timkiem.Category    = "Sản phẩm";
                timkiem.Name        = product.ProductName + " - Kích thước: " + size.SizeName;
                timkiem.MetaTitle   = product.MetaTitle + "-" + product.ProductId;
                timkiem.keyword     = keyword;
                timkiem.CreatedDate = size.CreateDate;
                timkiem.Description = " Bộ sản phẩm có kết cấu và giá sản phẩm: &nbsp;&nbsp;&nbsp;&nbsp; Kích ...";
                timkiem.ProductGuid = product.ProductGuid;
                ds.Add(timkiem);
            }


            // 2. Tìm kiếm trong bảng tin tức
            shNewService        _new  = new shNewService();
            IEnumerable <shNew> dsNew = _new.FindList().Where(x => TypeHelper.CompareString(x.TitleNew, keyword));

            foreach (var news in dsNew)
            {
                timkiem             = new TimKiemNangCao();
                timkiem.CategoryId  = TheLoaiTimKiemNangCao.TinTuc.GetHashCode();
                timkiem.Category    = "Tin Tức";
                timkiem.Name        = news.TitleNew;
                timkiem.MetaTitle   = news.MetaTitle + "-" + news.NewId;
                timkiem.keyword     = keyword;
                timkiem.CreatedDate = news.CreatedDate;
                timkiem.Description = news.Summary;
                ds.Add(timkiem);
            }

            return(ds);
        }