Exemplo n.º 1
0
        private void AddTicket()
        {
            lstTicket.Clear();
            dateType = GetDateType();
            string annuelType = (string)cboAnnualType.SelectedItem;
            int    lastId     = Convert.ToInt32(db.Ticket.ToList().Last().TicketId); //這是三小
            int    id         = lastId + 1;

            if (rbAnnual.Checked)
            {
                for (int i = 0; i < nudStandard.Value; i++)
                {
                    TicketOffer ticketType = GetTicketType("年票", annuelType, "成人");
                    lstTicket.Add(new Ticket
                    {
                        TicketId      = id.ToString().PadLeft(10, '0'),
                        TicketOfferNo = ticketType.TicketOfferNo,
                        EffectiveDate = dtpVisit.Value,
                        InvalidDate   = dtpVisit.Value.AddDays(ticketType.ValidDay - 1),
                        GuestName     = "",
                        Status        = true
                    });
                    id += 1;
                }
                for (int i = 0; i < nudChild.Value; i++)
                {
                    TicketOffer ticketType = GetTicketType("年票", annuelType, "兒童");
                    lstTicket.Add(new Ticket
                    {
                        TicketId      = id.ToString().PadLeft(10, '0'),
                        TicketOfferNo = ticketType.TicketOfferNo,
                        EffectiveDate = dtpVisit.Value,
                        InvalidDate   = dtpVisit.Value.AddDays(ticketType.ValidDay - 1),
                        GuestName     = "",
                        Status        = true
                    });
                    id += 1;
                }
                for (int i = 0; i < nudSenior.Value; i++)
                {
                    TicketOffer ticketType = GetTicketType("年票", annuelType, "老年");
                    lstTicket.Add(new Ticket
                    {
                        TicketId      = id.ToString().PadLeft(10, '0'),
                        TicketOfferNo = ticketType.TicketOfferNo,
                        EffectiveDate = dtpVisit.Value,
                        InvalidDate   = dtpVisit.Value.AddDays(ticketType.ValidDay - 1),
                        GuestName     = "",
                        Status        = true
                    });
                    id += 1;
                }
                for (int i = 0; i < nudDisability.Value; i++)
                {
                    TicketOffer ticketType = GetTicketType("年票", annuelType, "身心障礙");
                    lstTicket.Add(new Ticket
                    {
                        TicketId      = id.ToString().PadLeft(10, '0'),
                        TicketOfferNo = ticketType.TicketOfferNo,
                        EffectiveDate = dtpVisit.Value,
                        InvalidDate   = dtpVisit.Value.AddDays(ticketType.ValidDay - 1),
                        GuestName     = "",
                        Status        = true
                    });
                    id += 1;
                }
            }
            else
            {
                for (int i = 0; i < nudStandard.Value; i++)
                {
                    TicketOffer ticketType = GetTicketType("一日票", dateType, "成人");
                    lstTicket.Add(new Ticket
                    {
                        TicketId      = id.ToString().PadLeft(10, '0'),
                        TicketOfferNo = ticketType.TicketOfferNo,
                        EffectiveDate = dtpVisit.Value,
                        InvalidDate   = dtpVisit.Value.AddDays(ticketType.ValidDay - 1),
                        GuestName     = "",
                        Status        = true
                    });
                    id += 1;
                }
                for (int i = 0; i < nudChild.Value; i++)
                {
                    TicketOffer ticketType = GetTicketType("一日票", dateType, "兒童");
                    lstTicket.Add(new Ticket
                    {
                        TicketId      = id.ToString().PadLeft(10, '0'),
                        TicketOfferNo = ticketType.TicketOfferNo,
                        EffectiveDate = dtpVisit.Value,
                        InvalidDate   = dtpVisit.Value.AddDays(ticketType.ValidDay - 1),
                        GuestName     = "",
                        Status        = true
                    });
                    id += 1;
                }
                for (int i = 0; i < nudSenior.Value; i++)
                {
                    TicketOffer ticketType = GetTicketType("一日票", dateType, "老年");
                    lstTicket.Add(new Ticket
                    {
                        TicketId      = id.ToString().PadLeft(10, '0'),
                        TicketOfferNo = ticketType.TicketOfferNo,
                        EffectiveDate = dtpVisit.Value,
                        InvalidDate   = dtpVisit.Value.AddDays(ticketType.ValidDay - 1),
                        GuestName     = "",
                        Status        = true
                    });
                    id += 1;
                }
                for (int i = 0; i < nudDisability.Value; i++)
                {
                    TicketOffer ticketType = GetTicketType("一日票", dateType, "身心障礙");
                    lstTicket.Add(new Ticket
                    {
                        TicketId      = id.ToString().PadLeft(10, '0'),
                        TicketOfferNo = ticketType.TicketOfferNo,
                        EffectiveDate = dtpVisit.Value,
                        InvalidDate   = dtpVisit.Value.AddDays(ticketType.ValidDay - 1),
                        GuestName     = "",
                        Status        = true
                    });
                    id += 1;
                }
            }
        }
Exemplo n.º 2
0
 private List <string> GetOfferDetail(TicketOffer offer)
 {
     return(offer.TicketName.Split('-').ToList());
 }