Esempio n. 1
0
        public void CreateUpdateScenicAdmin(Guid memid, int scenicid)
        {
            Model.ScenicAdmin sa = GetScenicAdmin(memid);

            if (sa == null)
            {
                sa = new ScenicAdmin();
                sa.Membership = GetMemberById(memid);
            }

            Model.Scenic sc = new BLL.BLLScenic().GetScenicById(scenicid);
            sa.Scenic = sc;
            dal.UpdateScenicAdmin(sa);

            string[] names = { sa.Membership.Name };
            trp.AddUsersToRoles(names, roles);
        }
Esempio n. 2
0
 public void SaveScenictopic(IList<string> topicname, int scenicid)
 {
     Scenic s = new BLL.BLLScenic().GetScenicById(scenicid);
     Iticket.SaveScenictopic(topicname, s);
 }
Esempio n. 3
0
 public void GetChildAreaIds()
 {
     BLL.BLLScenic bllScenic = new BLL.BLLScenic();
       IList<Model.Scenic> scenics=  bllScenic.GetList_Mipang();
       Assert.IsTrue(scenics.Count > 0);
 }
Esempio n. 4
0
        public void Run()
        {
            if(!Directory.Exists(mappath))
            {
                Directory.CreateDirectory(mappath);
            }
            if (!Directory.Exists(mappath + "/testMainimgLocalizer/"))
            {
                Directory.CreateDirectory(mappath + "/testMainimgLocalizer/");
            }
            if (!Directory.Exists(mappath + "/testDetailimgLocalizer/"))
            {
                Directory.CreateDirectory(mappath + "/testDetailimgLocalizer/");
            }
            if (!Directory.Exists(mappath + "/scenicimg/"))
            {
                Directory.CreateDirectory(mappath + "/scenicimg/");
            }
            if (!Directory.Exists(mappath + "/scenicimg/mainimg/"))
            {
                Directory.CreateDirectory(mappath + "/scenicimg/mainimg/");
            }
            if (!Directory.Exists(mappath + "/scenicimg/detailimg/"))
            {
                Directory.CreateDirectory(mappath + "/scenicimg/detailimg/");
            }
            if (!Directory.Exists(mappath + "/scenicimg/small/"))
            {
                Directory.CreateDirectory(mappath + "/scenicimg/small/");
            }
            var bllscenic = new BLL.BLLScenic();
            var newslist = getSceniclist();

            //收集景区topic,及topicseo
            var temptp = string.Empty;
            var temptseo = string.Empty;
            foreach (var tstring in newslist)
            {
                temptp += tstring.topic + ",";
                temptseo += tstring.topicseo + ",";
            }
            var topicc1 = temptp.Split(new char[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList<string>();
            var topics1 = temptseo.Split(new char[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList<string>();
            var topicc2 = topicc1.Distinct().ToList<string>();
            var topics2 = topics1.Distinct().ToList<string>();
            //blltopic.SaveTopic(topicc2, topics2);

            var orgslist = bllscenic.GetScenic().ToList<Model.Scenic>();
            bllscenic.DeleteScenicimg();
            //循环景区
            foreach (Entity.ScenicEntity item in newslist)
            {
                if (string.IsNullOrWhiteSpace(item.name)) break;
                //组装scenic
                List<Model.Scenic> ss = orgslist.Where<Model.Scenic>(x => x.Name == item.name).ToList();
                Model.Scenic s;
                if (ss.Count == 1)//已经存在该景区
                {
                    s = ss.First();
                    s.Address = item.address;
                    s.Level = item.level;
                    s.SeoName = string.IsNullOrEmpty(s.SeoName) ? item.seoname : s.SeoName;
                    s.Area = bllarea.GetAreaByAreaname(item.areaid);
                    //处理topic字符串
                    var temptopic = item.topic.Split(new char[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList<string>();
                    // blltopic.SaveScenictopic(temptopic, s.Id);
                    s.Trafficintro = item.trafficintro;
                    s.BookNote = item.bookintro;
                    s.ScenicDetail = item.scenicdetail;
                    s.Desec = item.scenicintro;
                    s.Type = Model.EnterpriseType.景点;
                    //组装tickets
                    var newtlist = getTicketslist().Where(x => x.scenicname == s.Name).ToList<Entity.TicketEntity>();
                    var tickets = bllticket.GetTicketByscId(s.Id);
                    Model.Ticket t;
                    foreach (var te in newtlist)
                    {
                        var tmp = tickets.Where(x => x.Name == te.ticketname);
                        if (tmp.Count() == 1)//已经存在该票
                        {
                            t = tmp.First();
                            t.Name = te.ticketname;
                            t.Scenic = s;
                            t.IsMain = true;
                            var tpnormal = t.TicketPrice.Where(x => x.PriceType == Model.PriceType.Normal);
                            if (tpnormal.Any())
                                t.TicketPrice.First(x => x.PriceType == Model.PriceType.Normal).Price = decimal.Parse(te.orgprice);
                            var tpol = t.TicketPrice.Where(x => x.PriceType == Model.PriceType.PayOnline);
                            if (tpol.Any())
                                t.TicketPrice.First(x => x.PriceType == Model.PriceType.PayOnline).Price = decimal.Parse(te.olprice);
                            var tppre = t.TicketPrice.Where(x => x.PriceType == Model.PriceType.PreOrder);
                            if (tppre.Any())
                                t.TicketPrice.First(x => x.PriceType == Model.PriceType.PreOrder).Price = decimal.Parse(te.orgprice) * (decimal)0.95;
                        }
                        else//不存在该票
                        {
                            t = new Model.TicketNormal { Name = te.ticketname, Scenic = s, IsMain = true };
                            t.TicketPrice = new List<Model.TicketPrice>() {
                            new Model.TicketPrice() { Price=decimal.Parse(te.orgprice),PriceType=Model.PriceType.Normal,Ticket=t},
                            new Model.TicketPrice(){Price=decimal.Parse(te.olprice),PriceType=Model.PriceType.PayOnline,Ticket=t},
                            new Model.TicketPrice(){Price=decimal.Parse(te.orgprice)*(decimal)0.95,PriceType=Model.PriceType.PreOrder,Ticket=t}};
                            tickets.Add(t);
                        }
                    }
                    s.Tickets = tickets;
                    s.Photo = item.mainpic;
                    bllscenic.UpdateScenicInfo(s);
                    var silist = CopyFile(s);
                    if (silist != null)
                    {
                        bllscenic.SaveScenicimg(silist);
                    }
                }
                else//不存在该景区
                {
                    s = new Model.Scenic();
                    s.Name = item.name;
                    s.Address = item.address;
                    s.Area = bllarea.GetAreaByAreaname(item.areaid);
                    s.BookNote = item.bookintro;
                    s.Level = item.level;
                    s.Type = Model.EnterpriseType.景点;
                    //处理topic字符串
                    var temptopic = item.topic.Split(new char[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList<string>();
                    s.ScenicDetail = item.scenicdetail;
                    s.SeoName = item.seoname;
                    s.Trafficintro = item.trafficintro;
                    s.Desec = item.scenicintro;
                    //组装tickets
                    List<Entity.TicketEntity> newtlist = getTicketslist().Where(x => x.scenicname == s.Name).ToList<Entity.TicketEntity>();
                    List<Model.Ticket> tickets = new List<Model.Ticket>();
                    Model.Ticket t;
                    foreach (var te in newtlist)
                    {
                        t = new Model.TicketNormal();
                        t.Name = te.ticketname;
                        t.Scenic = s;
                        t.IsMain = true;
                        t.TicketPrice = new List<Model.TicketPrice>() {
                            new Model.TicketPrice() { Price=decimal.Parse(te.orgprice),PriceType=Model.PriceType.Normal,Ticket=t},
                            new Model.TicketPrice(){Price=decimal.Parse(te.olprice),PriceType=Model.PriceType.PayOnline,Ticket=t},
                            new Model.TicketPrice(){Price=decimal.Parse(te.orgprice)*(decimal)0.95,PriceType=Model.PriceType.PreOrder,Ticket=t}
                        };
                        tickets.Add(t);
                    }
                    s.Tickets = tickets;
                    s.Photo = item.mainpic;
                    bllscenic.UpdateScenicInfo(s);
                    //   blltopic.SaveScenictopic(temptopic, bllscenic.GetScenicBySeoName(item.seoname).Id);
                    List<Model.ScenicImg> silist = CopyFile(s);
                    if (silist != null)
                    {
                        bllscenic.SaveScenicimg(silist);
                    }
                }
            }
            //bllscenic.UpdateScenicInfo(orgslist);
        }