Exemplo n.º 1
0
 /// <summary>
 /// 将当前的购物篮项目转换为销售订单行。
 /// </summary>
 /// <returns></returns>
 public SalesLine ConvertToSalesLine()
 {
     SalesLine salesLine = new SalesLine();
     salesLine.ID = Guid.NewGuid(); // 为每个SalesLine设置一个不同的ID,以便EF的Context能够识别不同的SalesLine
     salesLine.Product = this.Product;
     salesLine.Quantity = this.Quantity;
     return salesLine;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 将当前的购物篮项目转换为销售订单行。
        /// </summary>
        /// <returns></returns>
        public SalesLine ConvertToSalesLine()
        {
            SalesLine salesLine = new SalesLine();

            salesLine.ID       = Guid.NewGuid(); // 为每个SalesLine设置一个不同的ID,以便EF的Context能够识别不同的SalesLine
            salesLine.Product  = this.Product;
            salesLine.Quantity = this.Quantity;
            return(salesLine);
        }
        /// <summary>
        /// 将当前的购物篮项目转换为销售订单行。
        /// </summary>
        /// <returns></returns>
        public SalesLine ConvertToSalesLine()
        {
            var salesLine = new SalesLine
            {
                ID       = Guid.NewGuid(),
                Product  = Product,
                Quantity = Quantity
            };

            return(salesLine);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 确定指定的Object是否等于当前的Object。
        /// </summary>
        /// <param name="obj">要与当前对象进行比较的对象。</param>
        /// <returns>如果指定的Object与当前Object相等,则返回true,否则返回false。</returns>
        /// <remarks>有关此函数的更多信息,请参见:http://msdn.microsoft.com/zh-cn/library/system.object.equals。
        /// </remarks>
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            SalesLine other = obj as SalesLine;

            if ((object)other == null)
            {
                return(false);
            }
            return(this.ID == other.ID);
        }
 /// <summary>
 /// 将当前的购物篮项目转换为销售订单行。
 /// </summary>
 /// <returns></returns>
 public SalesLine ConvertToSalesLine()
 {
     var salesLine = new SalesLine
         {
             ID = Guid.NewGuid(), 
             Product = Product, 
             Quantity = Quantity
         };
     return salesLine;
 }