青鸟影院售票系统
明白又清楚的资源。 private void lblBuy_Click(object sender, EventArgs e) { IPrintable iprintTicket = TicketFactory.getTicket(); IPrintable iprintStudent = TicketFactory.getSutdent(); IPrintable iprintFree = TicketFactory.getFree(); if (lblMovieName.Text.Trim() == "") { MessageBox.Show("请选择电影!"); return; } string seatNumber = ((Label)sender).Text; ScheduleItem si = c inemaDty[selectStr].SheduleItem; if (rbnPresent.Checked == true && txtPresentName.Text == "") { MessageBox.Show("请填写曾送者的姓名!"); return; } if (rbnStudent.Checked == true && cboStudent.Text == "") { MessageBox.Show("请选择折扣率!"); return; } if (cinemaDty[selectStr].Seats[seatNumber].Color == Color.Red) { MessageBox.Show("此票以售出!"); return; } if (rbnPresent.Checked == true) { DialogResult result = MessageBox.Show("是否购买此票?","信息提示",MessageBoxButtons.YesNo,MessageBoxIcon.Information); if (result==DialogResult.Yes) { seatLabel[seatNumber].BackColor = Color.Red; FreeTicket ticketFree = new FreeTicket(); ticketFree.Price = si.Movie.Price; ticketFree.ScheduleItem = si; ticketFree.Seat = new Seat(seatNumber, seatLabel[seatNumber].BackColor); ticketFree.CustomerName = txtPresentName.Text; Ticket ticket = ticketFree as Ticket; cinemaDty[selectStr].SoldTickets.Add(ticket); lblGetPrice.Text = ticket.Price.ToString(); ticket.Print(); } } else if (rbnStudent.Checked == true) { DialogResult result = MessageBox.Show("是否购买此票?", "信息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { seatLabel[seatNumber].BackColor = Color.Red; Ticket ticket = new StudentTicket(); ticket.Price = (int)((si.Movie.Price) * Convert.ToInt32(cboStudent.Text) * 0.1); ticket.ScheduleItem = si; ticket.Seat = new Seat(seatNumber, seatLabel[seatNumber].BackColor); cinemaDty[selectStr].SoldTickets.Add(ticket); lblGetPrice.Text = ticket.Price.ToString(); ticket.Print(); } } else { DialogResult result = MessageBox.Show("是否购买此票?", "信息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { TicketFactory.getTicket(); seatLabel[seatNumber].BackColor = Color.Red; Ticket ticket = new Ticket(si.Movie.Price, si, new Seat(seatNumber, seatLabel[seatNumber].BackColor)); cinemaDty[selectStr].SoldTickets.Add(ticket); lblGetPrice.Text = ticket.Price.ToString(); ticket.Print(); } } } inemaDty[selectStr].SheduleItem; if (rbnPresent.Checked == true && txtPresentName.Text == "") { MessageBox.Show("请填写曾送者的姓名!"); return; } if (rbnStudent.Checked == true && cboStudent.Text == "") { MessageBox.Show("请选择折扣率!"); return; } if (cinemaDty[selectStr].Seats[seatNumber].Color == Color.Red) { MessageBox.Show("此票以售出!"); return; } if (rbnPresent.Checked == true) { DialogResult result = MessageBox.Show("是否购买此票?","信息提示",MessageBoxButtons.YesNo,MessageBoxIcon.Information); if (result==DialogResult.Yes) { seatLabel[seatNumber].BackColor = Color.Red; FreeTicket ticketFree = new FreeTicket(); ticketFree.Price = si.Movie.Price; ticketFree.ScheduleItem = si; ticketFree.Seat = new Seat(seatNumber, seatLabel[seatNumber].BackColor); ticketFree.CustomerName = txtPresentName.Text; Ticket ticket = ticketFree as Ticket; cinemaDty[selectStr].SoldTickets.Add(ticket); lblGetPrice.Text = ticket.Price.ToString(); ticket.Print(); } } else if (rbnStudent.Checked == true) { DialogResult result = MessageBox.Show("是否购买此票?", "信息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { seatLabel[seatNumber].BackColor = Color.Red; Ticket ticket = new StudentTicket(); ticket.Price = (int)((si.Movie.Price) * Convert.ToInt32(cboStudent.Text) * 0.1); ticket.ScheduleItem = si; ticket.Seat = new Seat(seatNumber, seatLabel[seatNumber].BackColor); cinemaDty[selectStr].SoldTickets.Add(ticket); lblGetPrice.Text = ticket.Price.ToString(); ticket.Print(); } } else { DialogResult result = MessageBox.Show("是否购买此票?", "信息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { TicketFactory.getTicket(); seatLabel[seatNumber].BackColor = Color.Red; Ticket ticket = new Ticket(si.Movie.Price, si, new Seat(seatNumber, seatLabel[seatNumber].BackColor)); cinemaDty[selectStr].SoldTickets.Add(ticket); lblGetPrice.Text = ticket.Price.ToString(); ticket.Print(); } } }
用户评论
很有帮助谢谢
可以稍微学习下!!!新手入门
可以借鉴~适合初学。
初学参考还是很有用的。
还不错了,可惜不是java
很不错,内容很全面
功能没完全实现 不过当个模板还是很不错的
功能不够多
功能有些没实现