// GET: TimeSheet
        public async Task <ActionResult> Index(int message = 0)
        {
            ViewBag.Manager = UserRoleSetting.GetManagerItems();
            int year   = DateTime.Now.Year;
            int period = (int)(DateTime.Now - PayPeriod.FirstPayDayOfYear(year)).Days / 14 + 2;
            TimeSheetContainer model = await GetTimeSheetModel(year, period);

            model.YearList = PayPeriod.GetYearItems();
            switch (message)
            {
            case 0:
                ViewBag.Message = "";
                break;

            case 1:
                ViewBag.Message = "Please save timesheet before submit";
                break;

            case 2:
                ViewBag.Message = "Timesheet approval email has been sent successfully";
                break;

            case 3:
                ViewBag.Message = "Timesheet has been saved successfully";
                break;

            default:
                ViewBag.Message = "no message";
                break;
            }
            return(View(model));
        }
Beispiel #2
0
        /// <summary>
        ///     Create a tab page for user to apply casual work hours.
        /// </summary>
        /// <returns>A partial view with details of an application of casual work hours.</returns>
        public ActionResult Casual()
        {
            TimeSheetContainer model = new TimeSheetContainer();

            //get droplists of year and managers
            model.YearList  = PayPeriod.GetYearItems();
            ViewBag.Manager = UserRoleSetting.GetManagerItems();

            return(PartialView("_Casual", model));
        }
Beispiel #3
0
        /// <summary>
        ///     Create a tab page for user to fill and submit a HR application.
        /// </summary>
        /// <returns>A partial view with details of an application.</returns>
        public ActionResult Leave()
        {
            LeaveApplicationViewModel model         = new LeaveApplicationViewModel();
            List <LeaveBalance>       LeaveBalances = new List <LeaveBalance>();

            //get manager dropdown list
            ViewBag.Manager = UserRoleSetting.GetManagerItems();

            for (int i = 0; i < 3; i++)
            {
                var availableLeave = contextDb.LeaveBalances.Find(User.Identity.Name, (_leaveType)i);
                LeaveBalances.Add(availableLeave == null ? new LeaveBalance() : availableLeave);
            }
            model.LeaveBalances = LeaveBalances;

            return(PartialView("_Leave", model));
        }