Exemple #1
0
 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;
 }
Exemple #2
0
 public override bool Remove(NamedObject ndo_obj)
 {
     bool success = base.Remove(ndo_obj);
     if (true == success)
     {
         success = RecordHistory(ndo_obj, ActionType.Delete);
     }
     return success;
 }
Exemple #3
0
 public override bool Add(NamedObject ndo_obj)
 {
     bool success = base.Add(ndo_obj);
     if (true == success)
     {
         success = RecordHistory(ndo_obj, ActionType.Insert);
     }
     return success;
 }
Exemple #4
0
 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;
 }
Exemple #5
0
 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;
 }
Exemple #6
0
 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;
 }
Exemple #7
0
        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;
        }
Exemple #8
0
 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;
 }
Exemple #9
0
 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;
 }
Exemple #10
0
 protected NamedObject ResolveNDO(NamedObject ndo_changes)
 {
     string idProperty_Name;
     return ResolveNDO(ndo_changes, out idProperty_Name);
 }
Exemple #11
0
 public MfgOrderChangeHistory(NamedObject toChangeNDO, DateTime actionDate, ActionType actionType)
     : base(actionDate, actionType)
 {
     mfgOrder = toChangeNDO as MfgOrder;
 }
Exemple #12
0
 public bool Update(NamedObject ndo_changes)
 {
     NamedObject to_change = null;
     return Update(ndo_changes, out to_change);
 }