Beispiel #1
0
        public static List <Income> GetAllIncomes(FinancialSummary financialSummary, ExpenseTrackerContext _context)
        {
            var currentMonthFinancialObj = _context.Incomes.Where(b => b.Date.Month == financialSummary.Date.Month && b.Date.Year == financialSummary.Date.Year && b.ProfileNo == financialSummary.ProfileNo);

            return(currentMonthFinancialObj.ToList());
            //throw new NotImplementedException();
        }
Beispiel #2
0
 public FinancialController(ExpenseTrackerContext context)
 {
     try
     {
         financialSummaryBL = new FinancialSummaryBL(context);
     }
     catch (Exception e)
     {
         Console.WriteLine("Exception in getting Context object", e);
     }
 }
 public UserController(ExpenseTrackerContext context)
 {
     _context = context;
     if (_context.Users.Count() == 0)
     {
         _context.Users.AddRange(new User {
             UserName = "******", Password = "******"
         });                                                                          //Set UserName and password startup
         _context.SaveChanges();
     }
 }
Beispiel #4
0
 public ExpenseController(ExpenseTrackerContext context)
 {
     try
     {
         expenseBL = new ExpenseBL(context);
     }
     catch (Exception e)
     {
         Console.WriteLine("Exception in getting Context object", e);
     }
 }
 public IncomeSourceController(ExpenseTrackerContext context)
 {
     try
     {
         incomeSourceBL = new IncomeSourceBL(context);
         incomeSourceBL.AddIncomeSources();
     }
     catch (Exception e)
     {
         Console.WriteLine("Exception in getting Context object", e);
     }
 }
Beispiel #6
0
 public CategoryController(ExpenseTrackerContext context)
 {
     try
     {
         catBL = new CategoryBL(context);
         catBL.AddCategories();
     }
     catch (Exception e)
     {
         Console.WriteLine("Exception in getting Context object", e);
     }
 }
 public CurrencyController(ExpenseTrackerContext context)
 {
     try
     {
         currencyBL = new CurrencyBL(context);
         currencyBL.AddCurrency();
     }
     catch (Exception e)
     {
         Console.WriteLine("Exception in getting Context object", e);
     }
 }
Beispiel #8
0
 public PaymentController(ExpenseTrackerContext context)
 {
     try
     {
         paymentBL = new PaymentBL(context);
         paymentBL.AddPayments();
     }
     catch (Exception e)
     {
         Console.WriteLine("Exception in getting Context object", e);
     }
 }
        public ExpenseTrackerEFRepository(ExpenseTrackerContext ctx)
        {
            _ctx = ctx;

            // Disable lazy loading - if not, related properties are auto-loaded when
            // they are accessed for the first time, which means they'll be included when
            // we serialize (b/c the serialization process accesses those properties).
            //
            // We don't want that, so we turn it off.  We want to eagerly load them (using Include)
            // manually.

            _ctx.Configuration.LazyLoadingEnabled = false;
        }
Beispiel #10
0
 public FinancialSummaryBL(ExpenseTrackerContext context)
 {
     _context = context;
 }
 public IncomeSourceBL(ExpenseTrackerContext context)
 {
     _context = context;
 }
Beispiel #12
0
 public CostDao(ExpenseTrackerContext context)
 {
     _context = context;
 }
Beispiel #13
0
 public BaseRepository(ExpenseTrackerContext context)
 {
     _context = context;
 }
 public PaymentOperations()
 {
     context = new ExpenseTrackerContext();
 }
Beispiel #15
0
 public CurrencyBL(ExpenseTrackerContext context)
 {
     _context = context;
 }
Beispiel #16
0
 public NameDao(ExpenseTrackerContext context)
 {
     _context = context;
 }
 public PaymentBL(ExpenseTrackerContext context)
 {
     _context = context;
 }
 public ExpenseBL(ExpenseTrackerContext context)
 {
     _context = context;
 }
Beispiel #19
0
        public static FinancialSummary GetfinancialSummary(FinancialSummary financialSummary, ExpenseTrackerContext _context)
        {
            FinancialSummary financialSummaryObj = null;
            decimal          currentMonthexpense = 0;

            try
            {
                //find current month total incomes and total budget
                var     currentMonthFinancialObj = _context.Incomes.Where(b => b.Date.Month == financialSummary.Date.Month && b.Date.Year == financialSummary.Date.Year && b.ProfileNo == financialSummary.ProfileNo);
                decimal currentMonthIncome       = currentMonthFinancialObj.Sum(d => d.Amount);
                decimal currentMonthBudget       = currentMonthFinancialObj.Sum(d => d.Budget);

                var currentMonthExpenseObj = _context.Expenses.Where(b => b.ExpenseDate.Month == financialSummary.Date.Month && b.ExpenseDate.Year == financialSummary.Date.Year && b.ProfileNo == financialSummary.ProfileNo);
                currentMonthexpense = currentMonthExpenseObj.Sum(d => d.Amount);

                //
                var     incomesObj   = _context.Incomes.Where(b => b.Date.Month <= financialSummary.Date.Month && b.Date.Year <= financialSummary.Date.Year && b.ProfileNo == financialSummary.ProfileNo);
                var     expenseObj   = _context.Expenses.Where(b => b.ExpenseDate.Month < financialSummary.Date.Month && b.ExpenseDate.Year <= financialSummary.Date.Year && b.ProfileNo == financialSummary.ProfileNo);
                decimal totalIncome  = 0;
                decimal totalExpense = 0;
                decimal totalSavings = 0;
                if (incomesObj != null)
                {
                    totalIncome = incomesObj.Sum(d => d.Amount);
                }
                if (expenseObj != null)
                {
                    totalExpense = expenseObj.Sum(d => d.Amount);
                }
                totalSavings               = (totalIncome - totalExpense) - currentMonthBudget;
                financialSummaryObj        = new FinancialSummary();
                financialSummaryObj.Income = currentMonthIncome;
                if (currentMonthexpense >= currentMonthBudget)
                {
                    financialSummaryObj.Budget  = 0;
                    financialSummaryObj.Savings = totalSavings - (currentMonthexpense - currentMonthBudget);
                }
                else
                {
                    financialSummaryObj.Budget  = currentMonthBudget - currentMonthexpense;
                    financialSummaryObj.Savings = totalSavings;
                }
                //Financial Health
                GetFinancialHealth(financialSummaryObj, currentMonthexpense, currentMonthBudget);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception in getting financial summary", e);
            }
            return(financialSummaryObj);
        }
Beispiel #20
0
 public CategoryBL(ExpenseTrackerContext context)
 {
     _context = context;
 }
 public ExpenseAnalyzer()
 {
     _context = new ExpenseTrackerContext();
 }
Beispiel #22
0
 public DescriptionDao(ExpenseTrackerContext context)
 {
     _context = context;
 }
Beispiel #23
0
 public ExpenseController(ILogger <ExpenseController> logger, ExpenseTrackerContext ctx)
 {
     this.logger = logger;
     this.ctx    = ctx;
 }
Beispiel #24
0
 public ExpenseItemsController(ExpenseTrackerContext context, ILogger <ExpenseItemsController> logger)
 {
     _context = context;
     _logger  = logger;
 }
 public ExpenseService(ExpenseTrackerContext context, ILogger <ExpenseService> logger)
 {
     _context = context;
     _logger  = logger;
 }
 public ExpenseMasterOperations()
 {
     context = new ExpenseTrackerContext();
 }
Beispiel #27
0
 public StatsDataCollector()
 {
     _context = new ExpenseTrackerContext();
 }