protected override StoreInfo ChangeStoreInfo(Catalogue catalogue, StoreInfo storeInfo)
 {
     storeInfo.StoreName = catalogue.title;
     storeInfo.picName = catalogue.picName.Trim();
     storeInfo.StoreAddress = catalogue.StoreInfo.StoreAddress;
     storeInfo.StorePhone = catalogue.StoreInfo.StorePhone;
     storeInfo.StoreTag += catalogue.StoreInfo.StoreTag;
     return storeInfo;
 }
 protected override StoreInfo ChangeStoreInfo(Catalogue catalogue, StoreInfo storeInfo)
 {
     storeInfo.StoreName = catalogue.title;
     storeInfo.StorePictureHref = catalogue.StorePictureHref;
     //storeInfo.StoreAddress = catalogue.StoreInfo.StoreAddress;
     //storeInfo.StoreTag = catalogue.StoreInfo.StoreTag;
     storeInfo.MaxPrice = catalogue.StoreInfo.MaxPrice;
     return storeInfo;
 }
 private StoreInfoEntity GetStoreInfoEntity(Catalogue catalogueInfo, StoreInfoEntity oldStoreInfo, StoreInfo siteStoreInfo)
 {
     if (oldStoreInfo == null)
     {
         oldStoreInfo = new Maticsoft.Model.StoreInfoEntity();
         oldStoreInfo.BizID = catalogueInfo.StoreId;
     }
     if (siteStoreInfo == null)
     {
         return null;
     }
     oldStoreInfo.Box = chbbox.Checked;
     oldStoreInfo.StoreName = txtStoreNameSite.Text.Trim();
     oldStoreInfo.Bus = txtBusSite.Text.Trim();
     oldStoreInfo.BusinessAddTime = DateTime.Now;
     oldStoreInfo.BasicIntroduction = txtBasicSite.Text.Trim();
     oldStoreInfo.BusinessState = 40;
     oldStoreInfo.BusinessTypeID = "2";
     oldStoreInfo.CarPark = chbCarPark.Checked;
     oldStoreInfo.ChildrenChair = chbChildrenChair.Checked;
     oldStoreInfo.CityID = ((Maticsoft.Model.City)cbBoxCity.SelectedItem).CityID;
     oldStoreInfo.Cod = chbCod.Checked;
     oldStoreInfo.DistrictID = ((Maticsoft.Model.District)cbbDistrict.SelectedItem).DistrictID;
     oldStoreInfo.IsCitySend = chbIsCitySend.Checked;
     oldStoreInfo.IsCoupon = chbIsCoupon.Checked;
     oldStoreInfo.IsSend = chbIsSend.Checked ? 1 : 0;
     oldStoreInfo.KCVIP = chbKCVIP.Checked;
     oldStoreInfo.NoSmoke = chbNoSmoke.Checked;
     oldStoreInfo.OnlinePay = chbOnlinePay.Checked;
     oldStoreInfo.Onlineorder = chbOnlineorder.Checked ? 1 : 0;
     oldStoreInfo.PayCar = chbPayCar.Checked;
     oldStoreInfo.PayCar = chbPayCar.Checked;
     oldStoreInfo.StoreAddress = txtStoreAddressSite.Text.Trim();
     oldStoreInfo.StoreHours = txtStoreHoursSite.Text.Trim();
     oldStoreInfo.StoreName = txtStoreNameSite.Text.Trim();
     oldStoreInfo.StorePhone = txtStorePhoneSite.Text.Trim();
     oldStoreInfo.WIFI = chbWIFI.Checked;
     decimal maxPrice = 0;
     if (decimal.TryParse(txtMaxPriceSite.Text, out maxPrice))
     {
         oldStoreInfo.MaxPrice = maxPrice;
     }
     decimal minPrice = 0;
     if (decimal.TryParse(txtMinPriceSite.Text, out minPrice))
     {
         oldStoreInfo.MinPrice = minPrice;
     }
     oldStoreInfo.BranchName = txtDoubleName.Text.Trim();
     oldStoreInfo.StorePhoto = string.Format("{0}.jpg", oldStoreInfo.BizID);
     return oldStoreInfo;
 }
 protected virtual StoreInfo ChangeStoreInfo(Catalogue catalogue, StoreInfo storeInfo)
 {
     return storeInfo;
 }
 //public StoreInfo GetStoreInfo(Catalogue catalogue)
 //{
 //    var storePath = @".//div[@align='center']/div[@id='container']";
 //    var baseCollectionSite = new BaseCollectionSite(PageUrl);
 //    StoreInfoHtmlNode = baseCollectionSite.BaseHtmlNode;
 //    StoreInfoHtmlNode = StoreInfoHtmlNode.SelectSingleNode(storePath);
 //    if (StoreInfoHtmlNode == null)
 //    {
 //        return new NullStoreInfo();
 //    }
 //    int minPrice;
 //    int maxPrice;
 //    PeoplePrice(out minPrice, out maxPrice);
 //    var storeInfo = new StoreInfo();
 //    storeInfo.storeId = catalogue.StoreId;
 //    storeInfo.Fid = catalogue.FId;
 //    storeInfo.Facilities = GetFacilities();
 //    storeInfo.payCar = GetPayCar();
 //    storeInfo.BasicIntroduction = GetBasicIntroduction();
 //    storeInfo.subway = Subway();
 //    storeInfo.bus = GetBus();
 //    storeInfo.box = Getbox();
 //    storeInfo.MaxPrice = maxPrice;
 //    storeInfo.MinPrice = minPrice;
 //    storeInfo.StorePhone = GetPhoneNum();
 //    storeInfo.StoreHours = GetWorkTime();
 //    storeInfo.StoreTag = StoreTagText();
 //    storeInfo.StoreName = catalogue.title;
 //    storeInfo.picName = catalogue.picName;
 //    storeInfo.carPark = GetCarPark();
 //    storeInfo.StoreAddress = GetAddress();
 //    storeInfo.StoreHours = GetWorkTime();
 //    return storeInfo;
 //}
 protected override StoreInfo ChangeStoreInfo(Catalogue catalogue, StoreInfo storeInfo)
 {
     storeInfo.StoreName = catalogue.title;
     storeInfo.StorePictureHref = catalogue.StorePictureHref;
     return storeInfo;
 }
        /// <summary>
        /// 商家列表页获取
        /// </summary>
        /// <param name="pageUrl"></param>
        /// <param name="poIndex"></param>
        public List<Model.Catalogue> InsretPage(string pageUrl, int poIndex)
        {
            var htmlWeb = new HtmlWeb();
            var htmlDoc = htmlWeb.Load(pageUrl);
            var list =
                htmlDoc.DocumentNode.SelectNodes(
                    ".//div[@class='constr']/div/div[@class='res_hm_c']/div[@class='res_sch_res schResList']/div[@class='l']/a");

            if (list == null)
            {
                return null;
            }
            var catalogueList = new List<Model.Catalogue>();
            foreach (var htmlNode in list)
            //Parallel.ForEach(list, htmlNode =>
            {
                var title = htmlNode.SelectSingleNode(".//img").Attributes["title"].Value;
                var href = htmlNode.Attributes["href"].Value;
                var keyList = href.Trim('/').Split('/');
                var keyID = string.Empty;
                var catalogue = new Maticsoft.Model.Catalogue();
                if (keyList.Count() == 2)
                {
                    keyID = keyList[1];
                    catalogue.FId = keyID;
                    catalogue.title = title;
                    catalogue.href = href;
                    catalogue.LocalTagID = poIndex;
                    catalogue.StoreId = Guid.NewGuid().ToString();
                    var storeInfoBll = new Maticsoft.BLL.StoreInfo();
                    var temStoreInfoList = storeInfoBll.GetModelList(string.Format("Fid = '{0}'", keyID));
                    var storePictureBll = new StorePicture();
                    if (temStoreInfoList != null && temStoreInfoList.Count > 0)
                    {
                        catalogue.IsRead = true;
                        var temStoreInfo = temStoreInfoList.FirstOrDefault();
                        if (temStoreInfo != null)
                        {
                            catalogue.StoreId = temStoreInfo.storeId;
                        }
                        var oldStorePicture =
                            storePictureBll.GetModelList(string.Format("PicType ='Shop' and StoreId = '{0}'",
                                catalogue.StoreId));
                        foreach (var storePicture in oldStorePicture)
                        {
                            storePictureBll.Delete(storePicture.PID);
                        }
                        //Parallel.ForEach(oldStorePicture, storePicture => storePictureBll.Delete(storePicture.PID));
                    }
                    else
                    {
                        catalogue.IsRead = false;
                    }
                    var imgNode = htmlNode.SelectSingleNode(".//img[@class='jsLazyImage']");
                    if (imgNode != null)
                    {
                        var shopPicturePath = imgNode.Attributes["data-url"].Value;
                        if (!string.IsNullOrEmpty(shopPicturePath) && !shopPicturePath.EndsWith("food_nopic.png"))
                        {
                            var storePicture = new Maticsoft.Model.StorePicture();
                            storePicture.PID = Guid.NewGuid().ToString();
                            var pictureName = string.Format("{0}.jpg", storePicture.PID);
                            storePicture.PictureName = pictureName;
                            storePicture.PicType = "Shop";
                            storePicture.PicturePath = shopPicturePath;
                            storePicture.StoreId = catalogue.StoreId;
                            storePictureBll.Add(storePicture);
                            catalogue.picName = storePicture.PictureName;
                        }

                    }
                    catalogueList.Add(catalogue);
                }
                //catalogueBll.Add(catalogue);
            }

            return catalogueList.OrderBy(x => x != null && x.IsRead).ThenBy(x => x != null ? x.FId : string.Empty).ToList();
        }
 protected override StoreInfo ChangeStoreInfo(Catalogue catalogue, StoreInfo storeInfo)
 {
     storeInfo.StoreName = catalogue.title;
     storeInfo.StorePictureHref = catalogue.StorePictureHref;
     storeInfo.StoreAddress = catalogue.StoreInfo.StoreAddress;
     storeInfo.StoreTag = catalogue.StoreInfo.StoreTag;
     storeInfo.StoreTag += CarPark().ClearSiteCode();
     storeInfo.box = storeInfo.StoreTag.Contains(@"有包间");
     storeInfo.ChildrenChair = storeInfo.StoreTag.Contains(@"儿童座椅");
     storeInfo.CarParks = storeInfo.StoreTag.Contains(@"有停车位");
     return storeInfo;
 }
 protected Catalogue CreateCatalogue(int poIndex)
 {
     if (string.IsNullOrEmpty(Fid) || string.IsNullOrEmpty(Title) || string.IsNullOrEmpty(Href))
     {
         return new NullCatalogue();
     }
     var catalogue = new Catalogue
     {
         FId = Fid,
         title = Title,
         href = Href,
         LocalTagID = poIndex,
     };
     Fid = string.Empty;
     Title = string.Empty;
     Href = string.Empty;
     return catalogue;
 }
 public StoreInfo GetStoreInfo(Catalogue catalogue)
 {
     return catalogue.StoreInfo;
 }