public ActionResult Insert(ProfileBoxInfomationModel box) { var path = box.FolderPath; var profile = _profileBoxService.GetByFolderPath(path); if (profile != null) { ErrorNotification(_resourceManager.GetString("Profile.FailedToAddProfileBoxDulicatePath")); return(Redirect(Request.UrlReferrer.ToString())); } else { ProfileBox newBox = new ProfileBox { Name = box.Name, ADACount = 0, OfficeId = _workContext.User.WarehouseId, ProfileCount = 0, WarehouseId = _workContext.User.WarehouseId, TypeId = box.ProfileType, StatusId = (short)ABO.Core.ProfileBoxStatus.Open, CreatedBy = _workContext.User.UserID, CreatedDate = DateTime.Now, UpdatedDate = DateTime.Now, ScannedFolder = box.FolderPath }; _profileBoxService.Insert(newBox); SuccessNotification(_resourceManager.GetString("Profile.SuccessToAddProfileBox") + " File lưu tại: " + path); return(Redirect(Request.UrlReferrer.ToString())); } }
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)); }