|
using System;
using System.Xml;
using System.IO;
// user defined
using TreeView.Framework.Interface;
using System.Collections;
using TreeView.Objects;
namespace TreeView.Objects.Provider
{
/// <summary>
/// Summary description for CompanyProvider.
/// </summary>
public class CompanyProvider: IProvider
{
private ArrayList _List;
#region IProvider Members
public IList GetAll(int parentID)
{
_List = new ArrayList();
// create the objects
XmlDocument doc = new XmlDocument();
string filePath = System.AppDomain.CurrentDomain.BaseDirectory +"Data.xml";
doc.Load( filePath );
XmlNodeList nodeList = doc.GetElementsByTagName( "company" );
foreach ( XmlNode node in nodeList )
{
int ID = Convert.ToInt32( node.Attributes[ "id" ].Value );
string name = node.Attributes[ "name" ].Value;
// create a new company
Company company = new Company( ID, name );
_List.Add( company );
}
return _List;
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Passionate about cutting edge technologies and a .net enthusiast. I have played roles in variety of products starting from University automation to web 2.0 start-page (www.pageflakes.com).
Currently, working at Telerik Inc (www.telerik.com), the premium rad control provider for asp.net and winforms. I am a active contributor and member at www.dotnetslackers.com. In addition, i do a frequent post on my blog about LINQ, C#, Asp.net and about my projects.
I am Microsoft MVP. I love to travel and meet cool people.