public int hits; // or impressions or clicks\r
public string keyword;\r
\r
- public AdRecord()\r
- {\r
- }\r
- \r
- public void Initialize(IDictionary adProps)\r
+ public AdRecord(IDictionary adProps)\r
{\r
this.adProps = adProps;\r
+ hits = 0;\r
+ keyword = String.Empty;\r
}\r
}\r
\r
XmlReader reader;\r
XmlDocument document;\r
XmlNode topNode, innerNode;\r
- IDictionary hybridDict;\r
+ IDictionary hybridDict = null;\r
AdRecord[] adsArray = null;\r
try\r
{\r
innerNode = topNode.FirstChild;\r
while(innerNode!=null)\r
{\r
- if(innerNode.NodeType==NodeType.Element)\r
+ if(innerNode.NodeType==XmlNodeType.Element)\r
{\r
- if(hybridDic==null)\r
+ if(hybridDict==null)\r
{\r
- hybirdDict = new HybridDictionary();\r
+ hybridDict = new HybridDictionary();\r
}\r
hybridDict.Add(innerNode.LocalName, innerNode.InnerText);\r
}\r
string physPath = MapPathSecure(file);\r
string AdKey = "AdRotatorCache: " + physPath;\r
fileDirectory = UrlUtils.GetDirectory(UrlUtils.Combine(TemplateSourceDirectory, file));\r
- CacheInternal ci = HttpRuntime.CacheInternal;\r
- AdRecord[] records = (AdRecord[])ci[AdKey];\r
+ Cache cache = HttpRuntime.Cache;\r
+ AdRecord[] records = (AdRecord[])cache[AdKey];\r
if(records==null)\r
{\r
records = LoadAdFile(physPath);\r
- if(!(records))\r
+ if(records==null)\r
{\r
return null;\r
}\r
- ci.Insert(AdKey, records, new CacheDependency(physPath));\r
+ cache.Insert(AdKey, records, new CacheDependency(physPath));\r
}\r
return records;\r
}\r
\r
private IDictionary SelectAd()\r
{\r
- AdRecord[] records = GetFileData(AdvertisementFile);\r
+ AdRecord[] records = GetData(AdvertisementFile);\r
if(records!=null && records.Length!=0)\r
{\r
int impressions = 0;\r
int index = 0;\r
for(int i=0; i < records.Length; i++)\r
{\r
- if(IsAdMaching(records[i]))\r
+ if(IsAdMatching(records[i]))\r
{\r
if(rnd <= (counter + records[i].hits))\r
{\r
}\r
}\r
\r
- public AdRotator()\r
+ public AdRotator(): base()\r
{\r
- base();\r
advertisementFile = string.Empty;\r
fileDirectory = null;\r
}\r
Image adImage = new Image();\r
foreach(IEnumerable current in Attributes.Keys)\r
{\r
- hLink[(string)current] = Attributes[(string)current];\r
+ hLink.Attributes[(string)current] = Attributes[(string)current];\r
}\r
if(ID != null && ID.Length > 0)\r
hLink.ID = ID;\r