/// <summary> /// CreatedBy: MAM. IRFAN /// CreatedDate: 2016/02/05 /// /// Getting all non reistered company branches by Registered company id /// /// </summary> /// <returns> a list contain all branches</returns> /// public List <NonRegBranch> getNonRegBranchesNonCompId(int nonRegCompanyId) { List <NonRegBranch> branchesLists = new List <NonRegBranch>(); DataHandler dataHandler = new DataHandler(); List <object[]> paramertList = new List <object[]>(); paramertList.Add(new object[] { "@non_reg_companyId", nonRegCompanyId }); try { DataSet dataSet = dataHandler.GetDataSet("spGetNonRegBranchesByNonRegCompanyId", paramertList); if (dataSet != null && dataSet.Tables.Count != 0) { foreach (DataRow dataRow in dataSet.Tables[0].Rows) { NonRegBranch branch = new NonRegBranch(); branch.NonRegBranchId = int.Parse(dataRow["non_reg_branch_id"].ToString()); branch.BranchName = dataRow["branch_name"].ToString(); branch.BranchCode = dataRow["branch_code"].ToString(); branch.BranchId = int.Parse(dataRow["branch_id"].ToString()); branch.BranchAddress1 = dataRow["branch_address_1"].ToString(); branch.BranchAddress2 = dataRow["branch_address_2"].ToString(); branch.StateId = Convert.ToInt32(dataRow["state_id"].ToString()); branch.BranchCity = dataRow["city"].ToString(); branch.BranchZip = dataRow["zip"].ToString(); branch.CompanyNameBranchName = dataRow["company_name"].ToString() + " - " + dataRow["branch_name"].ToString(); string[] zipWithExtention = branch.BranchZip.Split('-'); if (zipWithExtention[0] != null) { branch.ZipPre = zipWithExtention[0]; } if (zipWithExtention.Count() >= 2 && zipWithExtention[1] != null) { branch.Extention = zipWithExtention[1]; } branch.BranchEmail = dataRow["email"].ToString(); branch.BranchPhoneNum1 = dataRow["phone_num_1"].ToString(); branch.BranchPhoneNum2 = dataRow["phone_num_2"].ToString(); branch.BranchPhoneNum3 = dataRow["phone_num_3"].ToString(); branch.BranchFax = dataRow["fax"].ToString(); branch.BranchCompany = Convert.ToInt32(dataRow["company_id"]); branchesLists.Add(branch); } return(branchesLists); } else { return(null); } } catch (Exception ex) { throw ex; } }
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> /// CreatedBy:Irfan /// CreatedDate:2016/02/11 /// Get Non Reg Branch by non reg branch Id /// /// UpdatedBy : nadeeka /// UpdatedDate: 2016/03/04 /// removed existing connection open method and set parameter to object list and pass stored procedure name /// call DataHandler class method and getting dataset object, /// return partner branch object using dataset object /// /// </summary> /// <param name="branch Id"></param> /// <returns></returns> public NonRegBranch getNonRegBranchByNonRegBranchId(int nonRegBranchId) { DataHandler dataHandler = new DataHandler(); List <object[]> paramertList = new List <object[]>(); paramertList.Add(new object[] { "@non_reg_branch_id", nonRegBranchId }); try { DataSet dataSet = dataHandler.GetDataSet("spGetNonRegBranchByNonRegBranchId", paramertList); if (dataSet != null && dataSet.Tables.Count != 0 && dataSet.Tables[0].Rows.Count != 0) { DataRow dataRow = dataSet.Tables[0].Rows[0]; NonRegBranch branch = new NonRegBranch(); branch.BranchId = int.Parse(dataRow["branch_id"].ToString()); branch.NonRegBranchId = int.Parse(dataRow["non_reg_branch_id"].ToString()); branch.BranchCode = dataRow["branch_code"].ToString(); branch.BranchName = dataRow["branch_name"].ToString(); branch.BranchAddress1 = dataRow["branch_address_1"].ToString(); branch.BranchAddress2 = dataRow["branch_address_2"].ToString(); branch.BranchCity = dataRow["city"].ToString(); branch.CompanyNameBranchName = dataRow["company_name"].ToString(); branch.NonRegCompanyId = int.Parse(dataRow["company_id"].ToString()); branch.BranchEmail = dataRow["email"].ToString(); return(branch); } else { return(null); } } catch (Exception ex) { throw ex; } }
/// <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)); }