/// <summary>
        /// CreatedBy: Kanishka
        /// CreatedDate:2016/1/18
        /// insert first branch details
        /// </summary>
        /// <returns></returns>
        public ActionResult CreateBranchFirstBranch()
        {
            var type = (string)Session["type"];

            if (type == "CompanyEmployee")
            {
                ViewBag.Type = "CompanyEmployee";
                _type        = "CompanyEmployee";

                if (TempData["UserCompany"] == null)
                {
                    return(RedirectToAction("EmployeeLogin", "Login"));
                }

                CompanyAccess ca = new CompanyAccess();
                //Get states to list
                List <State> stateList = ca.GetAllStates();
                ViewBag.StateId = new SelectList(stateList, "StateId", "StateName");

                _userCompany        = (UserCompanyModel)TempData["UserCompany"];
                _userCompany.Branch = new Branch();

                return(View(_userCompany));
            }
            else
            {
                ViewBag.Type = "";
                return(RedirectToAction("EmployeeLogin", "Login"));
            }
        }
        public ActionResult CreateBranchPost(Branch branch)
        {
            ViewBag.Type = "";

            int id = userData.UserId;
            //branch.StateId = branch.StateId2;
            BranchAccess br = new BranchAccess();
            //int reslt = br.insertBranchDetails(branch, id);
            int           reslt     = 0;
            CompanyAccess ca        = new CompanyAccess();
            List <State>  stateList = ca.GetAllStates();

            ViewBag.StateId = new SelectList(stateList, "StateId", "StateName");

            if (reslt > 0)
            {
                ViewBag.SuccessMsg = "Branch is successfully added";
                return(RedirectToAction("CreateBranch", "CreateBranch", new { success = 1 }));
                //branch = new Branch();
                //return PartialView(branch);
            }
            else
            {
                ViewBag.ErrorMsg = "Failed to add branch";
                return(PartialView());
            }
        }
Beispiel #3
0
        /// <summary>
        /// CreatedBy : Kanishka SHM
        /// CreatedDate: 2016/01/18
        ///
        /// Create company view
        /// </summary>
        /// <returns></returns>
        // GET: SetupCompany
        public ActionResult Setup()
        {
            if (Session["type"] == null)
            {
                return(RedirectToAction("UserLogin", "Login"));
            }
            var type = (string)Session["type"];
            //if (type == "CompanyEmployee")
            //{

            //}

            CompanyAccess ca = new CompanyAccess();
            //Get states to list
            List <State> stateList = ca.GetAllStates();

            ViewBag.StateId = new SelectList(stateList, "StateId", "StateName");

            _user = (User)TempData["User"];
            List <CompanyType> ctList = ca.GetAllCompanyType();

            ViewBag.TypeId = new SelectList(ctList, "TypeId", "TypeName");



            return(View());
        }
        // GET: CreateBranch
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult CreateBranch(int success = 0)
        {
            if (success == 1)
            {
                ViewBag.SuccessMsg = "Branch is successfully added";
            }
            //Get states to list
            CompanyAccess ca        = new CompanyAccess();
            List <State>  stateList = ca.GetAllStates();

            ViewBag.StateId = new SelectList(stateList, "StateId", "StateName");
            return(PartialView());
        }
Beispiel #5
0
        // GET: SetupProcessTest
        public ActionResult Step1(int?edit)
        {
            Session["userId"] = 229;

            if (Session["userId"] == null || Session["userId"].ToString() == "")
            {
                return(RedirectToAction("UserLogin", "Login"));
            }

            int           userId = Convert.ToInt32(Session["userId"]);
            CompanyAccess ca     = new CompanyAccess();
            StepAccess    sa     = new StepAccess();
            // Get company types to list
            List <CompanyType> ctList = ca.GetAllCompanyType();

            ViewBag.TypeId = new SelectList(ctList, "TypeId", "TypeName");

            //Get states to list
            List <State> stateList = ca.GetAllStates();

            ViewBag.StateId = new SelectList(stateList, "StateId", "StateName");

            if (Convert.ToInt32(Session["companyStep"]) == 1 && edit != 1)
            {
                return(View());
            }

            if (edit == 1)
            {
                if (!string.IsNullOrEmpty(Session["userId"].ToString()))
                {
                    userId = Convert.ToInt32(Session["userId"]);
                    //----------
                    Company preCompany = ca.GetCompanyDetailsCompanyId(userData.Company_Id);


                    _comCode     = preCompany.CompanyCode;
                    ViewBag.Edit = "Yes";

                    return(View(preCompany));
                }
            }

            return(RedirectToAction("UserLogin", "Login"));
        }
Beispiel #6
0
        public ActionResult Step2()
        {
            Session["userId"] = 229;
            //Session["userId"] = 4;
            //int userId = 68;
            if ((Session["userId"] != null) && (Session["userId"].ToString() != ""))
            //if(userId>0)
            {
                int        userId = (int)Session["userId"];
                StepAccess cs     = new StepAccess();
                int        reslt  = Convert.ToInt32(Session["companyStep"]);
                if (reslt == 2)
                {
                    if ((TempData["Company"] != null) && (TempData["Company"].ToString() != ""))
                    {
                        userCompany = new CompanyBranchModel();
                        userCompany = (CompanyBranchModel)TempData["Company"];

                        CompanyType = (userCompany.Company.TypeId == 1) ? "Lender" : "Dealer";

                        userCompany.MainBranch = new Branch();
                        if (userCompany.Company.Extension == null)
                        {
                            userCompany.Company.Extension = "";
                        }
                    }

                    //Get states to list
                    CompanyAccess ca        = new CompanyAccess();
                    List <State>  stateList = ca.GetAllStates();
                    ViewBag.StateId = new SelectList(stateList, "StateId", "StateName");

                    return(View(userCompany));
                }
                else
                {
                    return(RedirectToAction("UserLogin", "Login"));
                }
            }
            else
            {
                return(RedirectToAction("UserLogin", "Login"));
            }
        }
Beispiel #7
0
        public ActionResult Step1(Company company, int?edit)
        {
            if (Session["userId"] == null || Session["userId"].ToString() == "")
            {
                return(RedirectToAction("UserLogin", "Login"));
            }


            string type;

            if (edit != 1)
            {
                GeneratesCode gc = new GeneratesCode();
                _comCode = company.CompanyCode = gc.GenerateCompanyCode(company.CompanyName);
                type     = "INSERT";
            }
            else
            {
                company.CompanyCode = _comCode;
                type = "UPDATE";
            }

            //
            company.Zip = company.ZipPre;
            if (company.Extension != null)
            {
                company.Zip += "-" + company.Extension;
            }

            company.CreatedBy     = company.FirstSuperAdminId = Convert.ToInt32(Session["userId"]);
            company.CompanyStatus = true;
            CompanyAccess ca = new CompanyAccess();

            //check this record is new one or exitsting one
            //string type = (edit == 1) ? "UPDATE" : "INSERT";

            int companyId = ca.InsertCompany(company, type);

            if (companyId > 0)
            {
                ViewBag.SuccessMsg = "Company Successfully setup.";

                CompanyType = (company.TypeId == 1) ? "Lender" : "Dealer";

                //If succeed update step table to step2
                StepAccess sa = new StepAccess();
                sa.updateStepNumberByUserId(company.FirstSuperAdminId, 2);

                //Send company detail to step 2
                CompanyBranchModel comBranch = new CompanyBranchModel();
                comBranch.Company = company;

                TempData["Company"] = comBranch;

                return(RedirectToAction("Step2"));
            }
            ViewBag.ErrorMsg = "Failed to Setup company.";

            // Get company types to list
            List <CompanyType> ctList = ca.GetAllCompanyType();

            ViewBag.TypeId = new SelectList(ctList, "TypeId", "TypeName");

            //Get states to list
            List <State> stateList = ca.GetAllStates();

            ViewBag.StateId = new SelectList(stateList, "StateId", "StateName");

            return(View());
        }