コード例 #1
0
        /// <summary>
        /// CreatedBy : Irfan MAM
        /// CreatedDate: 2016/01/27
        /// Calling the default view for all step number pages
        /// Redirect to Appropriate controller using step number
        /// 
        /// 
        /// 
        /// </summary>
        /// <returns>Return the view</returns>

        public ActionResult Index()
        {
            //convert Session["companyStep"] to int value
            int stepNo = Convert.ToInt32(Session["companyStep"]);
            //assign logged user id to variable
            int userId = userData.UserId;
            //add step no and loan step(loan setup step 1 is considerd as step 6)
            stepNo = stepNo + loanstep;

            ViewBag.Step = stepNo;
            //assign step number to session variable
            Session["stepNo"] = stepNo;
            //Get company details if branch same as company
            //check step number
            //stepNo 2 - Branch setup
            if (stepNo == 2)
            {
                CompanyAccess ca = new CompanyAccess();
                Company company = ca.GetCompanyDetailsCompanyId(userData.Company_Id);

                //return View();
                return RedirectToAction("Step2");
            }
            //stepNo 5 - Partner Branch setup
            else if (stepNo == 5)
            {
                CompanyAccess ca = new CompanyAccess();
                //get partner company details
                Company nonRegCompany = ca.GetNonRegCompanyDetailsByRegCompanyId(userData.Company_Id);
                //if no partcompanies return to step 4 (Partner Company Setup)
                if (string.IsNullOrEmpty(nonRegCompany.CompanyName)) return RedirectToAction("Step4", "SetupProcess");

                CompanyBranchModel comBranch = new CompanyBranchModel();
                comBranch.Company = nonRegCompany;
                //assign returned partner company object to TempData object
                TempData["NonRegCompany"] = comBranch;

                //return View();
                return RedirectToAction("Step5");
            }
            //check stepNo is 0 and return to login page
            else if (stepNo == 0)
            {
                return RedirectToAction("UserLogin", "Login", new { lbl = "Company Setup is on going Please Contact Admin" });
            }
            //return to appropriate step
            else
            {
                return RedirectToAction("Step" + stepNo);
            }
        }