using Cksoft.Data; using Cksoft.Unity; using DllEapEntity; using System; using System.Collections.Generic; using System.Linq; namespace DllEapDal { public class OrderDetailDal { private IDatabase CurrDb = null; public OrderDetailDal(IDatabase db) { CurrDb = db; } public OrderDetail IUOrderDetail(OrderDetail mst,string usercode, ref string errorinfo) { try { int result = 0; int id = mst.ID; if(mst.EntityStatusID==1) { mst.RecCode = usercode; mst.RecTime = DateTime.Now; mst.ModCode = usercode; mst.ModTime = DateTime.Now; result = CurrDb.InsertFor(mst, usercode); if(result<0) { return null; } object objid = CurrDb.FindObject("select @@IDENTITY"); if (objid.ToString() == "") { return null; } id = int.Parse(objid.ToString()); } else { mst.ModCode = usercode; mst.ModTime = DateTime.Now; result = CurrDb.UpdateFor(mst, usercode); if (result < 0) { return null; } } mst = CurrDb.FindEntityFor(id); return mst; } catch (Exception e) { errorinfo = e.Message; return null; } } } }