예제 #1
0
        public ActionResult Save(EditShipmentViewModel model, string command)
        {
            if (command.ToLower() == "save")
            {
                // Save the screen data back to the db and exit
                adjustDates(model.Shipment, model.TZ);

                var modelError = ShipmentService.InsertOrUpdateShipment(model.Shipment, CurrentUser, model.LGS);
                if (modelError.IsError)
                {
                    prepareEditModel(model, model.Shipment);
                    model.SetErrorOnField(ErrorIcon.Error,
                                          modelError.Message,
                                          "Shipment_" + modelError.FieldName);
                    return(View("Edit", model));
                }
                else
                {
                    return(RedirectToAction("Shipments"));
                }
            }
            else
            {
                return(RedirectToAction("Shipments"));
            }
        }
예제 #2
0
        void prepareEditModel(EditShipmentViewModel model, ShipmentModel shipment)
        {
            PrepareViewModel(model, EvolutionResources.bnrAddEditShipment + " - " + EvolutionResources.lblShipment + ": " + model.Shipment.Id.ToString(), shipment.Id, MakeMenuOptionFlags(0, 0, shipment.Id));

            model.ShippingMethodList = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.ShippingMethod);
            model.CarrierVesselList  = LookupService.FindCarrierVesselListItemModel();
            model.PortList           = LookupService.FindPortsListItemModel();
            model.SeasonList         = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.Season);
        }
예제 #3
0
        public ActionResult Add()
        {
            // Called when the user clicks 'Create' to create a new shipment
            var model = new EditShipmentViewModel();

            model.Shipment = ShipmentService.FindShipmentModel(0, CurrentCompany, true);
            prepareEditModel(model, model.Shipment);

            return(View("Edit", model));
        }
예제 #4
0
        public ActionResult Edit(int id)
        {
            // Called when a user clicks to edit an order
            var model = new EditShipmentViewModel();

            model.Shipment = ShipmentService.FindShipmentModel(id, CurrentCompany, true);
            prepareEditModel(model, model.Shipment);

            model.LGS = ShipmentService.LockShipment(model.Shipment);

            return(View("Edit", model));
        }
예제 #5
0
        public ActionResult EditContent(int shipmentId, int contentId)
        {
            // Called when a user clicks to edit an order - we
            // go straight to the lines screen
            var contentModel = ShipmentService.FindShipmentContentModel(contentId);

            if (contentModel != null)
            {
                return(RedirectToAction("Edit", "Purchasing", new { area = "Purchasing", id = $"{contentModel.PurchaseOrderHeaderId}" }));
            }
            else
            {
                var model = new EditShipmentViewModel();

                model.Shipment = ShipmentService.FindShipmentModel(shipmentId, CurrentCompany, true);
                prepareEditModel(model, model.Shipment);

                model.LGS = ShipmentService.LockShipment(model.Shipment);

                model.SetRecordError("ShipmentContent", contentId, true);

                return(View("Edit", model));
            }
        }