Exemple #1
0
        public Tuple <string, int> Fetch()
        {
            var result = new Tuple <string, int>(string.Empty, 0);
            //获取需要更新商品的店铺:
            var shop = ShopDataAccess.GetTopShop();

            if (shop.IsNull())
            {
                return(new Tuple <string, int>(string.Empty, 0));
            }

            var fetcher  = FetcherFactory.CreateFetcher(shop.ShopUrl);
            var products = fetcher.GetProducts(shop.ShopUrl.Trim().Trim('/'));

            if (products.Count > 8)
            {
                //删除原来的商品:
                ProductDataAccess.DeleteProduct(shop.ID);
                ProductDataAccess.InsertProducts(products, shop.ID);

                ShopDataAccess.UpdateShopAsyncDate(shop.ID);
            }

            shop.FetchDate = DateTime.Now;
            ShopDataAccess.UpdateFetchDate(shop.ID);

            return(new Tuple <string, int>(string.Format("获取店铺:{0}完成,总过获取商品数量为:{1}个", shop.ShopName, products.Count / 2), shop.ID));
        }
Exemple #2
0
        private void DeleteProduct(Model.Product.Product product)
        {
            if (product == null)
            {
                throw new ArgumentNullException("product", Resources.MsgInvalidProduct);
            }

            _productDataAccess.DeleteProduct(product);
        }
        public ActionResult DeleteProduct(int productID)
        {
            if ((string)Session["roleName"] == "admin")
            {
                // pass the id to the method then to the DAL
                _productDataAccess.DeleteProduct(productID);
            }

            // return the view products page
            return(RedirectToAction("ViewProducts"));
        }
        public ActionResult ConfirmDelete(int id)
        {
            ProductDataAccess pda = new ProductDataAccess();
            int i = pda.DeleteProduct(id);

            if (i > 0)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }
Exemple #5
0
        public JsonResult DeleteDataProduct(int paramId)
        {
            string latestCode = ProductDataAccess.DeleteProduct(paramId);

            if (latestCode != "")
            {
                return(Json(new { success = true, latestCode, message = ProductDataAccess.Message }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { success = false, message = ProductDataAccess.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #6
0
 public void DeleteProduct(Movie product)
 {
     _productDataAccess.DeleteProduct(product);
 }