61 lines
1.5 KiB
C#
61 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MarketData.MarketDataModel
|
|
{
|
|
public class HeadlinesEqualityComparer : IEqualityComparer<Headline>
|
|
{
|
|
public bool Equals(Headline x,Headline y)
|
|
{
|
|
if(null==x || null ==y || null==x.Entry || null==y.Entry)return false;
|
|
if(x.Date.Equals(y.Date) && x.Entry.Equals(y.Entry))return false;
|
|
return true;
|
|
}
|
|
public int GetHashCode(Headline headline)
|
|
{
|
|
return (headline.Date.ToShortDateString()+headline.Entry).GetHashCode();
|
|
}
|
|
}
|
|
public class Headlines : List<Headline>
|
|
{
|
|
public Headlines()
|
|
{
|
|
}
|
|
public Headlines(List<Headline> headlines)
|
|
{
|
|
foreach(Headline headline in headlines)Add(headline);
|
|
}
|
|
}
|
|
public class Headline
|
|
{
|
|
public Headline()
|
|
{
|
|
}
|
|
public Headline(Headline headline)
|
|
{
|
|
Date=headline.Date;
|
|
Symbol=headline.Symbol;
|
|
CompanyName=headline.CompanyName;
|
|
Entry=headline.Entry;
|
|
Modified=headline.Modified;
|
|
Source=headline.Source;
|
|
}
|
|
public Headline(String symbol,DateTime date,String entry)
|
|
{
|
|
Symbol=symbol;
|
|
Date=date;
|
|
Entry=entry;
|
|
Modified=DateTime.Now;
|
|
}
|
|
public DateTime Date{get;set;}
|
|
public String Symbol{get;set;}
|
|
public String CompanyName{get;set;}
|
|
public String Entry{get;set;}
|
|
public DateTime Modified{get;set;}
|
|
public String Source{get;set;}
|
|
}
|
|
}
|