public async override Task <BasicPayBO> RunAsync(GetBasicPayQr request, CancellationToken cancellationToken = default) { var payRun = await p_Processor.RunAsync(new FindPayRunQr(request.PlanYear, request.PayPeriodID)); var basicPays = await p_DbContext.BasicPays .AsNoTracking() .Include(a => a.N_PeriodStart) .Where(a => a.ClientID == p_AppSession.ClientID && a.EmployeeID == request.EmployeeID && a.Effectivity < payRun.PeriodStart) .ProjectTo <BasicPayBO>(p_Mapper.ConfigurationProvider) .OrderByDescending(a => a.Effectivity) .ToListAsync(); if (basicPays.Count == 0) { throw new AerishObjectNotFoundException <BasicPay>(new { p_AppSession.ClientID, request.EmployeeID }); } return(basicPays.FirstOrDefault()); }
public override Task InitializeAsync(CreateTrackBillCmd tasq, CancellationToken cancellationToken) { return(p_TasqR.RunAsync(new GetTokenCmd(p_AppUser.UserID)) .ContinueWith(result => { p_HttpClient = p_ClientFactory.LynxApiClient(result.Result); })); }
public override Task InitializeAsync(GetUserDetailQr request, CancellationToken cancellationToken) { return(p_TasqR.RunAsync(new GetTokenCmd(p_AppUser.UserID)) .ContinueWith(result => { p_HttpClient = p_ClientFactory.LynxApiClient(result.Result); })); }
public async Task <IActionResult> Register() { var register = new NewUserCmd("Gigi", null, "", Domain.Gender.Female); return(Ok(await tasq.RunAsync(register))); }
public async Task <UserSessionBO> SignInAsync(string username, string password) { var validate = await p_TasqR.RunAsync(new ValidateUserLoginCmd(username, password)); if (!validate.IsSuccess) { throw validate.Error; } var user = await p_TasqR.RunAsync(new GetUserDetailQr(username)); var userVm = p_Mapper.Map <UserBO>(user); Guid newSession = Guid.NewGuid(); //Random string var sessionToken = p_DataSecure.Protect(new byte[32]); var session = await p_TasqR.RunAsync(new CreateSessionCmd(sid : newSession, username : username, token : sessionToken, expiration : p_DateTime.Now.AddDays(30))); var tokenObject = TokenBuilder(session); tokenObject.SessionID = newSession; tokenObject.CreatedOn = session.CreatedOn; tokenObject.RefreshToken = session.Token; //The session token as refresh token in JWT tokenObject.UserData = userVm; tokenObject.Status = Enums.SessionStatus.Active; return(tokenObject); }
public async override Task RunAsync(LogoutSessionCmd request, CancellationToken cancellationToken = default) { Thread.Sleep(2000); var token = await p_TasqR.RunAsync(new GetTokenCmd(p_AppUser.UserID)); if (token != null) { var s = p_UserSessionDbSet.Find(token.SessionID); p_UserSessionDbSet.Remove(s); p_BaseDbContext.SaveChanges(); } }
public override Task <bool> RunAsync(ExpiringSessionCmd request, CancellationToken cancellationToken = default) { return(p_TasqR.RunAsync(new GetSessionFromTokenQr(request.Token)) .ContinueWith(a => { a.Result.ExpiredOn = p_DateTime.Now.AddHours(-1); return p_DbContextBase.SaveChangesAsync().ContinueWith(b => { return Task.FromResult(b.Result > 0); }) .Unwrap(); }) .Unwrap()); }
public async override Task <UserSessionBO> RunAsync(GetActiveUserSessionQr request, CancellationToken cancellationToken = default) { string firebaseToken = p_TasqR.Run(new FindMyFirebaseTokenQr()); var verifResult = await p_LynxAPI.PostAsync <TokenVerificationResult, string> ( "/AccessToken/VerifyValidity", firebaseToken, cancellationToken ); if (verifResult.ObjectContent.TokenStatus != TokenStatus.Active) { return(null); } var token = await p_TasqR.RunAsync(new GetTokenCmd(p_AppUser.UserID)); return(token); }
public async override Task InitializeAsync(FindTrackBillQr request, CancellationToken cancellationToken) { var token = await p_TasqR.RunAsync(new GetTokenCmd(p_AppUser.UserID)); p_HttpClient = p_ClientFactory.LynxApiClient(token); }