Exemple #1
0
        public async Task <int> SendExpiringCardsEmail()
        {
            RoomAccessExpirationCheck roomAccessExpirationCheck = new RoomAccessExpirationCheck();
            int count = await roomAccessExpirationCheck.Run();

            return(count);
        }
Exemple #2
0
        public async Task <DataFeedModel <ExpiringCard> > GetExpiringCards()
        {
            RoomAccessExpirationCheck check = new RoomAccessExpirationCheck();
            var dataFeed = await check.GetDataFeed();

            return(dataFeed);
        }
Exemple #3
0
        public async Task <bool> RunMonthlyTask(bool noEmail = false)
        {
            try
            {
                bool result = true;

                // This is run at midnight on the 1st of the month. So the period should be the 1st of the previous month.
                DateTime period = DateTime.Now.FirstOfMonth().AddMonths(-1);

                using (var bc = new BillingClient())
                {
                    // This sends apportionment emails to clients
                    await bc.SendUserApportionmentReport(new UserApportionmentReportOptions()
                    {
                        Period  = period,
                        NoEmail = noEmail
                    });

                    // 2008-04-30
                    // Monthly financial report
                    await bc.SendFinancialManagerReport(new FinancialManagerReportOptions()
                    {
                        Period         = period,
                        IncludeManager = !noEmail
                    });

                    // This sends room expiration emails
                    RoomAccessExpirationCheck roomAccessExpirationCheck = new RoomAccessExpirationCheck();
                    int count = await roomAccessExpirationCheck.Run();

                    ////2009-08-01 Populate the BillingTables

                    //first day of last month
                    DateTime sd = period;
                    DateTime ed = period.AddMonths(1);

                    BillingProcessResult bpr;

                    bpr = await bc.BillingProcessStep1(BillingCategory.Tool, sd, ed, 0, 0, false, true);

                    result = result && bpr.Success;

                    bpr = await bc.BillingProcessStep1(BillingCategory.Room, sd, ed, 0, 0, false, true);

                    result = result && bpr.Success;

                    bpr = await bc.BillingProcessStep1(BillingCategory.Store, sd, ed, 0, 0, false, true);

                    result = result && bpr.Success;

                    bpr = await bc.BillingProcessStep4("subsidy", sd, 0);

                    result = result && bpr.Success;
                }

                return(result);
            }
            catch (Exception ex)
            {
                string err = ex.Message;
                return(false);
            }
        }