00001 using System; 00002 using System.Collections.Generic; 00003 using System.Text; 00004 00008 namespace HouseOver.THARM.CustomerCatalogue.Compares 00009 { 00013 public class ProfileMaxPriceComparer : IComparer<Customer> 00014 { 00016 private CatalogueData data; 00017 00022 public ProfileMaxPriceComparer(CatalogueData data) 00023 { 00024 this.data = data; 00025 } 00026 00033 public int Compare(Customer x, Customer y) 00034 { 00035 int c1 = 0; 00036 int c2 = 0; 00037 00038 foreach (Profile p in data.GetProfiles(x)) 00039 { 00040 if (p.MaxPrice > c1) c1 = p.MaxPrice; 00041 } 00042 00043 foreach (Profile p in data.GetProfiles(y)) 00044 { 00045 if (p.MaxPrice > c2) c1 = p.MaxPrice; 00046 } 00047 00048 return c1.CompareTo(c2); 00049 } 00050 } 00051 }