예제 #1
0
        // GET: OPDEXPENSEs/Edit/5
        public ActionResult MANOPDExpense(string id)
        {
            try
            {
                if (Request.IsAuthenticated)
                {
                    AuthenticateUser("MANOPDExpense");


                    int idDecrypted = Security.DecryptId(id);

                    if (!(AuthenticateEmailAddress(idDecrypted)))
                    {
                        return(RedirectToAction(UrlIndex, UrlHome));
                    }

                    if (id == null)
                    {
                        return(RedirectToAction(UrlIndex, UrlManApproval));
                    }


                    var result2 = GeneralController.GetOPDExpense(idDecrypted, _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService);


                    string remainingAmount = GeneralController.CalculateRemainingAmount(result2.EmployeeEmailAddress, result2.OpdType, result2.HospitalizationType, result2.MaternityType, _opdExpenseService, _setupExpenseAmountService, false);
                    ViewBag.RemainingAmount = remainingAmount;


                    ViewData["OPDEXPENSE_ID"] = idDecrypted;
                    return(View(result2));
                }
                else
                {
                    return(RedirectToAction(UrlIndex, UrlManApproval));
                }
            }
            catch (Exception ex)
            {
                logger.Error("MANAPPROVAL : MANOPDExpense()" + ex.Message.ToString());

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }