/* * Frontend page: Update Titles * Title: Update title status * Designed: Piyumi * User story: * Developed: Piyumi * Date created: 03/17/2016 */ public int UpdateTitleStatus(Models.Unit unitTitle) { string loanCode = null; //Check Session["loanCode"] is null or empty if (!string.IsNullOrEmpty(Session["loanCode"].ToString())) { //if not null or empty convert session to string variable loanCode = Session["loanCode"].ToString(); } TitleAccess titleObj = new TitleAccess(); //update title status bool reslt = titleObj.UpdateTitle(unitTitle, loanCode, userData.UserId); //Check result of update title if (reslt) { //if result is true get loan details by loan code LoanSetupStep1 loanDetails = new LoanSetupStep1(); loanDetails = (new LoanSetupAccess()).GetLoanDetailsByLoanCode(loanCode); string status = ""; //Check title status //TitleStatus 0 - Not received if (unitTitle.TitleStatus == 0) { status = "Not Received"; } //TitleStatus 1 - Received else if (unitTitle.TitleStatus == 1) { status = "Received"; } //TitleStatus 2 - Returned to Dealer else if (unitTitle.TitleStatus == 2) { status = "Returned to Dealer"; } //TitleStatus 3 - Sent to Bank else if (unitTitle.TitleStatus == 3) { status = "Sent to Bank"; } //insert log entry Log log = new Log(userData.UserId, userData.Company_Id, userData.BranchId, loanDetails.loanId, "Title Status Update", "Update title status of unit:" + unitTitle.IdentificationNumber + " ,Updated status:" + status + ",Updated date:" + DateTime.Now, DateTime.Now); int islog = (new LogAccess()).InsertLog(log); TempData["reslt"] = 1; return(1); } else { TempData["reslt"] = 0; return(0); } }
/* * Frontend page: Update Titles * Title: Search titles by identification number * Designed: Piyumi * User story: * Developed: Piyumi * Date created: 03/17/2016 */ public ActionResult SearchTitleStatus(string identificationNumber) { //check Session["AuthenticatedUser"] is null or Session["loanCode"] is null if (Session["AuthenticatedUser"] == null || Session["loanCode"] == null) { //return to login page if sessions are null return(RedirectToAction("UserLogin", "Login", new { lbl = " Due to inactivity your session has timed out, please log in again." })); } //Conver session to string variable string loanCode = Session["loanCode"].ToString(); TitleAccess obj1 = new TitleAccess(); TitleStatus obj2 = new TitleStatus(); List <Models.Unit> resultList = new List <Models.Unit>(); //Check input parameter:identificationNumber is null or empty and loancode is null or empty if ((!string.IsNullOrEmpty(identificationNumber)) && (!string.IsNullOrEmpty(loanCode))) { //search from units where matching the loan code and last 6 digits of identification number resultList = obj1.SearchTitle(loanCode, identificationNumber); } //Check search result list is not null if (resultList != null) { //filter list if contain active units - 1 obj2.TitleList = resultList.FindAll(t => t.UnitStatus == 1); //Check active units count is 0 if (obj2.TitleList.Count() == 0) { //filter list if contain payoff units - 2 obj2.TitleList = resultList.FindAll(t => t.UnitStatus == 2); //Check inactive units count is 0 if (obj2.TitleList.Count() == 0) { //filter list if contain inactive units - 0 obj2.TitleList = resultList.FindAll(t => t.UnitStatus == 0); } } //return search result list to view return(PartialView(obj2)); } else { obj2.TitleList = new List <Models.Unit>(); //return search result list to view return(PartialView(obj2)); } }
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)); }
/* * * 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)); }