private void RefreshLinks(HttpContext context) { ClassLibrary.BLL.News newsBll = new ClassLibrary.BLL.News(); ClassLibrary.BLL.Routes routeBll = new ClassLibrary.BLL.Routes(); ClassLibrary.BLL.RouteDetails rdBll = new ClassLibrary.BLL.RouteDetails(); ClassLibrary.BLL.InternalLink linkBll = new ClassLibrary.BLL.InternalLink(); List <ClassLibrary.Model.InternalLink> linkList = linkBll.GetModelList(string.Empty); List <ClassLibrary.Model.News> newsList = newsBll.GetModelList(""); foreach (ClassLibrary.Model.News model in newsList) { string tmpContent = ClassLibrary.BLL.WebClass.addInternelLink(model.Content, ClassLibrary.Common.SysConfig.linkCount, linkList); if (model.Content != tmpContent) { model.Content = tmpContent; newsBll.Update(model); } } List <ClassLibrary.Model.Routes> routeList = routeBll.GetModelList(""); foreach (ClassLibrary.Model.Routes model in routeList) { model.RouteFeature = ClassLibrary.BLL.WebClass.addInternelLink(model.RouteFeature, 1, linkList); model.DescriptionRoute = ClassLibrary.BLL.WebClass.addInternelLink(model.DescriptionRoute, 3, linkList); model.DescriptionPrice = ClassLibrary.BLL.WebClass.addInternelLink(model.DescriptionPrice, 1, linkList); model.RouteNotice = ClassLibrary.BLL.WebClass.addInternelLink(model.RouteNotice, 1, linkList); routeBll.Update(model); if (model.DetailType) { List <ClassLibrary.Model.RouteDetails> rdList = rdBll.GetModelList("routeid=" + model.ID); foreach (ClassLibrary.Model.RouteDetails model2 in rdList) { string tmpDetail = ClassLibrary.BLL.WebClass.addInternelLink(model2.DayDetail, 1, linkList); if (model2.DayDetail != tmpDetail) { model2.DayDetail = tmpDetail; rdBll.Update(model2); } } } } Print(context, "success"); }
private void updateImgAddress(HttpContext context) { ClassLibrary.BLL.Routes routeBll = new ClassLibrary.BLL.Routes(); ClassLibrary.BLL.RouteDetails rdBll = new ClassLibrary.BLL.RouteDetails(); List <ClassLibrary.Model.Routes> routeList = routeBll.GetModelList("id > 677"); foreach (ClassLibrary.Model.Routes model in routeList) { bool updated = false; if (model.RouteFeature.IndexOf("www.ytszg.com") > -1) { model.RouteFeature = model.RouteFeature.Replace("www.ytszg.com", "www.qu17.com"); updated = true; } if (model.RouteFeature.IndexOf("file/newsImg/image") > -1) { model.RouteFeature = model.RouteFeature.Replace("file/newsImg/image", "images"); updated = true; } if (model.DescriptionRoute.IndexOf("www.ytszg.com") > -1) { model.DescriptionRoute = model.DescriptionRoute.Replace("www.ytszg.com", "www.qu17.com"); updated = true; } if (model.DescriptionRoute.IndexOf("file/newsImg/image") > -1) { model.DescriptionRoute = model.DescriptionRoute.Replace("file/newsImg/image", "images"); updated = true; } if (model.RouteNotice.IndexOf("www.ytszg.com") > -1) { model.RouteNotice = model.RouteNotice.Replace("www.ytszg.com", "www.qu17.com"); updated = true; } if (model.DescriptionPrice.IndexOf("www.ytszg.com") > -1) { model.DescriptionPrice = model.DescriptionPrice.Replace("www.ytszg.com", "www.qu17.com"); updated = true; } if (updated) { routeBll.Update(model); } } List <ClassLibrary.Model.RouteDetails> routedList = rdBll.GetModelList(" routeid > 677"); foreach (ClassLibrary.Model.RouteDetails model in routedList) { bool updated = false; if (model.DayDetail.IndexOf("www.ytszg.com") > -1) { model.DayDetail = model.DayDetail.Replace("www.ytszg.com", "www.qu17.com"); updated = true; } if (model.DayDetail.IndexOf("file/newsImg/image") > -1) { model.DayDetail = model.DayDetail.Replace("file/newsImg/image", "images"); updated = true; } if (updated) { rdBll.Update(model); } } Print(context, "success"); }