public async Task <ActionResult> GetUserEditForm(int id) { ViewBag.ProfileBoxRootPath = _appSettings.ProfileBoxRootPath; var user = _userService.GetUserById(id); var userInfo = new UserModel { UserId = user.Id, UserName = user.UserName, FullName = user.FullName, WarehouseId = user.WarehouseId, RoleId = user.RoleId, IsEditMode = true }; Dictionary <string, string> roles = _userService.GetRoles(); userInfo.RoleList = WebUtility.ConvertDictionaryToSelectList(roles, false); Dictionary <string, string> warehouses = _warehouseService.GetAllWarehouses(); userInfo.WarehouseList = WebUtility.ConvertDictionaryToSelectList(warehouses, false); return(PartialView("_NewEditForm", userInfo)); }
public ActionResult GetProfileBoxNewForm(string profileType) { ViewBag.ProfileBoxRootPath = _appSettings.ProfileBoxRootPath; var info = new ProfileBoxInfomationModel { UserName = _workContext.User.UserName, WarehouseId = _workContext.User.WarehouseId, WarehouseName = _workContext.User.WarehouseName, }; //info.FolderPath = folderpath + "/" + info.WarehouseName.Trim() + "/" + info.Name; Dictionary <string, string> profileTypes = _profileTypeService.GetAllTypes(); info.ProfileTypeList = WebUtility.ConvertDictionaryToSelectList(profileTypes, false); // Set profile box name and save current box count/year var warehouseBoxNumber = _profileBoxService.GetNextBoxNumber(_workContext.User.WarehouseId); info.Name = GetProfileBoxName(info.ProfileTypeList.Count > 0 ? info.ProfileTypeList[0].Text : "", _workContext.User.WarehouseId, warehouseBoxNumber.BoxNumber, warehouseBoxNumber.Year); info.CurrentBoxCount = warehouseBoxNumber.BoxNumber; info.CurrentWHYear = warehouseBoxNumber.Year; //Dictionary<string, string> warehouses = _warehouseService.GetAllWarehouses(); //info.WarehousesList = WebUtility.ConvertDictionaryToSelectList(warehouses, false); return(PartialView("_ProfileBoxAddNew", info)); }
public ActionResult NotScanned(NotScannedModel.DistributorUpdateSearchModel search, int page = 1, int pageSize = 10, GridSortOptions sort = null) { var model = new NotScannedModel(); if (search.StartDate == DateTime.MinValue) { search.StartDate = DateTime.Now.AddDays(-7); } if (search.EndDate == DateTime.MinValue) { search.EndDate = DateTime.Now; } // Search criteria model.AllDistributorUpdateTypes = _distributorService.GetAllDistributorUpdateTypeNames().Select(x => new SelectListItem() { Text = x, Value = x }).ToList().InsertEmptyValue(); model.AllWarehouses = WebUtility.ConvertDictionaryToSelectList(_warehouseService.GetAllWarehouses(), true); model.Search = search; if (Request.QueryString.HasKeys()) { // Set profile box data if (sort == null || string.IsNullOrEmpty(sort.Column)) { sort = new GridSortOptions() { Column = "DistNumber", Direction = SortDirection.Ascending } } ; ViewBag.Sort = sort; var boxes = _distributorService.SearchDistributorUpdates( new DistributorUpdateSearchCriteria { StartDate = CommonHelper.GetStartOfDate(search.StartDate), EndDate = CommonHelper.GetEndOfDate(search.EndDate), Statuses = new[] { (short)DistributorUpdateStatus.NotCompleted }, WarehouseId = search.WarehouseId, UpdateType = search.UpdateType }, page, pageSize, sort.Column, WebUtility.GetSortDir(sort)); model.DistributorUpdates = boxes.Select(x => x.ToModel <NotScannedModel.DistributorUpdateModel>()).ToList(); model.Pager = boxes.ToMvcPaging(model.DistributorUpdates); // If current page > total pages, redirect to last page if (model.Pager.TotalPages > 0 && model.Pager.PageNumber > model.Pager.TotalPages) { return(Redirect(Url.Paging(model.Pager.TotalPages, model.Pager.PageSize).ToString())); } } return(View(model)); }
public async Task <ActionResult> GetUserNewForm() { var userInfo = new UserModel { IsEditMode = false }; Dictionary <string, string> roles = _userService.GetRoles(); userInfo.RoleList = WebUtility.ConvertDictionaryToSelectList(roles, false); Dictionary <string, string> warehouses = _warehouseService.GetAllWarehouses(); userInfo.WarehouseList = WebUtility.ConvertDictionaryToSelectList(warehouses, false); return(PartialView("_NewEditForm", userInfo)); }
public ActionResult Index(UserSearchModel search, int pageIndex = 1, int pageSize = 10) { var model = new UsersModel(); Dictionary <string, string> warehouses = _warehouseService.GetAllWarehouses(); ViewBag.Warehouses = WebUtility.ConvertDictionaryToSelectList(warehouses, true); Dictionary <string, string> users = _userService.GetAllUsers(); ViewBag.Users = WebUtility.ConvertDictionaryToSelectList(users, true); model.Search = search; var data = _userService.GetUsers(pageIndex, pageSize, search.WarehouseId, (search.UserId == null) ? 0 : search.UserId.Value); model.Data = data.Select(x => x.ToModel <UserGridModel>()).ToList(); model.Pager = data.ToMvcPaging(model.Data); return(View(model)); }
public ActionResult PrintLetter(DistributorLetterSearchModel search, int page = 1, int pageSize = 10, GridSortOptions sort = null) { search.StartDate = (search.StartDate.Date.ToShortDateString() == "1/1/0001") ? DateTime.Now.AddDays(-7) : search.StartDate; search.EndDate = (search.EndDate.Date.ToShortDateString() == "1/1/0001") ? DateTime.Now : search.EndDate; Dictionary <string, string> warehouses = _warehouseService.GetAllWarehouses(); ViewBag.Warehouses = WebUtility.ConvertDictionaryToSelectList(warehouses, true); DistributorLetterModel model = new DistributorLetterModel { Search = search, NewLetter = new NewLetterModel() }; var data = _distributorService.SearchDistributorLetter(search.DistributorNumber, search.StartDate, search.EndDate, search.WarehouseID, page, pageSize, sort.Column, ""); model.Data = data.Select(x => x.ToModel <DistributorGridModel>()).ToList(); model.Pager = data.ToMvcPaging(model.Data); return(View(model)); }
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)); }
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)); }