Пример #1
0
 public void RemoveObject(BaseContext context, LogicTransaction ltr = null)
 {
     if (context != null)
     {
         context.LogicTransactionObjectParams1.Remove(this);
     }
 }
Пример #2
0
        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);
 }
Пример #4
0
        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);
            }
        }
Пример #5
0
        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);
                }
            }
        }
Пример #7
0
 protected void RemoveChildCollection(BaseContext context, IEnumerable <IIIDObject> childCollection, Log.LogicTransaction ltr)
 {
     if (context == null || childCollection == null)
     {
         return;
     }
     childCollection.ToList().ForEach(obj => obj.RemoveObject(context));
 }
Пример #8
0
 protected virtual void RemoveLinkedCollections(BaseContext context, Log.LogicTransaction ltr)
 {
 }
Пример #9
0
        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);
        }
Пример #10
0
 protected virtual IEnumerable <String> InitWindows(Log.LogicTransaction ltr)
 {
     yield break;
 }
Пример #11
0
        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);
        }