cabin.cs

来自「根据起降城市,查询到起降时间,以及航次的具体信息.」· CS 代码 · 共 134 行

CS
134
字号
using System;

namespace BusinessEntity
{
	/// <summary>
	/// Cabin 的摘要说明。
	/// </summary>
	public class Cabin
	{
		private int id;
		private string cabinType;
		private string name;
		private decimal discount;
		private decimal price;
		private int remainTickets;

		public int Id
		{
			get
			{
				return id;
			}
			set
			{
				id = value;
			}
		}

		public string Name
		{
			get
			{
				return name;
			}
			set
			{
				name = value;
			}
		}

		public string CabinType
		{
			get
			{
				return cabinType;
			}
			set
			{
				cabinType = value;
			}
		}

		public int RemainTickets
		{
			get
			{
				return remainTickets;
			}
			set
			{
				if(value >= 0)
				{
					remainTickets = value;
				}
			}
		}

		public decimal Discount
		{
			get
			{
				return discount;
			}
			set
			{
				if(discount >=0 && discount <= 1)
				{
					discount = value;
				}
			}
		}

		public decimal Price
		{
			get
			{
				return price;
			}
			set
			{
				if(price >= 0)
				{
					price = value;
				}
			}
		}

		public Cabin(int id, string name, string cabinType, int remainTickets, decimal price, decimal discount)
		{
			this.id =id;
			this.name = name;
			this.cabinType = cabinType;
			this.remainTickets = remainTickets;
			this.price = price;
			this.discount = discount;
		}
	}

	public class CabinCollection : System.Collections.CollectionBase
	{
		public int Add(Cabin item)
		{
			return this.List.Add(item);
		}

		public Cabin this[int index]
		{
			get
			{
				return (Cabin)this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		public void Remove(Cabin item)
		{
			this.List.Remove(item);
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?