Exemple #1
0
        public PropertyDetailViewModel(INavigation navigation, PropertyDataModel propertyTapCommand) : base(navigation)
        {
            PropertyDataModel = propertyTapCommand;

            if (!string.IsNullOrEmpty(PropertyDataModel.DuvetSize) && !string.IsNullOrWhiteSpace(PropertyDataModel.DuvetSize))
            {
                IsDuvetSize = true;
            }
            else
            {
                IsDuvetSize = false;
            }
            if (!string.IsNullOrEmpty(PropertyDataModel.AccessToProperty) && !string.IsNullOrWhiteSpace(PropertyDataModel.AccessToProperty))
            {
                IsAccessProperty = true;
            }
            else
            {
                IsAccessProperty = false;
            }
            if (!string.IsNullOrEmpty(PropertyDataModel.Size) && !string.IsNullOrWhiteSpace(PropertyDataModel.Size))
            {
                IsPropertySize = true;
            }
            else
            {
                IsPropertySize = false;
            }
        }
        public UpdatePropertyViewModel(INavigation navigation, PropertyDataModel propertyDataModel) : base(navigation)
        {
            PropertyDataModel = propertyDataModel;
            if (Application.Current.Properties.ContainsKey("CurrentUserId"))
            {
                CurrentUserId = Convert.ToInt32(Application.Current.Properties["CurrentUserId"]);
            }

            // Short Term Apt
            if (PropertyDataModel.ShortTermApartment == true)
            {
                RadioYesImageAirbnb = "ic_cheked.png";
                RadioNoImageAirbnb  = "ic_uncheked.png";
            }
            else if (PropertyDataModel.ShortTermApartment == false)
            {
                RadioNoImageAirbnb  = "ic_cheked.png";
                RadioYesImageAirbnb = "ic_uncheked.png";
            }


            // Doorman
            if (PropertyDataModel.Doorman == true)
            {
                RadioYesImageDoorman = "ic_cheked.png";
                RadioNoImageDoorman  = "ic_uncheked.png";
            }
            else if (PropertyDataModel.Doorman == false)
            {
                RadioNoImageDoorman  = "ic_cheked.png";
                RadioYesImageDoorman = "ic_uncheked.png";
            }

            // Parking
            if (PropertyDataModel.Parking == true)
            {
                RadioYesImageParking = "ic_cheked.png";
                RadioNoImageParking  = "ic_uncheked.png";
            }
            else if (PropertyDataModel.Parking == false)
            {
                RadioNoImageParking  = "ic_cheked.png";
                RadioYesImageParking = "ic_uncheked.png";
            }

            // Balcony
            if (PropertyDataModel.Balcony == true)
            {
                RadioYesImageBalcony = "ic_cheked.png";
                RadioNoImageBalcony  = "ic_uncheked.png";
            }
            else if (PropertyDataModel.Balcony == false)
            {
                RadioNoImageBalcony  = "ic_cheked.png";
                RadioYesImageBalcony = "ic_uncheked.png";
            }

            // Dishwasher
            if (PropertyDataModel.Dishwasher == true)
            {
                RadioYesImageDishwasher = "ic_cheked.png";
                RadioNoImageDishwasher  = "ic_uncheked.png";
            }
            else if (PropertyDataModel.Dishwasher == false)
            {
                RadioNoImageDishwasher  = "ic_cheked.png";
                RadioYesImageDishwasher = "ic_uncheked.png";
            }

            // Pool
            if (PropertyDataModel.Pool == true)
            {
                RadioYesImagePool = "ic_cheked.png";
                RadioNoImagePool  = "ic_uncheked.png";
            }
            else if (PropertyDataModel.Pool == false)
            {
                RadioNoImagePool  = "ic_cheked.png";
                RadioYesImagePool = "ic_uncheked.png";
            }

            // Garden
            if (PropertyDataModel.Garden == true)
            {
                RadioYesImageGarden = "ic_cheked.png";
                RadioNoImageGarden  = "ic_uncheked.png";
            }
            else if (PropertyDataModel.Garden == false)
            {
                RadioNoImageGarden  = "ic_cheked.png";
                RadioYesImageGarden = "ic_uncheked.png";
            }


            // Elevator
            if (PropertyDataModel.Elevator == true)
            {
                RadioYesImageElevator = "ic_cheked.png";
                RadioNoImageElevator  = "ic_uncheked.png";
            }
            else if (PropertyDataModel.Elevator == false)
            {
                RadioNoImageElevator  = "ic_cheked.png";
                RadioYesImageElevator = "ic_uncheked.png";
            }

            // Property Type
            switch (PropertyDataModel.Type)
            {
            case "Apartment":
                PropertyTypeSelectedIndexChanged = 0;
                break;

            case "Villa":
                PropertyTypeSelectedIndexChanged = 1;
                break;

            case "Duplex":
                PropertyTypeSelectedIndexChanged = 2;
                break;

            case "Penthouse":
                PropertyTypeSelectedIndexChanged = 3;
                break;
            }

            QueenBedSelectedIndexChanged       = PropertyDataModel.NoOfQueenBeds.Value - 1;
            SingleBedSelectedIndexChanged      = PropertyDataModel.NoOfSingleBeds.Value - 1;
            DoubleBedSelectedIndexChanged      = PropertyDataModel.NoOfDoubleBeds.Value - 1;
            SingleSophaBedSelectedIndexChanged = PropertyDataModel.NoOfSingleSofaBeds.Value - 1;
            DoubleSophaBedSelectedIndexChanged = PropertyDataModel.NoOfDoubleSofaBeds.Value - 1;

            switch (PropertyDataModel.DuvetSize)
            {
            case "Small":
                DuvetSizeSelectedIndexChanged = 0;
                break;

            case "Medium":
                DuvetSizeSelectedIndexChanged = 1;
                break;

            case "Large":
                DuvetSizeSelectedIndexChanged = 2;
                break;

            case null:
                DuvetSizeSelectedIndexChanged = -1;
                break;
            }


            MessagingCenter.Subscribe <string>(this, "IsNavigationFromRegisterPage", (sender) =>
            {
                if (sender.Equals("Register"))
                {
                    IsNavigationFromRegisterPage = true;
                }
                else
                {
                    IsNavigationFromRegisterPage = false;
                }
            });
        }