protected override StoreInfo ChangeStoreInfo(Catalogue catalogue, StoreInfo storeInfo) { storeInfo.StoreName = catalogue.title; storeInfo.MaxPrice = catalogue.StoreInfo.MaxPrice; storeInfo.StorePictureHref = catalogue.StorePictureHref; return storeInfo; }
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); } }
protected override StoreInfo ChangeStoreInfo(Catalogue catalogue, StoreInfo storeInfo) { storeInfo.StoreName = catalogue.title; storeInfo.picName = catalogue.picName.Trim(); storeInfo.StoreAddress = catalogue.StoreInfo.StoreAddress; storeInfo.MaxPrice = catalogue.StoreInfo.MaxPrice; storeInfo.MinPrice = catalogue.StoreInfo.MinPrice; storeInfo.StoreTag += catalogue.StoreInfo.StoreTag; return storeInfo; }
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); }
protected override StoreInfo ChangeStoreInfo(Catalogue catalogue, StoreInfo storeInfo) { storeInfo.StoreName = catalogue.title; storeInfo.MaxPrice = catalogue.StoreInfo.MaxPrice; storeInfo.StoreTag += catalogue.StoreInfo.StoreTag; storeInfo.StorePictureHref = GetImageHref(StoreInfoHtmlNode, storeInfo.storeId); storeInfo.WIFI = storeInfo.Facilities.Contains(@"无线上网"); storeInfo.payCar = storeInfo.Facilities.Contains(@"可以刷卡"); storeInfo.DishTypeSite = GetDishTypeSite(); return storeInfo; }
protected override StoreInfo ChangeStoreInfo(Catalogue catalogue, StoreInfo storeInfo) { storeInfo.StoreName = catalogue.title; //storeInfo.picName = catalogue.picName.Trim(); storeInfo.StoreAddress = catalogue.StoreInfo.StoreAddress; storeInfo.MaxPrice = catalogue.StoreInfo.MaxPrice; storeInfo.StoreTag += catalogue.StoreInfo.StoreTag; storeInfo.Facilities += catalogue.StoreInfo.Facilities; storeInfo.StorePhone = catalogue.StoreInfo.StorePhone; storeInfo.StorePictureHref = catalogue.StorePictureHref; return storeInfo; }
protected override string GetPageUrl(StoreInfo storeInfo, string albumType, int pageNum) { return string.Format(PageUrl, storeInfo.Fid, pageNum); }
protected override Maticsoft.Model.StoreInfo GetStoreInfo(string storeName, HtmlNode restaurant) { if (restaurant == null) { return new Maticsoft.Model.NullStoreInfo(); } var storeInfo = new Maticsoft.Model.StoreInfo(); storeInfo.StoreAddress = StoreAddress; storeInfo.StorePhone = StorePhone; storeInfo.StoreName = storeName; storeInfo.MaxPrice = MaxPrice(restaurant); return storeInfo; }
protected override Maticsoft.Model.StoreInfo GetStoreInfo(string storeName, HtmlNode restaurant) { if (restaurant == null) { return new Maticsoft.Model.NullStoreInfo(); } var storeInfo = new Maticsoft.Model.StoreInfo(); storeInfo.StoreAddress = GetAddress(restaurant); storeInfo.StoreName = storeName; int minPrice; int maxPrice; PeoplePrice(restaurant, out minPrice, out maxPrice); storeInfo.MaxPrice = maxPrice; storeInfo.MinPrice = minPrice; storeInfo.StoreTag = GetStoreTag(restaurant); return storeInfo; }
public void GetPicture(StoreInfo storeInfo) { }
public List<BusPhotoAlbumTable> SaveAlbumTables(StoreInfo storeInfo) { return new List<BusPhotoAlbumTable>(); }
protected override StoreInfo ChangeStoreInfo(Catalogue catalogue, StoreInfo storeInfo) { storeInfo.StoreName = catalogue.title; storeInfo.StorePictureHref = catalogue.StorePictureHref; storeInfo.payCar = storeInfo.Facilities.Contains(@"可以刷卡"); storeInfo.ChildrenChair = storeInfo.Facilities.Contains(@"有宝宝椅"); storeInfo.CarParks = storeInfo.Facilities.Contains(@"有停车位"); storeInfo.WIFI = storeInfo.Facilities.Contains(@"无线上网"); storeInfo.NoSmoke = storeInfo.Facilities.Contains(@"全场禁烟"); return storeInfo; }
protected override List<StorePicture> PicturesBody(StoreInfo storeInfo, BusPhotoAlbum busphotoAlbumTable, string albumType, ref int pageNum) { var collectionPhone = new CollectionPhone(); collectionPhone.PageUrl = GetPageUrl(storeInfo, albumType, pageNum); var sid = GetStoreSid(storeInfo.StorePictureHref); collectionPhone.dictionary.Add("s_id", sid); collectionPhone.dictionary.Add("id", sid); collectionPhone.dictionary.Add("page", pageNum.ToString()); collectionPhone.dictionary.Add("keyword", string.Empty); try { //var location = collectionPhone.GetEpinLeResualt<List<PictureModel>>(); //if (location == null || location.Count <= 0) //{ // pageNum = 500; return new List<StorePicture>(); //} //return SavePicture(storeInfo, location, busphotoAlbumTable); } catch { pageNum = 500; return new List<StorePicture>(); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.StoreInfo GetModel(string storeId) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 storeId,Fid,StoreName,StoreAddress,StorePhone,BasicIntroduction,StoreHours,Facilities,payCar,subway,bus,box,carPark,StoreTag,MinPrice,MaxPrice,picName from StoreInfo "); strSql.Append(" where storeId=@storeId "); SqlParameter[] parameters = { new SqlParameter("@storeId", SqlDbType.NVarChar,50) }; parameters[0].Value = storeId; Maticsoft.Model.StoreInfo model=new Maticsoft.Model.StoreInfo(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.StoreInfo DataRowToModel(DataRow row) { Maticsoft.Model.StoreInfo model=new Maticsoft.Model.StoreInfo(); if (row != null) { if(row["storeId"]!=null) { model.storeId=row["storeId"].ToString(); } if(row["Fid"]!=null) { model.Fid=row["Fid"].ToString(); } if(row["StoreName"]!=null) { model.StoreName=row["StoreName"].ToString(); } if(row["StoreAddress"]!=null) { model.StoreAddress=row["StoreAddress"].ToString(); } if(row["StorePhone"]!=null) { model.StorePhone=row["StorePhone"].ToString(); } if(row["BasicIntroduction"]!=null) { model.BasicIntroduction=row["BasicIntroduction"].ToString(); } if(row["StoreHours"]!=null) { model.StoreHours=row["StoreHours"].ToString(); } if(row["Facilities"]!=null) { model.Facilities=row["Facilities"].ToString(); } if(row["payCar"]!=null && row["payCar"].ToString()!="") { if((row["payCar"].ToString()=="1")||(row["payCar"].ToString().ToLower()=="true")) { model.payCar=true; } else { model.payCar=false; } } if(row["subway"]!=null) { model.subway=row["subway"].ToString(); } if(row["bus"]!=null) { model.bus=row["bus"].ToString(); } if(row["box"]!=null && row["box"].ToString()!="") { if((row["box"].ToString()=="1")||(row["box"].ToString().ToLower()=="true")) { model.box=true; } else { model.box=false; } } if(row["carPark"]!=null) { model.carPark=row["carPark"].ToString(); } if(row["StoreTag"]!=null) { model.StoreTag=row["StoreTag"].ToString(); } if(row["MinPrice"]!=null && row["MinPrice"].ToString()!="") { model.MinPrice=int.Parse(row["MinPrice"].ToString()); } if(row["MaxPrice"]!=null && row["MaxPrice"].ToString()!="") { model.MaxPrice=int.Parse(row["MaxPrice"].ToString()); } if(row["picName"]!=null) { model.picName=row["picName"].ToString(); } } return model; }
protected List<StorePicture> SavePicture(StoreInfo storeInfo, List<PictureModel> pictureNodeList, BusPhotoAlbum busphotoAlbumTable) { var storePicturesList = new List<StorePicture>(); foreach (var pictureNode in pictureNodeList) { var picturePathName = string.Empty; if (!string.IsNullOrEmpty(pictureNode.image_url)) { picturePathName = StorePictureUrl + pictureNode.image_url; } else if (!string.IsNullOrEmpty(pictureNode.default_image)) { picturePathName = StorePictureUrl + pictureNode.default_image; } if (FilterPicturePathName(picturePathName)) { SaveIngPic(busphotoAlbumTable.AlbumName, picturePathName); storePicturesList.Add(BuildStorePicture(storeInfo, picturePathName)); } } return storePicturesList; }