コード例 #1
0
ファイル: TasqRAsyncTesting.cs プロジェクト: mgdagpin/TasqR
        public async Task CanRunWithKey()
        {
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <CommandWithKeyAsyncHandler>();

            var tasqR = new TasqR(handlerResolver);
            var cmd   = new CommandWithKeyAsync();

            int initialCount = cmd.Keys.Count;

            bool allAreTrue = true;
            int  callCount  = 0;

            var result = await tasqR.RunAsync(cmd);

            foreach (var item in result)
            {
                callCount++;
                if (!item)
                {
                    allAreTrue = false;
                }
            }

            Assert.AreEqual(initialCount, callCount);
            Assert.IsTrue(allAreTrue);
        }
コード例 #2
0
ファイル: PayrollRuns.razor.cs プロジェクト: vgdagpin/Aerish
        protected async override Task OnInitializedAsync()
        {
            var planYearResponse = await TasqR.RunAsync(new GetPlanYearQr());

            PlanYearData = planYearResponse.Data;

            CanCalculate = await DataService.GetAsync <bool>(AerishAdminConstants.Uri.MasterData + "/CanCalculate");
        }
コード例 #3
0
ファイル: EmployeeController.cs プロジェクト: vgdagpin/Aerish
        public async Task <QueryResult <EmployeeSummaryBO> > Search([FromQuery] QueryParameter requestParameter, CancellationToken cancellationToken = default)
        {
            var result = await TasqR.RunAsync(new GetEmployeesQr(requestParameter.Filter.Value, DataResultType.Summary), cancellationToken);

            return(new QueryResult <EmployeeSummaryBO>
            {
                Count = result.Count,
                Data = result.Data
            });
        }
コード例 #4
0
        public async Task <NodeItemSetBO> Get
        (
            int?employeeId    = null,
            string filter     = null,
            string currentUri = null
        )
        {
            var navigations = await TasqR.RunAsync(new GetNavigationQr(employeeId, filter, currentUri));

            return(navigations);
        }
コード例 #5
0
ファイル: TasqRAsyncTesting.cs プロジェクト: mgdagpin/TasqR
        public async Task CanRunWithReturn()
        {
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <TestCmdWithReturnForAsyncHandler>();
            var tasqR = new TasqR(handlerResolver);
            var cmd   = new TestCmdWithReturnForAsync(2);

            var result = await tasqR.RunAsync(cmd);

            Assert.AreEqual(3, result);
        }
コード例 #6
0
        public Task <TokenVerificationResult> VerifyValidity([FromBody] string firebaseToken)
        {
            return(Task.FromResult(new TokenVerificationResult
            {
                TokenStatus = TokenStatus.Active
            }));

            string authorization = Request.Headers["Authorization"];
            string token         = authorization?.Split(' ').LastOrDefault();

            var tokenMgr  = (JwtSignInManager)p_SignInManager;
            var sessionID = tokenMgr.ExtractSessionIDFromToken(token);

            return(TasqR.RunAsync(new VerifyTokenValidityCmd(sessionID.GetValueOrDefault())));
        }
コード例 #7
0
ファイル: TasqRAsyncTesting.cs プロジェクト: mgdagpin/TasqR
        public async Task CanRunWithoutReturn()
        {
            var testModel = new Test3Model {
                StartNumber = 10
            };
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <CommandWithAsyncWithoutReturnHandler>();

            var tasqR = new TasqR(handlerResolver);
            var cmd   = new CommandWithAsyncWithoutReturn(testModel);

            await tasqR.RunAsync(cmd);

            Assert.AreEqual(11, testModel.StartNumber);
        }
コード例 #8
0
        public async Task WillThrowExceptionFromAsyncHandler()
        {
            try
            {
                var handlerResolver = new TasqHandlerResolver();

                handlerResolver.Register <TestWithErrorCmdHandler>();
                var tasqR = new TasqR(handlerResolver);

                var cmd = new TestWithErrorCmd();
                await tasqR.RunAsync(cmd);
            }
            catch (AggregateException ex)
            {
                throw ex.GetBaseException();
            }
        }
コード例 #9
0
ファイル: TasqRAsyncTesting.cs プロジェクト: mgdagpin/TasqR
        public async Task CanRunWithKeyBaseType()
        {
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <CommandWithKeyAsyncHandler>();

            var tasqR    = new TasqR(handlerResolver);
            var instance = (ITasq <int, bool>)Activator.CreateInstance(typeof(CommandWithKeyAsync));

            bool allAreTrue = true;

            foreach (var item in await tasqR.RunAsync(instance))
            {
                if (!item)
                {
                    allAreTrue = false;
                }
            }

            Assert.IsTrue(allAreTrue);
        }
コード例 #10
0
ファイル: NavMenu.razor.cs プロジェクト: vgdagpin/Aerish
        public async Task LoadNavigations(int?employeeId = null, string search = null)
        {
            string navUri = navigationManager.ToBaseRelativePath(navigationManager.Uri);

            var result = await TasqR.RunAsync(new GetNavigationQr(employeeId, search, navUri));

            FlatData.Clear();

            foreach (var item in result.Nodes)
            {
                FlatData.Add(item);
            }

            if (result.SelectedNode != null)
            {
                SelectedNavigations = new List <object>()
                {
                    result.SelectedNode
                };
            }
        }
コード例 #11
0
ファイル: PayrollRuns.razor.cs プロジェクト: vgdagpin/Aerish
        protected async Task OnWindowCalculatePayRun()
        {
            WindowVisible = false;
            CanCalculate  = false;

            var calcParam = new CalculateParameter
            {
                PayRunID = NewCalcPayRun.PayRunID.GetValueOrDefault(),
                PlanYear = NewCalcPayRun.PlanYear.GetValueOrDefault(),
                PersonID = await AppSession.GetEmployeeID()
            };

            var cmd    = new MasterProcessCmd(MainConstants.Job.MainCalc, calcParam);
            var result = await TasqR.RunAsync(cmd);


            //var calcParam = new CalculateParameterVM
            //{
            //    PayRunID = NewCalcPayRun.PayRunID,
            //    PlanYear = NewCalcPayRun.PlanYear,
            //    PersonID = await AppSession.GetEmployeeID()
            //};

            //var result = await DataService.PostAsync<ProcessTrackerVM, CalculateParameterVM>
            //    (
            //        AerishAdminConstants.Uri.CalculateMasterData,
            //        calcParam
            //    );

            CanCalculate  = true;
            NewCalcPayRun = new PayRunVM();
            PayRunData    = null;
            lastPlanYear  = null;

            await OnReload();
        }
コード例 #12
0
 public async Task <IEnumerable <BillSummaryBO> > Get(CancellationToken cancellationToken = default)
 {
     return(await TasqR.RunAsync(new GetBillsQr(), cancellationToken));
 }
コード例 #13
0
 public Task <TextTemplateVM> Get(string code, CancellationToken cancellationToken = default)
 {
     return(TasqR.RunAsync(new FindTextTemplateQr(code), cancellationToken));
 }
コード例 #14
0
 public Task <CreateResult <TrackBillBO> > Create(TrackBillBO newEntry, CancellationToken cancellationToken = default)
 {
     return(TasqR.RunAsync(new CreateTrackBillCmd(newEntry, true), cancellationToken));
 }
コード例 #15
0
 public Task <BillPaymentStepsTemplateVM> FindBillTemplate(int billTemplateID, CancellationToken cancellationToken = default)
 {
     return(TasqR.RunAsync(new FindBillPaymentStepsTemplateQr(billTemplateID), cancellationToken));
 }
コード例 #16
0
 public Task <TrackBillBO> Get(Guid id)
 {
     return(TasqR.RunAsync(new FindTrackBillQr(id)));
 }
コード例 #17
0
 public Task <IEnumerable <BillPaymentStepsTemplateSummaryVM> > Search(short billID, string query, CancellationToken cancellationToken = default)
 {
     return(TasqR.RunAsync(new GetBillPaymentStepsTemplatesQr(billID, query), cancellationToken));
 }
コード例 #18
0
 public Task Delete(Guid id, CancellationToken cancellationToken = default)
 {
     return(TasqR.RunAsync(new DeleteTrackBillCmd(id), cancellationToken));
 }
コード例 #19
0
        public Task <long> ParsePost(CancellationToken cancellationToken = default)
        {
            var parameters = new List <MailPart>();

            p_Logger.LogInformation("Header Count: {0}", Request.Headers.Count);
            foreach (var header in Request.Headers)
            {
                parameters.Add(new MailPart
                {
                    PartType = MailPartType.Header,
                    Key      = header.Key,
                    Value    = new Dictionary <string, object>
                    {
                        { "Value", header.Value }
                    }
                });
            }


            p_Logger.LogInformation("Form Count: {0}", Request.Form.Count);
            foreach (var formItem in Request.Form)
            {
                parameters.Add(new MailPart
                {
                    PartType = MailPartType.Form,
                    Key      = formItem.Key,
                    Value    = new Dictionary <string, object>
                    {
                        { "Value", formItem.Value }
                    }
                });
            }

            p_Logger.LogInformation("Files Count: {0}", Request.Form.Files.Count);
            foreach (IFormFile file in Request.Form.Files)
            {
                if (file.Length == 0)
                {
                    continue;
                }

                using (var ms = new MemoryStream())
                {
                    file.CopyTo(ms);
                    var fileBytes = ms.ToArray();

                    parameters.Add(new MailPart
                    {
                        PartType = MailPartType.Attachment,
                        Key      = file.FileName,
                        Value    = new Dictionary <string, object>
                        {
                            { "Content-Type", file.ContentType },
                            { "Length", file.Length },
                            { "ContentDisposition", file.ContentDisposition },
                            { "Content", fileBytes }
                        }
                    });
                }
            }

            p_Logger.LogInformation("Mail Parse - POST");

            return(TasqR.RunAsync(new SaveMailCmd(parameters), cancellationToken));
        }
コード例 #20
0
 public Task <UserBillBO> Get(Guid id)
 {
     return(TasqR.RunAsync(new FindUserBillQr(id)));
 }
コード例 #21
0
 public Task <IEnumerable <UserBillSummaryBO> > Get(int forecastDays = 30)
 {
     return(TasqR.RunAsync(new GetUserBillsQr(AppUser.UserID, forecastDays)));
 }
コード例 #22
0
 public Task <UserBO> Get()
 {
     return(TasqR.RunAsync(new GetUserDetailQr(AppUser.UserID)));
 }
コード例 #23
0
 public Task <MarkPaidResult> MarkBillAsPaid(Guid id)
 {
     return(TasqR.RunAsync(new MarkUserBillAsPaidCmd(id)));
 }
コード例 #24
0
 public Task <IEnumerable <TrackBillSummaryBO> > Get()
 {
     return(TasqR.RunAsync(new GetTrackBillsQr(AppUser.UserID)));
 }