示例#1
0
        public ActionResult Customer()
        {
            if (string.IsNullOrEmpty((string)Session["DealerCode"]))
            {
                return(RedirectToAction("NewLogin", "Home"));
            }
            if (common.UserRight("2502", "001"))
            {
                dealerCode = Session["DealerCode"].ToString();

                List <SelectListItem> ddlCity = new List <SelectListItem>();
                ddlCity      = GeneralMethods.GetDataFromSP("Select_City");
                ViewBag.City = ddlCity;

                List <SelectListItem> ddlState = new List <SelectListItem>();
                ddlState      = GeneralMethods.GetDataFromSP("Select_State");
                ViewBag.State = ddlState;

                List <SelectListItem> ddlCountry = new List <SelectListItem>();
                ddlCountry      = GeneralMethods.GetDataFromSP("Select_Country");
                ViewBag.Country = ddlCountry;

                //List<SelectListItem> ddlCustomers = new List<SelectListItem>();
                //ddlCustomers = GeneralMethods.GetDataFromSPWithDealerCode("SP_Select_Customer",dealerCode);
                //ViewBag.Customers = ddlCustomers;

                List <SelectListItem> ddlCusType = new List <SelectListItem>();
                ddlCusType      = GeneralMethods.GetDataFromSPWithDealerCode("SP_SelectCustomerType", dealerCode);
                ViewBag.CusType = ddlCusType;

                //DataTable dt = new DataTable();
                //List<CustomerVM> lst = new List<CustomerVM>();

                //SqlParameter[] sqlParam =
                //    {
                //        new SqlParameter("@DealerCode",dealerCode)
                //    };
                //dt = DataAccess.getDataTable("SP_Select_CustomerModal", sqlParam, General.GetBMSConString());

                //if (dt.Rows.Count > 0)
                //{
                //    lst = EnumerableExtension.ToList<CustomerVM>(dt);
                //}
                List <CustomerVM> lstCustommer = CustomerMethods.GetCustomerModal(dealerCode);
                ViewBag.Customer = lstCustommer;

                List <AccountVM> lstAccount = CustomerMethods.Get_AccDesc(dealerCode);
                ViewBag.Accounts = lstAccount;
            }
            else
            {
                TempData["TestAccessError"] = MessageAlert.MsgAuthorized();
                return(RedirectToAction("Error", "Definition"));
            }



            return(View());
        }
        public ActionResult Customer()
        {
            if (string.IsNullOrEmpty((string)Session["DealerCode"]))
            {
                return(RedirectToAction("Login", "Home"));
            }
            dealerCode = Session["DealerCode"].ToString();

            List <SelectListItem> ddlCity = new List <SelectListItem>();

            ddlCity      = GeneralMethods.GetDataFromSP("Select_City");
            ViewBag.City = ddlCity;

            List <SelectListItem> ddlState = new List <SelectListItem>();

            ddlState      = GeneralMethods.GetDataFromSP("Select_State");
            ViewBag.State = ddlState;

            List <SelectListItem> ddlCountry = new List <SelectListItem>();

            ddlCountry      = GeneralMethods.GetDataFromSP("Select_Country");
            ViewBag.Country = ddlCountry;

            //List<SelectListItem> ddlCustomers = new List<SelectListItem>();
            //ddlCustomers = GeneralMethods.GetDataFromSPWithDealerCode("SP_Select_Customer",dealerCode);
            //ViewBag.Customers = ddlCustomers;

            List <SelectListItem> ddlCusType = new List <SelectListItem>();

            ddlCusType      = GeneralMethods.GetDataFromSPWithDealerCode("SP_SelectCustomerType", dealerCode);
            ViewBag.CusType = ddlCusType;

            //DataTable dt = new DataTable();
            //List<CustomerVM> lst = new List<CustomerVM>();

            //SqlParameter[] sqlParam =
            //    {
            //        new SqlParameter("@DealerCode",dealerCode)
            //    };
            //dt = DataAccess.getDataTable("SP_Select_CustomerModal", sqlParam, General.GetBMSConString());

            //if (dt.Rows.Count > 0)
            //{
            //    lst = EnumerableExtension.ToList<CustomerVM>(dt);
            //}
            List <CustomerVM> lstCustommer = CustomerMethods.GetCustomerModal(dealerCode);

            ViewBag.Customer = lstCustommer;
            List <ProspectDetailVM> PreCustommer = CustomerMethods.GetPreCustomerModal(dealerCode);

            Session["PreCustomer"] = PreCustommer;
            ViewBag.PreCustomer    = PreCustommer;
            List <AccountVM> lstAccount = CustomerMethods.Get_AccDesc(dealerCode);

            ViewBag.Accounts = lstAccount;


            return(View());
        }