public virtual List<DishesTyep> GetDish(List<DishesTyep> dishesTyepList)
 {
     foreach (var dishType in dishesTyepList)
     {
         var nextPageUrl = GetDishUrl(dishType);
         while (!string.IsNullOrEmpty(nextPageUrl))
         {
             var baseCollectionSite = new BaseCollectionSite(nextPageUrl);
             var dishTypeHtmlNode = baseCollectionSite.BaseHtmlNode;
             var dishesNodeList = dishTypeHtmlNode.SelectNodes(DishPath());
             if (dishesNodeList == null)
             {
                 continue;
             }
             SaveIngDish(dishType.DishesTypeName, string.Empty);
             foreach (var dishesNode in dishesNodeList)
             {
                 var dishes = GetDishes(dishType, dishesNode);
                 if (dishes.IsNull)
                 {
                     continue;
                 }
                 dishType.DishesList.Add(dishes);
                 SaveIngDish(dishType.DishesTypeName, dishes.DishesName);
             }
             nextPageUrl = GetNextPageUrl(dishTypeHtmlNode);
         }
     }
     FinishSaveDish();
     return dishesTyepList;
 }
 protected override List<Maticsoft.Model.DishesTyep> GetSiteDishTypeList()
 {
     var baseCollectionSite = new BaseCollectionSite(PageUrl);
     var dishTypeStr = baseCollectionSite.BaseHtmlNodeByGBK.InnerText.Replace("jsonp78(", string.Empty).Replace(@")", string.Empty).Trim();
     var mainResult = JsonHelper.JsonToObj<MainResult>(dishTypeStr) ?? new MainResult();
     var dishesTypeList = new List<Maticsoft.Model.DishesTyep>();
     foreach (var dishItem in mainResult.List)
     {
         var dishesType = new Maticsoft.Model.DishesTyep();
         dishesType.BusinessID = StoreInfo.OldStoreId;
         dishesType.DishesTypeID = Guid.NewGuid().ToString();
         dishesType.DishesTypeName = dishItem.cat.Name;
         var dishesList = (
                          from dishesTaoBao in dishItem.item
                          select new DishesEntity()
                          {
                              DishesID = Guid.NewGuid().ToString(),
                              DishesName = dishesTaoBao.DishName,
                              DishesUnit = string.IsNullOrEmpty(dishesTaoBao.DishesUnit) ? "份" : dishesTaoBao.DishesUnit,
                              DishesMoney = dishesTaoBao.itemPrice,
                              BusinessID = StoreInfo.OldStoreId,
                              DishesTypeID = dishesType.DishesTypeID,
                          }).ToList();
         dishesType.DishesList.AddRange(dishesList);
         dishesTypeList.Add(dishesType);
     }
     return dishesTypeList;
 }
 protected void CollectionPicture(StoreInfo storeInfo, BusPhotoAlbumTable busphotoAlbumTable, string albumType)
 {
     var picPath = ".//div[@class='w_100']/div[@class='w_100 fleft ']/div[@class='w980 center']/div[@class='w980 fleft']/div[@class='shopmid']/div[@class='shopw']/div[@id='pic_list']/div[@class='item_box']/div[@class='item masonry_brick']/div[@class='item_t']/div[@class='img']/a/img";
     if (albumType == "h")
     {
         picPath = ".//div[@class='w_100']/div[@class='w_100 fleft ']/div[@class='w980 center']/div[@class='w980 fleft']/div[@class='shopmid']/div[@class='shopw']/div[@class='pic_huanj']/ul/li/div[@class='hjtp_box']/div[@class='hjtpw center']/div[@class='hjtpw fleft']/a/img";
     }
     for (int i = 1; i < 500; i++)
     {
         var baseCollectionSite = new BaseCollectionSite(string.Format(PageUrl, storeInfo.Fid, albumType, i));
         var pictureHtmlNode = baseCollectionSite.BaseHtmlNode;
         var pictureNodeList = pictureHtmlNode.SelectNodes(picPath);
         if (pictureNodeList == null)
         {
             break;
         }
         if (pictureNodeList.Count <= 1)
         {
             var picNode = pictureNodeList.FirstOrDefault();
             if (picNode == null)
             {
                 break;
             }
             var picturePathName = picNode.Attributes["src"].Value;
             if (picturePathName.Contains("bctp_28.gif"))
             {
                 break;
             }
         }
         //SavePicture(storeInfo, pictureNodeList, busphotoAlbumTable);
     }
 }
 public HtmlNodeCollection GetDishInfoList(HtmlNode dishTypeNode)
 {
     var baseCollectionSite = new BaseCollectionSite(PageUrl);
     var dishNodeList = dishTypeNode.SelectNodes(DishesPath());
     if (dishNodeList == null || dishNodeList.Count <= 0)
     {
         return new HtmlNodeCollection(null);
     }
     var scripNode = dishTypeNode.SelectSingleNode(@"./../../../../..//div[@class='rec-dishes tab-item active']/div[@class='pic-list J_toggle']/ul/script");
     if (scripNode != null && !string.IsNullOrWhiteSpace(scripNode.InnerText))
     {
         var liNodeList = baseCollectionSite.BaseHtmlNodeCollection(scripNode.InnerText);
         if (liNodeList != null)
         {
             var dishLiList = liNodeList.SelectNodes(".//li");
             if (dishLiList != null)
             {
                 foreach (var dishLi in dishLiList)
                 {
                     dishNodeList.Add(dishLi);
                 }
             }
         }
     }
     return dishNodeList;
 }
 protected override void CollectionPicture(StoreInfo storeInfo, BusPhotoAlbumTable busphotoAlbumTable, string albumType)
 {
     var baseCollectionSite = new BaseCollectionSite(string.Format(PageUrl, storeInfo.Fid, albumType));
     var pictureHtmlNode = baseCollectionSite.BaseHtmlNode;
     var pictureNodeList = pictureHtmlNode.SelectNodes(PicturePath);
     if (pictureNodeList == null)
     {
         return;
     }
     SavePicture(storeInfo, pictureNodeList, busphotoAlbumTable);
 }
        public void GetPicture(Maticsoft.Model.StoreInfo storeInfo)
        {
            DeletePicture(storeInfo.storeId);
            const string picturePath = @".//div[@class='dc_center']/div[@class='xq_top']/div[@class='xq_top_left']/div[@class='fangda']/div[@id='preview']/div[@id='spec-n5']/div[@id='spec-list']/ul[@class='list-h']/li/img";
            var baseCollectionSite = new BaseCollectionSite(string.Format(PageUrl, storeInfo.Fid));
            var pictureHtmlNode = baseCollectionSite.BaseHtmlNode;
            var pictureNodeList = pictureHtmlNode.SelectNodes(picturePath);

            var busphotoAlbumTable = BuildBusPhotoAlbumTable(storeInfo);
            SavePicture(storeInfo, pictureNodeList, busphotoAlbumTable);
        }
        public List<DishType> GetDishType()
        {
            var dishTypeList = new List<DishType>();
            var dishesTypePath = @"//*[@id='menu']/[@class='clearboth']";
            var baseCollectionSite = new BaseCollectionSite(PageUrl);
            var dishTypeHtmlNode = baseCollectionSite.BaseHtmlNode;
            var dishTypeNodeList = dishTypeHtmlNode.SelectNodes(dishesTypePath);
            if (dishTypeNodeList == null || dishTypeNodeList.Count <= 0)
            {
                return dishTypeList;
            }
            foreach (var dishTypeNode in dishTypeNodeList)
            {
                var dishTypeID = Guid.NewGuid();
                var dishTypeName = dishTypeNode.InnerText;
                var dishTypeInfo = new DishType
                {
                    PkID = dishTypeID,
                    DishName = dishTypeName
                };
                dishTypeList.Add(dishTypeInfo);
                var dishNode = dishTypeNode.NextSibling;
                int dishID = 1;
                while (dishNode != null)
                {
                    var dishInfoList = dishNode.SelectNodes("//li");
                    if (dishInfoList == null)
                    {
                        break;
                    }
                    foreach (var dishInfo in dishInfoList)
                    {
                        var dishNameNode = dishInfo.SelectSingleNode(".//p/strong");
                        if (dishNameNode != null)
                        {
                            var dishName = dishNameNode.Attributes["title"].Value;
                            var dishPriceNode = dishInfo.SelectSingleNode(".//p/span");
                            var dishImg = dishInfo.SelectSingleNode(".//p/img");
                            var dishPrice = dishPriceNode != null ? dishInfo.InnerText.Replace("¥", string.Empty).Replace("元", string.Empty).Trim() : string.Empty;

                        }
                    }
                    dishNode = dishNode.NextSibling;
                }
            }
            return dishTypeList;
        }
 protected virtual HtmlAgilityPack.HtmlNodeCollection GetSiteDishTypeList()
 {
     var baseCollectionSite = new BaseCollectionSite(PageUrl);
     var dishTypeHtmlNode = baseCollectionSite.BaseHtmlNode;
     var dishNodeList = dishTypeHtmlNode.SelectNodes(DishesTypePath());
     return dishNodeList;
 }
 protected virtual void CollectionPicture(Maticsoft.Model.StoreInfo storeInfo, Maticsoft.Model.BusPhotoAlbumTable busphotoAlbumTable, string albumType)
 {
     var baseCollectionSite = new BaseCollectionSite(string.Format(PageUrl, storeInfo.Fid));
     var pictureHtmlNode = baseCollectionSite.BaseHtmlNode;
     var pictureNodeList = pictureHtmlNode.SelectNodes(PicturePath);
     SavePicture(storeInfo, pictureNodeList, busphotoAlbumTable);
 }
        public List<DishType> GetDishType()
        {
            var dishTypeList = new List<DishType>();
            const string dishesTypePath = @".//div[@class='shop-wrap ']/div[@class='main']/div[@id='dish-tag']/div[@class='tab-container']/div[@class='rec-dishes tab-item active']/div/ul/li";
            var baseCollectionSite = new BaseCollectionSite(PageUrl);
            var dishTypeHtmlNode = baseCollectionSite.BaseHtmlNode;
            var dishNodeList = dishTypeHtmlNode.SelectNodes(dishesTypePath);
            if (dishNodeList == null || dishNodeList.Count <= 0)
            {
                return dishTypeList;
            }

            var scripNode = baseCollectionSite.BaseHtmlNode.SelectSingleNode(@".//div[@class='shop-wrap ']/div[@class='main']/div[@id='dish-tag']/div[@class='tab-container']/div[@class='rec-dishes tab-item active']/div[@class='pic-list J_toggle']/ul/script");
            if (scripNode != null && !string.IsNullOrWhiteSpace(scripNode.InnerText))
            {
                var liNodeList = baseCollectionSite.BaseHtmlNodeCollection(scripNode.InnerText);
                if (liNodeList != null)
                {
                    var dishLiList = liNodeList.SelectNodes(".//li");
                    if (dishLiList != null)
                    {
                        foreach (var dishLi in dishLiList)
                        {
                            dishNodeList.Add(dishLi);
                        }
                    }
                }
            }
            int dishID = 1;
            var dishTypeID = Guid.NewGuid();
            const string dishTypeName = @"推荐菜";
            var dishTypeInfo = new DishType
            {
                PkID = dishTypeID,
                DishName = dishTypeName,
                DishesList = new List<int>(),
            };

            foreach (var dishNode in dishNodeList)
            {
                var dishNameNode = dishNode.SelectSingleNode("./div[@class='pic-name']/a");
                var dishPriceNode = dishNode.SelectSingleNode("./div[@class='pic-name']/span");
                var dishImg = dishNode.SelectSingleNode(".//a/img");
                if (dishNameNode == null)
                {
                    continue;
                }
                var dishName = dishNameNode.InnerText;
                var dishPrice = dishPriceNode == null ? "0" : dishPriceNode.InnerText.Replace("¥", string.Empty);
                var dianPingDishes = new DianPingDishes();
                dianPingDishes.DishID = dishID;
                dianPingDishes.DishTypeID = dishTypeID.ToString();
                if (string.IsNullOrWhiteSpace(dishName))
                {
                    continue;
                }
                if (string.IsNullOrWhiteSpace(dishPrice))
                {
                    dishPrice = "0";
                }
                dianPingDishes.DishName = dishName;
                dianPingDishes.DishesMoney = dishPrice;
                if (dishImg != null)
                {
                    if (dishImg.Attributes.Contains("src"))
                    {
                        dianPingDishes.PictureName = dishImg.Attributes["src"].Value;
                    }
                    else if (dishImg.Attributes.Contains("data-src"))
                    {
                        dianPingDishes.PictureName = dishImg.Attributes["data-src"].Value;
                    }
                }
                _generalEntityList.Add(dianPingDishes);
                dishTypeInfo.DishesList.Add(dianPingDishes.DishID);
                dishID += 1;
            }

            dishTypeList.Add(dishTypeInfo);

            return dishTypeList;
        }
        public List<DishType> GetDishType()
        {
            var dishTypeList = new List<DishType>();
            var dishesTypePath =
                @".//div[@class='dc_center']/div[@class='xq_ment']/div[@class='xq_ment_left ']/div/div[@class='dc_list']/ul/li";
            var baseCollectionSite = new BaseCollectionSite(PageUrl);
            var dishTypeHtmlNode = baseCollectionSite.BaseHtmlNode;
            var dishNodeList = dishTypeHtmlNode.SelectNodes(dishesTypePath);
            if (dishNodeList == null || dishNodeList.Count <= 0)
            {
                return dishTypeList;
            }
            int dishID = 1;
            var dishTypeID = Guid.NewGuid();
            var dishTypeName = @"推荐菜";
            var dishTypeInfo = new DishType
            {
                PkID = dishTypeID,
                DishName = dishTypeName,
                DishesList = new List<int>(),
            };
            foreach (var dishNode in dishNodeList)
            {
                var dishNameNode = dishNode.SelectSingleNode(".//h3/a");
                var dishPriceNode = dishNode.SelectSingleNode(".//h4/span[1]/font");
                var dishImg = dishNode.SelectSingleNode(".//div[@class='dc_l_img']/a/img");
                if (dishNameNode == null || dishPriceNode == null)
                {
                    continue;
                }
                var dishName = dishNameNode.InnerText;
                var dishPrice = dishPriceNode.InnerText.Replace("¥", string.Empty);
                var echieleDishes = new EchieleDishes();
                echieleDishes.DishID = dishID;
                echieleDishes.DishTypeID = dishTypeID.ToString();
                echieleDishes.DishName = dishName;
                echieleDishes.DishesMoney = dishPrice;
                if (dishImg != null)
                {
                    echieleDishes.PictureName = dishImg.Attributes["src"].Value;
                }
                _generalEntityList.Add(echieleDishes);
                dishTypeInfo.DishesList.Add(echieleDishes.DishID);
                dishID += 1;
            }
            dishTypeList.Add(dishTypeInfo);

            return dishTypeList;
        }
 protected virtual IEnumerable<HtmlNode> GetCatalogueList()
 {
     var baseCollectionSite = new BaseCollectionSite(PageUrl);
     var catalogueHtmlNode = baseCollectionSite.BaseHtmlNode;
     if (catalogueHtmlNode == null)
     {
         return null;
     }
     GetPageNum(catalogueHtmlNode);
     var restaurantList = catalogueHtmlNode.SelectNodes(CataloguePath);
     return restaurantList;
 }
        public List<DishType> GetDishType()
        {
            var dishTypeList = new List<DishType>();
            var dishesTypePath = @".//div[@align='center']/div[@id='container']/div[@id='content']/div[@id='menu']/h3[@class='clearboth']";
            var baseCollectionSite = new BaseCollectionSite(PageUrl);
            var dishTypeHtmlNode = baseCollectionSite.BaseHtmlNode;
            var dishTypeNodeList = dishTypeHtmlNode.SelectNodes(dishesTypePath);
            if (dishTypeNodeList == null || dishTypeNodeList.Count <= 0)
            {
                return dishTypeList;
            }
            int dishID = 1;
            var dishTypeID = Guid.NewGuid();
            foreach (var dishTypeNode in dishTypeNodeList)
            {
                dishTypeID = Guid.NewGuid();
                var dishTypeName = dishTypeNode.InnerText;
                var dishTypeInfo = new DishType
                {
                    PkID = dishTypeID,
                    DishName = dishTypeName,
                    DishesList = new List<int>(),
                };
                var dishNode = dishTypeNode.NextSibling;
                while (dishNode != null)
                {
                    if (dishNode.InnerHtml.Contains("返回顶部"))
                    {
                        break;
                    }
                    var dishInfoList = dishNode.SelectNodes(".//li");
                    dishNode = dishNode.NextSibling;
                    if (dishInfoList == null)
                    {
                        continue;
                    }
                    foreach (var dishInfo in dishInfoList)
                    {
                        var dishNameNode = dishInfo.SelectSingleNode(".//p/strong");
                        if (dishNameNode != null)
                        {
                            var dishName = dishNameNode.Attributes["title"].Value;
                            if (string.IsNullOrEmpty(dishName))
                            {
                                continue;
                            }
                            var dishPriceNode = dishInfo.SelectSingleNode(".//p/span");
                            var dishImg = dishInfo.SelectSingleNode("./img");
                            var dishPrice = dishPriceNode != null ? dishPriceNode.InnerText.Replace("¥", string.Empty).Replace("元", string.Empty).Replace("&nbsp;", string.Empty).Trim() : string.Empty;
                            var cyooyDishes = new CyooyDishes();
                            cyooyDishes.DishID = dishID;
                            cyooyDishes.DishTypeID = dishTypeID.ToString();
                            cyooyDishes.DishName = dishName;
                            cyooyDishes.DishesMoney = dishPrice;
                            cyooyDishes.DishesUnit = "份";
                            if (dishImg != null)
                            {
                                cyooyDishes.PictureName = @"http://www.cyooy.com" + dishImg.Attributes["src"].Value;
                            }
                            _generalEntityList.Add(cyooyDishes);
                            dishTypeInfo.DishesList.Add(cyooyDishes.DishID);
                            dishID += 1;
                            continue;
                        }
                        dishNameNode = dishInfo.SelectSingleNode(".//div[@class='foodName']");
                        if (dishNameNode != null)
                        {
                            var dishName = dishNameNode.Attributes["title"].Value;
                            var dishPriceNode = dishInfo.SelectSingleNode(".//div[@class='price']");
                            var dishPrice = dishPriceNode != null ? dishPriceNode.InnerText.Replace("¥", string.Empty).Replace("元", string.Empty).Trim() : string.Empty;
                            var cyooyDishes = new CyooyDishes();
                            cyooyDishes.DishID = dishID;
                            cyooyDishes.DishTypeID = dishTypeID.ToString();
                            cyooyDishes.DishName = dishName;
                            cyooyDishes.DishesMoney = dishPrice;
                            cyooyDishes.DishesUnit = "份";

                            _generalEntityList.Add(cyooyDishes);
                            dishTypeInfo.DishesList.Add(cyooyDishes.DishID);
                            dishID += 1;
                        }
                    }
                }
                dishTypeList.Add(dishTypeInfo);
            }
            return dishTypeList;
        }
 private void button1_Click(object sender, EventArgs e)
 {
     var baseCollectionSite = new BaseCollectionSite(textBox4.Text);
     BaseHtmlNode = baseCollectionSite.BaseHtmlNode;
     textBox1.Text = BaseHtmlNode.InnerHtml;
 }
 protected virtual List<Maticsoft.Model.StorePicture> PicturesBody(Maticsoft.Model.StoreInfo storeInfo,
     Maticsoft.Model.BusPhotoAlbum busphotoAlbumTable, string albumType, ref int pageNum)
 {
     var baseCollectionSite = new BaseCollectionSite(GetPageUrl(storeInfo, albumType, pageNum));
     var pictureHtmlNode = baseCollectionSite.BaseHtmlNode;
     var pictureNodeList = pictureHtmlNode.SelectNodes(PicturePath(albumType));
     if (FilterPage(pictureNodeList, ref pageNum))
     {
         return new List<Maticsoft.Model.StorePicture>();
     }
     return SavePicture(storeInfo, pictureNodeList, busphotoAlbumTable);
 }
 protected virtual void BuildBaseStore()
 {
     var baseCollectionSite = new BaseCollectionSite(PageUrl);
     StoreInfoHtmlNode = baseCollectionSite.BaseHtmlNode.SelectSingleNode(StorePath);
 }
 protected override void BuildBaseStore()
 {
     var baseCollectionSite = new BaseCollectionSite(PageUrl);
     StoreInfoHtmlNode = baseCollectionSite.BaseHtmlNodeByGBK.SelectSingleNode(StorePath);
 }