using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.Serialization; using System.Web.Script.Serialization; using System.Xml.Serialization; using XCode; using XCode.Configuration; using XCode.DataAccessLayer; namespace COMCMS.Core { /// 优惠券 [Serializable] [DataObject] [Description("优惠券")] [BindTable("Coupon", Description = "优惠券", ConnName = "dbconn", DbType = DatabaseType.SqlServer)] public partial class Coupon { #region 属性 private Int32 _Id; /// 编号 [DisplayName("编号")] [Description("编号")] [DataObjectField(true, true, false, 0)] [BindColumn("Id", "编号", "")] public Int32 Id { get => _Id; set { if (OnPropertyChanging("Id", value)) { _Id = value; OnPropertyChanged("Id"); } } } private String _ItemNO; /// 券号 [DisplayName("券号")] [Description("券号")] [DataObjectField(false, false, true, 20)] [BindColumn("ItemNO", "券号", "")] public String ItemNO { get => _ItemNO; set { if (OnPropertyChanging("ItemNO", value)) { _ItemNO = value; OnPropertyChanged("ItemNO"); } } } private Int32 _KId; /// 类别,0默认没限制 [DisplayName("类别")] [Description("类别,0默认没限制")] [DataObjectField(false, false, false, 0)] [BindColumn("KId", "类别,0默认没限制", "")] public Int32 KId { get => _KId; set { if (OnPropertyChanging("KId", value)) { _KId = value; OnPropertyChanged("KId"); } } } private Int32 _CouponType; /// 优惠券类型,0 现金用券,1打折券 [DisplayName("优惠券类型")] [Description("优惠券类型,0 现金用券,1打折券")] [DataObjectField(false, false, false, 0)] [BindColumn("CouponType", "优惠券类型,0 现金用券,1打折券", "")] public Int32 CouponType { get => _CouponType; set { if (OnPropertyChanging("CouponType", value)) { _CouponType = value; OnPropertyChanged("CouponType"); } } } private Decimal _DiscuountRates; /// 打折率,只有是打折券才有用 [DisplayName("打折率")] [Description("打折率,只有是打折券才有用")] [DataObjectField(false, false, false, 0)] [BindColumn("DiscuountRates", "打折率,只有是打折券才有用", "")] public Decimal DiscuountRates { get => _DiscuountRates; set { if (OnPropertyChanging("DiscuountRates", value)) { _DiscuountRates = value; OnPropertyChanged("DiscuountRates"); } } } private Int32 _IsLimit; /// 是否有类别限制,0 无限制;1 是类别限制,2是商品限制 [DisplayName("是否有类别限制")] [Description("是否有类别限制,0 无限制;1 是类别限制,2是商品限制")] [DataObjectField(false, false, false, 0)] [BindColumn("IsLimit", "是否有类别限制,0 无限制;1 是类别限制,2是商品限制", "")] public Int32 IsLimit { get => _IsLimit; set { if (OnPropertyChanging("IsLimit", value)) { _IsLimit = value; OnPropertyChanged("IsLimit"); } } } private Decimal _Price; /// 面额 [DisplayName("面额")] [Description("面额")] [DataObjectField(false, false, false, 0)] [BindColumn("Price", "面额", "")] public Decimal Price { get => _Price; set { if (OnPropertyChanging("Price", value)) { _Price = value; OnPropertyChanged("Price"); } } } private Decimal _NeedPrice; /// 需要消费面额 [DisplayName("需要消费面额")] [Description("需要消费面额")] [DataObjectField(false, false, false, 0)] [BindColumn("NeedPrice", "需要消费面额", "")] public Decimal NeedPrice { get => _NeedPrice; set { if (OnPropertyChanging("NeedPrice", value)) { _NeedPrice = value; OnPropertyChanged("NeedPrice"); } } } private DateTime _AddTime; /// 添加时间 [DisplayName("添加时间")] [Description("添加时间")] [DataObjectField(false, false, true, 0)] [BindColumn("AddTime", "添加时间", "")] public DateTime AddTime { get => _AddTime; set { if (OnPropertyChanging("AddTime", value)) { _AddTime = value; OnPropertyChanged("AddTime"); } } } private DateTime _StartTime; /// 添加时间 [DisplayName("添加时间")] [Description("添加时间")] [DataObjectField(false, false, true, 0)] [BindColumn("StartTime", "添加时间", "")] public DateTime StartTime { get => _StartTime; set { if (OnPropertyChanging("StartTime", value)) { _StartTime = value; OnPropertyChanged("StartTime"); } } } private DateTime _EndTime; /// 添加时间 [DisplayName("添加时间")] [Description("添加时间")] [DataObjectField(false, false, true, 0)] [BindColumn("EndTime", "添加时间", "")] public DateTime EndTime { get => _EndTime; set { if (OnPropertyChanging("EndTime", value)) { _EndTime = value; OnPropertyChanged("EndTime"); } } } private Int32 _TotalCount; /// 最大领取数量 [DisplayName("最大领取数量")] [Description("最大领取数量")] [DataObjectField(false, false, false, 0)] [BindColumn("TotalCount", "最大领取数量", "")] public Int32 TotalCount { get => _TotalCount; set { if (OnPropertyChanging("TotalCount", value)) { _TotalCount = value; OnPropertyChanged("TotalCount"); } } } private Int32 _TotalUseCount; /// 已使用次数 [DisplayName("已使用次数")] [Description("已使用次数")] [DataObjectField(false, false, false, 0)] [BindColumn("TotalUseCount", "已使用次数", "")] public Int32 TotalUseCount { get => _TotalUseCount; set { if (OnPropertyChanging("TotalUseCount", value)) { _TotalUseCount = value; OnPropertyChanged("TotalUseCount"); } } } private Int32 _SpreadUId; /// 推广员ID,可选 [DisplayName("推广员ID")] [Description("推广员ID,可选")] [DataObjectField(false, false, false, 0)] [BindColumn("SpreadUId", "推广员ID,可选", "")] public Int32 SpreadUId { get => _SpreadUId; set { if (OnPropertyChanging("SpreadUId", value)) { _SpreadUId = value; OnPropertyChanged("SpreadUId"); } } } private Int32 _UId; /// 用户Id [DisplayName("用户Id")] [Description("用户Id")] [DataObjectField(false, false, false, 0)] [BindColumn("UId", "用户Id", "")] public Int32 UId { get => _UId; set { if (OnPropertyChanging("UId", value)) { _UId = value; OnPropertyChanged("UId"); } } } private Int32 _MyType; /// 可使用类型 [DisplayName("可使用类型")] [Description("可使用类型")] [DataObjectField(false, false, false, 0)] [BindColumn("MyType", "可使用类型", "")] public Int32 MyType { get => _MyType; set { if (OnPropertyChanging("MyType", value)) { _MyType = value; OnPropertyChanged("MyType"); } } } #endregion #region 获取/设置 字段值 /// 获取/设置 字段值 /// 字段名 /// public override Object this[String name] { get { switch (name) { case "Id": return _Id; case "ItemNO": return _ItemNO; case "KId": return _KId; case "CouponType": return _CouponType; case "DiscuountRates": return _DiscuountRates; case "IsLimit": return _IsLimit; case "Price": return _Price; case "NeedPrice": return _NeedPrice; case "AddTime": return _AddTime; case "StartTime": return _StartTime; case "EndTime": return _EndTime; case "TotalCount": return _TotalCount; case "TotalUseCount": return _TotalUseCount; case "SpreadUId": return _SpreadUId; case "UId": return _UId; case "MyType": return _MyType; default: return base[name]; } } set { switch (name) { case "Id": _Id = value.ToInt(); break; case "ItemNO": _ItemNO = Convert.ToString(value); break; case "KId": _KId = value.ToInt(); break; case "CouponType": _CouponType = value.ToInt(); break; case "DiscuountRates": _DiscuountRates = Convert.ToDecimal(value); break; case "IsLimit": _IsLimit = value.ToInt(); break; case "Price": _Price = Convert.ToDecimal(value); break; case "NeedPrice": _NeedPrice = Convert.ToDecimal(value); break; case "AddTime": _AddTime = value.ToDateTime(); break; case "StartTime": _StartTime = value.ToDateTime(); break; case "EndTime": _EndTime = value.ToDateTime(); break; case "TotalCount": _TotalCount = value.ToInt(); break; case "TotalUseCount": _TotalUseCount = value.ToInt(); break; case "SpreadUId": _SpreadUId = value.ToInt(); break; case "UId": _UId = value.ToInt(); break; case "MyType": _MyType = value.ToInt(); break; default: base[name] = value; break; } } } #endregion #region 字段名 /// 取得优惠券字段信息的快捷方式 public partial class _ { /// 编号 public static readonly Field Id = FindByName("Id"); /// 券号 public static readonly Field ItemNO = FindByName("ItemNO"); /// 类别,0默认没限制 public static readonly Field KId = FindByName("KId"); /// 优惠券类型,0 现金用券,1打折券 public static readonly Field CouponType = FindByName("CouponType"); /// 打折率,只有是打折券才有用 public static readonly Field DiscuountRates = FindByName("DiscuountRates"); /// 是否有类别限制,0 无限制;1 是类别限制,2是商品限制 public static readonly Field IsLimit = FindByName("IsLimit"); /// 面额 public static readonly Field Price = FindByName("Price"); /// 需要消费面额 public static readonly Field NeedPrice = FindByName("NeedPrice"); /// 添加时间 public static readonly Field AddTime = FindByName("AddTime"); /// 添加时间 public static readonly Field StartTime = FindByName("StartTime"); /// 添加时间 public static readonly Field EndTime = FindByName("EndTime"); /// 最大领取数量 public static readonly Field TotalCount = FindByName("TotalCount"); /// 已使用次数 public static readonly Field TotalUseCount = FindByName("TotalUseCount"); /// 推广员ID,可选 public static readonly Field SpreadUId = FindByName("SpreadUId"); /// 用户Id public static readonly Field UId = FindByName("UId"); /// 可使用类型 public static readonly Field MyType = FindByName("MyType"); static Field FindByName(String name) => Meta.Table.FindByName(name); } /// 取得优惠券字段名称的快捷方式 public partial class __ { /// 编号 public const String Id = "Id"; /// 券号 public const String ItemNO = "ItemNO"; /// 类别,0默认没限制 public const String KId = "KId"; /// 优惠券类型,0 现金用券,1打折券 public const String CouponType = "CouponType"; /// 打折率,只有是打折券才有用 public const String DiscuountRates = "DiscuountRates"; /// 是否有类别限制,0 无限制;1 是类别限制,2是商品限制 public const String IsLimit = "IsLimit"; /// 面额 public const String Price = "Price"; /// 需要消费面额 public const String NeedPrice = "NeedPrice"; /// 添加时间 public const String AddTime = "AddTime"; /// 添加时间 public const String StartTime = "StartTime"; /// 添加时间 public const String EndTime = "EndTime"; /// 最大领取数量 public const String TotalCount = "TotalCount"; /// 已使用次数 public const String TotalUseCount = "TotalUseCount"; /// 推广员ID,可选 public const String SpreadUId = "SpreadUId"; /// 用户Id public const String UId = "UId"; /// 可使用类型 public const String MyType = "MyType"; } #endregion } }