public async Task LoadLoggedClient() { // check kung may session na ung logged client. // pag wala, i-load natin then saka idisplay ung nav head details if (CacheProvider.IsSet(CacheKey.LoggedClient)) { loggedClient = CacheProvider.Get <Client>(CacheKey.LoggedClient); return; } cliSession = SessionFactory.ReadSession <ClientSession>(SessionKeys.LoggedClient); // may client session na, so kunin nalang natin ung info nya. if (cliSession != null && cliSession.IsSet) { loggedClient = await cliService.GetClientByUsername(cliSession.Username); } // i-load muna ung client session from account session ClientSessionLoader cliLoader = new ClientSessionLoader(cliService); bool isLoaded = await cliLoader.LoadClientSession(); if (isLoaded) { loggedClient = cliLoader.LoadedClient; CacheProvider.Set(CacheKey.LoggedClient, loggedClient); } }
public async Task <bool> LoadLoggedClient() { ClientSession cliSession = SessionFactory.ReadSession <ClientSession>(SessionKeys.LoggedClient); // may client session na, so kunin nalang natin ung info nya. if (cliSession != null && cliSession.IsSet) { client = await cliService.GetClientByUsername(cliSession.Username); } // i-load muna ung client session from account session ClientSessionLoader cliLoader = new ClientSessionLoader(cliService); bool isLoaded = await cliLoader.LoadClientSession(); if (!isLoaded) { return(false); } client = cliLoader.LoadedClient; CacheProvider.Set(CacheKey.LoggedClient, client); return(true); }