Example #1
0
        private ActionResult DoDisplayRequest(PullRequest requestInfo, ViewTab selectedTab)
        {
            var model = new ManageSkuViewModel(requestInfo);

            var qualities = _service.GetQualityCodes();

            model.Qualities = qualities.Select(p => MapCode(p));

            var sewingPlants = _service.GetSewingPlantCodes();

            model.SewingPlantCodes = sewingPlants.Select(p => MapCode(p));

            var priceSeasonCodes = _service.GetPriceSeasonCodes();

            model.PriceSeasonCodes = priceSeasonCodes.Select(p => MapCode(p));

            var buildings = _service.GetBuildingList();

            model.BuildingList = buildings.Select(p => MapCode(p));

            //model.CurrentRequest = new ManageSkuRequestModel(requestInfo);

            var skus = _service.GetRequestSKUs(requestInfo.CtnResvId);

            model.RequestedSkus = skus.Select(p => new RequestSkuViewModel(p)).ToList();

            var result = _service.GetAssignedCartons(requestInfo.CtnResvId);

            model.AssignedCartonInfo = result.Select(row => new AssignedCartonModel
            {
                PulledCartons = row.PulledCartons,
                TotalCartons  = row.TotalCartons,
                PulledPieces  = row.PulledPieces,
                TotalPieces   = row.TotalPieces,
                Sku           = new SkuModel
                {
                    Style     = row.Sku.Style,
                    Color     = row.Sku.Color,
                    Dimension = row.Sku.Dimension,
                    SkuSize   = row.Sku.SkuSize,
                    SkuId     = row.Sku.SkuId,
                    UpcCode   = row.Sku.UpcCode
                }
            }).ToList();
            model.SelectedTab = selectedTab;

            return(View(Views.SkuEditor, model));
        }
Example #2
0
        public virtual ActionResult AddSku(ManageSkuViewModel model)
        {
            //User can convert only VwhId without providing target sku.Target sku is only required when user wants to convert sku
            Sku targetSku = null;

            if (model.RequestForConversion)
            {
                if (string.IsNullOrEmpty(model.TargetStyle) && string.IsNullOrEmpty(model.TargetColor) && string.IsNullOrEmpty(model.TargetDimension) && string.IsNullOrEmpty(model.TargetSkuSize))
                {
                    // Target SKU is required.
                    this.Response.StatusCode = 203;
                    return(Content("Target SKU is required."));
                }
                targetSku = _service.GetSku(model.TargetStyle, model.TargetColor, model.TargetDimension, model.TargetSkuSize);
                if (targetSku == null)
                {
                    // Target SKU is required.
                    this.Response.StatusCode = 203;
                    return(Content(string.Format("Target SKU {0},{1},{2},{3} is invalid", model.TargetStyle, model.TargetColor, model.TargetDimension, model.TargetSkuSize)));
                }
            }
            var newSku = _service.GetSku(model.NewStyle, model.NewColor, model.NewDimension, model.NewSkuSize);

            if (newSku == null)
            {
                this.Response.StatusCode = 203;
                return(Content(string.Format("SKU {0},{1},{2},{3} is invalid", model.NewStyle, model.NewColor, model.NewDimension, model.NewSkuSize)));
            }
            try
            {
                //Adding sku to request
                _service.AddSkutoRequest(model.ResvId, newSku.SkuId, model.NewPieces.Value,
                                         targetSku == null ? (int?)null : targetSku.SkuId);

                //getting list of added all SKUs to request.
                var skus = _service.GetRequestSKUs(model.ResvId);
                model.RequestedSkus = skus.Select(p => new RequestSkuViewModel(p)).ToList();
                return(PartialView(Views._manageSkuListPartial, model));
            }
            catch (Exception ex)
            {
                // Simulate the behavior of the obsolete HandleAjaxError attribute
                this.Response.StatusCode = 203;
                return(Content(ex.Message));
            }
        }
Example #3
0
 public virtual ActionResult DeleteSku(int?skuId, string resvId)
 {
     if (skuId == null || string.IsNullOrEmpty(resvId))
     {
         this.Response.StatusCode = 203;
         return(Content("Inappropriate data can't perform delete operation"));
     }
     try
     {
         //Deleting SKU from the Request
         _service.DeleteSkuFromRequest((int)skuId, resvId);
         var model = new ManageSkuViewModel();
         //Getting all remaining SKUs of Request
         var skus = _service.GetRequestSKUs(resvId);
         model.RequestedSkus = skus.Select(p => new RequestSkuViewModel(p)).ToList();
         return(PartialView(MVC_REQ2.REQ2.Home.Views._manageSkuListPartial, model));
     }
     catch (Exception ex)
     {
         // Simulate the behavior of the obsolete HandleAjaxError attribute
         this.Response.StatusCode = 203;
         return(Content(ex.Message));
     }
 }