public FormSimulator(Core.BusinessBase obj) { this._obj.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(obj_IsDirtyChanged); this._obj = obj; }
public SerializableListener(Core.BusinessBase obj) { this._obj.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(obj_IsDirtyChanged); this._obj = obj; }
public DataPortalResult Update(object obj, DataPortalContext context) { try { // tell the business object we're about to make a DataPortal_xyz call MethodCaller.CallMethodIfImplemented( obj, "DataPortal_OnDataPortalInvoke", new DataPortalEventArgs(context)); // tell the business object to update itself if (obj is Core.BusinessBase) { Core.BusinessBase busObj = (Core.BusinessBase)obj; if (busObj.IsDeleted) { if (!busObj.IsNew) { // tell the object to delete itself MethodCaller.CallMethod( busObj, "DataPortal_DeleteSelf"); } // mark the object as new MethodCaller.CallMethodIfImplemented( busObj, "MarkNew"); } else { if (busObj.IsNew) { // tell the object to insert itself MethodCaller.CallMethod( busObj, "DataPortal_Insert"); } else { // tell the object to update itself MethodCaller.CallMethod( busObj, "DataPortal_Update"); } // mark the object as old MethodCaller.CallMethodIfImplemented( busObj, "MarkOld"); } } else if (obj is CommandBase) { // tell the object to update itself MethodCaller.CallMethod( obj, "DataPortal_Execute"); } else { // this is an updatable collection or some other // non-BusinessBase type of object // tell the object to update itself MethodCaller.CallMethod( obj, "DataPortal_Update"); // mark the object as old MethodCaller.CallMethodIfImplemented( obj, "MarkOld"); } // tell the business object the DataPortal_xyz is complete MethodCaller.CallMethodIfImplemented( obj, "DataPortal_OnDataPortalInvokeComplete", new DataPortalEventArgs(context)); return(new DataPortalResult(obj)); } catch (Exception ex) { try { // tell the business object there was an exception MethodCaller.CallMethodIfImplemented( obj, "DataPortal_OnDataPortalException", new DataPortalEventArgs(context), ex); } catch { // ignore exceptions from the exception handler } throw new DataPortalException( "DataPortal.Update " + Resources.FailedOnServer, ex, new DataPortalResult(obj)); } }
public DataPortalResult Update(object obj, DataPortalContext context) { try { SetContext(context); DataPortalResult result; MethodInfo method; string methodName; if (obj is CommandBase) { methodName = "DataPortal_Execute"; } else if (obj is Core.BusinessBase) { Core.BusinessBase tmp = (Core.BusinessBase)obj; if (tmp.IsDeleted) { methodName = "DataPortal_DeleteSelf"; } else if (tmp.IsNew) { methodName = "DataPortal_Insert"; } else { methodName = "DataPortal_Update"; } } else { methodName = "DataPortal_Update"; } method = MethodCaller.GetMethod(obj.GetType(), methodName); IDataPortalServer portal; switch (TransactionalType(method)) { case TransactionalTypes.EnterpriseServices: portal = new ServicedDataPortal(); try { result = portal.Update(obj, context); } finally { ((ServicedDataPortal)portal).Dispose(); } break; case TransactionalTypes.TransactionScope: portal = new TransactionalDataPortal(); result = portal.Update(obj, context); break; default: portal = new SimpleDataPortal(); result = portal.Update(obj, context); break; } return(result); } finally { ClearContext(context); } }
public void Reg(Core.BusinessBase obj) { obj.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler (PrivateOnIsDirtyChanged); obj.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(OnIsDirtyChanged); }