Exemplo n.º 1
0
        public static Shortlist Open(string id)
        {
            var key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\HomeHunter\Shortlists\" + id);

            if (key == null)
            {
                throw new InvalidOperationException("Shortlist " + id + " does not exist.");
            }

            var shortlist = new Shortlist();

            shortlist.Id                             = id;
            shortlist.Name                           = key.GetValue("Name").ToString();
            shortlist.ExcludeTerms                   = WebInput.ToList(key.GetValue("ExcludeTerms"));
            shortlist.IncludeTerms                   = WebInput.ToList(key.GetValue("IncludeTerms"));
            shortlist.ExcludePostcodes               = WebInput.ToList(key.GetValue("ExcludePostcodes"));
            shortlist.MinimumPrice                   = Convert.ToInt32(key.GetValue("MinimumPrice"));
            shortlist.MaximumPrice                   = Convert.ToInt32(key.GetValue("MaximumPrice"));
            shortlist.AdvertisedOnOrAfter            = (DateTimeRange)Convert.ToInt32(key.GetValue("AdvertisedOnOrAfter"));
            shortlist.AdvertisedForOrOver            = (DateTimeRange)Convert.ToInt32(key.GetValue("AdvertisedForOrOver"));
            shortlist.SortOrder                      = (PropertyListingSortOrder)Convert.ToInt32(key.GetValue("SortOrder"));
            shortlist.LocationToSortBy               = key.GetValue("LocationToSortBy").ToString();
            shortlist.ExcludePriceOnApplication      = Convert.ToBoolean(key.GetValue("ExcludePriceOnApplication"));
            shortlist.ExcludeOffersInvited           = Convert.ToBoolean(key.GetValue("ExcludeOffersInvited"));
            shortlist.ResetIndexAtStart              = Convert.ToBoolean(key.GetValue("ResetIndexAtStart"));
            shortlist.Rightmove42PageLimitFixEnabled = Convert.ToBoolean(key.GetValue("Rightmove42PageLimitFixEnabled"));
            shortlist.ExcludePropertyUrls            = WebInput.ToList(key.GetValue("ExcludePropertyUrls"));

            return(shortlist);
        }
Exemplo n.º 2
0
 public void Save(dynamic eventArgs)
 {
     _shortlist.Name                      = eventArgs.name;
     _shortlist.ExcludeTerms              = WebInput.ToList(eventArgs.excludeTerms);
     _shortlist.IncludeTerms              = WebInput.ToList(eventArgs.includeTerms);
     _shortlist.ExcludePostcodes          = WebInput.ToList(eventArgs.excludePostcodes);
     _shortlist.MinimumPrice              = WebInput.ToInt32(eventArgs.minimumPrice);
     _shortlist.MaximumPrice              = WebInput.ToInt32(eventArgs.maximumPrice);
     _shortlist.AdvertisedOnOrAfter       = (DateTimeRange)Convert.ToInt32(eventArgs.advertisedOnOrAfter);
     _shortlist.AdvertisedForOrOver       = (DateTimeRange)Convert.ToInt32(eventArgs.advertisedForOrOver);
     _shortlist.SortOrder                 = (PropertyListingSortOrder)Convert.ToInt32(eventArgs.sortOrder);
     _shortlist.LocationToSortBy          = eventArgs.locationToSortBy;
     _shortlist.ExcludePriceOnApplication = Convert.ToBoolean(eventArgs.excludePriceOnApplication);
     _shortlist.ExcludeOffersInvited      = Convert.ToBoolean(eventArgs.excludeOffersInvited);
     _shortlist.Save();
     this.InvokeOnUiThreadIfRequired(() => Close());
 }