protected override bool Update(NamedObject ndo_changes, out NamedObject to_change) { bool success = base.Update(ndo_changes, out to_change); if (true == success) { success = RecordHistory(to_change, ActionType.Update); } return success; }
public override bool Remove(NamedObject ndo_obj) { bool success = base.Remove(ndo_obj); if (true == success) { success = RecordHistory(ndo_obj, ActionType.Delete); } return success; }
public override bool Add(NamedObject ndo_obj) { bool success = base.Add(ndo_obj); if (true == success) { success = RecordHistory(ndo_obj, ActionType.Insert); } return success; }
public virtual bool Dump(NamedObject ndo_obj) { object dump_obj = ResolveNDO(ndo_obj); if (dump_obj != null) { DumpCDOObject(dump_obj); return true; } else return false; }
public virtual bool Remove(NamedObject ndo_obj) { object res = ResolveNDO(ndo_obj); if (res != null) { ObjScope.Transaction.Begin(); ObjScope.Remove(res); ObjScope.Transaction.Commit(); return true; } else return false; }
private bool RecordHistory(NamedObject ndo_obj, ActionType actionType) { MfgOrder o = ndo_obj as MfgOrder; MfgOrderChangeHistory h; if (actionType == ActionType.Delete) h = new MfgOrderChangeHistory(null, this.TxnDate, actionType); else h = new MfgOrderChangeHistory(ndo_obj, this.TxnDate, actionType); o.AssignToMfgOrderChangeHistory(h); ObjScope.Transaction.Begin(); ObjScope.Add(h); ObjScope.Transaction.Commit(); return true; }
protected virtual bool Update(NamedObject ndo_changes, out NamedObject to_change) { string idProperty_Name = null; to_change = ResolveNDO(ndo_changes, out idProperty_Name); if (to_change != null) { ObjScope.Transaction.Begin(); foreach (PropertyInfo pi in ndo_changes.GetType().GetProperties()) { if (pi.Name == idProperty_Name) continue; // do not update Primary Property object v_changes = pi.GetValue(ndo_changes, null); if (v_changes != null && (pi.CanWrite || v_changes.GetType().IsGenericType)) SetProperty(to_change, pi, v_changes); } ObjScope.Transaction.Commit(); return true; } else return false; }
public virtual bool Add(NamedObject ndo_insert) { string idProperty_Name = null; object check_exist = ResolveNDO(ndo_insert, out idProperty_Name); if (check_exist == null) { foreach (PropertyInfo pi in ndo_insert.GetType().GetProperties()) { if (pi.Name == idProperty_Name) continue; // do not update Primary Property object v_changes = pi.GetValue(ndo_insert, null); if (v_changes != null && (pi.CanWrite || v_changes.GetType().IsGenericType)) SetProperty(ndo_insert, pi, v_changes); } ObjScope.Transaction.Begin(); ObjScope.Add(ndo_insert); ObjScope.Transaction.Commit(); return true; } else return false; }
protected NamedObject ResolveNDO(NamedObject ndo_changes, out string idProperty_Name) { object to_change = null; string idProperty_Value = Service.GetIdentityFieldValue(ndo_changes, out idProperty_Name); if (idProperty_Value == null || idProperty_Value == "0") to_change = ResolveCDO(ndo_changes.GetType(), ndo_changes.Name); else to_change = ResolveCDOByID(ndo_changes.GetType(), idProperty_Value); return to_change as NamedObject; }
protected NamedObject ResolveNDO(NamedObject ndo_changes) { string idProperty_Name; return ResolveNDO(ndo_changes, out idProperty_Name); }
public MfgOrderChangeHistory(NamedObject toChangeNDO, DateTime actionDate, ActionType actionType) : base(actionDate, actionType) { mfgOrder = toChangeNDO as MfgOrder; }
public bool Update(NamedObject ndo_changes) { NamedObject to_change = null; return Update(ndo_changes, out to_change); }