//public ImageSource ListImage { get; set; } public ItemsViewModel(int add_month = 0) { Title = "収入管理"; if (Now.Year < 2000) { Now = DateTime.Now; } DateTime target_date = Now.AddMonths(add_month); Now = Now.AddMonths(add_month); //ListImage = ImageSource.FromResource("Eri.Imeges.pig.png"); Items = new ObservableCollection <IncomeDetail>(); LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand(target_date)); MessagingCenter.Subscribe <NewItemPage, IncomeDetail>(this, "AddItem", async(obj, item) => { var newItem = item as IncomeDetail; Items.Add(newItem); //await DataStore.AddItemAsync(newItem); }); }
private JwtSecurityToken GetJwtSecurityToken(User dbUser) { return(JwtSecurityTokenFactory.GetToken( _config.Value.Issuer, _config.Value.Audience, dbUser.Id.ToString(), dbUser.Roles.Select(role => role.Type), Now.AddMonths(_config.Value.JwtExpirationInMonths), _config.Value.JwtSecretKey, HmacSha256 )); }
//Expire the members public void MemExpire() { //Declarations DateTime JDate, iDate, Now; string MemID, Mtype; int MTi, x = 0; Now = DateTime.Today; //Read Each members string sqlMem = string.Format("SELECT MemberID, MType, DateJoined FROM Member WHERE MStatus = 'Valid'"); OleDbCommand cmdMem = new OleDbCommand(sqlMem, db.con); if (db.con.State.Equals(ConnectionState.Closed)) { db.con.Open(); } OleDbDataReader drMem = cmdMem.ExecuteReader(); //For each member while (drMem.Read()) { //Declare MemID = drMem["MemberID"].ToString(); Mtype = drMem["MType"].ToString(); JDate = DateTime.Parse(drMem["DateJoined"].ToString()); //Set Member Type index //Get the date, a member of such type should have joined, if his membership to be expired today. if (Mtype == "Adult") { MTi = 0; } else { MTi = 1; } iDate = Now.AddMonths(-set.Expire[MTi]); //Compare dates int i = DateTime.Compare(JDate, iDate); // if in past, if (i < 0) { string sqlUMem = string.Format("UPDATE Member SET MStatus = 'Expired' WHERE MemberID = '{0}'", MemID); OleDbCommand cmdUMem = new OleDbCommand(sqlUMem, db.con); if (db.con.State.Equals(ConnectionState.Closed)) { db.con.Open(); } cmdUMem.ExecuteNonQuery(); x++; } } if (db.con.State.Equals(ConnectionState.Open)) { db.con.Close(); } }
} // GatherAvailableFunds /// <summary> /// Collects customer data from DB. Can be overridden to provide /// specific customer data instead of the current one. /// </summary> protected virtual void GatherData() { this.caisAccounts.Clear(); Cfg.Load(); DB.ForEachRowSafe( ProcessRow, "LoadAutoApprovalData", CommandSpecies.StoredProcedure, new QueryParameter("CustomerID", Args.CustomerID), new QueryParameter("Now", Now) ); MetaData.NumOfDefaultAccounts = ExperianConsumerDataExt.FindNumOfPersonalDefaults( this.caisAccounts, Cfg.Reject_Defaults_Amount, Now.AddMonths(-1 * Cfg.Reject_Defaults_MonthsNum) ); OriginationTime.FromExperian(MetaData.IncorporationDate); GatherAvailableFunds(); Trail.MyInputData.FullInit( Now, Cfg, Args, MetaData, Payments, OriginationTime, Turnover, Funds, DirectorNames, HmrcBusinessNames ); MetaData.Validate(); } // GatherData
public MaterialProvider(MaterialLogger logger) { All = logger.Read().ToArray(); AsDays = MakeDiff(EachDay(All)).Reverse().ToArray(); DateTime firsttime = Now; if (All.Count > 0) { firsttime = All[0].DateTime; } Durations = new[] { new { TitleKey = "ChartTimeRange_Days1", From = Now.AddDays(-1) }, new { TitleKey = "ChartTimeRange_Weeks1", From = Now.AddDays(-7) }, new { TitleKey = "ChartTimeRange_Weeks2", From = Now.AddDays(-14) }, new { TitleKey = "ChartTimeRange_Months1", From = Now.AddMonths(-1) }, new { TitleKey = "ChartTimeRange_Months2", From = Now.AddMonths(-2) }, new { TitleKey = "ChartTimeRange_Months3", From = Now.AddMonths(-3) }, new { TitleKey = "ChartTimeRange_Months6", From = Now.AddMonths(-6) }, new { TitleKey = "ChartTimeRange_Years1", From = Now.AddYears(-1) }, new { TitleKey = "ChartTimeRange_All", From = firsttime } }; From = Now.AddDays(-14); }
public ExpireAccountFundsCommandHandlerTestsFixture() { Now = DateTime.UtcNow; NextMonth = Now.AddMonths(1); MessageHandlerContext = new Mock <IMessageHandlerContext>(); ExpectedAccountId = 112L; Command = new ExpireAccountFundsCommand { AccountId = ExpectedAccountId }; FundsIn = new List <LevyFundsIn> { new LevyFundsIn { CalendarPeriodYear = 2018, CalendarPeriodMonth = 07, FundsIn = 12000 }, new LevyFundsIn { CalendarPeriodYear = 2018, CalendarPeriodMonth = 08, FundsIn = 15000 } }; FundsOut = new List <PaymentFundsOut> { new PaymentFundsOut { CalendarPeriodYear = 2018, CalendarPeriodMonth = 09, FundsOut = 10000 }, new PaymentFundsOut { CalendarPeriodYear = 2018, CalendarPeriodMonth = 10, FundsOut = 10000 } }; ExistingExpiredFunds = new List <ExpiredFund> { new ExpiredFund { CalendarPeriodYear = 2018, CalendarPeriodMonth = 01, Amount = 2000 }, new ExpiredFund { CalendarPeriodYear = 2018, CalendarPeriodMonth = 02, Amount = 2000 } }; ExpiringFunds = new Dictionary <CalendarPeriod, decimal> { { new CalendarPeriod(2018, 03), 1000 }, { new CalendarPeriod(2018, 04), 1000 }, { new CalendarPeriod(2018, 05), 0 }, { new CalendarPeriod(NextMonth.Year, NextMonth.Month), 1000 } }; ExpiredFunds = new Dictionary <CalendarPeriod, decimal> { { new CalendarPeriod(2018, 03), 1000 }, { new CalendarPeriod(2018, 04), 1000 }, { new CalendarPeriod(2018, 05), 0 }, { new CalendarPeriod(Now.Year, Now.Month), 0 } }; MockCurrentDateTime = new Mock <ICurrentDateTime>(); FundsExpiryPeriod = 18; MockLevyFundsInRepository = new Mock <ILevyFundsInRepository>(); MockPaymentFundsOutRepository = new Mock <IPaymentFundsOutRepository>(); MockExpiredFunds = new Mock <IExpiredFunds>(); MockExpiredFundsRepository = new Mock <IExpiredFundsRepository>(); MockLogger = new Mock <ILog>(); EmployerFinanceConfiguration = new EmployerFinanceConfiguration { FundsExpiryPeriod = FundsExpiryPeriod }; MockCurrentDateTime.Setup(x => x.Now).Returns(Now); MockLevyFundsInRepository.Setup(x => x.GetLevyFundsIn(ExpectedAccountId)).ReturnsAsync(FundsIn); MockPaymentFundsOutRepository.Setup(x => x.GetPaymentFundsOut(ExpectedAccountId)).ReturnsAsync(FundsOut); MockExpiredFundsRepository.Setup(x => x.Get(ExpectedAccountId)).ReturnsAsync(ExistingExpiredFunds); MockExpiredFunds.Setup(x => x.GetExpiringFunds( It.Is <Dictionary <CalendarPeriod, decimal> >(fi => AreFundsInEqual(FundsIn, fi)), It.Is <Dictionary <CalendarPeriod, decimal> >(fo => AreFundsOutEqual(FundsOut, fo)), It.Is <Dictionary <CalendarPeriod, decimal> >(ex => AreExpiredFundsEqual(ExistingExpiredFunds, ex)), FundsExpiryPeriod)).Returns(ExpiringFunds); Handler = new ExpireAccountFundsCommandHandler(MockCurrentDateTime.Object, MockLevyFundsInRepository.Object, MockPaymentFundsOutRepository.Object, MockExpiredFunds.Object, MockExpiredFundsRepository.Object, MockLogger.Object, EmployerFinanceConfiguration); }