private void AnalyzeDesires() { var allDesires = _desiresAccess.GetByDesireStatusId(1); foreach (var allDesire in allDesires) { if (allDesire.DesireCost < NightCore.CurrentBalance) { var newNot = new Notifications { NotId = _notAccess.All().Count() + 1, NotCode = StringManipulation.GenerateCode(allDesire.DesireName), NotStatus = "UnRead", LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now), NotDate = StringManipulation.GetStringFromDate(DateTime.Now), NotTitle = allDesire.DesireName + " desire can be satisfied.", NotText = "Oh how we love gratification. Our instant gratification mojo tells us that the desire "+ allDesire.DesireName+" can be satisfied." }; _notAccess.Insert(newNot); } } }
public void Update(Notifications model) { Execute(SqlUpdateCommand, model); }
public void Insert(Notifications model) { Execute(SqlInsertCommand, model); }
private void AnalyzeExpediture() { var allex= new List<Expediture>(); var allexcats= new List<ExpenseByCategory>(); allex = _expeditureAccess.GetByMonth(StringManipulation.MonthFilter(StringManipulation.CurrentMonth())); _transCruncher.CrunchExpenses(allex,allexcats); foreach (var expenseByCategory in allexcats) { if (expenseByCategory.Amount>= 0.2*NightCore.TotalIncome) { var newNot = new Notifications { NotId = _notAccess.All().Count() + 1, NotCode = StringManipulation.GenerateCode(expenseByCategory.Category), NotStatus = "UnRead", LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now), NotDate = StringManipulation.GetStringFromDate(DateTime.Now), NotTitle = "You need to watch...", NotText = "your expediture in "+expenseByCategory.Category+" category because it is currently more than 20% on your total income." }; _notAccess.Insert(newNot); } if(expenseByCategory.Amount >= 0.5 * NightCore.TotalIncome) { var newNot = new Notifications { NotId = _notAccess.All().Count() + 1, NotCode = StringManipulation.GenerateCode(expenseByCategory.Category), NotStatus = "UnRead", LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now), NotDate = StringManipulation.GetStringFromDate(DateTime.Now), NotTitle = expenseByCategory.Category + " is shooting the moon..", NotText = "your spending in " + expenseByCategory.Category + " is more than half of your humble income. You must find ways to cut it down if you are to survive this "+ StringManipulation.GetMonthAbrv(DateTime.Now) }; _notAccess.Insert(newNot); } } }
private void ExpeditureNotifications() { _ctt.Clear(); if (IsBeyondMeans()) { var newNot = new Notifications { NotId = _notAccess.All().Count() + 1, NotCode = StringManipulation.GenerateCode("Beyond Means"), NotStatus = "UnRead", LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now), NotDate = StringManipulation.GetStringFromDate(DateTime.Now), NotTitle = "Expediture is more than income", NotText = "Ahoy mate, you might be living beyond your means. You need to reduce your speding so you can grow your accounts" }; _notAccess.Insert(newNot); } else if(IsTenDeep()) { var newNot = new Notifications { NotId = _notAccess.All().Count() + 1, NotCode = StringManipulation.GenerateCode("Ten Deep"), NotStatus = "UnRead", LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now), NotDate = StringManipulation.GetStringFromDate(DateTime.Now), NotTitle = "90% and encroaching", NotText = "You have managed to spend over 90% of your income in the past couple of days(Wow!). Our mojo recommends you save that 10% left for a rainny day." }; _notAccess.Insert(newNot); } else if (IsTwentyDeep()) { var newNot = new Notifications { NotId = _notAccess.All().Count() + 1, NotCode = StringManipulation.GenerateCode("Twenty Deep"), NotStatus = "UnRead", LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now), NotDate = StringManipulation.GetStringFromDate(DateTime.Now), NotTitle = "80% and encroaching", NotText = "You have managed to spend over 80% of your income in the past couple of days(Wow!). Our mojo recommends you save that 20% left for a rainny day." }; _notAccess.Insert(newNot); } else if (IsFiftyDeep()) { var newNot = new Notifications { NotId = _notAccess.All().Count() + 1, NotCode = StringManipulation.GenerateCode("Fifty Deep"), NotStatus = "UnRead", LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now), NotDate = StringManipulation.GetStringFromDate(DateTime.Now), NotTitle = "I see you love deep seas.. ", NotText = "Your expediture is currently above half your income. It might be time to slightly lift your foot off that expediture pedal, you know..." }; _notAccess.Insert(newNot); } else { var newNot = new Notifications { NotId = _notAccess.All().Count() + 1, NotCode = StringManipulation.GenerateCode("Sweet"), NotStatus = "UnRead", LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now), NotDate = StringManipulation.GetStringFromDate(DateTime.Now), NotTitle = "Money Management Medal for you", NotText = "Our mojo tells us that your spending habits are better than 75% of your friends. Pat yourself on the shoulder mate." }; _notAccess.Insert(newNot); } if (!IsSetTargets()) { var newNot = new Notifications { NotId = _notAccess.All().Count() + 1, NotCode = StringManipulation.GenerateCode("Targets"), NotStatus = "UnRead", LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now), NotDate = StringManipulation.GetStringFromDate(DateTime.Now), NotTitle = "Set financial goals", NotText = "We have noticed you have not set any targets. We can really help you keep track of your financial goals. Go set some now!" }; _notAccess.Insert(newNot); } if (!IsSetDesires()) { var newNot = new Notifications { NotId = _notAccess.All().Count() + 1, NotCode = StringManipulation.GenerateCode("Desires"), NotStatus = "UnRead", LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now), NotDate = StringManipulation.GetStringFromDate(DateTime.Now), NotTitle = "Never heard of window shopping?", NotText = "Use desires to keep track of the things you want and you don't have, yet. We'll even tell you when you can have them, sweet right? Go add some now!" }; _notAccess.Insert(newNot); } else { AnalyzeDesires(); } AnalyzeExpediture(); var cc = _notAccess.GetByNotStatus("UnRead"); foreach (var notificationse in cc) { _ctt.Add(notificationse); } UnreadNotifications.ItemsSource = _ctt; }