コード例 #1
0
 protected void AddItemPanel(UserRelationItemPanel itemPanel)
 {
     itemPanel.Added     += OnAdded;
     itemPanel.Updated   += OnUpdated;
     itemPanel.Deleted   += OnDeleted;
     itemPanel.Activated += OnActivated;
     itemPanel.FillUsers(this.Users);
     itemPanel.FillRoles(this.Roles);
     this.panel.Children.Add(itemPanel);
 }
コード例 #2
0
        private void OnUpdated(object item)
        {
            UserRelationItemPanel panel = (UserRelationItemPanel)item;

            if (this.User == null)
            {
                this.User = new Domain.User();
            }
            this.User.relationsListChangeHandler.AddUpdated(panel.RelationItem);
            updated = true;
            OnChanged(panel.RelationItem);
        }
コード例 #3
0
        private void OnActivated(object item)
        {
            UserRelationItemPanel panel = (UserRelationItemPanel)item;

            if (this.ActiveItemPanel != panel)
            {
                this.ActiveItemPanel = panel;
                if (ItemChanged != null && panel.RelationItem != null)
                {
                    ItemChanged(panel.RelationItem);
                }
            }
        }
コード例 #4
0
        private void OnDeleted(object item)
        {
            UserRelationItemPanel panel = (UserRelationItemPanel)item;

            this.panel.Children.Remove(panel);
            if (this.panel.Children.Count == 0)
            {
                OnAdded(null);
                return;
            }
            if (panel.RelationItem != null)
            {
                if (this.User.relationsListChangeHandler.Items.Count > 1)
                {
                    if (this.User == null)
                    {
                        this.User = new Domain.User();
                    }

                    if (ItemDeleted != null && panel.RelationItem != null)
                    {
                        ItemDeleted(panel.RelationItem);
                    }


                    if (this.ActiveItemPanel != null && this.ActiveItemPanel == panel)
                    {
                        this.ActiveItemPanel = (UserRelationItemPanel)this.panel.Children[this.panel.Children.Count - 1];
                    }
                    int index = 1;
                    int j     = 0;
                    for (int i = this.panel.Children.Count - 1; i >= 0; i--)
                    {
                        UserRelationItemPanel pan = this.panel.Children[j] as UserRelationItemPanel;
                        pan.Index = index++;
                        j++;
                    }
                    if (Changed != null)
                    {
                        Changed();
                    }
                }
            }
        }
コード例 #5
0
        private void OnAdded(object item)
        {
            UserRelationItemPanel panel = (UserRelationItemPanel)item;

            if (this.User == null)
            {
                this.User = new Domain.User();
            }
            if (panel == null)
            {
                panel = new UserRelationItemPanel(1);
            }
            if (panel.RelationItem == null)
            {
                panel.RelationItem = new Relation();
            }
            panel.RelationItem.user = this.User;
            this.User.relationsListChangeHandler.AddNew(panel.RelationItem);
            updated = false;
            OnChanged(panel.RelationItem);
        }
コード例 #6
0
        /// <summary>
        /// affiche le calculatedMeasure en edition
        /// </summary>
        /// <param name="table"></param>
        public void DisplayUserRelations(Domain.User user)
        {
            this.User = user;
            this.panel.Children.Clear();
            int index = 1;

            if (user == null)
            {
                this.ActiveItemPanel = new UserRelationItemPanel(index);
                AddItemPanel(this.ActiveItemPanel);
                return;
            }
            foreach (Relation item in user.relationsListChangeHandler.Items)
            {
                UserRelationItemPanel itemPanel = new UserRelationItemPanel();
                itemPanel.Index = index;
                AddItemPanel(itemPanel);
                itemPanel.Display(item);
                index++;
            }

            this.ActiveItemPanel = new UserRelationItemPanel(index);
            AddItemPanel(this.ActiveItemPanel);
        }