public ActionResult LoanInfo(string title, string msg) { ViewBag.Msg = msg; int userId; string loanCode = null; try { userId = userData.UserId; } catch (Exception) { return(RedirectToAction("UserLogin", "Login", new { lbl = "Due to inactivity your session has timed out, please log in again." })); } if (Session["loanCode"] != null) { loanCode = Session["loanCode"].ToString(); } ViewBag.Title = title; ViewBag.Username = userData.UserName; BranchAccess ba = new BranchAccess(); ViewBag.roleId = userData.RoleId; // get the Company type for front end view int comType = ba.getCompanyTypeByUserId(userId); ViewBag.loanCompanyType = (comType == 1) ? "Dealer" : "Lender"; if (loanCode != null) { LoanSetupStep1 loan = (new LoanSetupAccess()).GetLoanDetailsByLoanCode(loanCode); Session["addUnitloan"] = loan; NonRegBranch nonRegBranch = ba.getNonRegBranchByNonRegBranchId(loan.nonRegisteredBranchId); ViewBag.NonRegBranchName = nonRegBranch.BranchName; //dealer email address, this will be used on curtailment page Session["DealerEmail"] = nonRegBranch.BranchEmail; ViewBag.loanBranchAddress = (nonRegBranch.BranchAddress1 != "" ? nonRegBranch.BranchAddress1 : "") + (nonRegBranch.BranchAddress2 != "" ? ", " + nonRegBranch.BranchAddress2 : "") + (nonRegBranch.BranchCity != "" ? ", " + nonRegBranch.BranchCity : ""); ViewBag.CurtailmentDueDate = loan.CurtailmentDueDate; ViewBag.LoanNumber = loan.loanNumber; } return(View()); }
/// <summary> /// Frontend page: Join Dealer /// Title: view of Link Dealer page /// Designed: Nadeeka /// User story: /// Developed: Nadeeka /// Date created: 2016/03/30 /// Edited: Piyumi Perera /// </summary> /// <returns></returns> public ActionResult LinkDealer() { //Check result of Join Dealer page if (TempData["msg"] != null) { //Check TempData["msg"] is 1 if (TempData["msg"].ToString() == "1") { ViewBag.SuccessMsg = "User Successfully Created"; } //Check TempData["msg"] is 2 else if (TempData["msg"].ToString() == "2") { ViewBag.Error = "Error"; } } CompanyAccess ca = new CompanyAccess(); BranchAccess ba = new BranchAccess(); Loan loan = new Loan(); //Check Session["oneLoanDashboard"] is not null if (Session["oneLoanDashboard"] != null) { //convert session object to loan object loan = (Loan)Session["oneLoanDashboard"]; } //Check Session["loanDashboardJoinDealer"] is not null if (Session["loanDashboardJoinDealer"] != null) { //convert session object to loan object loan = (Loan)Session["loanDashboardJoinDealer"]; } //remove Session["popUpSelectionType"] Session.Remove("popUpSelectionType"); //return non registered branch details by non registered branch id NonRegBranch nonRegBranches = ba.getNonRegBranchByNonRegBranchId(loan.NonRegBranchId); ViewBag.nonRegBranches = nonRegBranches.BranchName; ViewBag.nonRegCompany = nonRegBranches.CompanyNameBranchName; List <User> userList = new List <User>(); //return all users of given company id userList = (new UserAccess()).GetUserListByCompany(userData.Company_Id); //filter user list who has authorization for selected loan userList = userList.FindAll(t => t.BranchId == loan.BranchId || (t.BranchId == 0 && t.RoleId == 1)); ViewBag.UserIdForSendReq = new SelectList(userList, "UserId", "UserName"); //get report list for dealer user List <Right> ReportRightsList = new List <Right>(); User us = new User(); us.ReportRightsList = new List <Right>(); ReportRightsList = (new UserRightsAccess()).getReportRights(); if (ReportRightsList != null && ReportRightsList.Count > 0) { foreach (Right rgt in ReportRightsList) { //Check dealer user can view the report if (!rgt.DealerView) { continue; } else { //check title need not to be tracked for selected loan and report right for Title Status if ((loan.IsTitleTrack == 0) && (rgt.rightId == "R04")) { //if title need not to be tracked report right for Title Status is not added to right list continue; } //check there is no advance fee for selected loan and report right for advance fee invoice and advance fee receipt if ((loan.AdvanceFee == 0) && ((rgt.rightId == "R07") || (rgt.rightId == "R08"))) { //if there is no advance fee, report right for advance fee invoice and advance fee receipt are not added to right list continue; } //check there is no monthly loan fee for selected loan and report right for monthly loan fee invoice and monthly loan fee receipt if ((loan.MonthlyLoanFee == 0) && ((rgt.rightId == "R09") || (rgt.rightId == "R10"))) { //if there is no monthly loan fee, report right for monthly loan fee invoice and monthly loan fee receipt are not added to right list continue; } //check there is no lot inspection fee for selected loan and report right for lot inspection fee invoice and lot inspection fee receipt if ((loan.LotInspectionFee == 0) && ((rgt.rightId == "R11") || (rgt.rightId == "R12"))) { //if there is no lot inspection fee, report right for lot inspection fee invoice and lot inspection fee receipt are not added to right list continue; } } us.ReportRightsList.Add(rgt); } } //Check user is super admin if (userData.RoleId == 1) { //convert user list to session object Session["UserReqList"] = userList; } //Check user is admin else if (userData.RoleId == 2) { //convert user list to session object Session["UserReqList"] = userList; } else { //return to dashboard return(RedirectToAction("UserDetails", "UserManagement")); } return(View(us)); }