コード例 #1
0
        public override CreateRuleRes Execute(CreateRuleReq pServiceRequest)
        {
            CreateRuleRes wRes = new CreateRuleRes();

            FwkMembership.CreateRule(pServiceRequest.BusinessData, pServiceRequest.SecurityProviderName);
            return(wRes);
        }
コード例 #2
0
        public bool AceptChanges()
        {
            if (string.IsNullOrEmpty(txtRuleName.Text))
            {
                errorProvider1.SetError(txtRuleName, "Rule name must not be empty");
                return(false);
            }


            try
            {
                if (_CurrentRule == null)
                {
                    _CurrentRule = new FwkAuthorizationRule();
                }

                _CurrentRule.Expression = txtRuleExpression.Text;

                if (base.State == Bases.EntityUpdateEnum.NEW)
                {
                    _CurrentRule.Name = txtRuleName.Text;
                    if (FwkMembership.ExistRule(txtRuleName.Text.Trim(), frmAdmin.Provider.Name))
                    {
                        MessageViewInfo.Show(String.Format("The rule {0} exist", txtRuleName.Text));
                        txtRuleName.Focus();
                        return(false);
                    }
                    FwkMembership.CreateRule(_CurrentRule, frmAdmin.Provider.Name);

                    MessageViewInfo.Show(String.Format(Properties.Resources.RuleCreatedMessage, txtRuleName.Text));

                    this.btnCreateRule.Enabled = false;
                }
                if (base.State == Bases.EntityUpdateEnum.UPDATED)
                {
                    //Si Cambio el nombre
                    if (_CurrentRule.Name.Trim().CompareTo(txtRuleName.Text.Trim()) != 0)
                    {
                        FwkMembership.UpdateRuleAndRuleName(_CurrentRule, txtRuleName.Text.Trim(), frmAdmin.Provider.Name);
                    }
                    else
                    {
                        FwkMembership.UpdateRule(_CurrentRule, frmAdmin.Provider.Name);
                    }

                    MessageViewInfo.Show(String.Format(Properties.Resources.RuleUpdatedMessage, txtRuleName.Text));
                }
                NewSecurityInfoCreatedHandler();
            }
            catch (Exception ex)
            {
                MessageViewInfo.Show(ex);
                return(false);
            }
            return(true);
        }