public static async Task <HttpResponseMessage> GetAllAccountsRun(
            [HttpTrigger(AuthorizationLevel.Function, "GET", Route = @"GetAllAccounts/{asOfDate?}")] HttpRequestMessage req,
            string asOfDate,
            [Classification("Bank", "Account", "ALL", nameof(InterestAccruedToday))] Classification clsAllAccounts)
        {
            // Set the start time for how long it took to process the message
            DateTime startTime = DateTime.UtcNow;

            IEnumerable <string> allAccounts = await clsAllAccounts.GetAllInstanceKeys(null);

            System.Text.StringBuilder sbRet = new System.Text.StringBuilder();
            if (null != allAccounts)
            {
                foreach (string accountNumber in allAccounts)
                {
                    if (!(sbRet.Length == 0))
                    {
                        sbRet.Append(",");
                    }
                    sbRet.Append(accountNumber);
                }
            }

            return(req.CreateResponse <FunctionResponse>(System.Net.HttpStatusCode.OK,
                                                         FunctionResponse.CreateResponse(startTime,
                                                                                         false,
                                                                                         $"Account numbers: {sbRet.ToString()}  "),
                                                         FunctionResponse.MEDIA_TYPE));
        }
        public static async Task <IEnumerable <string> > ListAllBankAccounts(
            [ActivityTrigger] IDurableActivityContext listAccountsContext,
            [Classification("Bank", "Account", "ALL", @"")] Classification clsAllAccounts)
        {
            Nullable <DateTime> asOfDate = listAccountsContext.GetInput <Nullable <DateTime> >();

            return(await clsAllAccounts.GetAllInstanceKeys(asOfDate));
        }
Esempio n. 3
0
        public static async Task AccrueInterestFoAllAccountsTimer(
            [TimerTrigger("0 30 1 * * *",
                          RunOnStartup = false,
                          UseMonitor = true)] TimerInfo accrueInterestTimer,
            [DurableClient] IDurableOrchestrationClient accrueInterestOrchestration,
            [Classification("Bank", "Account", "ALL", @"")] Classification clsAllAccounts
            )
        {
            // Get all the account numbers
            IEnumerable <string> allAccounts = await clsAllAccounts.GetAllInstanceKeys();

            await accrueInterestOrchestration.StartNewAsync(nameof(AccrueInterestForAllAccounts), allAccounts);
        }
Esempio n. 4
0
        public static async Task ApplyInterestForAllAccountsTrigger(
            [HttpTrigger(AuthorizationLevel.Function, "POST", Route = @"ApplyInterestForAllAccounts")] HttpRequestMessage req,
            [DurableClient] IDurableOrchestrationClient accrueInterestOrchestration,
            [Classification("Bank", "Account", "ALL", @"")] Classification clsAllAccounts)
        {
            // Get all the account numbers
            IEnumerable <string> allAccounts = await req.Content.ReadAsAsync <IEnumerable <string> >();

            if ((null == allAccounts) || (allAccounts.Count() == 0))
            {
                // If no account list passed it, get all the accounts
                allAccounts = await clsAllAccounts.GetAllInstanceKeys();
            }

            await accrueInterestOrchestration.StartNewAsync(nameof(ApplyInterestForAllAccounts), allAccounts);
        }