當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。