Example #1
0
        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");
        }
Example #2
0
        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");
        }
Example #3
0
        private void EditRoute()
        {
            decimal price      = 0;
            int     routeOrder = 0;

            ClassLibrary.Model.Routes routeModel = new ClassLibrary.Model.Routes();

            routeModel.ID = routeId;

            routeModel.routesPrentClassID = "";
            routeModel.Title = Request.Form["Title"];

            if (Decimal.TryParse(Request.Form["Price"], out price))
            {
                routeModel.Price = price;
            }
            else
            {
                Response.Write("<script>alert('成人价格错误!');history.back(-1);</script>");
                return;
            }
            if (Request.Form["ChildPrice"] == "")
            {
                routeModel.ChildPrice = 0;
            }
            else if (Decimal.TryParse(Request.Form["ChildPrice"], out price))
            {
                routeModel.ChildPrice = price;
            }
            else
            {
                Response.Write("<script>alert('小孩价格错误!');history.back(-1);</script>");
                return;
            }
            if (Request.Form["routeOrder"] == "")
            {
                routeModel.Order = 9999;
            }
            else if (int.TryParse(Request.Form["routeOrder"], out routeOrder))
            {
                routeModel.Order = routeOrder;
            }
            else
            {
                Response.Write("<script>alert('线路排序错误!');history.back(-1);</script>");
                return;
            }
            int advanceDay = 0;

            if (int.TryParse(Request.Form["AdvanceDays"], out advanceDay))
            {
                routeModel.AdvanceDays = advanceDay;
            }


            routeModel.ThemeID = Request.Form["ThemeID"];
            if (routeModel.ThemeID == null)
            {
                routeModel.ThemeID = "";
            }
            //routeModel.routesPrentClassID = ParentClassIDList(routeModel.routesClassID);
            routeModel.StartPosition = Request.Form["StartPosition"];
            routeModel.RouteTime     = Request.Form["RouteTime"];
            routeModel.TrafficModel  = Request.Form["TrafficModel1"] + "去 " + Request.Form["TrafficModel2"] + "回";
            //routeModel.DescriptionRoute = Request.Form["DescriptionRoute"];
            routeModel.DescriptionPrice = ClassLibrary.BLL.WebClass.addInternelLink(Request.Form["DescriptionPrice"], 1, null);
            routeModel.RecommendHot     = Convert.ToBoolean(Request.Form["RecommendHot"]);
            routeModel.SeoKeywords      = Request.Form["SeoKeywords"];
            routeModel.SeoDescription   = Request.Form["SeoDescription"];
            //routeModel.RouteFeature = Request.Form["RouteFeature"];
            routeModel.RouteNotice = ClassLibrary.BLL.WebClass.addInternelLink(Request.Form["RouteNotice"], 1, null);
            routeModel.Display     = Convert.ToBoolean(Request.Form["Isdisplay"]);
            routeModel.ViewCount   = Convert.ToInt32(Request.Form["ViewCount"]);
            routeModel.Destination = Request.Form["Destination"];
            routeModel.Supplier    = Request.Form["SupplierName"];
            routeModel.SupplierTel = Request.Form["SupplierTel"];
            routeModel.DateType    = Convert.ToBoolean(Request.Form["DateType"]);
            routeModel.SeoTitle    = Request.Form["SeoTitle"];
            routeModel.Bright      = Request.Form["RouteBright"];
            routeModel.BoatName    = Request.Form["BoatName"];
            routeModel.LocationID  = Convert.ToInt32(Request.Form["locationid"]);
            if (routeModel.LocationID == 0)
            {
                Response.Write("<script>alert('请正确选择线路地址!');history.back(-1);</script>");
                return;
            }
            if (routeModel.DateType)
            {
                routeModel.DatePrice = Request.Form["DatePrice"];
            }

            routeModel.DetailType = Convert.ToBoolean(Request.Form["DetailType"]);
            if (routeModel.DetailType)
            {
                routeModel.RouteTime = Request.Form["xing_day"];

                /*for (int j = 1; j <= Int32.Parse(routeModel.RouteTime); j++)
                 * {
                 *  if (Request.Form["route_" + j + "_0"] == null)
                 *  {
                 *      Response.Write("<script>alert('请输入第 " + j + " 天标题');history.back(-1);</script>");
                 *      return;
                 *  }
                 *  if (Request.Form["route_" + j + "_1"] == null)
                 *  {
                 *      Response.Write("<script>alert('请输入第 " + j + " 天行程');history.back(-1);</script>");
                 *      return;
                 *  }
                 * }*/
                routeModel.DescriptionRoute = Request.Form["route_1_1"];
            }

            string province = Request.Form["ProvinceCheckBox"];

            if (province == null || province == "")
            {
                Response.Write("<script>alert('请选择线路目的地省市!');history.back(-1);</script>");
                return;
            }
            routeModel.routesPrentClassID = ParentClassIDList(province) + ",";

            string scenic = Request.Form["ScenicCheckBox"];

            if (scenic == null)
            {
                scenic = "";
            }

            string[] temScenics = scenic.Split(',');
            foreach (string temScenic in temScenics)
            {
                if (!routeModel.routesPrentClassID.Contains(temScenic))
                {
                    routeModel.routesPrentClassID += temScenic + ",";
                }
            }
            routeModel.routesPrentClassID = routeModel.routesPrentClassID.Substring(0, routeModel.routesPrentClassID.Length - 1);

            int routeParentID = Convert.ToInt32(Request.Form["routeParentID"]);

            if (scenic != "")
            {
                string[] scenicIds = scenic.Split(',');
                routeModel.routesClassID = routeParentID + "," + scenicIds[0];
            }
            else
            {
                string[] scenicIds = province.Split(',');
                routeModel.routesClassID = routeParentID + "," + scenicIds[0];
            }

            //string[] subRCIds = province.Split(',');

            routeModel.RouteFeature = ClassLibrary.BLL.WebClass.addInternelLink(Request.Form["RouteFeature"], 1, null);
            if (!routeModel.DetailType)
            {
                routeModel.DescriptionRoute = ClassLibrary.BLL.WebClass.addInternelLink(Request.Form["DescriptionRoute"], 1, null);
            }

            //图片
            HttpFileCollection files = Request.Files;

            int    size         = 0;
            string fileFullPath = Server.MapPath(SysConfig.UploadFilePathRoutesImg);

            Function.CreatedDirectory(fileFullPath);
            string oldAppImage = Request.Form["appImage_Hidden"];

            routeModel.AppImg = oldAppImage;

            if (files.Count > 0)
            {
                string[] oldImages = Request.Form["Image_Hidden"].Split(',');

                for (int i = 0; i < files.Count; i++)
                {
                    HttpPostedFile file = files[i];
                    size = file.ContentLength;

                    if (size > 0)
                    {
                        string ext      = Path.GetExtension(file.FileName);
                        string fileName = DateTime.Now.ToString("yyMMddHHmmssffff") + ext;

                        file.SaveAs(fileFullPath + fileName);
                        if (i == 0)
                        {
                            //缩图
                            Bitmap tmp  = new Bitmap(fileFullPath + fileName);
                            Bitmap bmp0 = Function.MakeThumNail(tmp, 100, 64);
                            tmp.Dispose();
                            string appfileName = DateTime.Now.ToString("yyMMddHHmmssffff") + ext;
                            Function.SaveBitmapImg(bmp0, fileFullPath + appfileName, ((long)90));
                            //bmp0.Save(fileFullPath + fileName);
                            bmp0.Dispose();
                            routeModel.AppImg = appfileName;

                            if (oldAppImage != "")
                            {
                                Function.DeleteFile(fileFullPath + oldAppImage);
                            }
                        }
                        routeModel.Image += fileName + ",";

                        if (oldImages.Length > i)
                        {
                            Function.DeleteFile(fileFullPath + oldImages[i]);
                        }
                    }
                    else //没有新图片时使用对应的旧图
                    {
                        if (oldImages.Length > i)
                        {
                            routeModel.Image += oldImages[i] + ",";
                        }
                    }
                }

                if (!string.IsNullOrEmpty(routeModel.Image))
                {
                    routeModel.Image = routeModel.Image.Substring(0, routeModel.Image.Length - 1);
                }
            }
            else
            {
                routeModel.Image = Request.Form["Image_Hidden"];
            }
            if (routeModel.AppImg == "")
            {
                string fileName = routeModel.Image.Split(',')[0];
                //缩图
                Bitmap tmp  = new Bitmap(fileFullPath + fileName);
                Bitmap bmp0 = Function.MakeThumNail(tmp, 100, 64);
                tmp.Dispose();
                string ext         = Path.GetExtension(fileName);
                string appfileName = Function.GetRandomTime() + ext;
                Function.SaveBitmapImg(bmp0, fileFullPath + appfileName, ((long)90));
                bmp0.Dispose();

                routeModel.AppImg = appfileName;
            }

            //end

            if (routeBLL.Update(routeModel) > 0)
            {
                bool oldDetailType = Convert.ToBoolean(Request.Form["DetailType_Hidden"]);
                if (oldDetailType)
                {
                    //delete
                    ClassLibrary.BLL.RouteDetails routeDetailBll = new ClassLibrary.BLL.RouteDetails();

                    routeDetailBll.DeleteByRouteId(routeId);
                }
                if (routeModel.DetailType)
                {
                    //update
                    ClassLibrary.Model.RouteDetails routeDetailModel;
                    ClassLibrary.BLL.RouteDetails   routeDetailBll = new ClassLibrary.BLL.RouteDetails();

                    for (int j = 1; j <= Int32.Parse(routeModel.RouteTime); j++)
                    {
                        routeDetailModel          = new ClassLibrary.Model.RouteDetails();
                        routeDetailModel.RouteID  = routeModel.ID;
                        routeDetailModel.DayOrder = j;
                        routeDetailModel.DayTitle = Request.Form["route_" + j + "_0"];
                        if (Convert.ToBoolean(Request.Form["rdo_title_" + j]))
                        {
                            routeDetailModel.DayTitle = Request.Form["route_" + j + "_0_0"];
                            int snum = Convert.ToInt32(Request.Form["jd_title_sc" + j]);
                            for (int k = 1; k < snum; k++)
                            {
                                routeDetailModel.DayTitle += "<em class='tfc" + Request.Form["s_route_" + j + "_0_" + (k - 1)] + "'></em>";
                                routeDetailModel.DayTitle += Request.Form["route_" + j + "_0_" + k];
                            }
                            routeDetailModel.Titletype = true;
                            routeDetailModel.Scenicnum = snum;
                        }
                        routeDetailModel.DayDetail     = ClassLibrary.BLL.WebClass.addInternelLink(Request.Form["route_" + j + "_1"], 1, null);
                        routeDetailModel.Breakfastdesc = Request.Form["route_" + j + "_6"];
                        routeDetailModel.Lunchdesc     = Request.Form["route_" + j + "_7"];
                        routeDetailModel.Dinnerdesc    = Request.Form["route_" + j + "_8"];
                        if (Request.Form["route_" + j + "_2"] != null)
                        {
                            routeDetailModel.BreakFast = true;
                        }
                        if (Request.Form["route_" + j + "_3"] != null)
                        {
                            routeDetailModel.Lunch = true;
                        }
                        if (Request.Form["route_" + j + "_4"] != null)
                        {
                            routeDetailModel.Dinner = true;
                        }
                        routeDetailModel.Hotel = Request.Form["route_" + j + "_5"];

                        routeDetailBll.Add(routeDetailModel);
                    }
                }
                Function.goMessagePage("修改路线", "操作成功", "Routes/RouteList.aspx");
            }
            else
            {
                Function.goMessagePage("修改路线", "操作失败,请稍后再试", "Routes/RouteList.aspx");
            }
        }