public ActionResult Index(int?ViewId)
        {
            if (Session["EmpID"] != null)
            {
                ViewBag.Reasons    = lb.GetReasons();
                ViewBag.Leavetypes = lb.GetLeaveTypes();

                if (ViewId == null || ViewId == 0)
                {
                    ViewBag.ViewID = 0;
                }
                else if (ViewId == 1)
                {
                    ViewBag.ViewID = 1;
                }
                else
                {
                    ViewBag.ViewID = 0;
                }
                if (TempData["HrsError"] != null && Convert.ToBoolean(TempData["HrsError"]) == true)
                {
                    TempData.Remove("HrsError");
                    ViewBag.HrsError = true;
                }
                else
                {
                    ViewBag.HrsError = false;
                }

                return(View("Index"));
            }
            else
            {
                return(RedirectToAction("Index", "LogIn"));
            }
        }
        public ActionResult EditDetails(string Application_Id)
        {
            if (Application_Id != null && Session["EmpID"] != null)
            {
                Application_Id = LeaveApplication.Models.Encryption.Base64Decode(Application_Id);
                try
                {
                    int.Parse(Application_Id);
                    LeaveApplication.Models.LeaveApplication x = lb.GetApplication(Application_Id);
                    Session["EditLeave"] = x;
                    if (x == null)
                    {
                        return(RedirectToAction("Index", "ViewApplications"));
                    }
                    else
                    {
                        ViewBag.Reasons    = lb.GetReasons();
                        ViewBag.Leavetypes = lb.GetLeaveTypes();

                        if (TempData["HrsError"] != null && Convert.ToBoolean(TempData["HrsError"]) == true)
                        {
                            ViewBag.HrsError = true;
                        }
                        else
                        {
                            ViewBag.HrsError = false;
                        }
                        return(View("EditDetails", x));
                    }
                }
                catch (FormatException)
                {
                    return(RedirectToAction("FacultyApplications"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "ViewApplications"));
            }
        }