Exemple #1
0
        public static CategoryTreeList Retrive_CategoryTreeList(FwkCategoryList pFwkCategoryList)
        {
            CategoryTreeList list = new CategoryTreeList();

            var wCategoryTreeList = from p in pFwkCategoryList select new CategoryTree(p);


            foreach (CategoryTree category in wCategoryTreeList)
            {
                list.Add((CategoryTree)category.Clone());

                CategoryTree rule = null;
                foreach (FwkAuthorizationRule r in category.FwkCategory.FwkRulesInCategoryList)
                {
                    rule                      = new CategoryTree();
                    rule.Name                 = r.Name.Trim();
                    rule.IsCategory           = false;
                    rule.ParentId             = category.Id;
                    rule.Id                   = string.Concat(category.Id, "_", r.Name.Trim());
                    rule.FwkAuthorizationRule = r;
                    list.Add(rule);
                }
            }
            return(list);
        }
Exemple #2
0
        /// <summary>
        /// Carga Dominios relacionados entre al objeto _RelatedDomains que esta bindiado a la grilla
        /// </summary>
        void Populate(out Exception ex)
        {
            ex = null;

            try
            {
                _Categories = SecurityController.SearchAllRulesCategory();
            }
            catch (Exception err)
            {
                err.Source = "Origen de datos";
                ex         = err;
            }
        }
Exemple #3
0
        /// <summary>
        /// Carga Dominios relacionados entre al objeto _RelatedDomains que esta bindiado a la grilla
        /// </summary>
        void Populate(out Exception ex)
        {
            ex = null;

            try
            {
                _CategoryList     = FwkMembership.GetAllCategories(frmAdmin.Provider.Name);
                _CategoryTreeList = CategoryTreeList.Retrive_CategoryTreeList(_CategoryList);
            }
            catch (Exception err)
            {
                err.Source = "Origen de datos";
                ex         = err;
            }
        }
        /// <summary>
        /// Obtiene las Categorias de una determinada aplicacion. Recibe el Nombre de cadena de coneccion del archivo de configuracion.-
        /// </summary>
        /// <param name="applicationName">Nombre de la aplicacion. Coincide con CompanyId en la arquitectura</param>
        /// <param name="connectionStringName">Nombre de cadena de coneccion del archivo de configuracion.-</param>
        /// <returns></returns>
        public static FwkCategoryList GetAllCategories(string applicationName, string connectionStringName)
        {
            FwkCategory     wCategory;
            FwkCategoryList wCategoryList = null;

            try
            {
                Guid wApplicationId = GetApplication(applicationName, connectionStringName);
                using (Fwk.Security.RuleProviderDataContext dc = new Fwk.Security.RuleProviderDataContext(System.Configuration.ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString))
                {
                    var rulesinCat = from s in dc.aspnet_RulesCategories where s.ApplicationId == wApplicationId select s;

                    wCategoryList = new FwkCategoryList();
                    foreach (aspnet_RulesCategory aspnet_cat in rulesinCat.ToList <aspnet_RulesCategory>())
                    {
                        wCategory            = new FwkCategory();
                        wCategory.CategoryId = aspnet_cat.CategoryId;
                        if (aspnet_cat.ParentCategoryId != null)
                        {
                            wCategory.ParentId = aspnet_cat.ParentCategoryId;
                        }
                        wCategory.Name = aspnet_cat.Name;
                        wCategoryList.Add(wCategory);
                    }
                }

                foreach (FwkCategory category in wCategoryList)
                {
                    category.FwkRulesInCategoryList = GetFwkRules_By_Category(category.CategoryId, connectionStringName);
                }


                return(wCategoryList);
            }
            catch (TechnicalException tx)
            { throw tx; }
            catch (Exception ex)
            {
                TechnicalException te = new TechnicalException(Fwk.Security.Properties.Resource.MembershipSecurityGenericError, ex);
                ExceptionHelper.SetTechnicalException <FwkMembership>(te);
                te.ErrorId = "4000";
                throw te;
            }
        }
Exemple #5
0
        public override void Initialize()
        {
            //txtRuleName.Focus();
            using (new WaitCursorHelper(this))
            {
                _AllRuleList = FwkMembership.GetRulesAuxList(frmAdmin.Provider.Name);
                fwkAuthorizationRuleBindingSource.DataSource = _AllRuleList;
                grdAllRules.RefreshDataSource();

                _CategoryList     = FwkMembership.GetAllCategories(frmAdmin.Provider.Name);
                _CategoryTreeList = CategoryTreeList.Retrive_CategoryTreeList(_CategoryList);
                treeList1.BeginUnboundLoad();

                this.categoryTreeBindingSource.DataSource = _CategoryTreeList;
                treeList1.RefreshDataSource();
                treeList1.EndUnboundLoad();
                treeList1.ExpandAll();

                moveCursor = new Cursor(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Fwk.Security.Admin.Resources.move_16.ico"));
            }
        }
Exemple #6
0
        public override void Initialize()
        {
            //txtRuleName.Focus();
            using (new WaitCursorHelper(this))
            {

                _AllRuleList = FwkMembership.GetRulesAuxList(frmAdmin.Provider.Name);
                fwkAuthorizationRuleBindingSource.DataSource = _AllRuleList;
                grdAllRules.RefreshDataSource();

                _CategoryList = FwkMembership.GetAllCategories(frmAdmin.Provider.Name);
                _CategoryTreeList = CategoryTreeList.Retrive_CategoryTreeList(_CategoryList);
                treeList1.BeginUnboundLoad();

                this.categoryTreeBindingSource.DataSource = _CategoryTreeList;
                treeList1.RefreshDataSource();
                treeList1.EndUnboundLoad();
                treeList1.ExpandAll();

                moveCursor = new Cursor(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Fwk.Security.Admin.Resources.move_16.ico"));
            }
        }
        /// <summary>
        /// Obtiene las Categorias de una determinada aplicacion. Recibe el Nombre de cadena de coneccion del archivo de configuracion.-
        /// </summary>
        /// <param name="applicationName">Nombre de la aplicacion. Coincide con CompanyId en la arquitectura</param>
        /// <param name="connectionStringName">Nombre de cadena de coneccion del archivo de configuracion.-</param>
        /// <returns></returns>
        public static FwkCategoryList GetAllCategories(string applicationName, string connectionStringName)
        {

            FwkCategory wCategory;
            FwkCategoryList wCategoryList = null;
            try
            {
                Guid wApplicationId = GetApplication(applicationName, connectionStringName);
                using (Fwk.Security.RuleProviderDataContext dc = new Fwk.Security.RuleProviderDataContext(System.Configuration.ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString))
                {
                    var rulesinCat = from s in dc.aspnet_RulesCategories where s.ApplicationId == wApplicationId select s;

                    wCategoryList = new FwkCategoryList();
                    foreach (aspnet_RulesCategory aspnet_cat in rulesinCat.ToList<aspnet_RulesCategory>())
                    {
                        wCategory = new FwkCategory();
                        wCategory.CategoryId = aspnet_cat.CategoryId;
                        if (aspnet_cat.ParentCategoryId != null)
                            wCategory.ParentId = aspnet_cat.ParentCategoryId;
                        wCategory.Name = aspnet_cat.Name;
                        wCategoryList.Add(wCategory);
                    }

                }

                foreach (FwkCategory category in wCategoryList)
                {
                    category.FwkRulesInCategoryList = GetFwkRules_By_Category(category.CategoryId, connectionStringName);
                }


                return wCategoryList;
            }
            catch (TechnicalException tx)
            { throw tx; }
            catch (Exception ex)
            {

                TechnicalException te = new TechnicalException(Fwk.Security.Properties.Resource.MembershipSecurityGenericError, ex);
                ExceptionHelper.SetTechnicalException<FwkMembership>(te);
                te.ErrorId = "4000";
                throw te;
            }
        }
Exemple #8
0
        /// <summary>
        /// Carga Dominios relacionados entre al objeto _RelatedDomains que esta bindiado a la grilla
        /// </summary>
        void Populate(out Exception ex)
        {
            ex = null;

            try
            {

                _CategoryList = FwkMembership.GetAllCategories(frmAdmin.Provider.Name);
                _CategoryTreeList = CategoryTreeList.Retrive_CategoryTreeList(_CategoryList);
            }
            catch (Exception err)
            {
                err.Source = "Origen de datos";
                ex = err;
            }



        }