⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 freeticket.cs

📁 ”青鸟影院”开始营业
💻 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 + -