public int UpdateWithContext(IEntityContext entityContext, CCashCouponPO po, string operatorName) { if (po == null) { throw ErrorCodeHelper.CCashCouponNull.ToException(); } if (string.IsNullOrWhiteSpace(po.AssetName)) { throw ErrorCodeHelper.CCashCouponAssetNameNotSet.ToException(); } EnumOperationLogAction enumOperationLogAction = EnumOperationLogAction.Update; CCashCouponPO oldObject = null; CCashCouponPO newObject = po; newObject.UpdateName = operatorName; newObject.UpdateTime = DateTime.Now; oldObject = GetByIdWithContext(entityContext, po.Id); if (oldObject == null) { throw ErrorCodeHelper.CCashCouponNotExist.ToException(); } CCashCouponPOManager.Instance.UpdateWithContext(entityContext, newObject); COperationLogManager.Instance.AddOperationLog(po.Id, EnumOperationLogType.CCashCoupon, enumOperationLogAction, oldObject, newObject, operatorName); return(po.Id); }
public int AddWithContext(IEntityContext entityContext, CIntegralRecordPO po, string operatorName) { if (po == null) { throw ErrorCodeHelper.CIntegralRecordNull.ToException(); } if (string.IsNullOrWhiteSpace(po.OrderId)) { throw ErrorCodeHelper.CIntegralRecordOrderIdNotSet.ToException(); } EnumOperationLogAction enumOperationLogAction = EnumOperationLogAction.Add; CIntegralRecordPO oldObject = null; CIntegralRecordPO newObject = po; newObject.CreateName = operatorName; newObject.CreateTime = DateTime.Now; newObject.UpdateName = operatorName; newObject.UpdateTime = DateTime.Now; CIntegralRecordPOManager.Instance.AddWithContext(entityContext, newObject); po.Id = newObject.Id; COperationLogManager.Instance.AddOperationLog(po.Id, EnumOperationLogType.CIntegralRecord, enumOperationLogAction, oldObject, newObject, operatorName); return(po.Id); }
public void AddOperationLog(int key, EnumOperationLogType type, EnumOperationLogAction action, object objOld, object objNew, string sOperator) { using (IEntityContext entityContext = COperationLogPOManager.Instance.CreateEntityContext()) { AddOperationLogWithContext(entityContext, key, type, action, objOld, objNew, sOperator); } }
public int AddWithContext(IEntityContext entityContext, BusinessHourWeekPO po, string operatorName) { if (po == null) { throw ErrorCodeHelper.BusinessHourWeekNull.ToException(); } EnumOperationLogAction enumOperationLogAction = EnumOperationLogAction.Add; BusinessHourWeekPO oldObject = null; BusinessHourWeekPO newObject = po; BusinessHourWeekPOManager.Instance.AddWithContext(entityContext, newObject); po.Id = newObject.Id; COperationLogManager.Instance.AddOperationLog(po.Id, EnumOperationLogType.BusinessHourWeek, enumOperationLogAction, oldObject, newObject, operatorName); return(po.Id); }
public int AddWithContext(IEntityContext entityContext, CResCoordinatePO po, string operatorName) { if (po == null) { throw ErrorCodeHelper.CResCoordinateNull.ToException(); } EnumOperationLogAction enumOperationLogAction = EnumOperationLogAction.Add; CResCoordinatePO oldObject = null; CResCoordinatePO newObject = po; newObject.CreateName = operatorName; newObject.CreateTime = DateTime.Now; CResCoordinatePOManager.Instance.AddWithContext(entityContext, newObject); po.Id = newObject.Id; COperationLogManager.Instance.AddOperationLog(po.Id, EnumOperationLogType.CResCoordinate, enumOperationLogAction, oldObject, newObject, operatorName); return(po.Id); }
public int UpdateWithContext(IEntityContext entityContext, CResCoordinatePO po, string operatorName) { if (po == null) { throw ErrorCodeHelper.CResCoordinateNull.ToException(); } EnumOperationLogAction enumOperationLogAction = EnumOperationLogAction.Update; CResCoordinatePO oldObject = null; CResCoordinatePO newObject = po; oldObject = GetByIdWithContext(entityContext, po.Id); if (oldObject == null) { throw ErrorCodeHelper.CResCoordinateNotExist.ToException(); } CResCoordinatePOManager.Instance.UpdateWithContext(entityContext, newObject); COperationLogManager.Instance.AddOperationLog(po.Id, EnumOperationLogType.CResCoordinate, enumOperationLogAction, oldObject, newObject, operatorName); return(po.Id); }
public void AddOperationLogWithContext(IEntityContext entityContext, int key, EnumOperationLogType type, EnumOperationLogAction action, object objOld, object objNew, string sOperator) { ObjectComparer objCompare = this.GetResComparer(); COperationLogPO log = new COperationLogPO(); log.Type = (byte)type; log.Action = (byte)action; log.CreateTime = DateTime.Now; log.DataInfo = objCompare.GetDifference(objOld, objNew); log.DataId = key; log.OperatorName = sOperator; log.TypeName = type.ToString(); entityContext.Add(log); }