public SupervisorController(IEmployeeService empService, IExpenseReportService rptService, Employee employee,IBudgetService budget) { employeeService = empService; reportService = rptService; this.employee = employee; deptBudget = budget; }
public void ActionOnReport(int? expenseId, Employee employee,ReportStatus status) { //IEmployeeService employeeService = new EmployeeService(); //Employee employee = employeeService.GetEmployee((int)Membership.GetUser().ProviderUserKey); using (EMEntitiesContext ctx = new EMEntitiesContext()) { var report = (from ExpReport in ctx.ExpenseReports where ExpReport.ExpenseId == expenseId select ExpReport).FirstOrDefault(); //if (action == "Approve") //{ report.ApprovedDate = DateTime.Now; //report.Status = "ApprovedBySupervisor"; report.Status = status.ToString(); report.ApprovedById = employee.UserId; ctx.SaveChanges(); //} //else //{ // report.ApprovedDate = DateTime.Now; // report.Status = "RejectedBySupervisor"; // report.ApprovedById = employee.UserId; // ctx.SaveChanges(); //} } }
private List<Employee> GetFakeEmployees() { List<Employee> employees = new List<Employee>(); Employee employee = new Employee { UserId = 1, Firstname = "John", Surname = "Doe", Department = new Department { DepartmentId = 1, DepartmentName = "State Services", MonthlyBudget = 10000 }, Role = "Consultant" }; employees.Add(employee); employee = new Employee(); employees.Add(employee); employee = new Employee { UserId = 2, Firstname = "Vikki", Surname = "Car", Department = new Department { DepartmentId = 2, DepartmentName = "Test Department", MonthlyBudget = 10000 }, Role = "Supervisor" }; employees.Add(employee); return employees; }
public AccountsController(IEmployeeService empService, IExpenseReportService rptService, Employee employee,IBudgetService budget) { employeeService = empService; reportService = rptService; this.employee = employee; budgetTracker = budget; }
public SupervisorController() { reportService = new ExpenseReportService(); employeeService = new EmployeeService(); employee = employeeService.GetEmployee((int)Membership.GetUser().ProviderUserKey); deptBudget = new DepartmentBudgetService(employee.Department); deptBudget.SetBudgetSpent(TODAY.Month, TODAY.Year); }
public AccountsController() { reportService = new ExpenseReportService(); employeeService = new EmployeeService(); config = new ConfigurationDAL(); budgetTracker = new CompanyBudgetService(decimal.Parse((string)config.GetAppSetting(COMPANY_BUDGET_KEY))); employee = employeeService.GetEmployee((int)Membership.GetUser().ProviderUserKey); }
public ConsultantController() { reportService = new ExpenseReportService(); employeeService = new EmployeeService(); currencyService = new CurrencyService(); fileUploader = new FileUploader(); employee = employeeService.GetEmployee((int)Membership.GetUser().ProviderUserKey); }
public Employee GetEmployee(int userId) { Employee employee = new Employee { UserId = 1, Firstname = "John", Surname = "Doe", Department = new Department {DepartmentId=1,DepartmentName="State Services",MonthlyBudget=10000 }, Role="Consultant" }; return employee; }
public void EmployeeService_GetEmployee_AreNotEqual() { Employee expectedEmployee = new Employee { UserId = 1, Firstname = "John", Surname = "Doe", Department = new Department { DepartmentId = 1, DepartmentName = "State Services", MonthlyBudget = 10000 }, Role = "Consultant" }; Employee result = employeeService.GetEmployee(2); Assert.AreNotEqual(expectedEmployee.UserId, result.UserId, "Expected employee and employee from employeeservice are equal"); }
public void EmployeeService_GetEmployeeUserIdasString_ThrowFormatException() { Employee expectedEmployee = new Employee { UserId = 1, Firstname = "John", Surname = "Doe", Department = new Department { DepartmentId = 1, DepartmentName = "State Services", MonthlyBudget = 10000 }, Role = "Consultant" }; var testId = "John"; Employee result = employeeService.GetEmployee(Int32.Parse(testId)); Assert.AreEqual(expectedEmployee.UserId, result.UserId, "This should throw an expception as GetEmployee does not expect a string"); }
public void InitializeMockEmployee() { mockEmployee = new Employee { UserId = 1, Firstname = "John", Surname = "Doe", Department = new Department { DepartmentId = 1, DepartmentName = "State Services", MonthlyBudget = 10000 }, Role = "Consultant" }; }
public void ProcessReport(int? expenseId, Employee employee, ReportStatus status) { }
public ConsultantController(IEmployeeService empService, IExpenseReportService rptService, Employee employee) { employeeService = empService; reportService = rptService; this.employee = employee; }
public void ActionOnReport(int? expenseId, Employee employee, ReportStatus status) { }
public List<ExpenseReport> GetReportsByConsultant(string status, Employee consultant) { return null; }
public void ProcessReport(int? expenseId, Employee employee, ReportStatus status) { using (EMEntitiesContext ctx = new EMEntitiesContext()) { var report = (from ExpReport in ctx.ExpenseReports where ExpReport.ExpenseId == expenseId select ExpReport).FirstOrDefault(); report.ProcessedDate = DateTime.Now; report.Status = status.ToString(); report.ProcessedById = employee.UserId; ctx.SaveChanges(); } }
/// <summary> /// Approve or Declines a report for Accounts /// </summary> /// <param name="expenseId">Expense Id of the report</param> /// <param name="employee">Accounts person</param> /// <param name="status">Approve or Decline</param> public void ProcessReport(int? expenseId, Employee employee, ReportStatus status) { reportDAL.ProcessReport(expenseId, employee, status); }
/// <summary> /// Get a list of expense reports from the ReportDAL /// </summary> /// <param name="status">status of the report</param> /// <param name="consultant">consultant</param> /// <returns></returns> public List<ExpenseReport> GetReportsByConsultant(string status, Employee consultant) { return reportDAL.GetExpenseReportByConsultant(status, consultant); }
/// <summary> /// Approve or Declines a report for Supervisor /// </summary> /// <param name="expenseId">Expense Id of the report</param> /// <param name="employee">Supervisor</param> /// <param name="status">Approve or Decline</param> public void ActionOnReport(int? expenseId,Employee employee,ReportStatus status) { reportDAL.ActionOnReport(expenseId, employee, status); }
public List<ExpenseReport> GetExpenseReportByConsultant(string status, Employee consultant) { using (EMEntitiesContext ctx = new EMEntitiesContext()) { var result = from report in ctx.ExpenseReports.Include("CreatedBy").Include("ExpenseItems").Include("Department") where report.CreatedBy.UserId == consultant.UserId && report.Status == status select report; return (List<ExpenseReport>)result.ToList(); } }