public ActionResult MANOPDExpense(OpdExpenseVM oPDEXPENSE) { try { string buttonStatus = Request.Form["buttonName"]; AuthenticateUser("MANOPDExpense"); string message = Validation(oPDEXPENSE, buttonStatus); if (message != string.Empty) { ModelState.AddModelError("", message); } if (buttonStatus == "approved") { oPDEXPENSE.Status = ClaimStatus.MANAPPROVED; } else if (buttonStatus == "rejected") { oPDEXPENSE.Status = ClaimStatus.MANREJECTED; } else { oPDEXPENSE.Status = ClaimStatus.MANINPROCESS; } if (ModelState.IsValid) { oPDEXPENSE.ModifiedDate = DateTime.Now; oPDEXPENSE.ManagementApprovalDate = DateTime.Now; oPDEXPENSE.ManagementEmailAddress = GetEmailAddress(); if (oPDEXPENSE.Status == ClaimStatus.MANAPPROVED) { oPDEXPENSE.HrApproval = true; oPDEXPENSE.FinanceApproval = true; oPDEXPENSE.ManagementApproval = true; } _opdExpenseService.UpdateOpdExpense(oPDEXPENSE); EmailSend(oPDEXPENSE); return(RedirectToAction(UrlIndex, UrlManApproval)); } var result2 = GeneralController.GetOPDExpense(Convert.ToInt32(oPDEXPENSE.ID), _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService); ViewData["OPDEXPENSE_ID"] = oPDEXPENSE.ID; return(View(result2)); } catch (Exception ex) { logger.Error("MANAPPROVAL : MANOPDExpense([Bind])" + ex.Message.ToString()); return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest))); } }
// GET: OPDEXPENSEs/Details/5 public ActionResult DetailsForOPDExpense(string id) { try { if (Request.IsAuthenticated) { AuthenticateUser("DetailsForOPDExpense"); int idDecrypted = Security.DecryptId(Convert.ToString(id)); if (!(AuthenticateEmailAddress(idDecrypted))) { return(RedirectToAction(UrlIndex, UrlHome)); } if (id == null) { return(RedirectToAction(UrlIndex, UrlManApproval)); } var result2 = GeneralController.GetOPDExpense(idDecrypted, _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService); return(View(result2)); } else { return(RedirectToAction(UrlIndex, UrlManApproval)); } } catch (Exception ex) { logger.Error("MANAPPROVAL : DetailsForOPDExpense()" + ex.Message.ToString()); return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest))); } }
private bool AuthenticateEmailAddress(int Id) { var opdInformation = GeneralController.GetOPDExpense(Convert.ToInt32(Id), _opdExpenseService, _opdExpensePatientService, _opdExpenseImageService); OfficeManagerController managerController = new OfficeManagerController(); string currentEmailAddress = managerController.GetEmailAddress(); if (currentEmailAddress.Equals(opdInformation.EmployeeEmailAddress)) { return(true); } else { return(false); } }
// 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))); } }