public UnitTest1() { IHourProcessor _hourProcessor = new HourProcessor(); IUniqueNumberGenerator _numberGenerator = new TwoDigitsUniqueNumberGenerator(); IHourPartialsGenerator _hourPartialsGenerator = new HourPartialsGenerator(_numberGenerator); IFullHoursGenerator _hoursGenerator = new FullHoursGenerator(_hourPartialsGenerator); _solutionImpl = new Solution(_hourProcessor, _hoursGenerator); }
public IActionResult RegisterHour(RegisterHourModel Hour) { if (ModelState.IsValid) { HourProcessor.RegisterHour( HttpContext.GetCurrentEmployeeModel().Id, Hour.StandbyHours, Hour.IncidentHours ); return(RedirectToAction("ViewHours")); } return(View()); }
static void Main(string[] args) { IHourProcessor _hourProcessor = new HourProcessor(); IUniqueNumberGenerator _numberGenerator = new TwoDigitsUniqueNumberGenerator(); IHourPartialsGenerator _hourPartialsGenerator = new HourPartialsGenerator(_numberGenerator); IFullHoursGenerator _hoursGenerator = new FullHoursGenerator(_hourPartialsGenerator); var proc = new Solution(_hourProcessor, _hoursGenerator); var hour = proc.solution(1, 8, 3, 2, 6, 4); Console.WriteLine(hour); Console.ReadKey(); }
static void Main(string[] args) { var processor = new HourProcessor(); var generator = new TwoDigitsUniqueNumberGenerator(); var hourGenerator = new HourPartialsGenerator(generator); var fullHourGenerator = new FullHoursGenerator(hourGenerator); var proc = new Solution(processor, fullHourGenerator); var hour = proc.Execute(1, 8, 3, 2, 6, 4); Console.WriteLine(hour); Console.ReadKey(); }
public IActionResult ViewHours() { if (HttpContext.GetCurrentEmployeeModel().Role.ToString() == "Admin") { var data = HourProcessor.LoadHours(); List <ViewHourModel> hours = new List <ViewHourModel>(); foreach (var row in data) { var employeedata = EmployeeProcessor.GetUserById(row.Employee_Id); hours.Add(new ViewHourModel { Id = row.ID, Employee_ID = row.Employee_Id, FirstName = employeedata.Firstname, LastName = employeedata.Lastname, StandbyHours = row.StandbyHours, IncidentHours = row.IncidentHours, TimeStamp = row.TimeStamp }); } return(View(hours)); } else { var data = HourProcessor.LoadHours(HttpContext.GetCurrentEmployeeModel().Id); List <ViewHourModel> hours = new List <ViewHourModel>(); foreach (var row in data) { var employeedata = EmployeeProcessor.GetUserById(row.Employee_Id); hours.Add(new ViewHourModel { Id = row.ID, Employee_ID = row.Employee_Id, FirstName = employeedata.Firstname, LastName = employeedata.Lastname, StandbyHours = row.StandbyHours, IncidentHours = row.IncidentHours, TimeStamp = row.TimeStamp }); } return(View(hours)); } }
public IViewComponentResult Invoke() { var data = HourProcessor.LoadHoursDashboard(HttpContext.GetCurrentEmployeeModel().Id); List <ViewHourModel> hours = new List <ViewHourModel>(); foreach (var row in data) { var employeedata = EmployeeProcessor.GetUserById(row.Employee_Id); hours.Add(new ViewHourModel { Id = row.ID, Employee_ID = row.Employee_Id, FirstName = employeedata.Firstname, LastName = employeedata.Lastname, StandbyHours = row.StandbyHours, IncidentHours = row.IncidentHours, TimeStamp = row.TimeStamp }); } return(View(hours)); }
public IActionResult Delete(int id) { HourProcessor.DeleteHours(id); return(RedirectToAction("ViewHours")); }