00001 using System; 00002 using System.Collections.Generic; 00003 using System.Text; 00004 00005 namespace HouseOver.THARM.CustomerCatalogue.Compares 00006 { 00010 public class SalePutUpDateComparer : IComparer<Customer> 00011 { 00013 private CatalogueData data; 00014 00019 public SalePutUpDateComparer(CatalogueData data) 00020 { 00021 this.data = data; 00022 } 00023 00030 public int Compare(Customer x, Customer y) 00031 { 00032 DateTime c1 = DateTime.Now; 00033 DateTime c2 = DateTime.Now; 00034 00035 foreach (Sale s in data.GetSales(x)) 00036 { 00037 if (s.PutUpForSale < c1) c1 = s.PutUpForSale; 00038 } 00039 00040 foreach (Sale s in data.GetSales(y)) 00041 { 00042 if (s.PutUpForSale < c2) c2 = s.PutUpForSale; 00043 } 00044 00045 return c1.CompareTo(c2); 00046 } 00047 } 00048 }