public virtual ActionResult Carton(string serializedContext, string palletId, char sound = '\0') { var ctx = new ContextModel { Serialized = serializedContext }; int oldSuggestionCount; palletId = palletId.Trim().ToUpper(); var cartons = _service.GetCartonSuggestions(ctx.BuildingId, ctx.PickAreaId, ctx.RestockAreaId, palletId, 5, out oldSuggestionCount); if (!cartons.Any()) { // TC8: No cartons available for replenishing AddStatusMessage(string.Format("Nothing to pull for [{0}] {1} -> {2} -> {3}", ctx.BuildingId, ctx.CartonAreaId, ctx.RestockAreaId, ctx.ShortName)); return(Pallet(serializedContext)); } var pallet = _service.GetPallet(palletId); //If pallet already contains cartons, making sure that the puller is continuing with partially pulled pallet or any other random pallet. //If it is a random pallet, then aware the puller for case of aisle mixing. if (pallet.CartonCount > 0 && oldSuggestionCount == 0) { AddStatusMessage(string.Format("Pallet {0} already contains cartons {1}, Make sure that you are not mixing cartons of different aisles.", pallet.PalletId, pallet.CartonCount)); } var cartonList = from carton in cartons select new CartonModel { CartonId = carton.CartonId, LocationId = carton.LocationId, SkuInCarton = new SkuModel { SkuId = carton.SkuInCarton.SkuId, Color = carton.SkuInCarton.Color, Style = carton.SkuInCarton.Style, Dimension = carton.SkuInCarton.Dimension, SkuSize = carton.SkuInCarton.SkuSize, UpcCode = carton.SkuInCarton.UpcCode }, SkuReplenishmentPriority = carton.SkuPriority }; var cvm = new CartonViewModel { PalletId = palletId, CartonList = cartonList, Context = new ContextModel { Serialized = serializedContext, }, RestockAisleId = cartons.First().RestockAisleId, CountCartonsOnPallet = pallet.CartonCount, PriceSeasonCode = pallet.PriceSeasonCode, Sound = sound, IsPuller = AuthorizeExAttribute.IsSuperUser(HttpContext) || HttpContext.User.IsInRole(ROLE_PUL) }; return(View(Views.Carton, cvm)); }
/// <summary> /// Set Editable properties on the base view model /// </summary> /// <param name="filterContext"></param> protected override void OnActionExecuted(ActionExecutedContext filterContext) { var vr = filterContext.Result as ViewResult; if (vr != null) { var model = vr.Model as ViewModelBase; if (model != null) { if (model.IsEditable == null || model.IsEditable.Value) { // Action has not specified any value, or it has permitted editing. // In this case we ensure that the logged in user has proper privileges. // Super users and people having the correct role are always alloed to edit. model.IsEditable = AuthorizeExAttribute.IsSuperUser(this.HttpContext) || this.HttpContext.User.IsInRole(ROLE_SECURITY_ADMIN); } else { // The action does not want this page to be editable. Honor its desire. } model.EditableRoleName = ROLE_SECURITY_ADMIN; } } base.OnActionExecuted(filterContext); }
public virtual ActionResult Index() { var model = new IndexViewModel(); var sc = _service.Value.GetSpotCheckList(); model.EnableEditing = AuthorizeExAttribute.IsSuperUser(HttpContext) || this.HttpContext.User.IsInRole(ROLE_RAD_EDITING); model.SpotCheckAreaList = _service.Value.GetSpotCheckAreas().Select(p => new SpotCheckAreaModel(p)).ToList(); var query = from item in sc group item by item.SewingPlantId into g let defstyle = g.Where(p => string.IsNullOrWhiteSpace(p.Style)).FirstOrDefault() orderby g.Key select new SewingPlantGroupModel { SewingPlantId = g.Key, PlantName = g.Where(p => p.SewingPlantId == g.Key).First().PlantName, SpotCheckPercent = defstyle == null ? null : defstyle.SpotCheckPercent, CreatedBy = defstyle == null ? "" : defstyle.CreatedBy, CreatedDate = defstyle == null ? null : defstyle.CreatedDate, IsSpotCheckEnabled = defstyle == null ? true : (defstyle.IsSpotCheckEnable ?? true), ModifiedBy = defstyle == null ? "" : defstyle.ModifiedBy, ModifiedDate = defstyle == null ? null : defstyle.ModifiedDate, Styles = (from item2 in g where !string.IsNullOrWhiteSpace(item2.Style) orderby item2.Style, item2.Color select new SpotCheckConfigurationModel(item2)).ToList() }; model.SewingPlants = query.ToList(); return(View(Views.Index, model)); }
protected override void OnActionExecuted(ActionExecutedContext filterContext) { var vr = filterContext.Result as ViewResult; if (vr != null) { var model = vr.Model as ViewModelBase; if (model != null) { model.IsEditable = AuthorizeExAttribute.IsSuperUser(HttpContext) || HttpContext.User.IsInRole(ROLE_MANAGE_REPLENISHMENT); model.EditableRoleName = ROLE_MANAGE_REPLENISHMENT; } } base.OnActionExecuted(filterContext); }
protected override void OnActionExecuted(ActionExecutedContext filterContext) { var vr = filterContext.Result as ViewResult; if (vr != null) { var model = vr.Model as VasConfigurationViewModelBase; if (model != null) { model.IsEditable = AuthorizeExAttribute.IsSuperUser(HttpContext) || HttpContext.User.IsInRole(VAS_CONFIGURATION_ROLE); model.EditableRoleName = VAS_CONFIGURATION_ROLE; } } base.OnActionExecuted(filterContext); }
/// <summary> /// Set Editable properties on the base view model /// </summary> /// <param name="filterContext"></param> protected override void OnActionExecuted(ActionExecutedContext filterContext) { var vr = filterContext.Result as ViewResultBase; if (vr != null) { var model = vr.Model as ViewModelBase; if (model != null) { model.UserIsManager = AuthorizeExAttribute.IsSuperUser(HttpContext) || HttpContext.User.IsInRole(ManagerRoleName); model.ManagerRoleName = ManagerRoleName; } } base.OnActionExecuted(filterContext); }
protected override void OnActionExecuted(ActionExecutedContext filterContext) { var vr = filterContext.Result as ViewResult; if (vr != null) { var model = (ViewModelBase)vr.Model; if (model == null) { throw new ApplicationException("Not expecting model to be null"); } model.BuildingId = _buildingId; model.BuildingDescription = _service.GetBuildingDescription(model.BuildingId); model.IsEditable = AuthorizeExAttribute.IsSuperUser(HttpContext) || HttpContext.User.IsInRole(ROLE_DCMS_LITE); model.DcmsLiteRoleName = ROLE_DCMS_LITE; } base.OnActionExecuted(filterContext); }
public virtual ActionResult Box(string id, bool showPrintDialog = false) { if (string.IsNullOrWhiteSpace(id)) { return(RedirectToAction(MVC_Inquiry.Inquiry.Home.Index())); } var box = _repos.Value.GetBoxOfUcc(id); if (box == null) { this.AddStatusMessage(string.Format("No box found for UCC Id {0}", id)); return(RedirectToAction(MVC_Inquiry.Inquiry.Home.Index())); } //var boxVas = _repos.Value.GetVasOnBox(id); var model = new BoxViewModel(box) { ShowPrintDialog = showPrintDialog, AuditList = _repos.Value.GetBoxProcesssHistory(id).Select(p => new BoxAuditModel(p)).ToArray(), PrinterList = _repos.Value.GetPrinters().Select(p => new SelectListItem { Text = string.Format("{0}: {1}", p.Item1, p.Item2), Value = p.Item1 }).ToArray(), //ListOfCompleteVas = boxVas.ListOfCompleteVas, //ListOfIncompleteVas = boxVas.ListOfIncompleteVas, CanCancelBox = AuthorizeExAttribute.IsSuperUser(this.HttpContext) || this.HttpContext.User.IsInRole(GlobalConstants.ROLE_MANAGER), ManagerRoleName = GlobalConstants.ROLE_MANAGER }; var route = Url.RouteCollection[DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_ApplyVasToBox1]; if (route != null) { model.UrlManageVas = Url.RouteUrl(DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_ApplyVasToBox1, new { id = model.Ucc128Id }); } route = Url.RouteCollection[DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_Logon]; if (route != null) { model.UrlLogin = Url.RouteUrl(DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_Logon, new { returnUrl = Url.Action(Actions.Box(id)) }); } route = Url.RouteCollection[DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_ScanToPallet1]; if (route != null) { model.UrlScanToPallet = Url.RouteUrl(DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_ScanToPallet1, new { id = model.Ucc128Id }); } var listBoxSku = _repos.Value.GetBoxSku(id, null); model.SkuWithEpc = listBoxSku.Select(p => new BoxSkuModel(p)).ToArray(); var boxVasList = _repos.Value.GetVasOnBox(id); model.VasStatusList = boxVasList.Select(p => new BoxVasModel(p)).ToList(); var pickers = listBoxSku.Select(p => p.MinPicker).Distinct(); model.PickerNames = string.Join(", ", pickers); if (model.SkuWithEpc != null) { var allepc = _repos.Value.GetBoxEpc(id); foreach (var sku in model.SkuWithEpc) { sku.AllEpc = allepc.Where(p => p.SkuId == sku.SkuId).Select(p => p.EpcCode).ToArray(); } } var cookie = this.Request.Cookies[GlobalConstants.COOKIE_UCC_CCL_PRINTER]; if (cookie != null) { model.PrinterId = cookie.Value; } return(View(Views.ViewNames.Box, model)); }