public virtual ActionResult GetHolidaysForEmployee(int id, bool forCurrentYear)
        {
            var employee = _hmUnitOfWork.EmployeeRepository.GetSingle(id);
            var holidays = employee.HolidayPeriods.Where(x => !forCurrentYear || x.StartDate.Year == DateTime.Now.Year).ToList();

            var vm = new GridDataJson
            {
                records = holidays.Count(),
                rows = holidays.Select(x => new GridRowJson
                {
                    id = x.Id,
                    cell = new object[]
                    {
                        x.StartDate.ToString("dd-MM-yyyy"),
                        x.EndDate.ToString("dd-MM-yyyy"),
                        x.Purpose.Description,
                        x.CancelDate != null,
                        x.CancelDate != null ? x.CancelDate.Value.ToString("dd-MM-yyyy") : null,
                        x.Note,
                    }
                }).ToList()
            };

            return Json(vm, JsonRequestBehavior.AllowGet);
        }
        public virtual ActionResult GetRequests()
        {
            var requests = _hmUnitOfWork.RequestRepository.FindBy(x => x.EmployeeId == CurrentEmployee.Id).ToList();

            var vm = new GridDataJson
            {
                records = requests.Count(),
                rows = requests.Select(x =>
                    new GridRowJson
                    {
                        id = x.Id,
                        cell = new object[]
                        {
                            x.StartDate.ToString("dd-MM-yyyy"),
                            x.EndDate.ToString("dd-MM-yyyy"),
                            x.Purpose.Description,
                            x.Accepted != null ? "accepted" : "pending"
                        }
                    }).ToList()
            };

            return Json(vm, JsonRequestBehavior.AllowGet);
        }
        public virtual ActionResult GetEmployees()
        {
            var employees = _hmUnitOfWork.EmployeeRepository.GetAll().ToList();

            var currentYear = DateTime.Now.Year;

            var vm = new GridDataJson
            {
                records = employees.Count(),
                rows = employees.Select(x =>
                {
                    var currentHolidayInformation = x.HolidayInformations.SingleOrDefault(y => y.Year == currentYear);

                    var days =
                        x.HolidayPeriods
                            .Where(y => y.CancelDate == null)
                            .Select(y => GetWorkDaysBetween(y.StartDate, y.EndDate))
                            .Sum();

                    var row = new GridRowJson
                    {
                        id = x.Id,
                        cell = new object[]
                        {
                            x.FirstName,
                            x.LastName,
                            x.EmailAddress,
                            x.Team != null ? x.Team.Name : "na",
                            currentHolidayInformation != null ? currentHolidayInformation.DaysAvailable.ToString () : "na",
                            currentHolidayInformation != null ? (currentHolidayInformation.DaysAvailable - days).ToString() : "na"
                        }
                    };

                    return row;
                }).ToList()
            };

            return Json(vm, JsonRequestBehavior.AllowGet);
        }