protected void Application_AcquireRequestState(object sender, EventArgs e) { var signInManager = DependencyResolver.Current.GetService <ISignInManager>(); #if DEBUG /*開發時自動登入*/ IList <string> actList = OrionUtils.EnumToDictionary <ACT>().Keys.ToList(); actList.Add("DevelopAdmin"); signInManager.DevelopSignIn(actList); try { } catch (Exception) { } #endif signInManager.Authenticate(Context); }
/// <summary></summary> public static MvcHtmlString BsEnumDropDownListFor <TModel, TEnum>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TEnum> > expression, string optionLabel, IDictionary <string, object> htmlAttributes) { if (expression == null) { throw new ArgumentNullException("expression"); } ModelMetadata modelMetadata = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData); if (modelMetadata == null) { throw new ArgumentNullException("無效的 expression 參數,沒有描述資訊"); } if (modelMetadata.ModelType == null) { throw new ArgumentNullException("無效的 expression 參數,沒有描述資訊"); } IDictionary <string, string> selectList = OrionUtils.EnumToDictionary(modelMetadata.ModelType); return(htmlHelper.BsDropDownListFor(expression, selectList, optionLabel, htmlAttributes)); }
/// <summary></summary> public static MvcHtmlString BsEnumCheckboxListFor <TModel, TEnum>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, IEnumerable <TEnum> > > expression, IDictionary <string, object> htmlAttributes) { IDictionary <string, string> selectList = OrionUtils.EnumToDictionary <TEnum>(); return(BsCheckboxListFor(htmlHelper, expression, HelperUtils.ToSelectListItem(selectList), htmlAttributes)); }
/// <summary></summary> public static MvcHtmlString BsEnumRadioListFor <TModel, TEnum>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TEnum> > expression, object htmlAttributes = null) { IDictionary <string, string> selectList = OrionUtils.EnumToDictionary <TEnum>(); return(BsRadioListFor(htmlHelper, expression, HelperUtils.ToSelectListItem(selectList), htmlAttributes)); }
/// <summary></summary> public static IHtmlString EnumJsonRaw(this HtmlHelper helper, Type type) { return(OrionUtils.EnumToDictionary(type).ToJsonRaw()); }
/// <summary></summary> public static IHtmlString EnumJsonRaw <TEnum>(this HtmlHelper helper) { return(OrionUtils.EnumToDictionary <TEnum>().ToJsonRaw()); }