コード例 #1
0
        public ActionResult Detail(ProfileBoxModel boxdetail, int id, int statusId = 0, int page = 1, int pageSize = 5)
        {
            var model      = new ProfileBoxModel();
            var profileBox = _profileBoxService.GetById(id);

            if (profileBox == null)
            {
                return(PageNotFound());
            }
            profileBox.WarehouseId = (boxdetail.ProfileBox == null) ? profileBox.WarehouseId : boxdetail.ProfileBox.Warehouse;


            model.ProfileBox            = profileBox.ToModel <ProfileBoxDetailModel>();
            model.ProfileBox.StatusList = WebUtility.ConvertEnumToSelectList <ABO.Core.ProfileBoxStatus>(false);
            Dictionary <string, string> warehouses = _warehouseService.GetAllWarehouses();

            model.ProfileBox.WarehouseList = WebUtility.ConvertDictionaryToSelectList(warehouses, false);
            Dictionary <string, string> profileTypes = _profileTypeService.GetAllTypes();

            model.ProfileBox.ProfileTypeList = WebUtility.ConvertDictionaryToSelectList(profileTypes, false);

            Dictionary <string, string> locations = _profileBoxService.GetLocationByWarehouseId(profileBox.WarehouseId);

            model.LocationList = WebUtility.ConvertDictionaryToSelectList(locations, false);

            Dictionary <string, string> openBoxes = _profileBoxService.GetProfileBoxByStatusType((short)ABO.Core.ProfileBoxStatus.Open, profileBox.TypeId, profileBox.Id);

            ViewBag.OpenBoxes = WebUtility.ConvertDictionaryToSelectList(openBoxes, false);

            // Get Profiles
            var profiles = _profileService.SearchProfilesByStatus(id, statusId, page, pageSize, null, null);

            model.Profiles   = profiles.Select(x => x.ToModel <ProfileModel>()).ToList();
            model.Pager      = profiles.ToMvcPaging(model.Profiles);
            model.StatusList = WebUtility.ConvertEnumToSelectList <ABO.Core.ProfileStatus>(true);

            model.ProfileBox.ProfileCount = model.ProfileBox.ProfileCount;
            return(View(model));
        }
コード例 #2
0
        public ActionResult Index(ProfileBoxSearchModel search, int page = 1, int pageSize = 5, GridSortOptions sort = null)
        {
            var model = new ProfileBoxsModel();
            //model.ProfileBox = new ProfileBoxInfomationModel
            //{
            //    Name = DateTime.Now.ToString("ddMMyyyy_HH") + "_" + _workContext.User.UserName,
            //    UserName = _workContext.User.UserName
            //};

            Dictionary <string, string> profileTypes = _profileTypeService.GetAllTypes();

            ViewBag.ProfileType = WebUtility.ConvertDictionaryToSelectList(profileTypes, true);

            Dictionary <string, string> warehouses = _warehouseService.GetAllWarehouses();

            ViewBag.Warehouses = WebUtility.ConvertDictionaryToSelectList(warehouses, true);


            Dictionary <string, string> users = _userService.GetAllUsers();

            ViewBag.Users = WebUtility.ConvertDictionaryToSelectList(users, true);



            ViewBag.StatusList = WebUtility.ConvertEnumToSelectList <ABO.Core.ProfileBoxStatus>(true);
            model.SearchModel  = search;

            var data = _profileBoxService.Search(page, pageSize, search.ToCriteria <ProfileBoxSearchModel, ProfileBoxSearchCriteria>());

            model.Data = data.Select(x => x.ToModel <ProfileBoxGridModel>()).ToList();

            ViewBag.ShowAddButton = _workContext.User.WarehouseId;

            model.Pager = data.ToMvcPaging(model.Data);

            return(View(model));
        }