예제 #1
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());
        }
예제 #2
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"));
        }
예제 #3
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());
        }