public ActionResult Index() { Debug("Get ~/Administration/User/Index()"); // Retrieve the user UserRecord user; if (int.Parse(HttpContext.User.Identity.Name) == -1) { user = UserRecord.CreateDefaultAdministrator(); } else { user = _userManager.GetById(int.Parse(HttpContext.User.Identity.Name)) as UserRecord; } // If the login doesn't exist, it is the administrator by default (due to RoleFilter) if (user == null) { FormsAuthentication.SignOut(); return(RedirectToAction("SignIn")); } // load ressources before designing the screen fitted to the user's profile LanguageDictionary ressources = new LanguageDictionary(Server.MapPath(LanguageDictionary.DIRECTORY_IMAGE), ConfigurationManager.DefaultLanguage); ressources.Load(_userManager.Database, user.CustomerId); // the user exists, check if it's already connected // In case of reloading page, the connection can't be disconnected as quick as expected ... if (DatabaseHub.IsAlreadyConnected(user.Id)) { FormsAuthentication.SignOut(); Debug($"The user '{user.Id}' is already connected on another support"); return(View("AlreadyConnected", new UserViewModel(ressources, user, false))); } // Show the screen on depends on the user's profile if (user.CustomerId == 1) { return(RedirectToAction("Index", "Customer")); } // Look for the default functional module for the current user ModuleRecord module = _userManager.GetDefaultModule(user); if (module == null) { FormsAuthentication.SignOut(); return(RedirectToAction("SignIn")); } return(RedirectToAction("Index", module.Module.ToString(), new { area = module.Module.ToString(), moduleId = module.Id })); }
public ActionResult Index(int?moduleId) { Debug($"Get ~/Administration/Administration/Index({moduleId})"); // If the login doesn't exist, it is the administrator by default (due to RoleFilter) if (!(_userManager.GetById(int.Parse(HttpContext.User.Identity.Name)) is UserRecord user)) { user = UserRecord.CreateDefaultAdministrator(); } // load ressources before designing the screen fitted to the user's profile LanguageDictionary ressources = new LanguageDictionary(Server.MapPath(LanguageDictionary.DIRECTORY_IMAGE), ConfigurationManager.DefaultLanguage); ressources.Load(_userManager.Database, user.CustomerId); // the user exists, check if it's already connected // In case of reloading page, the connection can't be disconnected as quick as expected ... if (DatabaseHub.IsAlreadyConnected(user.Id)) { FormsAuthentication.SignOut(); Debug($"The user '{user.Id}' is already connected on another support"); return(View("AlreadyConnected", new UserViewModel(ressources, user, false))); } return(View("Index", new UserViewModel(ressources, user, HttpContext.User.Identity.IsAuthenticated, moduleId))); }
static void init() { hub = new DatabaseHub(); resourcesList = Resources.Load <ResourcesList>(ScriptableObjectConstant.resourceListPath); enemyDatabaseWindow = new EnemyDatabaseWindow(); enemyDatabaseWindow.initDB(resourcesList); abilityDatabaseWindow = new AbilityDatabaseWindow(); abilityDatabaseWindow.initDB(resourcesList); itemDatabaseWindow = new ItemDatabaseWindow(); itemDatabaseWindow.initDB(resourcesList); hub.minSize = new Vector2(300 * 3, 300); hub.Show(); }
public Task <long> DeviceDriver_SaveUpdate(DeviceDriverSaveUpdate obj) { return(DatabaseHub.ExecuteAsync( storedProcedureName: "[dbo].[sp_SaveUpdate_DeviceDriver]", model: obj, dbName: AMSDB)); //Database name defined in Base Class. }