예제 #1
0
        public ActionResult UserEdit(long UserId = 0)
        {
            CmnEntityModel currentUser   = Session["CmnEntityModel"] as CmnEntityModel;
            var            authorityList = currentUser != null ? currentUser.USER_AUTHORITY : 0;

            if (currentUser == null || authorityList != 2)
            {
                return(RedirectToAction("Login", "UserAccount"));
            }

            UserAccountModel model = new UserAccountModel();

            CommonService comService = new CommonService();
            ManageUserDa  dataAccess = new ManageUserDa();

            if (UserId > 0)
            {
                UserAccountModel infor = new UserAccountModel();
                infor = dataAccess.getInfoUser(UserId);
                model = infor != null ? infor : model;
                model.DISTRICT_CD_KEY = model.USER_CITY.ToString() + "_" + model.USER_DISTRICT.ToString();
                model.TOWN_CD_KEY     = model.USER_CITY.ToString() + "_" + model.USER_DISTRICT.ToString() + "_" + model.USER_TOWN.ToString();
            }

            model.CITY_LIST = comService.GetCityList().ToList().Select(
                f => new SelectListItem
            {
                Value = f.CITY_CD.ToString(),
                Text  = f.CITY_NAME
            }).ToList();
            model.CITY_LIST.Insert(0, new SelectListItem {
                Value = Constant.DEFAULT_VALUE, Text = ""
            });

            model.DISTRICT_LIST = comService.GetDistrictList().ToList().Select(
                f => new SelectListItem
            {
                Value = f.CITY_CD.ToString() + "_" + f.DISTRICT_CD.ToString(),
                Text  = f.DISTRICT_NAME
            }).ToList();

            model.TOWN_LIST = comService.GetTownList().ToList().Select(
                f => new SelectListItem
            {
                Value = f.CITY_CD.ToString() + "_" + f.DISTRICT_CD.ToString() + "_" + f.TOWN_CD.ToString(),
                Text  = f.TOWN_NAME
            }).ToList();

            ViewBag.UserAuthority = new SelectList(UtilityServices.UtilityServices.GetAuthorityUser(), "Value", "Text");


            return(View(model));
        }
예제 #2
0
        public ActionResult Register(long UserId = 0)
        {
            UserAccountModel model = new UserAccountModel();

            CommonService comService = new CommonService();
            ManageUserDa  dataAccess = new ManageUserDa();

            if (UserId > 0)
            {
                UserAccountModel infor = new UserAccountModel();
                infor = dataAccess.getInfoUser(UserId);
                model = infor != null ? infor : model;
                model.DISTRICT_CD_KEY = model.USER_CITY.ToString() + "_" + model.USER_DISTRICT.ToString();
                model.TOWN_CD_KEY     = model.USER_CITY.ToString() + "_" + model.USER_DISTRICT.ToString() + "_" + model.USER_TOWN.ToString();
            }

            model.CITY_LIST = comService.GetCityList().ToList().Select(
                f => new SelectListItem
            {
                Value = f.CITY_CD.ToString(),
                Text  = f.CITY_NAME
            }).ToList();
            model.CITY_LIST.Insert(0, new SelectListItem {
                Value = Constant.DEFAULT_VALUE, Text = "Tỉnh/thành phố"
            });

            model.DISTRICT_LIST = comService.GetDistrictList().ToList().Select(
                f => new SelectListItem
            {
                Value = f.CITY_CD.ToString() + "_" + f.DISTRICT_CD.ToString(),
                Text  = f.DISTRICT_NAME
            }).ToList();
            model.DISTRICT_LIST.Insert(0, new SelectListItem {
                Value = Constant.DEFAULT_VALUE, Text = "Quận/huyện"
            });

            model.TOWN_LIST = comService.GetTownList().ToList().Select(
                f => new SelectListItem
            {
                Value = f.CITY_CD.ToString() + "_" + f.DISTRICT_CD.ToString() + "_" + f.TOWN_CD.ToString(),
                Text  = f.TOWN_NAME
            }).ToList();
            model.TOWN_LIST.Insert(0, new SelectListItem {
                Value = Constant.DEFAULT_VALUE, Text = "Xã/phường"
            });

            return(View(model));
        }
예제 #3
0
        public ActionResult ChangePassword(long UserId = 0)
        {
            UserAccountModel model = new UserAccountModel();

            CommonService comService = new CommonService();
            ManageUserDa  dataAccess = new ManageUserDa();

            if (UserId > 0)
            {
                UserAccountModel infor = new UserAccountModel();
                infor = dataAccess.getInfoUser(UserId);
                model = infor != null ? infor : model;
            }


            return(View(model));
        }