コード例 #1
0
        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);
        }
コード例 #2
0
        public IActionResult RegisterHour(RegisterHourModel Hour)
        {
            if (ModelState.IsValid)
            {
                HourProcessor.RegisterHour(
                    HttpContext.GetCurrentEmployeeModel().Id,
                    Hour.StandbyHours,
                    Hour.IncidentHours
                    );
                return(RedirectToAction("ViewHours"));
            }

            return(View());
        }
コード例 #3
0
        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();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: brajan1984/TestingTutorial
        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();
        }
コード例 #5
0
 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));
     }
 }
コード例 #6
0
        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));
        }
コード例 #7
0
 public IActionResult Delete(int id)
 {
     HourProcessor.DeleteHours(id);
     return(RedirectToAction("ViewHours"));
 }