Esempio n. 1
0
        private void mDeleteRule_Click(object sender, EventArgs e)
        {
            if (_CurrentRule == null)
            {
                return;
            }
            DialogResult res = DialogResult.No;

            res = MessageBox.Show(string.Concat("Are you shure to remove ", _CurrentRule.Name, " ?"), "Security ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (res == DialogResult.Yes)
            {
                foreach (CategoryTree category in _CategoryTreeList.Where(p => p.IsCategory))
                {
                    if (category.AnyRule(_CurrentRule.Name))
                    {
                        res = MessageBox.Show(string.Concat(_CurrentRule.Name, " is in ", category.Name, "\r\n Are you shure remove it ?"), "Security ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (res == DialogResult.Yes)
                        {
                            category.RemoveRule(_CurrentRule.Name);
                            FwkMembership.CreateRuleInCategory(category.FwkCategory, frmAdmin.Provider.Name);
                        }
                    }
                }
            }
            if (res == DialogResult.Yes)
            {
                FwkMembership.DeleteRule(_CurrentRule.Name, frmAdmin.Provider.Name);
            }

            PopulateAsync();
        }