Ejemplo n.º 1
0
        /// <summary>
        /// Elimina una regla de la base de datos
        /// </summary>
        /// <param name="ruleName"></param>
        /// <param name="applicationName"></param>
        /// <param name="connectionStringName"></param>
        /// <returns></returns>
        public static void DeleteRule(string ruleName, string applicationName, string connectionStringName)
        {
            aspnet_Rule waspnet_Rule = null;

            try
            {
                Guid wApplicationId = GetApplication(applicationName, connectionStringName);

                using (Fwk.Security.RuleProviderDataContext dc = new Fwk.Security.RuleProviderDataContext(System.Configuration.ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString))
                {
                    waspnet_Rule = dc.aspnet_Rules.First <aspnet_Rule>(s => s.name.Equals(ruleName.Trim()) && s.ApplicationId.Equals(wApplicationId));
                    dc.aspnet_Rules.DeleteOnSubmit(waspnet_Rule);
                    dc.SubmitChanges();
                }
            }
            catch (TechnicalException tx)
            { throw tx; }
            catch (Exception ex)
            {
                TechnicalException te = new TechnicalException(string.Format(Resource.Rule_ProblemGetingData_Error, ruleName), ex);
                te.ErrorId = "4003";
                Fwk.Exceptions.ExceptionHelper.SetTechnicalException <FwkMembership>(te);
                throw te;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ruleName"></param>
        /// <param name="applicationName"></param>
        /// <param name="connectionStringName"></param>
        /// <returns></returns>
        public static FwkAuthorizationRule GetRule(string ruleName, string applicationName, string connectionStringName)
        {
            aspnet_Rule waspnet_Rule = null;

            try
            {
                Guid wApplicationId = GetApplication(applicationName, connectionStringName);

                using (Fwk.Security.RuleProviderDataContext dc = new Fwk.Security.RuleProviderDataContext(System.Configuration.ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString))
                {
                    if (dc.aspnet_Rules.Any <aspnet_Rule>(s => s.name.Equals(ruleName.Trim()) && s.ApplicationId == wApplicationId))
                    {
                        waspnet_Rule = dc.aspnet_Rules.First <aspnet_Rule>(s => s.name.Equals(ruleName.Trim()) && s.ApplicationId == wApplicationId);
                    }
                    FwkAuthorizationRule rule = new FwkAuthorizationRule(waspnet_Rule.name, waspnet_Rule.expression, waspnet_Rule.ApplicationId.Value);
                    rule.Description = waspnet_Rule.Description;
                    rule.Id          = waspnet_Rule.Id;
                    return(rule);
                }
            }
            catch (TechnicalException tx)
            { throw tx; }
            catch (Exception ex)
            {
                TechnicalException te = new TechnicalException(string.Format(Resource.Rule_ProblemGetingData_Error, ruleName), ex);
                te.ErrorId = "4003";
                Fwk.Exceptions.ExceptionHelper.SetTechnicalException <FwkMembership>(te);
                throw te;
            }
        }
Ejemplo n.º 3
0
 partial void Deleteaspnet_Rule(aspnet_Rule instance);
Ejemplo n.º 4
0
 partial void Updateaspnet_Rule(aspnet_Rule instance);
Ejemplo n.º 5
0
 partial void Insertaspnet_Rule(aspnet_Rule instance);
Ejemplo n.º 6
0
 partial void Deleteaspnet_Rule(aspnet_Rule instance);
Ejemplo n.º 7
0
 partial void Updateaspnet_Rule(aspnet_Rule instance);
Ejemplo n.º 8
0
 partial void Insertaspnet_Rule(aspnet_Rule instance);