Esempio n. 1
0
        public ActionResult Edit(long id)
        {
            var response = new ShipperService().GetShipperByID(new ShipperByIDRequest()
            {
                ID = id
            });

            if (response.IsSuccess)
            {
                ShipperVM model = new ShipperVM(response.Result);
                model.AvailableShipperIdentifies = ApplicationConfigHelper.GetApplicationConfigs(Constants.SHIPPERIDENTIFY);
                model.SelectedShipperIdentifies  = model.AvailableShipperIdentifies.Where(t => response.Result.Str1.Split(',').Contains(t.ID.ToString()));
                model.IsEdit = true;
                return(View("Create", model));
            }
            else
            {
                ShipperVM model = new ShipperVM();
                model.AvailableShipperIdentifies = ApplicationConfigHelper.GetApplicationConfigs(Constants.SHIPPERIDENTIFY);
                model.SelectedShipperIdentifies  = Enumerable.Empty <Config>();
                model.IsEdit    = false;
                ViewBag.Message = "获取数据失败!";
                return(View("Create", model));
            }
        }
Esempio n. 2
0
        public ActionResult Create()
        {
            ShipperVM shipper = new ShipperVM();

            shipper.AvailableShipperIdentifies = ApplicationConfigHelper.GetApplicationConfigs(Constants.SHIPPERIDENTIFY);
            shipper.SelectedShipperIdentifies  = shipper.AvailableShipperIdentifies;
            shipper.IsEdit = false;
            shipper.State  = true;
            return(View(shipper));
        }
Esempio n. 3
0
        public ActionResult Edit(ShipperVM model)
        {
            if (ModelState.IsValid)
            {
                ShipperEntity shipper = new ShipperEntity()
                {
                    ID                 = model.ID,
                    Code               = model.Code,
                    Name               = model.Name,
                    EnglishName        = model.EnglishName,
                    IsDangerous        = model.IsDangerous,
                    IsCustoms          = model.IsCustoms,
                    Email              = model.Email,
                    LawPerson          = model.LawPerson,
                    IsSupplier         = model.IsSupplier,
                    IsBalance          = model.IsBalance,
                    PostCode           = model.PostCode,
                    Address1           = model.Address1,
                    Address2           = model.Address2,
                    Bank               = model.Bank,
                    Account            = model.Account,
                    TaxID              = model.TaxID,
                    InvoiceTitle       = model.InvoiceTitle,
                    Contactor1         = model.Contactor1,
                    Title1             = model.Title1,
                    Phone1             = model.Phone1,
                    Fax1               = model.Fax1,
                    Contactor2         = model.Contactor2,
                    Title2             = model.Title2,
                    Phone2             = model.Phone2,
                    Fax2               = model.Fax2,
                    WebSite            = model.WebSite,
                    RegistAdd          = model.RegistAdd,
                    Comment            = model.Comment,
                    Creater            = model.Creater,
                    CreateTime         = model.CreateTime,
                    InsuranceCompany   = model.InsuranceCompany,
                    InsuranceType      = model.InsuranceType,
                    InsuranceOrderNo   = model.InsuranceOrderNo,
                    InsuranceCost      = model.InsuranceCost,
                    InsuranceStartTime = model.InsuranceStartTime,
                    InsuranceEndTime   = model.InsuranceEndTime,
                    Remark             = model.Remark,
                    State              = model.State,
                    Updater            = base.UserInfo.Name,
                    UpdateTime         = DateTime.Now,
                    Str1               = model.PostedShipperIdentifyIDs != null && model.PostedShipperIdentifyIDs.Any() ? string.Join(",", model.PostedShipperIdentifyIDs) : string.Empty,
                    Str2               = model.Str2,
                    Str3               = model.Str3
                };

                Response <long> response = new ShipperService().AddOrUpdateShipper(new AddOrUpdateShipperRequest()
                {
                    Shipper = shipper
                });
                if (response.IsSuccess)
                {
                    ApplicationConfigHelper.RefreshApplicationShippers();
                }
                ViewBag.Message = response.SuccessMessage;
            }

            model.AvailableShipperIdentifies = ApplicationConfigHelper.GetApplicationConfigs(Constants.SHIPPERIDENTIFY);
            model.SelectedShipperIdentifies  = model.AvailableShipperIdentifies.Where(t => model.PostedShipperIdentifyIDs.Contains(t.ID.ToString()));
            model.IsEdit = true;

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