コード例 #1
0
        public ActionResult loadGrid()
        {
            string loanCode;

            try
            {
                loanCode = Session["loanCode"].ToString();
            }
            catch (Exception)
            {
                //filterContext.Controller.TempData.Add("UserLogin", "Login");
                return(RedirectToAction("UserLogin", "Login", new { lbl = "Due to inactivity your session has timed out, please log in again." }));
            }

            LoanSetupStep1 loanDetails = new LoanSetupStep1();

            loanDetails = (new LoanSetupAccess()).GetLoanDetailsByLoanCode(loanCode);



            BranchAccess ba = new BranchAccess();

            ViewBag.ComType     = userData.CompanyType;
            ViewBag.loanId      = loanDetails.loanId;
            ViewBag.loanDetails = loanDetails;

            UnitPayOffViewModel unitPayOffViewModel = new UnitPayOffViewModel();
            CurtailmentAccess   payoff = new CurtailmentAccess();

            unitPayOffViewModel.UnitPayOffList = new List <UnitPayOffModel>();
            unitPayOffViewModel.PayDate        = DateTime.Now;

            unitPayOffViewModel.UnitPayOffList = payoff.GetUnitPayOffList(loanDetails.loanId);

            decimal advanceFee = 0;

            advanceFee = payoff.AdvanceForPayOffUnits(loanDetails.loanId);

            //int advanceFeeAtPayoff = payoff.CheckAdvanceFeeAtPayOff(loanDetails.loanId);

            //if (advanceFeeAtPayoff == 1) {
            //    foreach (var unit in unitPayOffViewModel.UnitPayOffList) {
            //        unit.IsAdvancePaid = false;
            //    }
            //}
            ViewBag.AdvanceFee = advanceFee;

            var unitPayOffList = unitPayOffViewModel.UnitPayOffList;

            Session["payoffList"] = unitPayOffList;
            ViewBag.payOffList    = unitPayOffList;

            TitleAccess ta    = new TitleAccess();
            Title       title = ta.getTitleDetails(loanDetails.loanId);

            Session["PayOffUnitloanId"] = loanDetails.loanId;

            if (title != null)
            {
                bool isTitleTrack = title.IsTitleTrack;
                if (isTitleTrack)
                {
                    ViewBag.IsTitleTrack = "Yes";
                }
            }

            return(PartialView(unitPayOffViewModel));
        }
コード例 #2
0
        /*
         *
         * Frontend page   : Add Unit
         * Title           : Add or Advance Units
         * Designed        : Kasun Samarawickrama
         * User story      :
         * Developed       : Kasun Samarawickrama
         * Date created    : 02/24/2016
         *
         */
        public ActionResult AddUnit()
        {
            // Handle Record successfully update or Error message

            int Flag = 0;

            if (TempData["Msg"] != null)
            {
                Flag = int.Parse(TempData["Msg"].ToString());
                if (Flag == 1)
                {
                    ViewBag.Msg = "Success";
                }
                else if (Flag == 3)
                {
                    ViewBag.Msg = "Requested";
                }
                else if (Flag == 2)
                {
                    ViewBag.Msg = "Error";
                }
            }


            int userId = userData.UserId;

            ViewBag.Role = userData.RoleId;;

            //Check loan is null or not
            if (Session["loanCode"] == null || Session["loanCode"].ToString() == "")
            {
                return(RedirectToAction("UserLogin", "Login", new { lbl = "Failed find loan" }));
            }

            // for role id3 - user section
            if (userData.RoleId == 3)
            {
                // check user has rights to access this loan - if not redirect to dashboard
                if (Session["CurrentLoanRights"] == null || Session["CurrentLoanRights"].ToString() == "")
                {
                    return(RedirectToAction("UserDetails", "UserManagement"));
                }
                else
                {
                    var checkPermission = false;
                    var checkAdvance    = false;

                    // check user permission to the site
                    string rgts = "";
                    rgts = (string)Session["CurrentLoanRights"];
                    string[] rgtList = null;
                    //spit the permission string
                    if (rgts != "")
                    {
                        rgtList = rgts.Split(',');
                    }
                    if (rgtList != null)
                    {
                        foreach (var x in rgtList)
                        {
                            //check user have rights to add unit page
                            if (x == "U04")
                            {
                                checkPermission = true;
                            }
                            // check user have right to advance units in this page
                            if (x == "U01")
                            {
                                checkAdvance = true;
                            }
                        }
                        if (checkAdvance == true)
                        {
                            ViewBag.advanceAllow = true;
                        }
                        else
                        {
                            ViewBag.advanceAllow = false;
                        }
                        if (checkPermission == false)
                        {
                            return(RedirectToAction("UserDetails", "UserManagement"));
                        }
                    }
                    else
                    {
                        return(RedirectToAction("UserDetails", "UserManagement"));
                    }
                }
            }
            string loanCode = Session["loanCode"].ToString();
            // retrive loan details
            LoanSetupStep1 loan = (new LoanSetupAccess()).GetLoanDetailsByLoanCode(loanCode);

            int loanId = loan.loanId;

            Session["addUnitloan"] = loan;


            ViewBag.loanDetails = loan;
            //set default unit type for add unit page
            if (loan.selectedUnitTypes.Count == 1)
            {
                ViewBag.UnitTypeId = loan.selectedUnitTypes[0].unitTypeName;
            }

            Models.Unit unit = new Models.Unit();

            unit.AdvancePt   = loan.advancePercentage;
            unit.LoanId      = loanId;
            unit.LoanAmount  = loan.loanAmount;
            unit.AdvanceDate = DateTime.Now;
            unit.StartDate   = loan.startDate;
            unit.EndDate     = loan.maturityDate;

            //get company type
            //1 - Lender
            //2 - Dealer
            BranchAccess ba          = new BranchAccess();
            int          companyType = ba.getCompanyTypeByUserId(userId);

            ViewBag.CompabyType = companyType;
            ViewBag.RoleId      = userData.RoleId;

            //Check title
            TitleAccess ta    = new TitleAccess();
            Title       title = ta.getTitleDetails(loan.loanId);

            // check title track allow or not
            if (title != null)
            {
                bool isTitleTrack = title.IsTitleTrack;
                if (isTitleTrack)
                {
                    ViewBag.IsTitleTrack = "Yes";
                }

                string upload = title.TitleAcceptMethod;
                if (!string.IsNullOrEmpty(upload) && upload == "Scanned Title Adequate")
                {
                    ViewBag.Upload = "Yes";
                }
            }
            // loan Details for (loan Detail box) in the page
            UnitAccess         ua = new UnitAccess();
            LoanPaymentDetails loanPaymentDetails = ua.GetLoanPaymentDetailsByLoanId(loanId);

            unit.Balance = loanPaymentDetails.BalanceAmount;
            // check balane field is editable or not for this loan
            ViewBag.Editable = loan.isEditAllowable ? "Yes" : "No";


            //set user role to restrict add & advance unit if this user is dealer user(role id = 4)
            ViewBag.RoleId = userData.RoleId;

            return(PartialView(unit));
        }