using Castle.ActiveRecord; using NHibernate.Criterion; using System; using System.Text; namespace BizCom { [ActiveRecord("CE_ErpCustomer")] public class CeErpCustomer : ComBase { /// /// /// [PrimaryKey(PrimaryKeyType.Native)] public int ID { get; set; } private string _buyer_nick = ""; /// ///买家昵称 /// [Property] public string buyer_nick { get { return _buyer_nick; } set { _buyer_nick = value; } } private string _star_flag = ""; /// ///星标 /// [Property] public string star_flag { get { return _star_flag; } set { _star_flag = value; } } private int _buy_day = 0; /// /// /// [Property] public int buy_day { get { return _buy_day; } set { _buy_day = value; } } private string _phone = ""; /// ///电话 /// [Property] public string phone { get { return _phone; } set { _phone = value; } } private string _address = ""; /// ///地址 /// [Property] public string address { get { return _address; } set { _address = value; } } private double _total_fee = 0; /// ///总金额 /// [Property] public double total_fee { get { return _total_fee; } set { _total_fee = value; } } private int _buy_count = 0; /// ///购买次数 /// [Property] public int buy_count { get { return _buy_count; } set { _buy_count = value; } } /// ///最后购买时间 /// [Property] public DateTime? lastbuy_time { get; set; } private string _seller_nick = ""; /// /// /// [Property] public string seller_nick { get { return _seller_nick; } set { _seller_nick = value; } } private int _product_count = 0; /// /// /// [Property] public int product_count { get { return _product_count; } set { _product_count = value; } } private string _lastTid = ""; /// ///上次购买订单号 /// [Property] public string lastTid { get { return _lastTid; } set { _lastTid = value; } } private int _isMore = 0; /// ///是否比上次买更多 /// [Property] public int isMore { get { return _isMore; } set { _isMore = value; } } private string _lastTid2 = ""; /// /// /// [Property] public string lastTid2 { get { return _lastTid2; } set { _lastTid2 = value; } } private string _buyer_id = ""; /// ///客户id /// [Property] public string buyer_id { get { return _buyer_id; } set { _buyer_id = value; } } /// /// /// [Property] public DateTime? lastbuy_time2 { get; set; } public static CeErpCustomer GetByNick(string nick) { return FindFirst(Expression.Eq("buyer_nick", nick)); } public static CeErpCustomer GetByNickAndShop(string nick, string shopname) { return FindFirst(Expression.Sql(string.Format("(buyer_nick='{0}' and seller_nick='{1}')", nick, shopname))); } public static CeErpCustomer GetByIdAndShop(string id, string shopname) { return FindFirst(Expression.Sql(string.Format("(buyer_id='{0}' and seller_nick='{1}')", id, shopname))); } public static void Del(object id) { StringBuilder sql = new StringBuilder(); sql.AppendFormat("delete from CE_ErpCustomer where id=" + id); ExecuteNonQuery(sql.ToString()); } } }