C#影院售票系统毕业设计(1)

2019-12-30 11:02:24王冬梅
  • {  public Ticket() { } 
  • public Ticket(ScheduleItem sch,Seat seat)   { 
  • this.ScheduItem = sch;  this.Seat = seat; 
  • }  private Seat _seat = new Seat(); 
  • /// <summary>  /// 所属座位 
  • /// </summary>  public Seat Seat 
  • {  get { return _seat; } 
  • set { _seat = value; }  } 
  •   private int _price; 
  • /// <summary>  /// 票价 
  • /// </summary>  public int Price 
  • {  get { return _price; } 
  • set { _price = value; }  } 
  • /// <summary>  /// 放映场次 
  • /// </summary>  public ScheduleItem ScheduItem { get; set; } 
  • /// <summary>  /// 计算票价 
  • /// </summary>  public virtual void CalcPrice() 
  • {  this.Price = ScheduItem.Movie.Price; 
  • }  /// <summary> 
  • /// 打印售票信息  /// </summary> 
  • public virtual void Print()  { 
  • string info = string.Format("************************************************nt青鸟影院n------------------------------------------------n电影名:t{0}n时间:t{1}n座位号:t{2}n价格:t{3}n************************************************", this.ScheduItem.Movie.MovieName, this.ScheduItem.Time, this.Seat.SeatNum, this.Price);  MessageBox.Show(info); 
  • //存到文件中  string fileName = this.ScheduItem.Time.Replace(":", "-")+" "+this.Seat.SeatNum+".txt"; 
  • FileStream fs = new FileStream(fileName,FileMode.Create);  StreamWriter sw = new StreamWriter(fs); 
  • sw.Write(info);  sw.Close(); 
  • fs.Close();  } 
  • /// <summary>  /// 显示当前售票信息