Пример #1
0
        void prepareEditModel(EditCustomerFreightViewModel model, int id)
        {
            PrepareViewModel(model, EvolutionResources.bnrCustomerFreight + (id > 0 ? " - CustId:" + id.ToString() : ""), id, MakeMenuOptionFlags(id, 0));

            model.FreightCarrierList = LookupService.FindFreightCarriersListItemModel(CurrentCompany.Id);
            model.FreightTermList    = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.FreightTerm);
        }
Пример #2
0
        public ActionResult CustomerFreight(int id)
        {
            var model = new EditCustomerFreightViewModel();

            prepareEditModel(model, id);

            model.CustomerFreight = CustomerService.FindCustomerFreightModel(id, CurrentCompany);
            model.LGS             = CustomerService.LockCustomerFreight(model.CustomerFreight);

            return(View(model));
        }
Пример #3
0
        public ActionResult Save(EditCustomerFreightViewModel model, string command)
        {
            var modelError = CustomerService.InsertOrUpdateCustomerFreight(model.CustomerFreight, CurrentUser, model.LGS);

            if (modelError.IsError)
            {
                prepareEditModel(model, model.CustomerFreight.CustomerId);
                model.SetErrorOnField(ErrorIcon.Error,
                                      modelError.Message,
                                      "CustomerFreight_" + modelError.FieldName);
                return(View("CustomerFreight", model));
            }
            else
            {
                prepareEditModel(model, model.CustomerFreight.CustomerId);
                model.SetErrorOnField(ErrorIcon.Information,
                                      EvolutionResources.infChangesSuccessfullySaved,
                                      "CustomerFreight_FreightCarrierId" + modelError.FieldName);
                return(View("CustomerFreight", model));
            }
        }