Exemplo n.º 1
0
        private void ListConditions(SecurityAction sa)
        {
            this.Cursor = Cursors.WaitCursor;
            this.flowLayoutPanel1.SuspendLayout();

            try
            {
                ClearFlowPanel();

                foreach (SecurityCondition sc in sa.Conditions)
                {
                    ucCondition ctl = new ucCondition();
                    ctl.UpdateConditionEvent += new ucCondition.UpdateConditionEventHandler(UpdateCondition);
                    ctl.SetCondition(sc);
                    ctl.ShowEditPanel = false;

                    this.flowLayoutPanel1.Controls.Add(ctl);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("初始化用户行为{0}的条件列表失败,错误消息为:{1}", sa.Name, ex.Message));
            }
            finally
            {
                this.flowLayoutPanel1.ResumeLayout();
                this.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 2
0
        private void AddConditon2Action(string eventGuid, string actionGuid, SecurityCondition sc)
        {
            TreeNode pNode = null;

            if (!FindParentNode(eventGuid, actionGuid, out pNode))
            {
                MessageBox.Show("添加条件前,请先选中条件所属安全行为");
                return;
            }

            ucCondition ctl = FindConditon(sc.ConditionGuid);

            if (ctl != null)
            {
                MessageBox.Show("已经存在相同标识符的条件");
                ctl.IsRuleSelected = true;

                return;
            }

            ctl = new ucCondition();
            ctl.SetCondition(sc);
            ctl.UpdateConditionEvent += new ucCondition.UpdateConditionEventHandler(UpdateCondition);

            this.flowLayoutPanel1.Controls.Add(ctl);
        }
Exemplo n.º 3
0
        private void RemoveConditon(string eventGuid, string actionGuid, string conditionGuid)
        {
            TreeNode pNode = null;

            if (!FindParentNode(eventGuid, actionGuid, out pNode))
            {
                MessageBox.Show("删除条件前,请先选中条件所属安全行为");
                return;
            }

            ucCondition ctl = FindConditon(conditionGuid);

            if (ctl == null)
            {
                MessageBox.Show("要删除的条件不存在");
                return;
            }

            this.flowLayoutPanel1.Controls.Remove(ctl);
        }
Exemplo n.º 4
0
        private void RefreshCondition(string eventGuid, string actionGuid, SecurityCondition sc)
        {
            TreeNode pNode = null;

            if (!FindParentNode(eventGuid, actionGuid, out pNode))
            {
                MessageBox.Show("更新条件前,请先选中条件所属安全行为");
                return;
            }

            ucCondition ctl = FindConditon(sc.ConditionGuid);

            if (ctl == null)
            {
                MessageBox.Show("要更新的条件不存在");
                return;
            }

            ctl.SetCondition(sc);
        }