using Castle.ActiveRecord; using NHibernate.Criterion; using System; using System.Collections.Generic; using System.Data; using System.Text; namespace BizCom { [ActiveRecord("CE_ErpTradeLog")] public class CeErpTradeLog : ComBase { /// /// /// [PrimaryKey(PrimaryKeyType.Native)] public int ID { get; set; } private string _tid = ""; /// /// /// [Property] public string tid { get { return _tid; } set { _tid = value; } } private int _orderState = 0; /// ///日志生成是订单当前状态 /// [Property] public int OrderState { get { return _orderState; } set { _orderState = value; } } private int _userId = 0; /// ///操作人Id /// [Property] public int UserId { get { return _userId; } set { _userId = value; } } /// ///操作时间 /// [Property] public DateTime? OperateTime { get; set; } private string _con = ""; /// ///操作说明 /// [Property] public string Con { get { return _con; } set { _con = value; } } private int _afterSaleState = 0; /// ///是否售后>0进入售后 /// [Property] public int AfterSaleState { get { return _afterSaleState; } set { _afterSaleState = value; } } public static void Del(object id) { StringBuilder sql = new StringBuilder(); sql.AppendFormat("delete from CE_ErpTradeLog where id=" + id); ExecuteNonQuery(sql.ToString()); } public static void AddLog(string tid, int ostate, int uid) { AddLog(tid, ostate, uid, ""); } public static void AddLog(string tid, int ostate, int uid, string con) { try { CeErpTradeLog tradeLog = new CeErpTradeLog(); tradeLog.tid = tid; tradeLog.OrderState = ostate; tradeLog.UserId = uid; tradeLog.Con = con; tradeLog.OperateTime = DateTime.Now; tradeLog.Create(); } catch { } } //直接用状态以及tid查询订单 public static int GetByTidAndStatus(string tid, int status) { DataTable dt = DbConn.ExecuteDataset("select top 1 * from CE_ErpTradeLog where tid = '"+ tid + "' and OrderState ="+ status + " ;").Tables[0]; return dt.Rows.Count; } } }