public void SaveDishes(StoreInfoEntity storeInfoEntity, StoreInfo siteStoreInfo) { var dishTypeBll = new Maticsoft.BLL.DishesTyep(); var dishesEntityBll = new Maticsoft.BLL.DishesBll(); var storePictureBll = new Maticsoft.BLL.StorePicture(); DoProgress(30); dishesEntityBll.Remove(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID)); dishTypeBll.Remove(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID)); foreach (var dishType in siteStoreInfo.DishTypeList) { dishType.BusinessID = storeInfoEntity.BizID; dishTypeBll.Add(dishType); foreach (var dishesEntity in dishType.DishesList) { dishesEntity.BusinessID = storeInfoEntity.BizID; dishesEntityBll.Add(dishesEntity); if (!string.IsNullOrEmpty(dishesEntity.PictureHref) && !string.IsNullOrWhiteSpace(dishesEntity.PictureHref)) { var storePicture = new Maticsoft.Model.StorePicture(); storePicture.PID = Guid.NewGuid().ToString(); storePicture.PictureName = string.Format("{0}.jpg", storePicture.PID); storePicture.PicType = "Food"; storePicture.PicturePath = dishesEntity.PictureHref; storePicture.StoreId = storeInfoEntity.BizID; storePictureBll.Add(storePicture); } } } DoProgress(); }
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; }
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; }
public void GetPicture(StoreInfo storeInfo) { try { _pictureSite.GetPicture(storeInfo); } catch { throw; } }
public List<Maticsoft.Model.BusPhotoAlbum> SaveAlbumTables(StoreInfo storeInfo) { try { return _pictureSite.SaveAlbumTables(storeInfo); } catch { throw; } }
private void GetFoodAction(StoreInfo store, string siteType) { var saveDishesEntity = new SaveDishesEntity(siteType); var dishTypeList = saveDishesEntity.UpdateDish(store, UpdateLabelText); var dishTypeListCount = 0; var dishCount = 0; if (dishTypeList != null) { store.DishTypeList = new List<DishesTyep>(); store.DishTypeList = dishTypeList; dishTypeListCount = dishTypeList.Count; dishCount = dishTypeList.Sum(x => x.DishesList.Count); store.DishTypeList = dishTypeList; } else { store.DishTypeList.Clear(); } lblDish.SetTextBoxText(string.Format("{0}菜品{1}种菜系{2}道菜品下载完成", store.StoreName, dishTypeListCount, dishCount)); //Invoke(_showMessageBox, (string.Format("{0}菜品{1}种菜系{2}道菜品下载完成", store.StoreName, dishTypeListCount, dishCount))); }
private void ClearStoreText(StoreInfo storeInfo) { textBox4.ClearTag(); chbCarPark.UpdateCheckedState(false); chbChildrenChair.UpdateCheckedState(false); chbCod.UpdateCheckedState(false); chbIsCitySend.UpdateCheckedState(false); chbIsCoupon.UpdateCheckedState(false); chbIsSend.UpdateCheckedState(false); chbKCVIP.UpdateCheckedState(false); chbNoSmoke.UpdateCheckedState(false); chbOnlinePay.UpdateCheckedState(false); chbOnlineorder.UpdateCheckedState(false); chbPayCar.UpdateCheckedState(false); chbPayCar.UpdateCheckedState(storeInfo.payCar); chbWIFI.UpdateCheckedState(false); chbbox.UpdateCheckedState(false); chbDish.UpdateCheckedState(false); chbPic.UpdateCheckedState(false); lblDish.SetTextBoxText(string.Empty); lblPic.SetTextBoxText(string.Empty); chbCarPark.UpdateCheckedState(storeInfo.CarParks); chbChildrenChair.UpdateCheckedState(storeInfo.ChildrenChair); chbPayCar.UpdateCheckedState(storeInfo.payCar); chbWIFI.UpdateCheckedState(storeInfo.WIFI); chbbox.UpdateCheckedState(storeInfo.box); chbNoSmoke.UpdateCheckedState(storeInfo.NoSmoke); txtBasic.SetTextBoxText(storeInfo.BasicIntroduction); txtBus.SetTextBoxText(storeInfo.bus); txtFacilities.SetTextBoxText(storeInfo.Facilities); txtMaxPrice.SetTextBoxText(storeInfo.MaxPrice.ToString()); txtMinPrice.SetTextBoxText(storeInfo.MinPrice.ToString()); txtStoreAddress.SetTextBoxText(storeInfo.StoreAddress); txtStoreHours.SetTextBoxText(string.IsNullOrWhiteSpace(storeInfo.StoreHours) ? "10:00-22:00" : storeInfo.StoreHours); txtStoreName.SetTextBoxText(storeInfo.StoreName); txtStorePhone.SetTextBoxText(storeInfo.StorePhone); txtStoreTag.SetTextBoxText(storeInfo.StoreTag); txtDoubleName.SetTextBoxText(string.Empty); txtBasicSite.SetTextBoxText(storeInfo.BasicIntroduction); txtBusSite.SetTextBoxText(storeInfo.bus); txtMaxPriceSite.SetTextBoxText(storeInfo.MaxPrice.ToString()); txtMinPriceSite.SetTextBoxText(storeInfo.MinPrice.ToString()); txtStoreAddressSite.SetTextBoxText(storeInfo.StoreAddress); txtStoreHoursSite.SetTextBoxText(string.IsNullOrWhiteSpace(storeInfo.StoreHours) ? "10:00-22:00" : storeInfo.StoreHours); txtStoreNameSite.SetTextBoxText(storeInfo.StoreName); txtStorePhoneSite.SetTextBoxText(storeInfo.StorePhone); textBox7.SetTextBoxText(storeInfo.StorePictureHref); }
public Maticsoft.Model.StoreInfo GetStoreInfo(Maticsoft.Model.Catalogue catalogue) { InitProgress(); DoProgress(50); BuildBaseStore(); DoProgress(50); if (StoreInfoHtmlNode == null) { return new NullStoreInfo(); } int minPrice; int maxPrice; PeoplePrice(out minPrice, out maxPrice); var storeInfo = new StoreInfo(); storeInfo.storeId = catalogue.StoreId; DoProgress(20); storeInfo.Fid = catalogue.FId; storeInfo.Facilities = GetFacilities().ClearSiteCode().Trim(); storeInfo.payCar = GetPayCar(); storeInfo.BasicIntroduction = GetBasicIntroduction().ClearSiteCode().Trim(); DoProgress(30); storeInfo.subway = Subway().ClearSiteCode().Trim(); storeInfo.bus = GetBus().ClearSiteCode().Trim(); DoProgress(20); storeInfo.box = Getbox(); storeInfo.StoreHours = GetWorkTime().ClearSiteCode().Trim(); storeInfo.StoreTag = StoreTagText().ClearSiteCode().Trim(); storeInfo.carPark = GetCarPark().ClearSiteCode().Trim(); storeInfo.StoreAddress = GetAddress().ClearSiteCode().Trim(); storeInfo.StorePhone = GetPhoneNum().ClearSiteCode().Trim(); DoProgress(20); storeInfo.MinPrice = minPrice; storeInfo.MaxPrice = maxPrice; storeInfo = ChangeStoreInfo(catalogue, storeInfo); DoProgress(); return storeInfo; }
protected virtual StoreInfo ChangeStoreInfo(Catalogue catalogue, StoreInfo storeInfo) { return storeInfo; }
public virtual void DeleteOldPicture(StoreInfo temStoreInfo) { var oldStorePicture = StorePictureBll.GetModelList(string.Format("PicType ='{1}' and StoreId = '{0}'", temStoreInfo.storeId, PicType)); foreach (var storePicture in oldStorePicture) { StorePictureBll.Delete(storePicture.PID); } }
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 override string GetPageUrl(StoreInfo storeInfo, string albumType, int pageNum) { return string.Format(PageUrl, storeInfo.Fid, albumType, pageNum); }
public void GetPicture(StoreInfo storeInfo) { }
private void GetPicAction(StoreInfo store, string siteType) { var pictureLogic = new PictureLogic(siteType); pictureLogic.SetLabelEventHandler(UpdateLabelText); var albumTablesList = pictureLogic.SaveAlbumTables(store); var albumCount = 0; var picturesCount = 0; if (albumTablesList != null) { albumCount = albumTablesList.Count; picturesCount = albumTablesList.Sum(x => x.StorePicturesList.Count); store.BusPhotoAlbumTableList = albumTablesList; } else { store.BusPhotoAlbumTableList.Clear(); } lblPic.SetTextBoxText(string.Format("{0}{1}个相册{2}张图片下载完成", store.StoreName, albumCount, picturesCount)); //Invoke(_showMessageBox, string.Format("{0}{1}个相册{2}张图片下载完成", store.StoreName, albumCount, picturesCount)); }
/// <summary> /// 收集某一家商店 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public Model.StoreInfo CollectionStore(string pageUrl, Model.Catalogue catalogue) { var htmlWeb = new HtmlWeb(); try { var htmlDoc = htmlWeb.Load(string.Format("{0}{1}", _pageUrl, pageUrl)); var nodeDetail = htmlDoc.DocumentNode.SelectSingleNode( ".//div[@class='constr']/div[@class='constr_in pt15 pb30']/div[@class='l res_detail_con']"); if (nodeDetail == null) { return null; } var nodeAddress = nodeDetail.SelectSingleNode(".//div[@class='res_hm_find']/div[@class='res_hm_find_in z']/div[@class='fix pb10']/div[@class='cell pl20']/div[@class='dash pb15 mr5']/div[@class='lh22']/div[@class='cell pl5']"); var addressName = string.Empty; if (nodeAddress != null) { var addressText = nodeAddress.FirstChild; if (addressText == null) { return null; } addressName = addressText.InnerText.Replace("/r/n", string.Empty).Trim(); if (string.IsNullOrEmpty(addressName)) { return null; } } var minPrice = 0; var maxPrice = 0; var peoplePriceNode = nodeDetail.SelectSingleNode(".//div[@class='res_hm_find']/div[@class='res_hm_find_in z']/div[@class='fix pb10']/div[@class='cell pl20']/div[@class='dash pb15 mr5']/div[@class='lh22']/strong[@class ='cr']"); if (peoplePriceNode != null) { var peoplePriceList = peoplePriceNode.InnerText.Trim().Split('-'); if (peoplePriceList.Count() == 2) { int.TryParse(peoplePriceList[0], out minPrice); int.TryParse(peoplePriceList[1], out maxPrice); } } var storeTagList = nodeDetail.SelectNodes(".//div[@class='cell pl5']/a[@class='dib mr5']"); var storeTagText = string.Empty; var storeTagStrList = new List<string>(); if (storeTagList != null) { storeTagStrList.AddRange(storeTagList.ToList().ConvertAll(x => x.InnerText)); } var storeTagStrNode = nodeDetail.SelectNodes(".//div[@class='p20 mt5']/div[@class='mt10 f13']/div[@class='fix mb2']/p[@class='cell pl15']/a[@class='mr10']"); if (storeTagStrNode != null && storeTagStrNode.Count > 0) { storeTagStrList.AddRange(storeTagStrNode.ToList().ConvertAll(x => x.InnerText)); } storeTagText = storeTagText + string.Join(@"、", storeTagStrList); var nodePhone = nodeDetail.SelectNodes(".//p[@class='cell pl15']"); if (nodePhone == null) { return null; } var phoneNum = nodePhone.Count > 1 ? nodePhone[1].FirstChild.InnerText.ToString().Replace(@"021-57575777 我吃,我吃,我吃吃吃", string.Empty).Trim() : string.Empty; var workTime = nodePhone.Count > 2 ? nodePhone[2].FirstChild.InnerText.ToString() : string.Empty; var facilitieslist = nodePhone.Count > 3 ? nodePhone[3].SelectNodes(".//span") : null; var facilities = string.Empty; if (facilitieslist != null) { foreach (var nodeInfo in facilitieslist) { facilities += nodeInfo.InnerText + '、'; } } facilities = facilities.Trim('、'); var cardListNode = nodePhone.Count > 3 ? nodePhone[3].SelectSingleNode(".//a[@class='dib mr5 g3']") : null; bool payCar = cardListNode != null; //简介 var basicIntroduction = nodePhone.Count > 4 ? nodePhone[4].InnerText : string.Empty; var subway = string.Empty; var carPark = string.Empty; var bus = string.Empty; var busTagNode = nodeDetail.SelectSingleNode(".//u[@class='res_u_info u u00']"); if (busTagNode != null) { var busNode = busTagNode.ParentNode.ParentNode.SelectSingleNode(".//p[@class='cell pl15']"); if (busNode != null) { bus = busNode.InnerText.Replace("/r/n", string.Empty).Replace(@" ", string.Empty).Replace("修改", string.Empty).Trim(); } } var carParkTagNode = nodeDetail.SelectSingleNode(".//u[@class='res_u_info u u02']"); if (carParkTagNode != null) { var carParkNode = carParkTagNode.ParentNode.ParentNode.SelectSingleNode(".//p[@class='cell pl15']"); if (carParkNode != null) { carPark = carParkNode.InnerText.Replace("/r/n", string.Empty).Replace(@" ", string.Empty).Replace("修改", string.Empty).Trim(); } } var subwayTagNode = nodeDetail.SelectSingleNode(".//u[@class='res_u_info u u01']"); if (subwayTagNode != null) { var subwayNode = subwayTagNode.ParentNode.ParentNode.SelectSingleNode(".//p[@class='cell pl15']"); if (subwayNode != null) { subway = subwayNode.InnerText.Replace("/r/n", string.Empty).Replace(@" ", string.Empty).Replace("修改", string.Empty).Trim(); } } var box = nodeDetail.SelectSingleNode(".//a[@class='res_seat selSchSeat']") != null; var storeInfo = new Maticsoft.Model.StoreInfo(); storeInfo.storeId = catalogue.StoreId; storeInfo.Fid = catalogue.FId; storeInfo.Facilities = facilities; storeInfo.payCar = payCar; storeInfo.BasicIntroduction = basicIntroduction; storeInfo.subway = subway; storeInfo.bus = bus; storeInfo.box = box; storeInfo.MaxPrice = maxPrice; storeInfo.MinPrice = minPrice; storeInfo.StorePhone = phoneNum; storeInfo.StoreHours = workTime; storeInfo.StoreTag = storeTagText; storeInfo.StoreName = catalogue.title; storeInfo.picName = catalogue.picName.Trim(); storeInfo.storeTagList.AddRange(storeTagStrList); if (addressName.IndexOf("上海", System.StringComparison.Ordinal) == 0) { addressName = addressName.Substring(2); } storeInfo.StoreAddress = addressName; storeInfo.carPark = carPark; //var storeList = storeInfoBll.GetModelList(string.Format("Fid like '%{0}%'", catalogue.FId)); //if (storeList.Count <= 0) //{ // storeInfoBll.Add(storeInfo); //} return storeInfo; } catch (Exception) { throw; } }
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; }
//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; }
public void SaveStorePictures(StoreInfoEntity storeInfoEntity, StoreInfo siteStoreInfo) { var storePicturesBll = new Maticsoft.BLL.StorePictures(); storePicturesBll.Remove(string.Format("BusinessID ='{0}'", storeInfoEntity.BizID)); var busPhotoAlbumBll = new Maticsoft.BLL.BusPhotoAlbum(); busPhotoAlbumBll.Remove(string.Format("BusinessID = '{0}'", storeInfoEntity.BizID)); var storePictureBll = new Maticsoft.BLL.StorePicture(); DoProgress(30); foreach (var busPhotoAlbum in siteStoreInfo.BusPhotoAlbumTableList) { busPhotoAlbum.BusinessID = storeInfoEntity.BizID; busPhotoAlbumBll.Add(busPhotoAlbum); var pcituresList = busPhotoAlbum.StorePicturesList; foreach (var storePicture in pcituresList) { storePicture.StoreId = storeInfoEntity.BizID; storePictureBll.Add(storePicture); var storePictures = new Maticsoft.Model.StorePictures { StorePicturesID = Guid.NewGuid().ToString(), BusPhotoAlbumID = busPhotoAlbum.BusPhotoAlbumID, BusinessID = busPhotoAlbum.BusinessID, PictureAddress = storePicture.PictureName, PicState = 2, UploadTime = DateTime.Now }; storePicturesBll.Add(storePictures); } } DoProgress(); }
public void SetRestaurant(StoreInfo storeInfo) { _dishTypeSite.StoreInfo = storeInfo; }