public MockBudgetDAL()
 {
     department = new Department();
     department.DepartmentId = 1;
     department.DepartmentName = "Test Department";
     department.MonthlyBudget = 10000;
 }
 public BudgetTracker(Department department)
 {
     budgetTrackerDAL = new BudgetTrackerDAL();
     budgetAmount = department.MonthlyBudget;
     //companyMonthlyBudget = GetCompanyMonthlyBudget();
     totalExpenseAmount = budgetTrackerDAL.TotalExpenseAmountByDept(department.DepartmentId);
 }
 public decimal? GetDepartmentMonthlySpendCommitted(int month, int year, Department department)
 {
     if (month == 1 && year == 2014 && department == this.department)
     {
         return 5500;
     }
     else
     {
         return 0;
     }
 }
        public void IntializeDepartmentService()
        {
            IBudgetDAL budgetDAL = new MockBudgetDAL();

            department = new Department();
            department.DepartmentId = 1;
            department.DepartmentName = "Test Department";
            department.MonthlyBudget = 10000;

            deptBudgetService = new DepartmentBudgetService(department,budgetDAL);
        }
        public void IntializeCompanyBudgetService()
        {
            IBudgetDAL budgetDAL = new MockBudgetDAL();

            department = new Department();
            department.DepartmentId = 1;
            department.DepartmentName = "Test Department";
            department.MonthlyBudget = 10000;

            companyBudgetService = new CompanyBudgetService(30000, budgetDAL);
        }
        public decimal? GetDepartmentMonthlySpendCommitted(int month, int year, Department department)
        {
            using (EMEntitiesContext ctx = new EMEntitiesContext())
            {
                decimal? total = 0;

                var reports = from expenseReports in ctx.ExpenseReports
                              where expenseReports.ProcessedDate.Value.Month == month && expenseReports.ProcessedDate.Value.Year == year
                                    && expenseReports.ProcessedById != null && department.DepartmentId == expenseReports.Department.DepartmentId
                                    && expenseReports.Status == "ApprovedByAccounts"  // John June 3
                              select expenseReports;

                foreach (var expenseItems in reports)
                {
                    foreach (var totalamount in expenseItems.ExpenseItems)
                    {
                        total = total + totalamount.AudAmount;
                    }
                }
                return total;
            }
        }
 public decimal? GetDepartmentBudgetRemain(int month, int year, Department department)
 {
     Budget deptBudget = new Budget(department.MonthlyBudget);
     deptBudget.Spent = budgetTrackerDAL.GetDepartmentMonthlySpendCommitted(month, year, department);
     return (deptBudget.RemainingBudget);
 }
 public decimal? TotalExpenseProcessByDepartment(int month, int year, Department department)
 {
     if (month == 1 && year == 2014 && department == this.department)
     {
         return 6500;
     }
     else
     {
         return 0;
     }
 }
 public decimal? GetDepartmentBudgetRemain(int month, int year, Department department)
 {
     Budget deptBudget = new Budget(department.MonthlyBudget);
     deptBudget.Spent = budgetTrackerDAL.TotalExpenseAmountByDept(department.DepartmentId);
     return (deptBudget.RemainingBudget);
 }
 public DepartmentBudgetService(Department department, IBudgetDAL budgetDal)
 {
     this.department = department;
     Budget = new Budget(department.MonthlyBudget);
     budgetTrackerDAL = budgetDal;
 }
 public DepartmentBudgetService(Department department)
 {
     this.department = department;
     Budget = new Budget(department.MonthlyBudget);
     budgetTrackerDAL = new BudgetDAL();
 }
 public decimal? GetDepartmentBudgetRemain(int month, int year, Department department)
 {
     throw new NotImplementedException();
 }
 public MockBudgetService(Department department)
 {
     this.department = department;
      Budget = new Budget(department.MonthlyBudget);
 }
        public decimal? TotalExpenseProcessByDepartment(int month, int year, Department department)
        {
            using (EMEntitiesContext ctx = new EMEntitiesContext())
            {
                decimal? total = 0;

                var reports = from expenseReports in ctx.ExpenseReports
                              where expenseReports.ApprovedDate.Value.Month == month && expenseReports.ApprovedDate.Value.Year == year
                                    && expenseReports.ApprovedById != null && expenseReports.Status=="ApprovedByAccounts"
                              select expenseReports;

                foreach (var expenseItems in reports)
                {
                    foreach (var totalamount in expenseItems.ExpenseItems)
                    {
                        total = total + totalamount.AudAmount;
                    }
                }
                return total;
            }
        }
 public decimal? GetDepartmentBudgetRemain(int month, int year, Department department)
 {
     decimal? totalExpenseProcessedDepartment = 0;
     budgetAmount = department.MonthlyBudget;
        // totalExpenseProcessedDepartment = budgetTrackerDAL.TotalExpenseProcessByDepartment(month, year, department);
     totalExpenseAmount = budgetTrackerDAL.TotalExpenseAmountByDept(department.DepartmentId);
     return (budgetAmount - totalExpenseProcessedDepartment);
 }