Ejemplo n.º 1
0
 public bool IsDuplicate(RealEstateOfferModel offer)
 {
     try
     {
         if (offer.PropType == PropType)
         {
             if (offer.AdvType == AdvType)
             {
                 //Do other stuff
                 if (DoOffersHaveSameLocation(offer))
                 {
                     if (offer.Price == Price)
                     {
                         //Duplicated offers may have same descriptions
                         if (offer.Title == Title)
                         {
                             return(true);
                         }
                         return(DoOffersHaveDuplicatedImages(offer));
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
     }
     return(false);
 }
Ejemplo n.º 2
0
 private bool DoOffersHaveSameLocation(RealEstateOfferModel offer)
 {
     try
     {
         if (offer.OfferCity.CityDetails.Wojewodztwo == OfferCity.CityDetails.Wojewodztwo)
         {
             if (offer.OfferCity.CityDetails.GmiSymbol == OfferCity.CityDetails.GmiSymbol)
             {
                 if (offer.OfferCity.CityDetails.Nazwa == OfferCity.CityDetails.Nazwa)
                 {
                     return(true);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(false);
 }
Ejemplo n.º 3
0
 private bool DoOffersHaveDuplicatedImages(RealEstateOfferModel offer)
 {
     try
     {
         foreach (var imageFirst in offer.ImagesAddresses)
         {
             foreach (var imageSecond in imagesAddresses)
             {
                 Bitmap firstImage  = GetBitmapFromUrl(imageFirst);
                 Bitmap secondImage = new Bitmap(GetBitmapFromUrl(imageSecond), firstImage.Width, firstImage.Height);
                 if (AreImagesSame(firstImage, secondImage))
                 {
                     return(true);
                 }
             }
         }
     }
     catch (Exception)
     {
         return(true);
     }
     return(false);
 }