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

📄 order.cs

📁 C#高级编程第6版随书源代码 值得下载
💻 CS
字号:
using System;
using System.Collections.Generic;

namespace Wrox.ProCSharp.EnterpriseServices
{
   [Serializable]
   public class Order
   {
      public static Order Create(string customerId, DateTime orderDate, 
                      string shipAddress, string shipCity, string shipCountry)
      {
         return new Order()
         {
            CustomerId = customerId,
            OrderDate = orderDate,
            ShipAddress = shipAddress,
            ShipCity = shipCity,
            ShipCountry = shipCountry
         };
      }

      public Order()
      {
      }

      internal void SetOrderId(int orderId)
      {
         this.OrderId = orderId;
      }

      public void AddOrderLine(OrderLine orderLine)
      {
         orderLines.Add(orderLine);
      }

      private List<OrderLine> orderLines = new List<OrderLine>();

      public int OrderId { get; private set; }
      public string CustomerId { get; private set; }
      public DateTime OrderDate { get; private set; }
      public string ShipAddress { get; private set; }
      public string ShipCity { get; private set; }
      public string ShipCountry { get; private set; }

      public OrderLine[] OrderLines
      {
          get
          {
              OrderLine[] ol = new OrderLine[orderLines.Count];
              orderLines.CopyTo(ol);
              return ol;
          }
      }
  }
}

⌨️ 快捷键说明

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