Esempio n. 1
0
        public QueryResult <MasterDataSummaryBO> Get([FromQuery] QueryParameter requestParameter)
        {
            var personId = p_AppSession.PersonID;

            var query = TasqR.Run(new GetMasterDataQr(p_AppSession.PlanYear, personId));

            return(query);
        }
Esempio n. 2
0
        public IProcessTrackerBase Calculate(CalculateParameter parameter)
        {
            parameter["PersonId"] = p_AppSession.PersonID?.ToString();

            var cmd = new MasterProcessCmd(MainConstants.Job.MainCalc, parameter);

            return(TasqR.Run(cmd));
        }
Esempio n. 3
0
        public QueryResult <PayRunBO> Get([FromQuery] QueryParameter requestParameter)
        {
            short planYear = requestParameter.GetFromFilter <short>("PlanYear");

            var query = TasqR.Run(new GetPayRunQr(planYear));

            return(query);
        }
Esempio n. 4
0
        public void CanRunWithKeyBaseType()
        {
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <CommandWithKeyHandler>();

            var tasqR    = new TasqR(handlerResolver);
            var instance = Activator.CreateInstance(typeof(CommandWithKey));

            tasqR.Run((ITasq <int, bool>)instance);

            Assert.IsTrue(((CommandWithKey)instance).AllAreCorrect);
        }
Esempio n. 5
0
        public void CanRunWithKey()
        {
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <CommandWithKeyHandler>();

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

            tasqR.Run(cmd);

            Assert.IsTrue(cmd.AllAreCorrect);
        }
Esempio n. 6
0
        public void CanRunWithReturnForAsyncHandler()
        {
            int startNumber     = 8;
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <TestCmdWithReturnForAsyncHandler>();

            var tasqR = new TasqR(handlerResolver);
            var cmd   = new TestCmdWithReturnForAsync(startNumber);

            int finalNumber = tasqR.Run(cmd);

            Assert.AreEqual(9, finalNumber);
        }
Esempio n. 7
0
        public void CanRunWithReturn()
        {
            int startNumber     = 8;
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <SampleCommandWithReturnHandler>();

            var tasqR = new TasqR(handlerResolver);
            var cmd   = new SampleCommandWithReturn(startNumber);

            int finalNumber = tasqR.Run(cmd);

            Assert.AreEqual(9, finalNumber);
        }
Esempio n. 8
0
        public void CanRunWithKeyForAsyncHandlerBaseType()
        {
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <CommandWithKeyAsyncHandler>();

            var tasqR    = new TasqR(handlerResolver);
            var instance = (ITasq)Activator.CreateInstance(typeof(CommandWithKeyAsync));


            tasqR.Run(instance);

            Assert.IsTrue(true);
        }
        public bool Save([FromBody] string token)
        {
            try
            {
                TasqR.Run(new SaveFirebaseTokenCmd(token));

                return(true);
            }
            catch (Exception ex)
            {
                p_Logger.LogError(ex);

                return(false);
            }
        }
Esempio n. 10
0
        public void CanRunWithoutReturnForAsyncHandler()
        {
            var testModel = new Test3Model {
                StartNumber = 10
            };
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <CommandWithAsyncWithoutReturnHandler>();

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

            tasqR.Run(cmd);

            Assert.AreEqual(11, testModel.StartNumber);
        }
Esempio n. 11
0
        public void CanRunWithoutReturn()
        {
            var testModel = new TestModel {
                SampleNumber = 10
            };
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <SampleCommandWithoutReturnHandler>();

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

            tasqR.Run(cmd);

            Assert.AreEqual(11, testModel.SampleNumber);
        }
Esempio n. 12
0
        public void CanThrowExceptionIfNoHandlerRegistered()
        {
            try
            {
                var handlerResolver = new TasqHandlerResolver();

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

                tasqR.Run(cmd);
            }
            catch (Exception ex)
            {
                Assert.AreEqual("Type CommandWithKey not registered", ex.Message);

                throw;
            }
        }
Esempio n. 13
0
        public void CannotRunDefaultCmdWithHandlerWithNoParamlessConstructor()
        {
            try
            {
                var handlerResolver = new TasqHandlerResolver();

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

                var cmd = new CmdHandlerWithNoParamlessCtor();
                tasqR.Run(cmd);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.Message.StartsWith("No parameterless constructor defined for type"));

                throw;
            }
        }
Esempio n. 14
0
        public void CanRunWithKeyForAsyncHandler()
        {
            var handlerResolver = new TasqHandlerResolver();

            handlerResolver.Register <CommandWithKeyAsyncHandler>();

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

            bool allAreTrue = true;

            foreach (var item in tasqR.Run(cmd))
            {
                if (!item)
                {
                    allAreTrue = false;
                }
            }

            Assert.IsTrue(allAreTrue);
        }
Esempio n. 15
0
        public IProcessTrackerBase ImportPerson(ImportPersonParameter parameter)
        {
            var cmd = new MasterProcessCmd(MainConstants.Job.ImportPerson, parameter);

            return(TasqR.Run(cmd));
        }
Esempio n. 16
0
 public QueryResult <PlanYearBO> Get([FromQuery] QueryParameter requestParameter)
 {
     return(TasqR.Run(new GetPlanYearQr(requestParameter)));
 }