Order.cs
上传用户:lxycoco
上传日期:2022-07-21
资源大小:38457k
文件大小:2k
源码类别:

C#编程

开发平台:

Others

  1. using System;
  2. using System.Collections;
  3. namespace Wrox.ProCSharp.EnterpriseServices
  4. {
  5. [Serializable]
  6. public class Order
  7. {
  8. public static Order Create(string customerId, DateTime orderDate, string shipAddress,
  9. string shipCity, string shipCountry)
  10. {
  11. Order o = new Order();
  12. o.customerId = customerId;
  13. o.orderDate = orderDate;
  14. o.shipAddress = shipAddress;
  15. o.shipCity = shipCity;
  16. o.shipCountry = shipCountry;
  17. return o;
  18. }
  19. public Order()
  20. {
  21. }
  22. internal void SetOrderId(int orderId)
  23. {
  24. this.orderId = orderId;
  25. }
  26. public void AddOrderLine(OrderLine orderLine)
  27. {
  28. orderLines.Add(orderLine);
  29. }
  30. private int orderId;
  31. private string customerId;
  32. private DateTime orderDate;
  33. private string shipAddress;
  34. private string shipCity;
  35. private string shipCountry;
  36. private ArrayList orderLines = new ArrayList();
  37. public int OrderId
  38. {
  39. get
  40. {
  41. return orderId;
  42. }
  43. }
  44. public string CustomerId
  45. {
  46. get
  47. {
  48. return customerId;
  49. }
  50. }
  51. public DateTime OrderDate
  52. {
  53. get
  54. {
  55. return orderDate;
  56. }
  57. }
  58. public string ShipAddress
  59. {
  60. get
  61. {
  62. return shipAddress;
  63. }
  64. }
  65. public string ShipCity
  66. {
  67. get
  68. {
  69. return shipCity;
  70. }
  71. }
  72. public string ShipCountry
  73. {
  74. get
  75. {
  76. return shipCountry;
  77. }
  78. }
  79. public OrderLine[] OrderLines
  80. {
  81. get
  82. {
  83. OrderLine[] ol = new OrderLine[orderLines.Count];
  84. orderLines.CopyTo(ol);
  85. return ol;
  86. }
  87. }
  88. }
  89. }