Пример #1
0
        public AzureSearchRProperty(Property property)
        {
            this.Baths = property.Baths;
            this.BathsFull = property.BathsFull;
            this.BathsHalf = string.IsNullOrWhiteSpace(property.BathsHalf) ? (int?)null : Int32.Parse(property.BathsHalf.Trim());
            this.Beds = property.Beds;
            this.PoolFlag = property.PoolFlag;
            //this.Fireplaces = property.Fireplace;
            //this.Stories = string.IsNullOrWhiteSpace(property.Stories) ? (int?)null : Int32.Parse(property.Building.Stories);

            this.BuilderTractName = property.BuilderTractName;
            this.City = property.City;
            //this.Community = property.Community;
            this.County = property.County;
            this.FullStreetAddress = property.FullStreetAddress;
            this.GrossSQFT = property.GrossSQFT;
            this.RandomNumber = property.RandomNumber;
            if (property.Latitude != null && property.Longitude != null)
            {
                this.GeoLocation = GeographyPoint.Create((double)property.Latitude.Value,
                (double)property.Longitude.Value);
            }
            this.ListingKey = "" + property.ListingKey; // azure search was giving error on type
            //this.LisAltAgentFirstName = property.LisAltAgentFirstName;
            //this.LisListAgentLastName = property.LisListAgentLastName;
            //this.LisSaleAgentLastName = property.LisSaleAgentLastName;
            //this.LisSaleOfficeFullOfficeName = property.LisSaleOfficeFullOfficeName;
            //this.LisSaleOfficeOfficePhoneDisplay = property.LisSaleOfficeOfficePhoneDisplay;
            //this.ListAgentAgentID = property.ListAgentAgentID;
            //this.ListOfficeOfficeID = property.ListOfficeOfficeID;

            this.ListingID = property.ListingID;

            this.ListPrice = property.ListPrice;
            this.LotAreaAcre = property.LotAreaAcre;
            this.LotSizeArea = property.LotSizeArea;
            //this.ModelCode = property.ModelCode;
            this.ModificationTimestamp = property.ModificationTimestamp;
            this.PropertyType = property.PropertyType;
            this.SearchLocality = property.SearchLocality;
            if (string.IsNullOrEmpty(property.SearchLocality))
            {
                AllowedZipcode lookup = new AllowedZipcode();
                this.SearchLocality = lookup.GetSearchRegion(property.PostalCode.Value);
            }
            this.State = property.State;
            this.PropertySubTypes = string.IsNullOrWhiteSpace(property.PropertySubTypes) ? null :
                property.PropertySubTypes.Contains("Condominium") ? "condo" :
                property.PropertySubTypes.Contains("Single") ? "single" :
                property.PropertySubTypes.Contains("Townhouse") ? "townhouse" : property.PropertySubTypes;
            this.StreetName = property.StreetName;
            this.StreetNumber = "" + property.StreetNumber;
            this.ThumbnailUrl = property.ThumbnailUrl;
            //this.TotalTaxes = string.IsNullOrWhiteSpace(property.TotalTaxes) ? (double?)null : double.Parse(property.TotalTaxes.Trim());
            this.ListingStatus = property.ListingStatus;
            this.LocaleListingStatus = property.LocaleListingStatus;
            this.PricePerSqFt = property.PricePerSqFt;
        }
Пример #2
0
        public List<RetsProperty> GetRetsProperties(DateTime startDate, DateTime endDate, ImportLog logInstance)
        {
            List<RetsProperty> ret = new List<RetsProperty>();
            AllowedZipcode allowedZipcodes = new AllowedZipcode();
            HttpWebResponse loginResponse = Login();
            loginResponse.Close();
            logInstance.JobEndTime = DateTime.UtcNow;
            HttpWebResponse propertyResponse = GetPropertyData(startDate, endDate);
            string response = PrintResponseStream(propertyResponse);
            propertyResponse.Close();
            if (string.IsNullOrWhiteSpace(response) == false && response.Contains("No records found") == false)
            {

                int successCount = 0;
                int fails = 0;
                int ignored = 0;
                try
                {

                    XmlSerializer x = new XmlSerializer(typeof(RETS));
                    RETS retsResults = (RETS)x.Deserialize(new StringReader(response));
                    Console.WriteLine("De-Serialized.");
                    if(retsResults.REData != null &&
                        retsResults.REData.MRISProperties != null &&
                        retsResults.REData.MRISProperties.Length > 0)
                    {

                        foreach (RETSREDataAllProperty propertyInfo in retsResults.REData.MRISProperties)
                        {
                            try
                            {
                                RetsProperty aProperty = propertyInfo.ToRetsProperty();
                                if (aProperty.PostalCode != null
                                        && allowedZipcodes.GetSearchRegion(aProperty.PostalCode.Value) != null)
                                {
                                    ret.Add(aProperty);
                                    successCount++;
                                }
                                else
                                    ignored++;
                            }
                            catch (Exception e)
                            {
                                fails++;
                                logInstance.Comments = "ERROR: " + e.StackTrace;
                            }
                        }
                    }
                    logInstance.Successful = true;
                    logInstance.ImportCount = successCount;
                    logInstance.FailureCount = fails;
                }
                catch (Exception e)
                {
                    Console.WriteLine("ERROR: " + e.StackTrace);
                    logInstance.Successful = false;
                    logInstance.Comments = "ERROR: " + e.StackTrace;
                }
            }
            logInstance.JobEndTime = DateTime.UtcNow;
            HttpWebResponse logoutResponse = Logout();
            logoutResponse.Close();
            return ret;
        }
Пример #3
0
        private AllowedZipcode _localities; // = new AllowedZipcode();

        #endregion Fields

        #region Constructors

        public PropertyManager(IRepository repository, IServicesManager servicesManager)
            : base(repository, servicesManager)
        {
            _localities = new AllowedZipcode();
        }