예제 #1
0
        public ActionResult FINTravelExpense(OpdExpenseVM oPDEXPENSE)
        {
            try
            {
                string buttonStatus = Request.Form["buttonName"];

                AuthenticateUser();

                string message = Validation(oPDEXPENSE, buttonStatus);

                if (message != string.Empty)
                {
                    ModelState.AddModelError("", message);
                }

                if (buttonStatus == "rejected")
                {
                    oPDEXPENSE.Status = ClaimStatus.FINREJECTED;
                }
                else if (buttonStatus == "finalapproved")
                {
                    oPDEXPENSE.Status = ClaimStatus.COMPLETED;
                }
                else if (buttonStatus == "managerapproval")
                {
                    oPDEXPENSE.Status = ClaimStatus.MANGINPROCESS;
                }
                else
                {
                    oPDEXPENSE.Status = ClaimStatus.FININPROCESS;
                }

                if (ModelState.IsValid)
                {
                    oPDEXPENSE.ModifiedDate        = DateTime.Now;
                    oPDEXPENSE.FinanceApprovalDate = DateTime.Now;
                    oPDEXPENSE.FinanceEmailAddress = GetEmailAddress();

                    if (oPDEXPENSE.Status == ClaimStatus.COMPLETED)
                    {
                        oPDEXPENSE.FinanceApproval = true;
                    }

                    _opdExpenseService.UpdateOpdExpense(oPDEXPENSE);
                    EmailSend(oPDEXPENSE);
                    return(RedirectToAction(UrlIndex, UrlFinApproval));
                }

                var opdExpense = GeneralController.GetTravelExpense(Convert.ToInt32(oPDEXPENSE.ID), _opdExpenseService, _travelExpenseService);
                ViewData["OPDEXPENSE_ID"] = oPDEXPENSE.ID;
                return(View(opdExpense));
            }
            catch (Exception ex)
            {
                logger.Error("FINAPPROVAL : FINOPDExpense([Bind])" + ex.Message.ToString());

                return(View(new HttpStatusCodeResult(HttpStatusCode.BadRequest)));
            }
        }
예제 #2
0
        // GET: OPDEXPENSEs/Edit/5
        public ActionResult ManTravelExpense(string id)
        {
            try
            {
                if (Request.IsAuthenticated)
                {
                    AuthenticateUser("ManTravelExpense");

                    int idDecrypted = Security.DecryptId(id);

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

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


                    var result2 = GeneralController.GetTravelExpense(idDecrypted, _opdExpenseService, _travelExpenseService);

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

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