Example #1
0
        public CommonFixture()
        {
            #region [ cool privilege control ]
            IList <ComposablePartCatalog> composableList = new List <ComposablePartCatalog>();

            composableList.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
            composableList.Add(new AssemblyCatalog(typeof(LanguageKey).Assembly));
            composableList.Add(new AssemblyCatalog(typeof(FunctionTypeVM).Assembly));
            //composableList.Add(new AssemblyCatalog(typeof(StaticContent).Assembly));
            composableList.Add(new AssemblyCatalog(typeof(LoginController).Assembly));

            Bootstrapper boot = new Bootstrapper(composableList);

            boot.RunTask();

            composableList = new List <ComposablePartCatalog>();
            composableList.Add(new AssemblyCatalog(typeof(PrivilegeFun).Assembly));
            WCFBootstrapper wcfBootStrapper = new WCFBootstrapper(composableList);

            SystemMgtHelper systemMgtHelper = new SystemMgtHelper(WCFBootstrapper.Container);

            Bootstrapper.Container.ComposeExportedValue <LoginUserMgtHelper>(new LoginUserMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <AuditLogMgtHelper>(new AuditLogMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <AuthHisMgtHelper>(new AuthHisMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <FunMgtHelper>(new FunMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <FunTypeMgtHelper>(new FunTypeMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <OrgMgtHelper>(new OrgMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <OrgDetailMgtHelper>(new OrgDetailMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <RoleMgtHelper>(new RoleMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <SystemMgtHelper>(systemMgtHelper);
            Bootstrapper.Container.ComposeExportedValue <CheckPrivilegeHelper>(new CheckPrivilegeHelper(WCFBootstrapper.Container));

            WCFAuthInfoVM entity_WCFAuthInfoVM = new WCFAuthInfoVM("", "", "", "", "", LanguageKey.en.ToString(), "");

            StaticContent.SystemInfoInst = systemMgtHelper.GetSystemInfo(entity_WCFAuthInfoVM);
            #endregion

            #region [ Initialize Language Pack ]
            LangPack entity_LangPack = new LangPack();

            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.en));
            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.cn));
            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.tw));
            #endregion

            #region [ Set Route Table ]
            RouteTable.Routes.Clear();
            var areaRegistration        = new AccessControlAreaRegistration();
            var areaRegistrationContext = new AreaRegistrationContext(
                areaRegistration.AreaName, RouteTable.Routes);
            areaRegistration.RegisterArea(areaRegistrationContext);

            RouteConfig.RegisterRoutes(RouteTable.Routes);
            #endregion
        }
Example #2
0
        public string GetMultiLingualResSer(string str_LangKey)
        {
            LanguageKey languageKey_Input = LanguageKey.en;

            Enum.TryParse <LanguageKey>(str_LangKey, out languageKey_Input);

            IDictionary <string, string> dic_AllKey = LangPack.GetAllByLangKey(LangPack.GetLanugage(languageKey_Input));

            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();

            return(jsonSerializer.Serialize(dic_AllKey));
            //return dic_AllKey;
        }
        protected void Application_Start()
        {
            #region [ Cool Privilege Control ]
            AreaRegistration.RegisterAllAreas();

            var myassembly1 = new DirectoryCatalog("bin");
            IList <ComposablePartCatalog> composableList = new List <ComposablePartCatalog>();
            composableList.Add(myassembly1);

            Bootstrapper boot = new Bootstrapper(composableList);

            boot.RunTask();

            IPostOffice postOffice = new PostOffice();

            #region [ Compose Service Helper ]
            SystemMgtHelper systemMgtHelper = new SystemMgtHelper(postOffice.SystemMgtSerPath);

            Bootstrapper.Container.ComposeExportedValue <LoginUserMgtHelper>(new LoginUserMgtHelper(postOffice.LoginUserMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <AuditLogMgtHelper>(new AuditLogMgtHelper(postOffice.AuditLogMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <AuthHisMgtHelper>(new AuthHisMgtHelper(postOffice.AuthHisMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <FunMgtHelper>(new FunMgtHelper(postOffice.FunMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <FunTypeMgtHelper>(new FunTypeMgtHelper(postOffice.FunTypeMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <OrgMgtHelper>(new OrgMgtHelper(postOffice.OrgMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <OrgDetailMgtHelper>(new OrgDetailMgtHelper(postOffice.OrgDetailMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <RoleMgtHelper>(new RoleMgtHelper(postOffice.RoleMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <SystemMgtHelper>(systemMgtHelper);
            Bootstrapper.Container.ComposeExportedValue <CheckPrivilegeHelper>(new CheckPrivilegeHelper(postOffice.CheckPrivilegeSerPath));
            #endregion

            WCFAuthInfoVM entity_WCFAuthInfoVM = new WCFAuthInfoVM("", "", "", "", "", LanguageKey.en.ToString(), "");

            StaticContent.SystemInfoInst = systemMgtHelper.GetSystemInfo(entity_WCFAuthInfoVM);

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            LangPack entity_LangPack = new LangPack();

            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.en));
            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.cn));
            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.tw));
            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.esve));
            #endregion
        }
Example #4
0
        // GET: AccessControl/Login
        public ActionResult Index(string str_Language = "en")
        {
            ClearSelectionCriteriaFromViewData();

            LanguageKey temp = LanguageKey.en;

            Enum.TryParse <LanguageKey>(str_Language, out temp);

            TempData[StaticContent.LanguageKey] = temp;

            Thread.CurrentThread.CurrentCulture       =
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(LangPack.GetLanugage(temp));

            if (TempData[ActionMessageKey] != null)
            {
                ViewBag.ActionMessage = TempData[ActionMessageKey];
            }

            initLanguageComboBox(str_Language);

            return(View());
        }
 void MvcApplication_BeginRequest(object sender, EventArgs e)
 {
     if (!LangPack.ContainsKey(Thread.CurrentThread.CurrentUICulture.Name.ToLower()))
     {
         Thread.CurrentThread.CurrentCulture       =
             Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(LangPack.GetLanugage(LanguageKey.en));
     }
 }