public ActionResult Withdrawn(int PermitKey)
 {
     WithdrawPermitVM Model = new WithdrawPermitVM();
     Model.PermitKey = PermitKey;
     return PartialView(Model);
 }
        public ActionResult Withdrawn(WithdrawPermitVM Model)
        {
            if (!ModelState.IsValid)
                return PartialView(Model);

            try
            {

                AjaxResult result;

                if (Model.Withdrawn.Value)
                {
                    PermitBLL.ApproveWithdraw(Model.PermitKey);
                    result = new AjaxResult(AjaxResult.AjaxStatus.OK, "The Permit has been Withdrawn.");
                }
                else
                {
                    PermitBLL.DenyWithdraw(Model.PermitKey);
                    result = new AjaxResult(AjaxResult.AjaxStatus.OK, "The Withdraw has been Denied.");
                }

                return Json(result);

            }
            catch (Exception ex)
            {
                AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.ERROR, ex.Message);
                return Json(result);
            }
        }
        public ActionResult RequestToWithdrawPermit(WithdrawPermitVM Model)
        {
            if (!Judge.AllowWithdraw)
                return RedirectToAction("InvalidRequest", "ePermitError", new { PermitKey = Model.PermitKey });

            try
            {
                AjaxResult result;
                if (Model.Withdrawn.Value)
                {
                    PermitBLL.RequestWithdraw(Model.PermitKey);
                    result = new AjaxResult(AjaxResult.AjaxStatus.OK, "The Permit is Pending Withdraw.");
                }
                else
                    result = new AjaxResult(AjaxResult.AjaxStatus.OK, "The Permit is not Withdrawn.");

                return Json(result);

            }
            catch (Exception ex)
            {
                AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.ERROR, ex.Message);
                return Json(result);
            }
        }