- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
/// <summary>
/// Calculates and returns a hashcode based on this user's
/// MarketName and default units. The hashcode should be
/// unique for each different combination of MarketName and
/// units.
/// </summary>
/// <returns>An int that may be positive or negative.</returns>
public override int GetHashCode()
{
// A function like this raises innumerable questions. Why did they over ride the
// hash code function? Why did they use an attribute that is not certain to be unique?
// why did they not use the one that is going to be unique? Why did they not cvheck to
// see if the thing they were hasing was not null? When did my life go so far off the rails
// that I have to deal with code like this? How many places call this code? Why did they not
// include any meaningful comments? Why does it suddenly start breaking after the 3.5 upgrade?
// in an effort to avoid thinking about those questions, I've justy changed the has to use the
// unique user id instead of the retarded defaultuserunits hash.
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(this.MarketName);
if (this.DefaultUserUnits != null)
{
sb.Append(Utility.StringUtility.GetJSObjectLiteral(this.DefaultUserUnits));
}
else
{
sb.Append(Utility.StringUtility.GetJSObjectLiteral(this.ID));
}
return sb.ToString().GetHashCode();
}