protected void Page_Load(object sender, EventArgs e)
{
mk.gov.nbrm.www.Kurs kurs = new mk.gov.nbrm.www.Kurs();
System.Xml.XmlDataDocument xmldoc = new System.Xml.XmlDataDocument();
xmldoc.LoadXml(kurs.GetExchangeRatesD(Calendar1.SelectedDate, Calendar2.SelectedDate));
ZapisiXML(xmldoc);
}
private void ZapisiXML(XmlDataDocument xmlDoc)
{
DataSet dtst = new DataSet();
DataTable dt = dtst.Tables.Add("Kurs");
dt.Columns.Add("RBr", typeof(double));
dt.Columns.Add("Datum", typeof(DateTime));
dt.Columns.Add("Valuta", typeof(string));
dt.Columns.Add("Oznaka", typeof(string));
dt.Columns.Add("Drzava", typeof(string));
dt.Columns.Add("Nomin", typeof(double));
dt.Columns.Add("Kupoven", typeof(double));
dt.Columns.Add("Sreden", typeof(double));
dt.Columns.Add("Prodazen", typeof(double));
dt.Columns.Add("DrzavaAng", typeof(string));
XmlNodeList xmlnodes = xmlDoc.SelectNodes(@"dsKurs/KursZbir");
foreach (XmlNode xmlNode in xmlnodes)
{
DataRow dr = dt.NewRow();
dr["RBr"] = xmlNode.SelectSingleNode("RBr").InnerText;
dr["Datum"] = xmlNode.SelectSingleNode("Datum").InnerText;
dr["Valuta"] = xmlNode.SelectSingleNode("Valuta").InnerText;
dr["Oznaka"] = xmlNode.SelectSingleNode("Oznaka").InnerText;
dr["Drzava"] = xmlNode.SelectSingleNode("Drzava").InnerText;
dr["Nomin"] = xmlNode.SelectSingleNode("Nomin").InnerText;
dr["Kupoven"] = xmlNode.SelectSingleNode("Kupoven").InnerText;
dr["Sreden"] = System.Convert.ToDouble(xmlNode.SelectSingleNode("Sreden").InnerText);
dr["Prodazen"] = xmlNode.SelectSingleNode("Prodazen").InnerText;
dr["DrzavaAng"] = xmlNode.SelectSingleNode("DrzavaAng").InnerText;
dt.Rows.Add(dr);
}
GridView1.DataSource = dtst;
GridView1.DataBind();
}