public void RemoveObject(BaseContext context, LogicTransaction ltr = null) { if (context != null) { context.LogicTransactionObjectParams1.Remove(this); } }
public void RemoveObject(BaseContext context, Log.LogicTransaction ltr = null) { if (context == null) { return; } var _ltr = ltr == null ? (this.NeedLtrForDelete ? context.BeginLtr() : null) : ltr; RemoveLinkedCollections(context, _ltr); RemoveChildCollection(context, this.RightsForThisObject, _ltr); if (_ltr != null) { _ltr.AddDeletedObject(this, context); } if (_ltr != null && ltr == null) { _ltr.Commit(context); } RemoveEntity(context); }
public void RemoveObject(BaseContext context, LogicTransaction ltr = null) { if (context == null) { return; } if (Params != null) { Params.ToList().ForEach(p => p.RemoveObject(context, ltr)); } context.LogicTransactionObjects1.Remove(this); }
void DoInitWindows(Log.LogicTransaction ltr) { var _ltr = ltr == null?this.BeginLtr("INIT_WND") : ltr; var existingWindows = new HashSet <String>(InitWindows(_ltr)); this.Windows.Where(wnd => !existingWindows.Contains(wnd.Iid)) .ToList() .ForEach(wnd => wnd.RemoveObject(this, _ltr)); if (ltr == null) { _ltr.Commit(this); } }
public void RemoveObject(BaseContext context, LogicTransaction ltr = null) { if (context == null) { return; } if (Children != null) { Children.ToList().ForEach(c => c.RemoveObject(context, ltr)); } if (Objects != null) { Objects.ToList().ForEach(o => o.RemoveObject(context, ltr)); } }
public void SetRights(String securityEntityID, RightsActionEnum action, RightsEnum?rightsValue, BaseContext context, Log.LogicTransaction ltr = null) { var ace = context.AllRights.Where(r => r.SubjectId.Equals(this.Iid, StringComparison.OrdinalIgnoreCase) && r.ObjectId.Equals(securityEntityID, StringComparison.OrdinalIgnoreCase)) .ToList() .FirstOrDefault(r => r.Action == action); if (rightsValue == null) { if (ace != null) { ace.RemoveObject(context, ltr); } return; } if (ace == null) { ace = context.AllRights.Add(new Users.DbRights(context) { Subject = this, SubjectId = this.Iid, ObjectId = securityEntityID, Rights = rightsValue.Value, Action = action }); if (ltr != null) { ltr.AddCreatedObject(ace, context); } return; } if (ace.Rights != rightsValue.Value) { if (ltr != null) { ltr.AddUpdatedObjectBefore(ace, context); } ace.Rights = rightsValue.Value; if (ltr != null) { ltr.AddUpatedObjectAfter(ace, context); } } }
protected void RemoveChildCollection(BaseContext context, IEnumerable <IIIDObject> childCollection, Log.LogicTransaction ltr) { if (context == null || childCollection == null) { return; } childCollection.ToList().ForEach(obj => obj.RemoveObject(context)); }
protected virtual void RemoveLinkedCollections(BaseContext context, Log.LogicTransaction ltr) { }
Windows.ActionDescriptor AddAction(Windows.WindowDescriptor window, String actionKey, String actionName, Log.LogicTransaction ltr) { var action = window.ChildActions.FirstOrDefault(act => act.ActionKey.Equals(actionKey, StringComparison.OrdinalIgnoreCase)); if (action == null) { window.ChildActions.Add(action = new Windows.ActionDescriptor(this, actionKey, window) { ActionName = actionName }); if (ltr != null) { ltr.AddCreatedObject(action, this); } } else if (!String.Equals(action.ActionName, actionName, StringComparison.Ordinal)) { if (ltr != null) { ltr.AddUpdatedObjectBefore(action, this); } action.ActionName = actionName; if (ltr != null) { ltr.AddUpatedObjectAfter(action, this); } } return(action); }
protected virtual IEnumerable <String> InitWindows(Log.LogicTransaction ltr) { yield break; }
protected Windows.WindowDescriptor AddWindow(String windowId, String windowName, Windows.WindowDescriptor parentWindow, IEnumerable <Tuple <String, String> > actions, Log.LogicTransaction ltr) { var window = this.Windows.FirstOrDefault(wnd => wnd.Iid.Equals(windowId, StringComparison.OrdinalIgnoreCase)); if (window == null) { window = this.Windows.Add(new Windows.WindowDescriptor(this, windowId, windowName) { ChildActions = new List <Windows.ActionDescriptor>(), ChildWindows = new List <Windows.WindowDescriptor>() }); if (ltr != null) { ltr.AddCreatedObject(window, this); } } else if (!window.Name.Equals(windowName, StringComparison.Ordinal) || window.ParentWindow != parentWindow) { if (ltr != null) { ltr.AddUpdatedObjectBefore(window, this); } window.ParentWindow = parentWindow; if (parentWindow != null && !parentWindow.ChildWindows.Contains(window)) { parentWindow.ChildWindows.Add(window); } window.Name = windowName; if (ltr != null) { ltr.AddUpatedObjectAfter(window, this); } } if (actions == null && window.ChildActions.Count > 0) { foreach (var action in window.ChildActions) { action.RemoveObject(this, ltr); } window.ChildActions.Clear(); } else if (actions != null) { var addedActions = new HashSet <String>(actions.Select(act => { AddAction(window, act.Item1, act.Item2, ltr); return(act.Item1); })); foreach (var action in window.ChildActions.Where(act => !addedActions.Contains(act.ActionKey))) { action.RemoveObject(this, ltr); window.ChildActions.Remove(action); } } return(window); }