private void BindRouteDays() { StringBuilder sb = new StringBuilder(); if (!detailType) { sb.AppendFormat("<div class='detl_route'>{0}</div>", replaceSite(route.DescriptionRoute)); } else { ClassLibrary.BLL.RouteDetails rdBll = new ClassLibrary.BLL.RouteDetails(); List <ClassLibrary.Model.RouteDetails> detailList = rdBll.GetModelList("routeid =" + route.ID + " order by dayorder"); sb.AppendLine("<div class='route_days'>"); foreach (ClassLibrary.Model.RouteDetails model in detailList) { sb.AppendLine("<div class='days_item'>"); sb.AppendLine("<div class='route_date'>"); sb.AppendLine("<i class='icon_r'></i>"); sb.AppendLine("<div class='rdtitle'>"); sb.AppendFormat("<div class='date_no'>第{0}天</div>", model.DayOrder).AppendLine(); sb.AppendFormat("<div class='date_title'>{0}</div>", model.DayTitle).AppendLine(); sb.AppendLine("</div>"); sb.AppendLine("</div>"); sb.AppendFormat("<div class='route_dtl'>{0}</div>", replaceSite(model.DayDetail)).AppendLine(); sb.AppendLine("<div class='route_tips'>"); sb.AppendFormat("<div class='catering'><span>早餐:{0}</span><span>中餐:{1}</span><span>晚餐:{2}</span></div>", model.BreakFast ? "含" : "无", model.Lunch ? "含" : "无", model.Dinner ? "含" : "无"); sb.AppendFormat("<div class='hotel'>住宿:{0}</div>", model.Hotel == "" ? "无" : model.Hotel); sb.AppendLine("</div>"); sb.AppendLine("</div>"); } sb.AppendLine("</div>"); } routedays = sb.ToString(); }
private void RouteCopy(HttpContext context) { string id = context.Request.QueryString["id"]; ClassLibrary.BLL.Routes routeBll = new ClassLibrary.BLL.Routes(); ClassLibrary.Model.Routes routemodel = routeBll.GetModel(int.Parse(id)); if (routemodel == null || routemodel.Title == "") { Print(context, "error"); return; } string[] oldImgs = routemodel.Image.Split(','); string fileFullPath = context.Server.MapPath(SysConfig.UploadFilePathRoutesImg); string newImgs = ""; for (int i = 0; i < oldImgs.Length; i++) { string ext = Path.GetExtension(oldImgs[i]); string fileName = Function.GetRandomTime() + ext; try { File.Copy(fileFullPath + oldImgs[i], fileFullPath + fileName); } catch (Exception e) { } newImgs += fileName + ","; } if (!string.IsNullOrEmpty(newImgs)) { newImgs = newImgs.Substring(0, newImgs.Length - 1); } routemodel.Image = newImgs; routemodel.Display = false; routemodel.ViewCount = 0; routemodel.Order = 999; routemodel.FirstTime = DateTime.Now.ToString("yyyy-MM-dd"); routemodel.CreatedTime = DateTime.Now; if (routeBll.Add(routemodel) > 0) { if (routemodel.DetailType) { int routeId = routeBll.GetLastId(); ClassLibrary.BLL.RouteDetails rdBll = new ClassLibrary.BLL.RouteDetails(); List <ClassLibrary.Model.RouteDetails> detailList = rdBll.GetModelList("routeId = " + routemodel.ID); foreach (ClassLibrary.Model.RouteDetails model in detailList) { model.RouteID = routeId; rdBll.Add(model); } Print(context, "success"); } } else { Print(context, "error"); } }
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"); }
private void BindData() { myModel = routeBLL.GetModel(routeId); if (myModel != null) { themeID = myModel.ThemeID; routeClassId = Int32.Parse(myModel.routesClassID.Split(',')[1]); routeParentId = Int32.Parse(myModel.routesClassID.Split(',')[0]); trafficModel1 = myModel.TrafficModel.Substring(0, 2); trafficModel2 = myModel.TrafficModel.Substring(4, 2); title = myModel.Title; price = Convert.ToInt32(myModel.Price); routeOrder = myModel.Order; startPosition = myModel.StartPosition; routeTime = myModel.RouteTime; descriptionRoute = myModel.DescriptionRoute; descriptionPrice = myModel.DescriptionPrice; recommendHot = myModel.RecommendHot; destination = myModel.Destination; supplierName = myModel.Supplier; supplierTel = myModel.SupplierTel; seoTitle = myModel.SeoTitle; bright = myModel.Bright; boatName = myModel.BoatName; image = myModel.Image; appImage = myModel.AppImg; string[] images = myModel.Image.Split(','); StringBuilder sbri = new StringBuilder(); for (int i = 0; i < images.Length; i++) { sbri.AppendLine("<div>"); sbri.AppendLine("<input type='file' name='Image' onchange='CheckImgFile(this)' />"); sbri.AppendFormat("<img src='{0}' width='70' height='50' />", ClassLibrary.Common.SysConfig.UploadFilePathRoutesImg + images[i]); sbri.AppendLine("</div>"); } routeImage = sbri.ToString(); seoKeywords = myModel.SeoKeywords; seoDescription = myModel.SeoDescription; viewCount = myModel.ViewCount; detailType = myModel.DetailType; dateType = myModel.DateType; datePrice = ""; if (myModel.DatePrice != "") { string[] tmpDatePrice = myModel.DatePrice.Split('|'); string cDate = DateTime.Now.ToShortDateString().ToString(); for (int k = 0; k < tmpDatePrice.Length; k++) { string tmpPrices = tmpDatePrice[k]; if (tmpPrices == "") { continue; } string[] tmpPrice = tmpPrices.Split(','); TimeSpan ts = DateTime.Parse(tmpPrice[0]) - DateTime.Now; if (ts.TotalDays > 0) { datePrice += tmpPrices + "|"; } } } childPrice = Convert.ToInt32(myModel.ChildPrice); advanceDays = myModel.AdvanceDays; routeFeature = myModel.RouteFeature; routeNotice = myModel.RouteNotice; isdisplay = myModel.Display; routeParentClassIds = myModel.routesPrentClassID; if (detailType) { routeList = routeDetailBll.GetModelList("RouteID = '" + routeId + "' order by dayOrder"); StringBuilder sb = new StringBuilder(); for (int i = 1; i <= routeList.Count; i++) { ClassLibrary.Model.RouteDetails detail = routeList[i - 1]; sb.AppendFormat("<div class='fieldset xingcheng-by-day' id='day_{0}'>", i); //sb.AppendFormat("<dl><dd><b>第{0}天:<input class='text' id='route_{0}_0' name='route_{0}_0' style='width:300px;' value='{1}'/></b>{2}</dd></dl>", i, detail.DayTitle, (i != 1) ? (" <a id='remove_day" + i + "' href='#' onclick='xingcheng_remove_day();return false;' style='display:" + ((i == routeList.Count) ? "" : "none") + "'>删除第" + i + "天行程</a>") : ""); sb.AppendFormat("<dl><dd><b>第{0}天:<input type='radio' name='rdo_title_{0}' value='False' {1} onclick='checkTitle(this,{0})' />按标题<input class='text' id='route_{0}_0' name='route_{0}_0' value='{3}' style='width:300px;{2}' />", i, detail.Titletype ? "" : "checked='checked'", detail.Titletype ? "display:none;" : "", detail.Titletype ? "" : detail.DayTitle); sb.AppendFormat("<input type='radio' name='rdo_title_{0}' value='True' {1} onclick='checkTitle(this,{0})' />按景点</b>{2}</dd></dl>", i, detail.Titletype ? "checked='checked'" : "", (i != 1) ? (" <a id='remove_day" + i + "' href='#' onclick='xingcheng_remove_day();return false;' style='display:" + ((i == routeList.Count) ? "" : "none") + "'>删除第" + i + "天行程</a>") : ""); if (detail.Titletype) { string[] dtitle = new string[detail.Scenicnum]; string[] dslt = new string[detail.Scenicnum - 1]; string tle = detail.DayTitle; dtitle[0] = tle.Substring(0, tle.IndexOf("<em")); for (int m = 1; m < detail.Scenicnum; m++) { tle = tle.Substring(tle.IndexOf("tfc") + 3); dslt[m - 1] = tle.Substring(0, tle.IndexOf("'")); tle = tle.Substring(tle.IndexOf("</em>") + 5); if (m == detail.Scenicnum - 1) { dtitle[m] = tle; } else { dtitle[m] = tle.Substring(0, tle.IndexOf("<em")); } } //555<em class='tfc2'></em>444<em class='tfc3'></em>333<em class='tfc1'></em>222<em class='tfc2'></em>111<em class='tfc3'></em>900 sb.AppendFormat("<dl class='titleByJd' id='jd_title_{0}'><dd><input class='text' id='route_{0}_0_0' name='route_{0}_0_0' size='10' value='{1}' /></dd>", i, dtitle[0]); for (int n = 1; n < detail.Scenicnum; n++) { sb.AppendFormat("<dd><select name='s_route_{0}_0_{1}'><option value='1' {2}>=飞机=</option><option value='2' {3}>=汽车=</option><option value='3' {4}>=轮船=</option><option value='4' {5}>=火车=</option></select>", i, n - 1, dslt[n - 1] == "1" ? "selected" : "", dslt[n - 1] == "2" ? "selected" : "", dslt[n - 1] == "3" ? "selected" : "", dslt[n - 1] == "4" ? "selected" : ""); sb.AppendFormat("<input class='text' id='route_{0}_0_{1}' name='route_{0}_0_{1}' size='10' value='{2}' /></dd>", i, n, dtitle[n]); } sb.AppendFormat("<a href='#?' onclick='xingcheng_add_jd({0});'>+添加</a><a href='#?' onclick='xingcheng_remove_jd({0});'>-减少</a>", i); sb.AppendFormat("<input type='hidden' id='jd_title_sc{0}' name='jd_title_sc{0}' value='{1}' /></dl>", i, detail.Scenicnum); } sb.AppendFormat("<dl><dt>行程安排:</dt>"); sb.AppendFormat("<dd><div class='add_del_box'>"); sb.AppendFormat("<textarea id='route_{0}_1' name='route_{0}_1' style='width:700px;' rows='15'>{1}</textarea>", i, detail.DayDetail); sb.AppendFormat("</div></dd></dl>"); sb.AppendFormat("<dl class='hotel'><dd>"); sb.AppendFormat("<div class='floatL'>早餐:<input id='route_{0}_2' name='route_{0}_2' type='checkbox' {2} /><input class='text text160' id='route_{0}_6' name='route_{0}_6' type='text' size='20' value='{1}' /></div>", i, detail.Breakfastdesc, detail.BreakFast ? "checked" : ""); sb.AppendFormat("<div class='floatL'>中餐:<input id='route_{0}_3' name='route_{0}_3' type='checkbox' {2} /><input class='text text160' id='route_{0}_7' name='route_{0}_7' type='text' size='20' value='{1}' /></div>", i, detail.Lunchdesc, detail.Lunch ? "checked" : ""); sb.AppendFormat("<div class='floatL'>晚餐:<input id='route_{0}_4' name='route_{0}_4' type='checkbox' {2} /><input class='text text160' id='route_{0}_8' name='route_{0}_8' type='text' size='20' value='{1}' /></div>", i, detail.Dinnerdesc, detail.Dinner ? "checked" : ""); sb.AppendFormat("</dd></dl>"); sb.AppendFormat("<dl><dt>住宿:<input type='text' class='text text160' id='route_{0}_5' name='route_{0}_5' value='{1}'/></dt></dl></div>", i, detail.Hotel); } routeDetails = sb.ToString(); } else { StringBuilder sb = new StringBuilder(); sb.AppendFormat("<div class='fieldset xingcheng-by-day' id='day_1'>"); //sb.AppendFormat("<dl><dd><b>第1天:<input class='text' id='route_1_0' name='route_1_0' style='width:300px;' /></b></dd></dl>"); sb.AppendFormat("<dl><dd><b>第1天:<input type='radio' name='rdo_title_1' value='False' checked='checked' onclick='checkTitle(this,1)' />按标题<input class='text' id='route_1_0' name='route_1_0' style='width:300px;' />"); sb.AppendFormat("<input type='radio' name='rdo_title_1' value='True' onclick='checkTitle(this,1)' />按景点</b></dd></dl>"); sb.AppendFormat("<dl><dt>行程安排:</dt>"); sb.AppendFormat("<dd><div class='add_del_box'>"); sb.AppendFormat("<textarea id='route_1_1' name='route_1_1' style='width:700px;' rows='15'></textarea>"); sb.AppendFormat("</div></dd></dl>"); sb.AppendFormat("<dl class='hotel'><dd>"); sb.AppendFormat("<div class='floatL'>早餐:<input id='route_1_2' name='route_1_2' type='checkbox' /><input class='text text160' id='route_1_6' name='route_1_6' type='text' size='20' /></div>"); sb.AppendFormat("<div class='floatL'>中餐:<input id='route_1_3' name='route_1_3' type='checkbox' /><input class='text text160' id='route_1_7' name='route_1_7' type='text' size='20' /></div>"); sb.AppendFormat("<div class='floatL'>晚餐:<input id='route_1_4' name='route_1_4' type='checkbox' /><input class='text text160' id='route_1_8' name='route_1_8' type='text' size='20' /></div>"); sb.AppendFormat("</dd></dl>"); sb.AppendFormat("<dl><dt>住宿:<input type='text' class='text text160' id='route_1_5' name='route_1_5' /></dt></dl></div>"); routeDetails = sb.ToString(); } } else { Function.goMessagePage("修改路线", "操作失败,数据不存在!", "Routes/RouteList.aspx"); } }