Beispiel #1
0
        public void Fill(AddressInfoGrid clInfo, FranchiseInfoModel franchise)
        {
            IsSearchByWaterfall = false;
            IsSearchByCode      = !clInfo.AddressInfo.IsMap;
            IsSearchByMap       = clInfo.AddressInfo.IsMap;
            Franchise           = franchise;


            RxApp.MainThreadScheduler.Schedule(_ =>
            {
                ErrorUpsert = String.Empty;
                PreId       = clInfo.PreId;
                var addr    = clInfo.AddressInfo;
                Id          = addr.AddressId;


                if (clInfo.AddressInfo.IsMap)
                {
                    AddressMapInfo = new AddressMapInfoModel
                    {
                        Address = new AddressMapModel
                        {
                            Country     = addr.Country.Value,
                            MainAddress = addr.MainAddress,
                            NumExt      = addr.ExtIntNumber,
                            Reference   = addr.Reference,
                            RegionA     = addr.RegionA.Value,
                            RegionB     = addr.RegionB.Value,
                            RegionC     = addr.RegionC.Value,
                            RegionD     = addr.RegionD.Value,
                            ZipCode     = addr.ZipCode.Value
                        },
                        PlaceId  = addr.PlaceId,
                        Position = new PositionModel
                        {
                            Lat = addr.Lat,
                            Lng = addr.Lng,
                        }
                    };
                }
                else
                {
                    ZipCodeId = (int?)addr.ZipCode.IdKey;
                    ZipCode   = addr.ZipCode.Value;
                    ZipCodeSearchVm.Search = ZipCodeId != null ? ZipCode : String.Empty;
                    ZipCodeSearchVm.IsDone = SharedConstants.Client.IS_TRUE;

                    CountrySel  = AddAndSelectToControl(addr.Country, Countries);
                    RegionArSel = AddAndSelectToControl(addr.RegionA, RegionsA);
                    RegionBrSel = AddAndSelectToControl(addr.RegionB, RegionsB);
                    RegionCrSel = AddAndSelectToControl(addr.RegionC, RegionsC);
                    RegionDrSel = AddAndSelectToControl(addr.RegionD, RegionsD);
                }

                MainAddress = addr.MainAddress;
                Reference   = addr.Reference;
                NumExt      = addr.ExtIntNumber;
            });
        }
Beispiel #2
0
        public void Save(AddressMapInfoModel model)
        {
            var addressInfo = new AddressInfoModel
            {
                AddressId = Id,
                Country   = new ListItemModel {
                    Value = model.Address.Country
                },
                ExtIntNumber = model.Address.NumExt,
                MainAddress  = model.Address.MainAddress,
                Reference    = model.Address.Reference,
                RegionA      = new ListItemModel {
                    Value = model.Address.RegionA
                },
                RegionB = new ListItemModel {
                    Value = model.Address.RegionB
                },
                RegionC = new ListItemModel {
                    Value = model.Address.RegionC
                },
                RegionD = new ListItemModel {
                    Value = model.Address.RegionD
                },
                ZipCode = new ListItemModel {
                    Value = model.Address.ZipCode
                },
                PlaceId          = model.PlaceId,
                StoreCoverageIds = model.CoverageStoreIds,
                IsMap            = true
            };

            if (model.Position != null)
            {
                addressInfo.Lat = model.Position.Lat;
                addressInfo.Lng = model.Position.Lng;
            }

            MessageBus.Current.SendMessage(new AddressInfoGrid
            {
                PreId       = PreId,
                AddressInfo = addressInfo
            }, SharedMessageConstants.ORDER_ADDRESSINFO);
        }