当前位置: 首页>>代码示例>>C#>>正文


C# Castle.RenderText方法代码示例

本文整理汇总了C#中Castle.RenderText方法的典型用法代码示例。如果您正苦于以下问题:C# Castle.RenderText方法的具体用法?C# Castle.RenderText怎么用?C# Castle.RenderText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Castle的用法示例。


在下文中一共展示了Castle.RenderText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Perform

    public bool Perform(Castle.MonoRail.Framework.ExecuteEnum when,
                        Castle.MonoRail.Framework.IRailsEngineContext context,
                        Castle.MonoRail.Framework.Controller controller)
    {
        try
        {
            User user = null;
            if (context.Session.Contains(Constants.USER))
            {
                user = (User) context.Session[Constants.USER];
            }
/*
            if (context.Session[Constants.CATEGORIES_ACLS] == null)
            {
                Hashtable aclcat = Category.GetHashesByUser(user);
                Hashtable aclmenu = Menu.GetHashByCategoryHash(aclcat);
                context.Session[Constants.CATEGORIES_ACLS] = aclcat;
                context.Session[Constants.MENUS_ACLS] = aclmenu;
            }
*/
            // Get config parameters from database
            foreach (ConfigModel configModel in ConfigModel.FindAll())
            {
                if (configModel.Key == Constants.LAYOUT_LOWER)
                {
                    if (controller.Name == Constants.LOGIN_CONTROLLER)
                        controller.LayoutName = configModel.Val/*.Substring(0,6)*/ + Constants.LOGIN_SUB;
                    else
                        controller.LayoutName = configModel.Val;
                }
                else
                    controller.PropertyBag[configModel.Key] = configModel.Val;
            }

            // Get config parameters from site.config
            foreach (string key in config.Keys)
            {
                controller.PropertyBag[key] = config.GetExistentValue(key);
            }
            
            // Get config parameters from cookies:
            string lang = Commons.GetCurrentLang(controller);
            controller.PropertyBag[Constants.LANG] = lang ;

            // Get all supported languages:
            Language[] all_linguas = Language.FindAll();
            controller.PropertyBag[Constants.ALL_LINGUAS] = all_linguas;
            
            
            controller.PropertyBag[Constants.LAYOUTS_AVAILABLE] =
                ConfigCombo.FindAllByKey(Constants.LAYOUT_LOWER);
            controller.PropertyBag[Constants.COLORS_AVAILABLE] =
                ConfigCombo.FindAllByKey(Constants.COLOR);
            controller.PropertyBag[Constants.HEADERS_AVAILABLE] =
                ConfigCombo.FindAllByKey(Constants.HEADER);

            controller.PropertyBag[Constants.PERMISSION_READ] = Permission.Read;
            controller.PropertyBag[Constants.PERMISSION_CREATE] = Permission.Create;
            controller.PropertyBag[Constants.PERMISSION_MODIFY] = Permission.Modify;
            controller.PropertyBag[Constants.PERMISSION_DELETE] = Permission.Delete;
            controller.PropertyBag[Constants.PERMISSION_PUBLISH] = Permission.Publish;

            context.Session[Constants.IS_ROOT] =
                ((user != null) && (user.Name == Constants.SUPER_USER));
            context.Session[Constants.IS_ADMIN] =
                ((user  != null) && user.IsInGroup(Constants.ADMIN_GROUP_NAME));

            return true;
        }
        catch (Castle.ActiveRecord.Framework.ActiveRecordException ex)
        {
            logger.Error(ex.Message + "," + ex.StackTrace);
            controller.RenderText(Constants.WEBSITE_UNAVAILABLE);
            return false;
        }
        catch (System.Exception ex)
        {
            throw ex;
        }
    }
开发者ID:BackupTheBerlios,项目名称:castleportal-svn,代码行数:80,代码来源:ConfigLoad.cs


注:本文中的Castle.RenderText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。