?? freeticket.cs
字號:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace MyCinema
{
/// <summary>
/// 贈票子類
/// </summary>
[Serializable]
public class FreeTicket:Ticket,IPrintable
{
public FreeTicket() { }
public FreeTicket(ScheduleItem scheduleItem, Seat seat, string customerName)
: base(scheduleItem, seat)
{
this.CustomerName = customerName;
}
//贈票人姓名
private string customerName;
public string CustomerName
{
get { return customerName; }
set { customerName = value; }
}
public override void CalcPrice()
{
this.Price = 0;
}
#region IPrintable 成員
public override void Print()
{
string fileName = this.ScheduleItem.Time + " " + this.Seat.SeatNum + ".txt";
FileStream fs = new FileStream(fileName, FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine("***************************");
sw.WriteLine(" 青鳥影院 (贈票)");
sw.WriteLine("---------------------------");
sw.WriteLine(" 電影名:\t{0}", this.ScheduleItem.Movie.MovieName);
sw.WriteLine(" 時間:\t{0}", this.ScheduleItem.Time);
sw.WriteLine(" 座位號:\t{0}", this.Seat.SeatNum);
sw.WriteLine(" 姓名:\t{0}", this.CustomerName);
sw.WriteLine("***************************");
sw.Close();
fs.Close();
}
#endregion
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -