public class Product
{
    /// <summary>
    /// 自增ID
    /// </summary>
    public int ID { get; set; }
    /// <summary>
    /// 主键
    /// </summary>
    public string Code { get; set; }
    /// <summary>
    /// 名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 类型
    /// </summary>
    public string Category { get; set; }
    /// <summary>
    /// 价格
    /// </summary>
    public decimal Price { get; set; }
    /// <summary>
    /// 生产日期
    /// </summary>
    public DateTime ProduceDate { get; set; }
    public override string ToString()
    {
        return string.Format("{0}{1}{2}{3}{4}{5}", ID.ToString().PadLeft(2), Category.PadLeft(15), Code.PadLeft(7), Name.PadLeft(17), Price.ToString().PadLeft(4), ProduceDate.ToString("yyyy-M-d").PadLeft(13));
    }
    public static ProductCollection GetSampleCollection()
    {
        ProductCollection collection = new ProductCollection(
            new Product() { ID = 1, Code = "1001", Category = "Red Wine", Name = "Product1" }
            , new Product() { ID = 2, Code = "1002", Category = "Red Wine", Name = "Product2" }
            , new Product() { ID = 3, Code = "1003", Category = "Red Wine", Name = "Product3" }
            , new Product() { ID = 4, Code = "1004", Category = "Red Wine", Name = "Product4" }
            , new Product() { ID = 5, Code = "1005", Category = "Red Wine", Name = "Product5" }
            , new Product() { ID = 6, Code = "1006", Category = "Red Wine", Name = "Product6" }
            , new Product() { ID = 7, Code = "1007", Category = "Red Wine", Name = "Product7" }
        );
        return collection;
    }
}
产品类

相关文章:

  • 2022-12-23
  • 2021-06-03
  • 2022-01-24
  • 2021-06-29
  • 2021-06-03
  • 2022-12-23
猜你喜欢
  • 2021-06-06
  • 2021-12-06
  • 2021-05-10
  • 2021-05-20
相关资源
相似解决方案