Esempio n. 1
0
        public ActionResult ApplyLeave()
        {
            DateTime today = DateTime.Today;

            le_leaveApplication le_leaveApplication = new le_leaveApplication();

            le_leaveApplication.EmployeeId = 1;
            le_leaveApplication.LeaveFrom  = today;
            le_leaveApplication.LeaveTo    = today;
            //le_leaveApplication.LeaveDurationDays = 3;

            return(View(le_leaveApplication));
        }
Esempio n. 2
0
        public ActionResult ApplyLeavePreview([Bind(Include = "Id,EmployeeId,LeaveType,LeaveFrom,LeaveTo,LeaveDurationDays")] le_leaveApplication le_leaveApplication)
        {
            if (ModelState.IsValid)
            {
                // insert a record into leave application table with status 'pending approval' and leave application date = system date.
                le_leaveApplication.DateApplied       = DateTime.Today;
                le_leaveApplication.ApplicationStatus = "Pending Approval";

                db.le_leaveApplications.Add(le_leaveApplication);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(le_leaveApplication));
        }
Esempio n. 3
0
        public ActionResult ApplyLeave([Bind(Include = "Id,EmployeeId,LeaveType,LeaveFrom,LeaveTo,LeaveDurationDays")] le_leaveApplication le_leaveApplication)
        {
            if (ModelState.IsValid)
            {
                ModelState.Clear();
                le_leaveApplication.LeaveDurationDays = (int)(le_leaveApplication.LeaveTo - le_leaveApplication.LeaveFrom).TotalDays + 1;
                le_leaveApplication.EmployeeId        = 9;


                // minus weekend and public holidays.

                return(View("ApplyLeavePreview", le_leaveApplication));
            }

            return(View(le_leaveApplication));
        }
Esempio n. 4
0
        public ActionResult DoSubmit()
        {
            le_leaveApplication le_leaveApplication = new le_leaveApplication();

            if (ModelState.IsValid)
            {
                le_leaveApplication.LeaveDurationDays = (int)(le_leaveApplication.LeaveTo - le_leaveApplication.LeaveFrom).TotalDays + 1;
                le_leaveApplication.EmployeeId        = 9;


                // minus weekend and public holidays.

                return(View("ApplyLeavePreview", le_leaveApplication));
            }

            return(View("ApplyLeave"));
        }