Exemplo n.º 1
0
        public void BuildOrderForQZTest()
        {
            BLL.BLLQZTicketSeller seller = new BLLQZTicketSeller();

            TourMembership member = new TourMembership();
            member.IdCard = "idcard";

            Ticket currentTicket = new TicketNormal();
            TicketPrice tp = new TicketPrice();
            tp.Price = 1;
            tp.PriceType = PriceType.PreOrder;
            tp.Ticket = currentTicket;
            currentTicket.TicketPrice.Add(tp);
            Model.Order order = seller.BuildOrderForQZ(member,"yuanfei","",currentTicket, 1, "浙江旅游信息中心网站");

            Assert.AreEqual(order.TotalPrice, 1);
        }
Exemplo n.º 2
0
    private void bind(Scenic scenic)
    {
        maintitlett.InnerHtml = scenic.Name;

        hfposition.Value = scenic.Position;
        scbindname = scenic.Name;
        hfscname.Value = scenic.Name;
        scid = scenic.Id;
        Area parentarea = new BLLArea().GetAreaByCode(scenic.Area.Code.Substring(0, 4) + "00");
        Area childarea = scenic.Area;
        areaname.HRef = "/Tickets/" + parentarea.SeoName;
        areaname.InnerHtml = parentarea.Name.Substring(3, parentarea.Name.Length - 3) + " >";
        if (parentarea.Id != childarea.Id)
        {
            county.Visible = true;
            string childname = childarea.Name.Substring(3);
            if (childname.Length >= 6)
                childname = childname.Substring(3);
            county.InnerHtml = childname + " >";
            county.HRef = "/Tickets/" + parentarea.SeoName + "_" + childarea.SeoName;
        }
        else
        {
            county.Visible = false;
        }
        //导航链接 隐藏套票的所属单位
        string owerName = scenic.Name;
        IList<Ticket> tickets = s.Tickets;
        foreach (Ticket t in tickets)
        {
            if (t.As<Ticket>() is TicketUnion)
            {
                owerName = t.DisplayNameOfOwner;
                break;
            }

        }
        scenicname.HRef = "/Tickets/" + parentarea.SeoName + "_" + scenic.Area.SeoName + "/" + scenic.SeoName + ".html";
        scenicname.InnerHtml = owerName;
        scaddress = scenic.Address;
        booknote = scenic.BookNote;
        sclevel = scenic.Level;
        scdesc = scenic.ScenicDetail;
        transguid = scenic.Trafficintro;
        if (!string.IsNullOrEmpty(scenic.Desec))
        {
            if (scenic.Desec.Length > 30)
                scshortdesc = scenic.Desec.Substring(0, 30) + "...";
            else
                scshortdesc = scenic.Desec + "...";
        }
        IList<ScenicImg> listsi = bllscenicimg.GetSiByType(scenic, 1);
        if (listsi.Count > 0)
            ImgMainScenic.Src = "/ScenicImg/mainimg/" + listsi[0].Name;
        //判断是否是联票,如果是的话则使用新的样式'
        if (scenic.Tickets != null && scenic.Tickets.Count > 0)
        {
            var t = scenic.Tickets[0].As<Ticket>();
            if (t is TicketUnion)
            {
                rptBookNote.DataSource = ((TicketUnion)t).TicketList;
                rptBookNote.DataBind();
                rptscInfo.DataSource = ((TicketUnion)t).TicketList;
                rptscInfo.DataBind();
                rptJt.DataSource = ((TicketUnion)t).TicketList;
                rptJt.DataBind();
            }
            else
            {
                List<Ticket> listTicket = new List<Ticket>();
                listTicket.Add(t);
                rptBookNote.DataSource = listTicket;
                rptBookNote.DataBind();
                rptscInfo.DataSource = listTicket;
                rptscInfo.DataBind();
                rptJt.DataSource = listTicket;
                rptJt.DataBind();
            }
        }
        else
        {
            Ticket t = new TicketNormal();
            t.Scenic = scenic;
            List<Ticket> listTicket = new List<Ticket>();
            listTicket.Add(t);
            rptBookNote.DataSource = listTicket;
            rptBookNote.DataBind();
            rptscInfo.DataSource = listTicket;
            rptscInfo.DataBind();
            rptJt.DataSource = listTicket;
            rptJt.DataBind();
        }

        IList<Scenic> list = bllscenic.GetScenic();
        Dictionary<Scenic, double> places = new Dictionary<Scenic, double>();
        List<double> listdistance = new List<double>();
        if (!string.IsNullOrEmpty(scenic.Position))
        {
            //bindimg(list, scenic);
            //foreach (ScenicImg item in scdiction.Keys)
            //{
            bindimglist += scenic.Position + ":";
            // }
        }

        //绑定主题
        rpttopic.DataSource = blltopic.GetStByscid(scenic.Id);
        rpttopic.DataBind();

        //绑定普通票
        IList<Ticket> listticket = bllticket.GetTp(scenic.Id);

        //衢州新春门票,的主门票productCode
        if (listticket.Count > 0)
        {
            maintitlett.InnerHtml = listticket[0].DisplayNameOfOwner;
            IList<Ticket> listTicket = listticket.Where(x => x.IsMain).Where(x => x.TourActivity != null).ToList();
            if (listTicket.Count() > 0)
            {
                hfProductCode.Value = listTicket[0].ProductCode;
                //判断门票是否已经过期
                TourActivity act = listTicket[0].TourActivity;
                if (DateTime.Now.Date >= act.BeginDate && DateTime.Now.Date <= act.EndDate)
                {

                    var ticketAsign = listTicket[0].TourActivity
                         .GetActivityAssignForPartnerTicketDate(SiteConfig.PartnerCodeOfTourOL, listTicket[0].ProductCode, DateTime.Now.Date);

                    hfSyCount.Value = (ticketAsign.AssignedAmount - ticketAsign.SoldAmount).ToString();
                }
            }
            else
            {
                qzTicketCount.Visible = false;
            }
        }
        else
        {
            qzTicketCount.Visible = false;
        }

        rpttp.DataSource = listticket.Where(x => x.Enabled).ToList();
        rpttp.DataBind();
        //编辑
        EditRole();
        //sc_dp.scname = scenic.Name;
        //sc_dp.BaseData = booknote;

        //plate2.scname = scenic.Name;
        //plate2.BaseData = scenic.ScenicDetail;
        //sc_jtzn.scname = scenic.Name;
        //sc_jtzn.BaseData = scenic.Trafficintro;
    }
Exemplo n.º 3
0
    protected void rptSearchScenics_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "addscenic")
        {

            int scenicId = Convert.ToInt32(e.CommandArgument);
            //为联票创建一张门票
            DJ_TourEnterprise ent = bllEnt.GetOne(scenicId);
            //如果该拥有者已经有一张门票属于该套票 则不做任何操作
            if (CurrentTicket.TicketList.Where(x => x.Scenic.Id == scenicId).Count() > 0)
            {
                CommonLibrary.Notification.Show(this, "", "该套票已经包含此景区的门票,不需要创建", "");
            }
            else
            {
                TicketNormal t = new TicketNormal();
                t.BeginDate = DateTime.Today;
                t.EndDate = DateTime.MaxValue;
                t.IsMain = false;
                t.Lock = true;
                t.Name = CurrentTicket.Name + "-" + ent.Name;
                t.Scenic = ent;
                //获得主票的原价信息,赋值给自动创建的门票
                decimal originalPrice = 0;
                if (ent.Tickets.Count > 0)
                {

                    if (ent.Tickets.Where(x => x.IsMain).Count() > 0)
                    {
                        originalPrice = ent.Tickets.Where(x => x.IsMain).ToList()[0].GetPrice(PriceType.Normal);
                    }
                    else
                    {
                        originalPrice = ent.Tickets[0].GetPrice(PriceType.Normal);
                    }
                }
                IList<TicketPrice> tpList = new List<TicketPrice>();
                TicketPrice tp1 = new TicketPrice();
                tp1.Price = 0;
                tp1.PriceType = PriceType.PayOnline;

                TicketPrice tp2 = new TicketPrice();
                tp2.Price = 0;
                tp2.PriceType = PriceType.PreOrder;

                TicketPrice tp3 = new TicketPrice();
                tp3.Price = originalPrice;
                tp3.PriceType = PriceType.Normal;

                tpList.Add(tp1);
                tpList.Add(tp2);
                tpList.Add(tp3);
                t.TicketPrice = tpList;
                t.TicketUnion = CurrentTicket;
                bllTicket.SaveOrUpdateTicket(t);
            }

            BindTickets();
        }
    }
Exemplo n.º 4
0
 public void SaveOrUpdateTicket(string ticketname, string yuan, string xf, string zx, string ticketid, string scid)
 {
     Model.Ticket ticket;
     if (!string.IsNullOrEmpty(ticketid))
     {
         ticket = GetTicket(int.Parse(ticketid));
         ticket.TicketPrice.Where(x => x.PriceType == PriceType.Normal).First().Price = decimal.Parse(yuan);
         ticket.TicketPrice.Where(x => x.PriceType == PriceType.PreOrder).First().Price = decimal.Parse(xf);
         ticket.TicketPrice.Where(x => x.PriceType == PriceType.PayOnline).First().Price = decimal.Parse(zx);
         ticket.Name = ticketname;
         ticket.Lock = true;
     }
     else
     {
         ticket = new TicketNormal();
         ticket.Name = ticketname;
         ticket.Scenic = bllScenic.GetScenicById(int.Parse(scid));
         ticket.Lock = true;
         ticket.TicketPrice = new List<TicketPrice>() {
                 new TicketPrice(){PriceType=PriceType.Normal,Price=decimal.Parse(yuan),Ticket=ticket},
                 new TicketPrice(){PriceType=PriceType.PreOrder,Price=decimal.Parse(xf),Ticket=ticket},
                 new TicketPrice(){PriceType=PriceType.PayOnline,Price=decimal.Parse(zx),Ticket=ticket}
             };
     }
     SaveOrUpdateTicket(ticket);
 }
Exemplo n.º 5
0
        private Scenic ParseTicket(tourism_item item)
        {
            Scenic s = new Scenic();
            s.Name = item.title;
            s.MipangId = item.mipang_id;
            s.Phone = item.photo;
            s.Type = EnterpriseType.景点;
            s.IsHide = true;
            s.Area = new BLLArea().GetAreaByCode("330000");

            ///构造景点的area对象
            ///现有数据: 浙江/江苏/All/杭州/建德
            ///目标数据:浙江省杭州市
            s.Desec = item.city;

            foreach (ticket ticket in item.tickets)
            {
                Ticket t = new TicketNormal();
                t.IsMain = true;
                t.Name = ticket.ticket_name;

                TicketPrice tp1 = new TicketPrice();
                TicketPrice tp2= new TicketPrice();
                TicketPrice tp3 = new TicketPrice();
                tp1.Price = ticket.ticket_price;
                tp1.PriceType = PriceType.Normal;
                tp1.Ticket = t;

                tp2.Price = ticket.ticket_price;
                tp2.PriceType = PriceType.PreOrder;
                tp2.Ticket = t;

                tp3.Price = ticket.ticket_price;
                tp3.PriceType = PriceType.PayOnline;
                tp3.Ticket = t;

                t.TicketPrice.Add(tp1);
                t.TicketPrice.Add(tp2);
                t.TicketPrice.Add(tp3);

              //  t.TicketPrice = tps;
                t.Scenic = s;
                s.Tickets.Add(t);
            }

            return s;
        }