/// <summary> /// 创建交易 /// </summary> /// <param name="name">名称</param> /// <param name="description">描述</param> /// <param name="startDate">开始日期</param> /// <param name="tradeType">交易类型</param> /// <returns>创建的交易</returns> public static Trade CreateTrade(string name, string description, DateTime startDate, string tradeType) { const string tradeTypes = "购买飞机、租赁飞机、购买发动机、租赁发动机、购买BFE"; if (!tradeTypes.Contains(tradeType)) { throw new ArgumentException("交易类型错误!"); } var trade = new Trade { Name = name, Description = description, CreateDate = DateTime.Now, StartDate = startDate, TradeType = tradeType }; return trade; }
/// <summary> /// 设置交易 /// </summary> /// <param name="trade">交易</param> public void SetTrade(Trade trade) { if (trade == null || trade.IsTransient()) { throw new ArgumentException("交易参数为空!"); } Trade = trade; TradeId = trade.Id; }