public static void CreateShopFile() { List <string> shopUrlList = new List <string>(); IEnumerable <ShopInfo> shops = BaseDataDAL.GetShopListInfo(true); IEnumerable <ShopInfo> detailshops = BaseDataDAL.GetShopDetailInfo(true); if (shops.Any()) { WeeklySitemapJob.Logger.Info("有" + shops.Count() + "个门店地址需要收录"); } if (shops != null && shops.Any()) { foreach (var shop in shops.Where(q => q != null)) { string title = shop.RegionName + "门店"; shopUrlList.Add(string.Format("<li><a target=\"_blank\" title=\"{2}\" href=\"http://www.tuhu.cn/shops/{0}{1}.aspx\">{2}</a></li>", shop.RegionNamePinYin, shop.RegionId, title)); } } //if (detailshops != null && detailshops.Any()) //{ // foreach (var shop in detailshops.Where(q => q != null)) // { // //string title = shop.ShopName + "门店"; // shopUrlList.Add(string.Format("<li><a target=\"_blank\" title=\"{3}\" href=\"http://www.tuhu.cn/shop/{0}{1}/{2}.aspx\">{3}</a></li>", shop.RegionNamePinYin, shop.RegionId, shop.ShopId,shop.ShopName)); // } //} Stream shopstream = GenerateStreamFromString(shopUrlList); Attachment fileattachment = new Attachment(shopstream, "SEOShop.html"); SendMail("SEOShopHTML", ConfigurationManager.AppSettings["SEOFileJob:To"], fileattachment); }
public static bool InsertShopListURL(bool isFull = false) { List <string> shopUrlList = new List <string>(); IEnumerable <ShopInfo> shops = BaseDataDAL.GetShopListInfo(isFull); if (shops != null && shops.Any()) { foreach (var shop in shops.Where(q => q != null)) { shopUrlList.Add(string.Format("http://www.tuhu.cn/shops/{0}{1}.aspx", shop.RegionNamePinYin, shop.RegionId)); } } WeeklySitemapJob.Logger.Info("有" + shopUrlList.Count() + "需要导入库"); return(InsertURLToDB(shopUrlList, "ShopList")); }